isspace() causes failed assertion in .tab driver
On June 14th, 2007, Daniel Bäck wrote to gdal-dev:
> Hello,
>
> If you build GDAL against the debug version of the c-runtime with
> Visual Studio 2005 (/MDd) and try to open a .tab file with 8-bit ASCII
> characters in it, the field names for instance, you get an assert in
> isspace on row 177 in
> http://trac.osgeo.org/gdal/browser/trunk/gdal/ogr/ogrsf_frmts/mitab/mitab_imapinfofile.cpp
>
> The parameter passed to isspace is a signed char which is converted to
> a signed int so any values >127 will become negative. It seems to work
> fine when built against the release libraries and if you ignore the
> assert it seems to work so this is probably nothing serious maybe
> depending on the locale that is used. It can easily be fixed by
> casting the char to an unsigend char before passing it to isspace:
> isspace((unsigned char)*pszLine)
>
> Regards,
> Daniel Bäck
Change History
(3)
Resolution: |
→ fixed
|
Status: |
assigned → closed
|
MITAB bug 1737 already proposed changing this same isspace() to iswspace(): http://bugzilla.maptools.org/show_bug.cgi?id=1737
After bringing up this issue, Daniel sent the following (and very useful) reply: