stl_format.c: fix case that would return FOUG_STL_ASCII_FORMAT instead of FOUG_STL_UNKNOWN_FORMAT

This commit is contained in:
Hugues Delorme 2014-01-29 11:29:55 +01:00
parent 36594dc120
commit e548e342b9

View File

@ -37,14 +37,17 @@ foug_stl_format_t foug_stl_get_format(foug_stream_t *stream, size_t data_size)
/* ASCII STL ? */ /* ASCII STL ? */
{ {
/* Skip spaces at beginning */
size_t pos = 0; size_t pos = 0;
while (isspace(fixed_buffer[pos]) && pos < _INTERNAL_FOUG_FIXED_BUFFER_SIZE) while (isspace(fixed_buffer[pos]) && pos < _INTERNAL_FOUG_FIXED_BUFFER_SIZE)
++pos; ++pos;
if (pos == _INTERNAL_FOUG_FIXED_BUFFER_SIZE)
return FOUG_STL_ASCII_FORMAT;
if (strcmp(fixed_buffer + pos, "solid ") == 0) /* Next token (if exists) must match "solid " */
if (pos < _INTERNAL_FOUG_FIXED_BUFFER_SIZE
&& strcmp(fixed_buffer + pos, "solid ") == 0)
{
return FOUG_STL_ASCII_FORMAT; return FOUG_STL_ASCII_FORMAT;
}
} }
/* Fallback case */ /* Fallback case */