Corrected small bug in the tokenizer (it would add a fake token for lines ending with a space before /n)

This commit is contained in:
Paolo Cignoni 2004-11-23 11:56:50 +00:00
parent 96d8ae7ec0
commit b5553ec6ca
1 changed files with 14 additions and 5 deletions

View File

@ -19,6 +19,12 @@
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
* for more details. * * for more details. *
* * * *
****************************************************************************/
/****************************************************************************
History
$Log: not supported by cvs2svn $
****************************************************************************/ ****************************************************************************/
#ifndef __VCGLIB_IMPORT_OFF #ifndef __VCGLIB_IMPORT_OFF
@ -285,11 +291,14 @@ namespace vcg
{ {
while (line[from]==' ' && from!=length) while (line[from]==' ' && from!=length)
from++; from++;
to = from+1; if(from!=length)
while (line[to]!=' ' && to!=length) {
to++; to = from+1;
tokens.push_back(line.substr(from, to-from).c_str()); while (line[to]!=' ' && to!=length)
from = to; to++;
tokens.push_back(line.substr(from, to-from).c_str());
from = to;
}
} }
while (from<length); while (from<length);
} // end Tokenize } // end Tokenize