Mercurial > octave
changeset 26466:04e7b115e69d
maint: merge stable to default.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 06 Jan 2019 07:37:48 -0800 |
parents | 7471f3831aa0 (current diff) dd40f9650821 (diff) |
children | 11cef718fcbc |
files | libinterp/corefcn/graphics.cc libinterp/octave-value/ov-fcn-handle.cc |
diffstat | 14 files changed, 124 insertions(+), 124 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/m-editor/find-dialog.cc Sat Jan 05 10:53:17 2019 -0800 +++ b/libgui/src/m-editor/find-dialog.cc Sun Jan 06 07:37:48 2019 -0800 @@ -122,7 +122,8 @@ _search_selection_check_box = new QCheckBox (tr ("Search se&lection")); #if defined (HAVE_QSCI_FINDSELECTION) _search_selection_check_box->setCheckable (true); - _search_selection_check_box->setEnabled (edit_area->hasSelectedText ()); + if (edit_area) + _search_selection_check_box->setEnabled (edit_area->hasSelectedText ()); #else _search_selection_check_box->setCheckable (false); _search_selection_check_box->setEnabled (false); @@ -245,7 +246,7 @@ // initialize search text with selected text if this is in one single line void find_dialog::init_search_text (void) { - if (_edit_area->hasSelectedText ()) + if (_edit_area && _edit_area->hasSelectedText ()) { int lbeg, lend, cbeg, cend; _edit_area->getSelection (&lbeg,&cbeg,&lend,&cend); @@ -274,6 +275,9 @@ void find_dialog::find (bool forward) { + if (! _edit_area) + return; + int line, col; line = col = -1; bool do_wrap = _wrap_check_box->isChecked (); @@ -326,47 +330,45 @@ } } - if (_edit_area) + if (_edit_area->hasSelectedText () + && _search_selection_check_box->isChecked ()) { - if (_edit_area->hasSelectedText () - && _search_selection_check_box->isChecked ()) - { #if defined (HAVE_QSCI_FINDSELECTION) - if (_find_result_available) - _find_result_available = _edit_area->findNext (); - else - _find_result_available - = _edit_area->findFirstInSelection ( - _search_line_edit->text (), - _regex_check_box->isChecked (), - _case_check_box->isChecked (), - _whole_words_check_box->isChecked (), - do_forward, - true + if (_find_result_available) + _find_result_available = _edit_area->findNext (); + else + _find_result_available + = _edit_area->findFirstInSelection ( + _search_line_edit->text (), + _regex_check_box->isChecked (), + _case_check_box->isChecked (), + _whole_words_check_box->isChecked (), + do_forward, + true #if defined (HAVE_QSCI_VERSION_2_6_0) - , true + , true #endif - ); + ); #endif - } - else - { - _find_result_available - = _edit_area->findFirst (_search_line_edit->text (), - _regex_check_box->isChecked (), - _case_check_box->isChecked (), - _whole_words_check_box->isChecked (), - do_wrap, - do_forward, - line,col, - true + } + else + { + _find_result_available + = _edit_area->findFirst (_search_line_edit->text (), + _regex_check_box->isChecked (), + _case_check_box->isChecked (), + _whole_words_check_box->isChecked (), + do_wrap, + do_forward, + line,col, + true #if defined (HAVE_QSCI_VERSION_2_6_0) - , true + , true #endif - ); - } + ); } + if (_find_result_available) _from_start_check_box->setChecked (0); else if (! _rep_all) @@ -375,9 +377,12 @@ void find_dialog::do_replace (void) { - _rep_active = true; // changes in selection not made by the user - _edit_area->replace (_replace_line_edit->text ()); - _rep_active = false; + if (_edit_area) + { + _rep_active = true; // changes in selection not made by the user + _edit_area->replace (_replace_line_edit->text ()); + _rep_active = false; + } } void find_dialog::replace (void)
--- a/libgui/src/octave-dock-widget.cc Sat Jan 05 10:53:17 2019 -0800 +++ b/libgui/src/octave-dock-widget.cc Sun Jan 06 07:37:48 2019 -0800 @@ -446,7 +446,7 @@ QRect available_size = QApplication::desktop ()->availableGeometry (m_parent); int x1, y1, x2, y2; available_size.getCoords (&x1, &y1, &x2, &y2); - QRect default_size = QRect (x1, y1, x2/3, y2/2); + QRect default_size = QRect (x1+16, y1+32, x2/3, 2*y2/3); m_recent_float_geom = settings->value ("DockWidgets/" + objectName () + "_floating_geometry",
--- a/libgui/src/octave-qt-link.cc Sat Jan 05 10:53:17 2019 -0800 +++ b/libgui/src/octave-qt-link.cc Sun Jan 06 07:37:48 2019 -0800 @@ -56,7 +56,7 @@ namespace octave { octave_qt_link::octave_qt_link (void) - : octave_link () + : octave_link (), m_shutdown_confirm_result (false) { qRegisterMetaType<octave_value> ("octave_value"); qRegisterMetaType<symbol_info_list> ("symbol_info_list");
--- a/libinterp/corefcn/gl-render.cc Sat Jan 05 10:53:17 2019 -0800 +++ b/libinterp/corefcn/gl-render.cc Sun Jan 06 07:37:48 2019 -0800 @@ -2396,13 +2396,13 @@ NDArray c; const NDArray vn = props.get_vertexnormals ().array_value (); dim_vector vn_dims = vn.dims (); - bool has_vertex_normals = ((vn_dims(0) == z.rows ()) && - (vn_dims(1) == z.columns ()) && + bool has_vertex_normals = ((vn_dims(0) == zr) && + (vn_dims(1) == zc) && (vn_dims(2) == 3)); const NDArray fn = props.get_facenormals ().array_value (); dim_vector fn_dims = fn.dims (); - bool has_face_normals = ((fn_dims(0) == z.rows () - 1) && - (fn_dims(1) == z.columns () - 1) && + bool has_face_normals = ((fn_dims(0) == zr - 1) && + (fn_dims(1) == zc - 1) && (fn_dims(2) == 3)); // FIXME: handle transparency @@ -2789,8 +2789,12 @@ } } if (el_mode > 0) - set_normal (bfl_mode, (el_mode == GOURAUD ? vn : fn), - j-1, i); + { + if (el_mode == GOURAUD) + set_normal (bfl_mode, vn, j-1, i); + else + set_normal (bfl_mode, fn, j-1, std::min (i, zc-2)); + } m_glfcns.glVertex3d (x(j1,i), y(j-1,i2), z(j-1,i)); @@ -2887,8 +2891,12 @@ } } if (el_mode > 0) - set_normal (bfl_mode, (el_mode == GOURAUD ? vn : fn), - j, i-1); + { + if (el_mode == GOURAUD) + set_normal (bfl_mode, vn, j, i-1); + else + set_normal (bfl_mode, fn, std::min (j, zr-2), i-1); + } m_glfcns.glVertex3d (x(j2,i-1), y(j,i1), z(j,i-1));
--- a/libinterp/corefcn/graphics.cc Sat Jan 05 10:53:17 2019 -0800 +++ b/libinterp/corefcn/graphics.cc Sun Jan 06 07:37:48 2019 -0800 @@ -9451,7 +9451,7 @@ { // find first element that is NaN to get number of corners octave_idx_type nc = 3; - while (! octave::math::isnan (idx(nc,jj)) && nc < fcmax) + while (nc < fcmax && ! octave::math::isnan (idx(nc,jj))) nc++; std::list<octave_idx_type> coplanar_ends; @@ -9869,26 +9869,20 @@ for (int i = 0; i < p-1; i++) { - if (y_mat) - { - i1 = i; - i2 = i + 1; - } + i1 = i; + i2 = i + 1; for (int j = 0; j < q-1; j++) { - if (x_mat) - { - j1 = j; - j2 = j + 1; - } + j1 = j; + j2 = j + 1; if (x_mat || y_mat) { - x0 = x(j1,i1); - x1 = x(j1,i2); - x2 = x(j2,i2); - x3 = x(j2,i1); + x0 = x(x_mat?j1:0,y_mat?i1:0); + x1 = x(x_mat?j1:0,y_mat?i2:0); + x2 = x(x_mat?j2:0,y_mat?i2:0); + x3 = x(x_mat?j2:0,y_mat?i1:0); x1m0 = x1 - x0; x2m1 = x2 - x1; x3m2 = x3 - x2; @@ -9897,10 +9891,10 @@ x2p1 = x2 + x1; x3p2 = x3 + x2; x0p3 = x0 + x3; - y0 = y(j1,i1); - y1 = y(j1,i2); - y2 = y(j2,i2); - y3 = y(j2,i1); + y0 = y(x_mat?j1:0,y_mat?i1:0); + y1 = y(x_mat?j1:0,y_mat?i2:0); + y2 = y(x_mat?j2:0,y_mat?i2:0); + y3 = y(x_mat?j2:0,y_mat?i1:0); y1m0 = y1 - y0; y2m1 = y2 - y1; y3m2 = y3 - y2;
--- a/libinterp/corefcn/ls-mat-ascii.cc Sat Jan 05 10:53:17 2019 -0800 +++ b/libinterp/corefcn/ls-mat-ascii.cc Sun Jan 06 07:37:48 2019 -0800 @@ -270,58 +270,51 @@ Matrix tmp (nr, nc); - if (nr < 1 || nc < 1) - is.clear (std::ios::badbit); - else + double d; + for (octave_idx_type i = 0; i < nr; i++) { - double d; - for (octave_idx_type i = 0; i < nr; i++) - { - std::string buf = get_mat_data_input_line (is); + std::string buf = get_mat_data_input_line (is); + + std::istringstream tmp_stream (buf); - std::istringstream tmp_stream (buf); - - for (octave_idx_type j = 0; j < nc; j++) - { - octave_quit (); + for (octave_idx_type j = 0; j < nc; j++) + { + octave_quit (); - d = octave_read_value<double> (tmp_stream); + d = octave_read_value<double> (tmp_stream); - if (! tmp_stream && ! tmp_stream.eof ()) - error ("load: failed to read matrix from file '%s'", - filename.c_str ()); + if (! tmp_stream && ! tmp_stream.eof ()) + error ("load: failed to read matrix from file '%s'", + filename.c_str ()); - tmp.elem (i, j) = d; - total_count++; + tmp.elem (i, j) = d; + total_count++; - // Skip whitespace and commas. - char c; - while (1) - { - tmp_stream >> c; + // Skip whitespace and commas. + char c; + while (1) + { + tmp_stream >> c; - if (! tmp_stream) - break; + if (! tmp_stream) + break; - if (! (c == ' ' || c == '\t' || c == ',')) - { - tmp_stream.putback (c); - break; - } + if (! (c == ' ' || c == '\t' || c == ',')) + { + tmp_stream.putback (c); + break; } + } - if (tmp_stream.eof ()) - break; - } + if (tmp_stream.eof ()) + break; } } if (! is && ! is.eof ()) - error ("load: failed to read matrix from file '%s'", - filename.c_str ()); + error ("load: failed to read matrix from file '%s'", filename.c_str ()); // FIXME: not sure this is best, but it works. - if (is.eof ()) is.clear ();
--- a/libinterp/corefcn/ls-mat5.cc Sat Jan 05 10:53:17 2019 -0800 +++ b/libinterp/corefcn/ls-mat5.cc Sun Jan 06 07:37:48 2019 -0800 @@ -2010,7 +2010,7 @@ // Round nel up to nearest even number of elements. // Take into account short tags for 4 byte elements. - return PAD ((nel > 0 && nel * size <= 4 ? 4 : 8) + nel * size); + return PAD ((nel * size <= 4 ? 4 : 8) + nel * size); } else return 8; @@ -2179,8 +2179,7 @@ octave_idx_type nel = m.numel (); if (tc.is_inline_function ()) - // length of "inline" is 6 - ret += 8 + PAD (6 > max_namelen ? max_namelen : 6); + ret += 8 + PAD (6); // length of "inline" is 6 else if (tc.isobject ()) { size_t classlen = tc.class_name ().length ();
--- a/libinterp/corefcn/ls-oct-text.cc Sat Jan 05 10:53:17 2019 -0800 +++ b/libinterp/corefcn/ls-oct-text.cc Sun Jan 06 07:37:48 2019 -0800 @@ -353,8 +353,6 @@ bool save_three_d (std::ostream& os, const octave_value& tc, bool parametric) { - bool fail = false; - octave_idx_type nr = tc.rows (); octave_idx_type nc = tc.columns (); @@ -400,7 +398,7 @@ os.precision (old_precision); - return (os && ! fail); + return (static_cast<bool> (os)); } DEFUN (save_precision, args, nargout,
--- a/libinterp/octave-value/ov-classdef.cc Sat Jan 05 10:53:17 2019 -0800 +++ b/libinterp/octave-value/ov-classdef.cc Sun Jan 06 07:37:48 2019 -0800 @@ -2412,8 +2412,7 @@ octave_value_list args; - if (type.length () > 1 && idx.size () > 1 - && type[1] == '(') + if (type.length () > 1 && idx.size () > 1 && type[1] == '(') { args = *(++(idx.begin ())); skip++;
--- a/libinterp/octave-value/ov-fcn-handle.cc Sat Jan 05 10:53:17 2019 -0800 +++ b/libinterp/octave-value/ov-fcn-handle.cc Sun Jan 06 07:37:48 2019 -0800 @@ -1985,8 +1985,7 @@ && ! (param_list && param_list->takes_varargs ())) { // It's an index expression. - octave::tree_index_expression *idx_expr = dynamic_cast<octave::tree_index_expression *> - (body_expr); + octave::tree_index_expression *idx_expr = dynamic_cast<octave::tree_index_expression *> (body_expr); octave::tree_expression *head_expr = idx_expr->expression (); std::list<octave::tree_argument_list *> arg_lists = idx_expr->arg_lists (); std::string type_tags = idx_expr->type_tags ();
--- a/libinterp/parse-tree/lex.ll Sat Jan 05 10:53:17 2019 -0800 +++ b/libinterp/parse-tree/lex.ll Sun Jan 06 07:37:48 2019 -0800 @@ -858,7 +858,7 @@ curr_lexer->m_current_input_column += yyleng; - int result; + unsigned int result; sscanf (yytext+1, "%o", &result); if (result > 0xff) @@ -882,7 +882,7 @@ curr_lexer->m_current_input_column += yyleng; - int result; + unsigned int result; sscanf (yytext+2, "%x", &result); // Truncate the value silently instead of checking the range like
--- a/libinterp/parse-tree/pt-eval.cc Sat Jan 05 10:53:17 2019 -0800 +++ b/libinterp/parse-tree/pt-eval.cc Sun Jan 06 07:37:48 2019 -0800 @@ -2995,8 +2995,7 @@ } // perform actual "catch" block - if (catch_code) - catch_code->accept (*this); + catch_code->accept (*this); } } }
--- a/liboctave/array/Sparse.cc Sat Jan 05 10:53:17 2019 -0800 +++ b/liboctave/array/Sparse.cc Sun Jan 06 07:37:48 2019 -0800 @@ -2494,7 +2494,7 @@ d = Sparse<T> (nr, nc, nz); } } - else if (nnr != 0 && nnc != 0) + else // one of dimensions == 1 (vector) { octave_idx_type roff = 0; octave_idx_type coff = 0;
--- a/liboctave/util/oct-rl-hist.c Sat Jan 05 10:53:17 2019 -0800 +++ b/liboctave/util/oct-rl-hist.c Sun Jan 06 07:37:48 2019 -0800 @@ -277,7 +277,10 @@ beg = (limit < 0 || end < limit) ? 0 : (end - limit); retval = malloc ((size_t) (end - beg + 1) * sizeof (char **)); - + // FIXME: Should this call current_liboctave_error_handler instead? + if (! retval) + return retval; + k = 0; for (i = beg; i < end; i++) { @@ -285,13 +288,16 @@ size_t len = line ? strlen (line) : 0; char *tmp = malloc (len + 64); - if (number_lines) - sprintf (tmp, "%5d %s", i + history_base, - line ? line : ""); - else - strcpy (tmp, line ? line : ""); + if (tmp) + { + if (number_lines) + sprintf (tmp, "%5d %s", i + history_base, + line ? line : ""); + else + strcpy (tmp, line ? line : ""); - retval[k++] = tmp; + retval[k++] = tmp; + } } retval[k] = 0;