diff libinterp/corefcn/__ftp__.cc @ 28467:159b6a1eb408

Use wide character overload to open file streams on Windows. * liboctave/system/lo-sysdep.cc, liboctave/system/lo-sysdep.h (fstream, ifstream, ofstream): Add "wrapper" functions to open file streams. * libinterp/corefcn/__fcn__.cc (F__ftp_mput__, F__ftp_mget__), libinterp/corefcn/debug.cc (do_dbtype), libinterp/corefcn/help.cc (help_system::raw_help_from_docstrings_file), libinterp/corefcn/load-save.cc (check_gzip_magic, load_save_system::get_file_format, load_save_system::dump_octave_core, load_save_system::load, load_save_system::save), libinterp/corefcn/oct-hist.cc (mk_tmp_hist_file, history_system::do_edit_history), libinterp/corefcn/urlwrite.cc (Furlwrite), libinterp/octave-value/ov-java.cc (read_java_opts, read_classpath_txt), libinterp/parse-tree/oct-parse.yy (get_file_line), liboctave/util/cmd-hist.cc (gnu_history::do_append), liboctave/util/file-info.cc (file_info::snarf_file), liboctave/util/url-transfer.cc (base_url_transfer::mget_directory, base_url_transfer::mput_directory): Use new functions. * libinterp/corefcn/dlmread.cc (dlmread): Use wide character overload for std::ifstream::open on Windows. * src/mkoctfile.in.cc (octave_u8_conv_to_encoding): Dummy function for cross-compiler. (main): Use wide character overload of std::ofstream::open on Windows.
author Markus Mützel <markus.muetzel@gmx.de>
date Fri, 12 Jun 2020 22:13:04 +0200
parents 9f9ac219896d
children 2bb050267d74 0a5b15007766
line wrap: on
line diff
--- a/libinterp/corefcn/__ftp__.cc	Fri Jun 12 11:39:35 2020 -0400
+++ b/libinterp/corefcn/__ftp__.cc	Fri Jun 12 22:13:04 2020 +0200
@@ -424,11 +424,10 @@
         }
       else
         {
-          std::string ascii_fname = octave::sys::get_ASCII_filename (file);
-
           // FIXME: Does ascii mode need to be flagged here?
-          std::ifstream ifile (ascii_fname.c_str (),
-                               std::ios::in | std::ios::binary);
+          std::ifstream ifile = 
+            octave::sys::ifstream (file.c_str (),
+                                   std::ios::in | std::ios::binary);
 
           if (! ifile.is_open ())
             error ("__ftp_mput__: unable to open file");
@@ -497,9 +496,9 @@
             url_xfer.mget_directory (sv(i), target);
           else
             {
-              std::ofstream ofile ((target + sv(i)).c_str (),
-                                   std::ios::out |
-                                   std::ios::binary);
+              std::ofstream ofile =
+                octave::sys::ofstream ((target + sv(i)).c_str (),
+                                       std::ios::out | std::ios::binary);
 
               if (! ofile.is_open ())
                 error ("__ftp_mget__: unable to open file");