Minor utf8.c improvements
* src/utf8.c: Minor rephrases for -1.
This commit is contained in:
@@ -35,7 +35,8 @@
|
||||
# define iconv_open(tocode, fromcode) ((iconv_t) -1)
|
||||
|
||||
# undef iconv
|
||||
# define iconv(cd, inbuf, inbytesleft, outbuf, outbytesleft) (errno = ENOSYS, (size_t) -1)
|
||||
# define iconv(cd, inbuf, inbytesleft, outbuf, outbytesleft) \
|
||||
(errno = ENOSYS, SIZE_MAX)
|
||||
|
||||
# undef iconv_close
|
||||
# define iconv_close(cd) 0
|
||||
@@ -77,7 +78,7 @@ utf8_convert (bool to_utf, char const *input, char **output)
|
||||
*output = xstrdup (input);
|
||||
return true;
|
||||
}
|
||||
else if (cd == (iconv_t)-1)
|
||||
else if (cd == (iconv_t) -1)
|
||||
return false;
|
||||
|
||||
inlen = strlen (input) + 1;
|
||||
@@ -93,7 +94,7 @@ utf8_convert (bool to_utf, char const *input, char **output)
|
||||
implementation-defined conversion on this character." It will "update
|
||||
the variables pointed to by the arguments to reflect the extent of the
|
||||
conversion and return the number of non-identical conversions performed".
|
||||
On error, it returns -1.
|
||||
On error, it returns SIZE_MAX.
|
||||
In other words, non-zero return always indicates failure, either because
|
||||
the input was not fully converted, or because it was converted in a
|
||||
non-reversible way.
|
||||
|
||||
Reference in New Issue
Block a user