# HG changeset patch # User Rik # Date 1425083354 28800 # Node ID 6b7aee95c54c535e3f8047bc72cbb7b287de672a # Parent 5261186f1b006f2311a989de2455642a644a223f 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". diff -r 5261186f1b00 -r 6b7aee95c54c libinterp/corefcn/graphics.cc --- 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) { diff -r 5261186f1b00 -r 6b7aee95c54c libinterp/dldfcn/__osmesa_print__.cc --- a/libinterp/dldfcn/__osmesa_print__.cc Fri Feb 27 15:53:42 2015 -0800 +++ b/libinterp/dldfcn/__osmesa_print__.cc Fri Feb 27 16:29:14 2015 -0800 @@ -182,11 +182,10 @@ if (! error_state) { - size_t pos = file.find_first_not_of ("|"); - if (pos != std::string::npos) + if (! file.empty () && file[0] == '|') { // create process and pipe gl2ps output to it - std::string cmd = file.substr (pos); + std::string cmd = file.substr (1); gl2ps_print (fobj, cmd, term); } else