changeset 22855:f9fdd2f66514

maint: use initializer of char array for octave_popen tmode. * sysdep.cc (octave_popen): Use initializer of char array, rather than declaring array and then setting each bit.
author Rik <rik@octave.org>
date Fri, 02 Dec 2016 02:44:29 -0800
parents e3e52ba95250
children d5b58e234c37
files libinterp/corefcn/sysdep.cc
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/sysdep.cc	Thu Dec 01 13:33:51 2016 -0800
+++ b/libinterp/corefcn/sysdep.cc	Fri Dec 02 02:44:29 2016 -0800
@@ -512,10 +512,8 @@
 #if defined (__MINGW32__) || defined (_MSC_VER)
   if (mode && mode[0] && ! mode[1])
     {
-      char tmode[3];
-      tmode[0] = mode[0];
-      tmode[1] = 'b';
-      tmode[2] = 0;
+      // Use binary mode on Windows if unspecified
+      char tmode[3] = {mode[0], 'b', '\0'};
 
       return _popen (command, tmode);
     }