a few more little fixes in read_csv
This commit is contained in:
@@ -165,7 +165,7 @@ int CvMLData::read_csv(const char* filename)
|
|||||||
if( !fgets_chomp( buf, M, file ))
|
if( !fgets_chomp( buf, M, file ))
|
||||||
{
|
{
|
||||||
fclose(file);
|
fclose(file);
|
||||||
return 1;
|
return -1;
|
||||||
}
|
}
|
||||||
for( ptr = buf; *ptr != '\0'; ptr++ )
|
for( ptr = buf; *ptr != '\0'; ptr++ )
|
||||||
cols_count += (*ptr == delimiter);
|
cols_count += (*ptr == delimiter);
|
||||||
@@ -173,7 +173,7 @@ int CvMLData::read_csv(const char* filename)
|
|||||||
if ( cols_count == 0)
|
if ( cols_count == 0)
|
||||||
{
|
{
|
||||||
fclose(file);
|
fclose(file);
|
||||||
return 1;
|
return -1;
|
||||||
}
|
}
|
||||||
cols_count++;
|
cols_count++;
|
||||||
|
|
||||||
@@ -194,18 +194,17 @@ int CvMLData::read_csv(const char* filename)
|
|||||||
if (!token)
|
if (!token)
|
||||||
{
|
{
|
||||||
fclose(file);
|
fclose(file);
|
||||||
return 1;
|
return -1;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < cols_count-1; i++)
|
for (int i = 0; i < cols_count-1; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
str_to_flt_elem( token, el_ptr[i], type);
|
str_to_flt_elem( token, el_ptr[i], type);
|
||||||
var_types_ptr[i] |= type;
|
var_types_ptr[i] |= type;
|
||||||
token = strtok(NULL, str_delimiter);
|
token = strtok(NULL, str_delimiter);
|
||||||
if (!token)
|
if (!token)
|
||||||
{
|
{
|
||||||
fclose(file);
|
fclose(file);
|
||||||
return 1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
str_to_flt_elem( token, el_ptr[cols_count-1], type);
|
str_to_flt_elem( token, el_ptr[cols_count-1], type);
|
||||||
|
Reference in New Issue
Block a user