Okay, apparently the newer standard specifies char** for the inbuf
parameter to iconv() (See http://lists.debian.org/debian-glibc/2004/05/msg00006.html) I'm casting in the general case, but I added a non-const codepath in case it matters on some platform. --HG-- branch : SDL-1.2 extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402386
This commit is contained in:
parent
aa3a251d43
commit
cc3fe2e639
1 changed files with 14 additions and 1 deletions
|
@ -34,7 +34,20 @@ size_t SDL_iconv(SDL_iconv_t cd,
|
|||
const char **inbuf, size_t *inbytesleft,
|
||||
char **outbuf, size_t *outbytesleft)
|
||||
{
|
||||
size_t retCode = iconv(cd, inbuf, inbytesleft, outbuf, outbytesleft);
|
||||
size_t retCode;
|
||||
#ifdef ICONV_REALLY_MODIFIES_INBUF
|
||||
if ( inbuf && *inbuf && inbytesleft ) {
|
||||
char *tmp = SDL_stack_alloc(char, *inbytesleft);
|
||||
char *ptr = tmp;
|
||||
retCode = iconv(cd, &ptr, inbytesleft, outbuf, outbytesleft);
|
||||
inbuf += (ptr - tmp);
|
||||
SDL_stack_free(tmp);
|
||||
} else {
|
||||
retCode = iconv(cd, NULL, inbytesleft, outbuf, outbytesleft);
|
||||
}
|
||||
#else
|
||||
retCode = iconv(cd, (char **)inbuf, inbytesleft, outbuf, outbytesleft);
|
||||
#endif
|
||||
if ( retCode == (size_t)-1 ) {
|
||||
switch(errno) {
|
||||
case E2BIG:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue