mirror of
https://github.com/opencv/opencv.git
synced 2025-01-19 15:04:01 +08:00
a few more little fixes in read_csv
This commit is contained in:
parent
33d23ef27a
commit
ea3ccc6d61
@ -165,7 +165,7 @@ int CvMLData::read_csv(const char* filename)
|
||||
if( !fgets_chomp( buf, M, file ))
|
||||
{
|
||||
fclose(file);
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
for( ptr = buf; *ptr != '\0'; ptr++ )
|
||||
cols_count += (*ptr == delimiter);
|
||||
@ -173,7 +173,7 @@ int CvMLData::read_csv(const char* filename)
|
||||
if ( cols_count == 0)
|
||||
{
|
||||
fclose(file);
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
cols_count++;
|
||||
|
||||
@ -194,18 +194,17 @@ int CvMLData::read_csv(const char* filename)
|
||||
if (!token)
|
||||
{
|
||||
fclose(file);
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
for (int i = 0; i < cols_count-1; i++)
|
||||
{
|
||||
|
||||
str_to_flt_elem( token, el_ptr[i], type);
|
||||
var_types_ptr[i] |= type;
|
||||
token = strtok(NULL, str_delimiter);
|
||||
if (!token)
|
||||
{
|
||||
fclose(file);
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
str_to_flt_elem( token, el_ptr[cols_count-1], type);
|
||||
|
Loading…
Reference in New Issue
Block a user