diff libinterp/corefcn/graphics.cc @ 19909:6b7aee95c54c

Test directly for '|' character at front of drawnow "file". * graphics.cc (drawnow): Test directly for '|' character at front of drawnow "file". * __osmesa_print__.c: Test directly for '|' character at front of drawnow "file".
author Rik <rik@octave.org>
date Fri, 27 Feb 2015 16:29:14 -0800
parents 60fe3ef12bb0
children e814e202cd84
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.cc	Fri Feb 27 15:53:42 2015 -0800
+++ b/libinterp/corefcn/graphics.cc	Fri Feb 27 16:29:14 2015 -0800
@@ -11069,12 +11069,11 @@
 
               if (! error_state)
                 {
-                  size_t pos = file.find_first_not_of ("|");
-                  if (pos != std::string::npos)
-                    file = file.substr (pos);
+                  if (! file.empty () && file[0] == '|')
+                    file = file.substr (1);  // Strip leading pipe character
                   else
                     {
-                      pos = file.find_last_of (file_ops::dir_sep_chars ());
+                      size_t pos = file.find_last_of (file_ops::dir_sep_chars ());
 
                       if (pos != std::string::npos)
                         {