which version is needed? |
which version is needed? |
Andreas K. Foerster
Guest
|
Am Monday, dem 25. Jun 2007 schrieb Sam Lantinga:
:-( Also I find it annoying that SDL_iconv can output several different error codes, in contrast to the default iconv implementation. Is there a more elegant way to check for an error? | /* do the conversion */ | returncode = SDL_iconv (cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft); | | /* check for errors */ | if (returncode == SDL_ICONV_ERROR | || returncode == SDL_ICONV_E2BIG | || returncode == SDL_ICONV_EILSEQ | || returncode == SDL_ICONV_EINVAL) | { | /* ... */ | } My first thought was just to check if the result is less than zero. But size_t is unsigned on my system, so (size_t)(-1) is NOT less than zero. -- AKFoerster |
|||||||||||||||||||||
|
which version is needed? |
Sam Lantinga
Guest
|
Hmm, that is kind of annoying. Maybe we can have you pass a pointer to an error code? That would be a 1.3 API change though... -Sam Lantinga, Lead Software Engineer, Blizzard Entertainment |
|||||||||||||||
|
which version is needed? |
Andreas K. Foerster
Guest
|
Am Wednesday, dem 27. Jun 2007 schrieb Sam Lantinga:
Sorry for the late answer. Why not stay compatible with other implementations? That is _one_ dedicated result for errors and a separate variable "SDL_errno" for the error code. To define it as (size_t)(-1) is fine even when size_t is unsigned. Then it is the maximum value. But having just one single value for errors makes checking simpler. -- AKFoerster |
|||||||||||||||||
|