Mercurial > octave
changeset 26494:10919e3c9aaa
maint: Merge stable to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 08 Jan 2019 13:54:57 -0500 |
parents | 10f648516d5b (current diff) bc6237a189e1 (diff) |
children | 7da6136d3ecd |
files | libinterp/corefcn/graphics.cc |
diffstat | 9 files changed, 80 insertions(+), 43 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/__magick_read__.cc Mon Jan 07 13:27:20 2019 -0500 +++ b/libinterp/corefcn/__magick_read__.cc Tue Jan 08 13:54:57 2019 -0500 @@ -769,7 +769,7 @@ // Save locale as GraphicsMagick might change this (fixed in // GraphicsMagick since version 1.3.13 released on December 24, 2011) const char *static_locale = setlocale (LC_ALL, nullptr); - const std::string locale (static_locale); + const std::string locale = (static_locale ? static_locale : ""); const std::string program_name = octave::sys::env::get_program_invocation_name ();
--- a/libinterp/corefcn/dot.cc Mon Jan 07 13:27:20 2019 -0500 +++ b/libinterp/corefcn/dot.cc Tue Jan 08 13:54:57 2019 -0500 @@ -54,8 +54,8 @@ } else { + z(i) = 1; tmp_k = x(i); - z(i) = 1; } } @@ -289,7 +289,7 @@ octave_idx_type tmp_np = 1; - bool match = dimy(0) == k && nd == dimy.ndims (); + bool match = ((dimy(0) == k) && (nd == dimy.ndims ())); dimz = dim_vector::alloc (nd); @@ -297,7 +297,7 @@ dimz(1) = n; for (int i = 2; match && i < nd; i++) { - match = match && dimx(i) == dimy(i); + match = (dimx(i) == dimy(i)); dimz(i) = dimx(i); tmp_np *= dimz(i); }
--- a/libinterp/corefcn/graphics.cc Mon Jan 07 13:27:20 2019 -0500 +++ b/libinterp/corefcn/graphics.cc Tue Jan 08 13:54:57 2019 -0500 @@ -10483,14 +10483,17 @@ // Don't notify the style change until the "value" property is fixed bool modified = style.set (st, true, false); - // We now need to override "value" for listbox and popupmenu and eventually - // notify the toolkit afterwards. - if (modified && (style_is ("listbox") || style_is ("popupmenu"))) - { - Matrix v = value.get ().matrix_value (); - if (v.numel () == 1 && v(0) == 0) - value.set (octave_value (1), true, false); - + // Override "value" property for listbox and popupmenu. + if (modified) + { + if (style_is ("listbox") || style_is ("popupmenu")) + { + Matrix v = value.get ().matrix_value (); + if (v.numel () == 1 && v(0) == 0) + value.set (octave_value (1), true, false); + } + + // Notify toolkit graphics_object go = gh_manager::get_object (get___myhandle__ ()); if (go) go.update (style.get_id ());
--- a/libinterp/corefcn/oct-hist.cc Mon Jan 07 13:27:20 2019 -0500 +++ b/libinterp/corefcn/oct-hist.cc Tue Jan 08 13:54:57 2019 -0500 @@ -257,7 +257,7 @@ history_system::history_system (interpreter& interp) : m_interpreter (interp), m_input_from_tmp_file (false), - m_timestamp_format_string () + m_timestamp_format_string (default_timestamp_format ()) { } void history_system::initialize (bool read_history_file)
--- a/liboctave/util/cmd-edit.cc Mon Jan 07 13:27:20 2019 -0500 +++ b/liboctave/util/cmd-edit.cc Tue Jan 08 13:54:57 2019 -0500 @@ -529,7 +529,7 @@ // Remove incomplete component. const char *f = strrchr (line, sys::file_ops::dir_sep_char ()); - if (s[1] == '~' || (f && f != s)) + if (f && (s[1] == '~' || f != s)) { // For something like "A /b", f==s; don't assume a file. @@ -833,7 +833,8 @@ { retval = static_cast<char *> (std::malloc (len+1)); - strcpy (retval, tmp.c_str ()); + if (retval) + strcpy (retval, tmp.c_str ()); } return retval; @@ -854,7 +855,8 @@ { retval = static_cast<char *> (std::malloc (len+1)); - strcpy (retval, tmp.c_str ()); + if (retval) + strcpy (retval, tmp.c_str ()); } return retval; @@ -875,7 +877,8 @@ { retval = static_cast<char *> (std::malloc (len+1)); - strcpy (retval, tmp.c_str ()); + if (retval) + strcpy (retval, tmp.c_str ()); } return retval; @@ -905,9 +908,10 @@ char ** gnu_readline::command_completer (const char *text, int, int) { - char **matches = nullptr; - matches - = ::octave_rl_completion_matches (text, gnu_readline::command_generator); + char **matches = + ::octave_rl_completion_matches (text, + gnu_readline::command_generator); + return matches; } @@ -1110,7 +1114,12 @@ int command_editor::startup_handler (void) { - for (startup_hook_fcn f : startup_hook_set) + // Iterate over a copy of the set to avoid problems if a hook + // function attempts to remove itself from the startup_hook_set. + + std::set<startup_hook_fcn> hook_set = startup_hook_set; + + for (startup_hook_fcn f : hook_set) { if (f) f (); @@ -1122,7 +1131,12 @@ int command_editor::pre_input_handler (void) { - for (pre_input_hook_fcn f : pre_input_hook_set) + // Iterate over copy of the set to avoid problems if a hook function + // attempts to remove itself from the pre_input_hook_set. + + std::set<pre_input_hook_fcn> hook_set = pre_input_hook_set; + + for (pre_input_hook_fcn f : hook_set) { if (f) f (); @@ -1726,7 +1740,7 @@ tmpstr = now.strftime ("%I:%M:%S"); else if (c == '@') tmpstr = now.strftime ("%I:%M %p"); - else if (c == 'A') + else // (c == 'A') tmpstr = now.strftime ("%H:%M"); break;
--- a/scripts/java/module.mk Mon Jan 07 13:27:20 2019 -0500 +++ b/scripts/java/module.mk Tue Jan 08 13:54:57 2019 -0500 @@ -34,8 +34,18 @@ %canon_reldir%_JAVA_CLASSES = $(addprefix %reldir%/, $(JAVA_CLASSES)) +OCT_V_JAR = $(oct__v_JAR_$(V)) +oct__v_JAR_ = $(oct__v_JAR_$(AM_DEFAULT_VERBOSITY)) +oct__v_JAR_0 = @echo " JAR " $@; +oct__v_JAR_1 = + +OCT_V_JAVAC = $(oct__v_JAVAC_$(V)) +oct__v_JAVAC_ = $(oct__v_JAVAC_$(AM_DEFAULT_VERBOSITY)) +oct__v_JAVAC_0 = @echo " JAVAC " $@; +oct__v_JAVAC_1 = + $(%canon_reldir%_JAVA_CLASSES) : %.class : %.java | %reldir%/$(octave_dirstamp) - $(AM_V_GEN)$(MKDIR_P) %reldir%/$(org_octave_dir) && \ + $(OCT_V_JAVAC)$(MKDIR_P) %reldir%/$(org_octave_dir) && \ ( cd $(srcdir)/scripts/java; \ "$(JAVAC)" -source 1.6 -target 1.6 -Xlint:-options \ -d $(abs_top_builddir)/scripts/java \ @@ -43,7 +53,7 @@ if AMCOND_HAVE_JAVA %reldir%/octave.jar: $(%canon_reldir%_JAVA_CLASSES) - $(AM_V_GEN)rm -f $@-t $@ && \ + $(OCT_V_JAR)rm -f $@-t $@ && \ ( cd scripts/java; \ "$(JAR)" cf octave.jar-t $(JAVA_CLASSES) ) && \ mv $@-t $@
--- a/scripts/plot/util/printd.m Mon Jan 07 13:27:20 2019 -0500 +++ b/scripts/plot/util/printd.m Tue Jan 08 13:54:57 2019 -0500 @@ -44,7 +44,7 @@ error ("printd: output FILENAME '%s' requires a suffix.\nOptions are: pdf ps eps txt jpg jpeg", filename); endif opt = substr (filename, sufix+1); - [pf, tempf, mag] = mkstemp ("oct-XXXXXX", 1); + [pf, tempf, mag] = mkstemp (fullfile (tempdir (), "oct-XXXXXX"), true); fprintf (pf, "%s", disp (obj)); frewind (pf); @@ -94,8 +94,8 @@ %! " 4 | 244" , ... %! " 5 | 2" ); %! printd (r2, "test_p.txt"); -%! system ("cat test_p.txt"); -%! delete ("test_p.txt"); +%! type ("test_p.txt"); +%! unlink ("test_p.txt"); %!test %! r2 = char ( @@ -106,8 +106,12 @@ %! " 3 | 98" , %! " 4 | 244" , %! " 5 | 2" ); -%! printd (r2, "test_p.txt"); -%! r4 = fileread ("test_p.txt"); -%! delete ("test_p.txt"); -%! r2 = disp (r2); -%! assert (r4, r2); +%! unwind_protect +%! filename = [tempname() ".txt"]; +%! printd (r2, filename); +%! r4 = fileread (filename); +%! r2 = disp (r2); +%! assert (r4, r2); +%! unwind_protect_cleanup +%! unlink (filename); +%! end_unwind_protect
--- a/src/mkoctfile.in.cc Mon Jan 07 13:27:20 2019 -0500 +++ b/src/mkoctfile.in.cc Tue Jan 08 13:54:57 2019 -0500 @@ -603,10 +603,12 @@ // mkostemps will open the file and return a file descriptor. We // won't worry about closing it because we will need the file until we // are done and then the file will be closed when mkoctfile exits. - octave_mkostemps_wrapper (ctmpl, 2); - return std::string (ctmpl); + std::string retval (ctmpl); // make C++ string from filled-in template + delete [] ctmpl; + + return retval; } static void
--- a/test/pkg/pkg.tst Mon Jan 07 13:27:20 2019 -0500 +++ b/test/pkg/pkg.tst Tue Jan 08 13:54:57 2019 -0500 @@ -61,6 +61,7 @@ %!testif HAVE_Z %! for i = 1:numel (mfile_pkg_name) %! silent_pkg_install (mfile_pkg_tgz{i}); +%! system (["chmod -Rf u+w '" prefix "'"]); ## FIXME: Work around bug #53578 %! pkg ("uninstall", mfile_pkg_name{i}); %! endfor %! @@ -70,6 +71,7 @@ %!testif HAVE_Z %! for i = 1:numel (mfile_pkg_name) %! silent_pkg_install ("-local", mfile_pkg_tgz{i}); +%! system (["chmod -Rf u+w '" prefix "'"]); ## FIXME: Work around bug #53578 %! pkg ("uninstall", mfile_pkg_name{i}); %! endfor @@ -90,14 +92,15 @@ ## Action load/unload (within install/uninstall) %!testif HAVE_Z %! for i = 1:numel (mfile_pkg_name) -%! name = mfile_pkg_name{i}; -%! silent_pkg_install ("-local", mfile_pkg_tgz{i}); -%! unwind_protect -%! pkg ("load", name); -%! pkg ("unload", name); -%! unwind_protect_cleanup -%! pkg ("uninstall", name); -%! end_unwind_protect +%! name = mfile_pkg_name{i}; +%! silent_pkg_install ("-local", mfile_pkg_tgz{i}); +%! unwind_protect +%! pkg ("load", name); +%! pkg ("unload", name); +%! unwind_protect_cleanup +%! system (["chmod -Rf u+w '" prefix "'"]); ## FIXME: Work around bug #53578 +%! pkg ("uninstall", name); +%! end_unwind_protect %! endfor %! %!error <package foobar is not installed> pkg ("load", "foobar"); @@ -122,6 +125,7 @@ %! [desc, flag] = pkg ("describe", mfile_pkg_name{1}); %! ## FIXME: this only tests that the describe command runs, %! ## not that the output is in anyway correct. +%! system (["chmod -Rf u+w '" prefix "'"]); ## FIXME: Work around bug #53578 %! pkg ("uninstall", mfile_pkg_name{1}); # -verbose