comparison libinterp/dldfcn/audioread.cc @ 19906:ed5ee3f610db

Correct tests using std::string::find_XXX which did not use std::string::npos. * symtab.cc (find_function): For old-style class syntax, avoid setting method == dispatch if there is no dir_sep_str. * __osmesa_print__.cc: Correctly check for pipe command versus filename. * audioread.cc: Correctly find extension of file after '.'.
author Rik <rik@octave.org>
date Fri, 27 Feb 2015 09:31:11 -0800
parents 879cff0c05dc
children d575cd1e0da7
comparison
equal deleted inserted replaced
19905:815db217f6f4 19906:ed5ee3f610db
329 int samplerate = args(2).int_value (); 329 int samplerate = args(2).int_value ();
330 330
331 if (error_state) 331 if (error_state)
332 return retval; 332 return retval;
333 333
334 std::string ext = filename.substr (filename.find_last_of (".") + 1); 334 std::string ext;
335 std::size_t dotpos = filename.find_last_of (".");
336 if (dotpos != std::string::npos)
337 ext = filename.substr (dotpos + 1);
335 std::transform (ext.begin (), ext.end (), ext.begin (), ::tolower); 338 std::transform (ext.begin (), ext.end (), ext.begin (), ::tolower);
336 339
337 sf_count_t items_to_write = audio.rows () * audio.columns (); 340 sf_count_t items_to_write = audio.rows () * audio.columns ();
338 341
339 if (audio.rows () == 1) 342 if (audio.rows () == 1)