]> git.ipfire.org Git - thirdparty/tar.git/commitdiff
Minor utf8.c improvements
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 3 Aug 2024 06:32:42 +0000 (23:32 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 4 Aug 2024 08:41:43 +0000 (01:41 -0700)
* src/utf8.c: Minor rephrases for -1.

src/utf8.c

index 6dde8814290c77001966a49d59e206efd2410047..2e499a9c5aedc5267aa3d672479bc0eda5c26b0c 100644 (file)
@@ -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.