# HG changeset patch # User Markus Mützel # Date 1585295617 -3600 # Node ID 4ca254b41ea86891b277dfd7eb3631b464fe4b2c # Parent 47d4a84a57253b7bd47d6cecabd7a2b56a7caa35# Parent b895daca20e2bbc20a6e4e59f5826450526a405f maint: merge stable to default. diff -r 47d4a84a5725 -r 4ca254b41ea8 libinterp/corefcn/sysdep.cc --- a/libinterp/corefcn/sysdep.cc Thu Mar 26 15:06:09 2020 -0700 +++ b/libinterp/corefcn/sysdep.cc Fri Mar 27 08:53:37 2020 +0100 @@ -218,9 +218,8 @@ std::string file = args(0).xstring_value ("__open_with_system_app__: argument must be a filename"); #if defined (OCTAVE_USE_WINDOWS_API) - HINSTANCE status - = ShellExecuteW (0, 0, octave::sys::u8_to_wstring (file).c_str (), - 0, 0, SW_SHOWNORMAL); + std::wstring wfile = octave::sys::u8_to_wstring (file); + HINSTANCE status = ShellExecuteW (0, 0, wfile.c_str (), 0, 0, SW_SHOWNORMAL); // ShellExecute returns a value greater than 32 if successful. return octave_value (reinterpret_cast (status) > 32); @@ -859,9 +858,10 @@ LONG result; HKEY h_subkey; - result = RegOpenKeyExW (h_rootkey, - sys::u8_to_wstring (subkey).c_str (), 0, - KEY_READ, &h_subkey); + std::wstring wsubkey = sys::u8_to_wstring (subkey); + result = RegOpenKeyExW (h_rootkey, wsubkey.c_str (), 0, KEY_READ, + &h_subkey); + if (result != ERROR_SUCCESS) return result; @@ -869,18 +869,17 @@ frame.add_fcn (reg_close_key_wrapper, h_subkey); + std::wstring wname = sys::u8_to_wstring (name); DWORD length = 0; - result = RegQueryValueExW (h_subkey, - sys::u8_to_wstring (name).c_str (), - nullptr, nullptr, nullptr, &length); + result = RegQueryValueExW (h_subkey, wname.c_str (), nullptr, nullptr, + nullptr, &length); if (result != ERROR_SUCCESS) return result; DWORD type = 0; OCTAVE_LOCAL_BUFFER (BYTE, data, length); - result = RegQueryValueExW (h_subkey, - sys::u8_to_wstring (name).c_str (), - nullptr, &type, data, &length); + result = RegQueryValueExW (h_subkey, wname.c_str (), nullptr, &type, + data, &length); if (result != ERROR_SUCCESS) return result; @@ -901,9 +900,9 @@ fields.clear (); - retval = RegOpenKeyExW (h_rootkey, - sys::u8_to_wstring (subkey).c_str (), 0, - KEY_READ, &h_subkey); + std::wstring wsubkey = sys::u8_to_wstring (subkey); + retval = RegOpenKeyExW (h_rootkey, wsubkey.c_str (), 0, KEY_READ, + &h_subkey); if (retval != ERROR_SUCCESS) return retval; diff -r 47d4a84a5725 -r 4ca254b41ea8 liboctave/system/file-ops.cc --- a/liboctave/system/file-ops.cc Thu Mar 26 15:06:09 2020 -0700 +++ b/liboctave/system/file-ops.cc Fri Mar 27 08:53:37 2020 +0100 @@ -516,8 +516,9 @@ msg = ""; #if defined (OCTAVE_USE_WINDOWS_API) - status = _wrename (u8_to_wstring (from).c_str (), - u8_to_wstring (to).c_str ()); + std::wstring wfrom = u8_to_wstring (from); + std::wstring wto = u8_to_wstring (to); + status = _wrename (wfrom.c_str (), wto.c_str ()); #else status = std::rename (from.c_str (), to.c_str ()); #endif diff -r 47d4a84a5725 -r 4ca254b41ea8 liboctave/system/lo-sysdep.cc --- a/liboctave/system/lo-sysdep.cc Thu Mar 26 15:06:09 2020 -0700 +++ b/liboctave/system/lo-sysdep.cc Fri Mar 27 08:53:37 2020 +0100 @@ -102,8 +102,8 @@ path_name.append (R"(\*)"); // Find first file in directory. - HANDLE hFind = FindFirstFileW (u8_to_wstring (path_name).c_str (), - &ffd); + std::wstring wpath_name = u8_to_wstring (path_name); + HANDLE hFind = FindFirstFileW (wpath_name.c_str (), &ffd); if (INVALID_HANDLE_VALUE == hFind) { DWORD errCode = GetLastError (); @@ -153,8 +153,9 @@ fopen (const std::string& filename, const std::string& mode) { #if defined (OCTAVE_USE_WINDOWS_API) - return _wfopen (u8_to_wstring (filename).c_str (), - u8_to_wstring (mode).c_str ()); + std::wstring wfilename = u8_to_wstring (filename); + std::wstring wmode = u8_to_wstring (mode); + return _wfopen (wfilename.c_str (), wmode.c_str ()); #else return std::fopen (filename.c_str (), mode.c_str ()); #endif @@ -197,7 +198,8 @@ getenv_wrapper (const std::string& name) { #if defined (OCTAVE_USE_WINDOWS_API) - wchar_t *env = _wgetenv (u8_to_wstring (name).c_str ()); + std::wstring wname = u8_to_wstring (name); + wchar_t *env = _wgetenv (wname.c_str ()); return env ? u8_from_wstring (env) : ""; #else char *env = ::getenv (name.c_str ()); diff -r 47d4a84a5725 -r 4ca254b41ea8 liboctave/util/oct-shlib.cc --- a/liboctave/util/oct-shlib.cc Thu Mar 26 15:06:09 2020 -0700 +++ b/liboctave/util/oct-shlib.cc Fri Mar 27 08:53:37 2020 +0100 @@ -301,10 +301,12 @@ } std::string dir = sys::file_ops::dirname (f); + std::wstring wdir = sys::u8_to_wstring (dir); SetDllDirectoryW (dir.empty () - ? nullptr : sys::u8_to_wstring (dir).c_str ()); + ? nullptr : wdir.c_str ()); - m_handle = LoadLibraryW (sys::u8_to_wstring (m_file).c_str ()); + std::wstring wfile = sys::u8_to_wstring (m_file); + m_handle = LoadLibraryW (wfile.c_str ()); SetDllDirectoryW (nullptr); diff -r 47d4a84a5725 -r 4ca254b41ea8 scripts/plot/draw/lightangle.m --- a/scripts/plot/draw/lightangle.m Thu Mar 26 15:06:09 2020 -0700 +++ b/scripts/plot/draw/lightangle.m Fri Mar 27 08:53:37 2020 +0100 @@ -141,6 +141,7 @@ %! clf; %! sphere (36); %! lightangle (45, 30); +%! title ("lightangle() demo #1"); %!test %! hf = figure ("visible", "off");