aboutsummaryrefslogtreecommitdiff
path: root/converters/iconv/files
diff options
context:
space:
mode:
authorAkinori MUSHA <knu@FreeBSD.org>2002-03-18 11:13:33 +0000
committerAkinori MUSHA <knu@FreeBSD.org>2002-03-18 11:13:33 +0000
commitdc2cf7c4bcbf813c9744705b37346b1c0da6f0a3 (patch)
treef052a2b041d3bc1eefed9d99430085d5d83f04c6 /converters/iconv/files
parent21d944be5c0c2eb514e315ee1fdd5cef39924107 (diff)
downloadports-dc2cf7c4bcbf813c9744705b37346b1c0da6f0a3.tar.gz
ports-dc2cf7c4bcbf813c9744705b37346b1c0da6f0a3.zip
Notes
Diffstat (limited to 'converters/iconv/files')
-rw-r--r--converters/iconv/files/patch-lib::converter.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/converters/iconv/files/patch-lib::converter.c b/converters/iconv/files/patch-lib::converter.c
new file mode 100644
index 000000000000..362246793dca
--- /dev/null
+++ b/converters/iconv/files/patch-lib::converter.c
@@ -0,0 +1,55 @@
+--- lib/converter.c.orig Sun Nov 26 22:10:22 2000
++++ lib/converter.c Mon Mar 18 19:49:56 2002
+@@ -92,14 +92,14 @@
+ if (ch == UCS_CHAR_NONE) {
+ /* Incomplete character in input buffer */
+ errno = EINVAL;
+- return res;
++ return (size_t)(-1);
+ }
+ if (ch == UCS_CHAR_INVALID) {
+ /* Invalid character in source buffer */
+ *inbytesleft += *inbuf - ptr;
+ *inbuf = ptr;
+ errno = EILSEQ;
+- return res;
++ return (size_t)(-1);
+ }
+ size = ICONV_CES_CONVERT_FROM_UCS(&(uc->to), ch,
+ outbuf, outbytesleft);
+@@ -116,7 +116,7 @@
+ *inbytesleft += *inbuf - ptr;
+ *inbuf = ptr;
+ errno = E2BIG;
+- return res;
++ return (size_t)(-1);
+ }
+ }
+ return res;
+@@ -156,14 +156,24 @@
+ {
+ if (inbuf && *inbuf && inbytesleft && *inbytesleft > 0 && outbuf
+ && *outbuf && outbytesleft && *outbytesleft > 0) {
+- size_t len = *inbytesleft < *outbytesleft ? *inbytesleft
+- : *outbytesleft;
++ size_t result, len;
++ if (*inbytesleft < *outbytesleft) {
++ result = 0;
++ len = *inbytesleft;
++ } else {
++ result = (size_t)(-1);
++ errno = E2BIG;
++ len = *outbytesleft;
++ }
+ bcopy(*inbuf, *outbuf, len);
+ *inbuf += len;
+ *inbytesleft -= len;
+ *outbuf += len;
+ *outbytesleft -= len;
++
++ return result;
+ }
++
+ return 0;
+ }
+