Opened 20 years ago

Last modified 20 years ago

#567 closed defect (invalid)

OGRFeature::GetFieldAsStringList does not return number of strings

Reported by: sf@… Owned by: warmerdam
Priority: high Milestone:
Component: OGR_SF Version: unspecified
Severity: normal Keywords:
Cc:

Description

OGRFeature::GetFieldAsStringList as well as OGR_F_GetFieldAsStringList do
not return the number of strings in the list.

The prototypes are:
char **OGRFeature::GetFieldAsStringList( int iField )
char **OGR_F_GetFieldAsStringList( OGRFeatureH hFeat, int iField )

To be consistent with GetFieldAsIntegerList and GetFieldAsDoubleList,
the prototypes should rather be:
char **OGRFeature::GetFieldAsStringList( int iField, int* pnCount )
char **OGR_F_GetFieldAsStringList( OGRFeatureH hFeat, int iField, int* pnCount )

i.e. the should return the number of strings in the list in the
last parameter pnCount.

Change History (3)

comment:1 by warmerdam, 20 years ago

David, 

The returned list is NULL terminated.  You can use the CSLCount() function
to count the entries in it.  This is a fairly widely used convention for
lists of strings in OGR and GDAL.  I don't plan to change the
GetFieldAsStringList() method. 

Thanks

comment:2 by sf@…, 20 years ago

Oh, ok. I did not know that.
I am sorry to have opened a ticket for that.

David

comment:3 by warmerdam, 20 years ago

David, 

No problem.  No harm, no foul. 

Best regards,
Note: See TracTickets for help on using tickets.