summaryrefslogtreecommitdiff
path: root/editors/nvi
diff options
context:
space:
mode:
authorchristos <christos@pkgsrc.org>2013-02-08 23:09:18 +0000
committerchristos <christos@pkgsrc.org>2013-02-08 23:09:18 +0000
commit4dcea3785723f6a9760cd872ee9639fb31fb859e (patch)
tree2fd3e2028bf12938eaa8f8bd44bd464633f0f3ef /editors/nvi
parent26d71ab394478fd200a1b212cdcb4a289ba01aaf (diff)
downloadpkgsrc-4dcea3785723f6a9760cd872ee9639fb31fb859e.tar.gz
fix conversion issue
Diffstat (limited to 'editors/nvi')
-rw-r--r--editors/nvi/Makefile4
-rw-r--r--editors/nvi/distinfo3
-rw-r--r--editors/nvi/patches/patch-common_conv.c76
3 files changed, 80 insertions, 3 deletions
diff --git a/editors/nvi/Makefile b/editors/nvi/Makefile
index 98c4ed5fd6c..eaf9263ff8f 100644
--- a/editors/nvi/Makefile
+++ b/editors/nvi/Makefile
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.45 2013/01/23 17:26:07 wiz Exp $
+# $NetBSD: Makefile,v 1.46 2013/02/08 23:09:18 christos Exp $
DISTNAME= nvi-1.81.6
-PKGREVISION= 7
+PKGREVISION= 8
CATEGORIES= editors
MASTER_SITES= ${HOMEPAGE:Q}
EXTRACT_SUFX= .tar.bz2
diff --git a/editors/nvi/distinfo b/editors/nvi/distinfo
index d94554fe470..50f0b1010b0 100644
--- a/editors/nvi/distinfo
+++ b/editors/nvi/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.18 2013/01/23 17:33:28 wiz Exp $
+$NetBSD: distinfo,v 1.19 2013/02/08 23:09:18 christos Exp $
SHA1 (nvi-1.81.6.tar.bz2) = d3445ed69166102735335a2ff60d092d9a9143c6
RMD160 (nvi-1.81.6.tar.bz2) = 0db8568bea96392d9a027044177c60317c8ade36
@@ -33,6 +33,7 @@ SHA1 (patch-ba) = 57edce2dafc630d7e948a5b528242bdcff334228
SHA1 (patch-bb) = 5110c239cd1cc82cdd1eaeba6ceedb11ee797b26
SHA1 (patch-bc) = 6ac8377ae6f2fc513c058c0bf7f5ad18e97141a8
SHA1 (patch-bd) = 9a04f7a247fe6bf800469e81f7a83ffddd45b4b5
+SHA1 (patch-common_conv.c) = efb2dabf226523a493fc1172013adc8021f4c2b9
SHA1 (patch-dist_Makefile.am) = ebae821ce659df003f5f2043f754e325c0863aff
SHA1 (patch-dist_configure.in) = 0834b7680d520937eb5a1503128ddb64297edadb
SHA1 (patch-ex_ex__script.c) = ac745c0481718ed8c769fb43ee990152902fa54e
diff --git a/editors/nvi/patches/patch-common_conv.c b/editors/nvi/patches/patch-common_conv.c
new file mode 100644
index 00000000000..50b61282c82
--- /dev/null
+++ b/editors/nvi/patches/patch-common_conv.c
@@ -0,0 +1,76 @@
+$NetBSD: patch-common_conv.c,v 1.1 2013/02/08 23:09:18 christos Exp $
+
+Don't fail if a character conversion failed; insert the raw characters
+into the file instead.
+
+--- common/conv.c.orig 2007-11-18 11:41:42.000000000 -0500
++++ common/conv.c 2013-02-08 18:04:36.000000000 -0500
+@@ -60,6 +60,21 @@
+ return 0;
+ }
+
++#ifndef ERROR_ON_CONVERT
++#define HANDLE_ICONV_ERROR(o, i, ol, il) do { \
++ *o++ = *i++; \
++ ol--; il--; \
++ } while (/*CONSTCOND*/0)
++#define HANDLE_MBR_ERROR(n, mbs, d, s) do { \
++ d = s; \
++ MEMSET(&mbs, 0, 1); \
++ n = 1; \
++ } while (/*CONSTCOND*/0)
++#else
++#define HANDLE_ICONV_ERROR goto err
++#define HANDLE_MBR_ERROR goto err
++#endif
++
+ #define CONV_BUFFER_SIZE 512
+ /* fill the buffer with codeset encoding of string pointed to by str
+ * left has the number of bytes left in str and is adjusted
+@@ -72,9 +87,9 @@
+ char *bp = buffer; \
+ outleft = CONV_BUFFER_SIZE; \
+ errno = 0; \
+- if (iconv(id, (char **)&str, &left, &bp, &outleft) == -1 /*&& \
+- errno != E2BIG*/) \
+- goto err; \
++ if (iconv(id, (const char **)&str, &left, &bp, &outleft) \
++ == (size_t)-1 /* && errno != E2BIG */) \
++ HANDLE_ICONV_ERROR(bp, str, outleft, left); \
+ if ((len = CONV_BUFFER_SIZE - outleft) == 0) { \
+ error = -left; \
+ goto err; \
+@@ -116,8 +131,9 @@
+ for (i = 0, j = 0; j < len; ) {
+ n = mbrtowc((*tostr)+i, src+j, len-j, &mbs);
+ /* NULL character converted */
+- if (n == -2) error = -(len-j);
+- if (n == -1 || n == -2) goto err;
++ if (n == (size_t)-2) error = -(len-j);
++ if (n == (size_t)-1 || n == (size_t)-2)
++ HANDLE_MBR_ERROR(n, mbs, (*tostr)[i], src[j]);
+ if (n == 0) n = 1;
+ j += n;
+ if (++i >= *blen) {
+@@ -238,8 +254,9 @@
+ BINC_RETC(NULL, cw->bp1, cw->blen1, nlen); \
+ } \
+ errno = 0; \
+- if (iconv(id, &bp, &len, &obp, &outleft) == -1 && \
+- errno != E2BIG) \
++ if (iconv(id, &bp, &len, &obp, &outleft) == (size_t)-1 && \
++ errno != E2BIG) \
++ HANDLE_ICONV_ERROR(obp, bp, outleft, len); \
+ goto err; \
+ offset = cw->blen1 - outleft; \
+ } \
+@@ -264,7 +281,8 @@
+
+ for (i = 0, j = 0; i < len; ++i) {
+ n = wcrtomb(dst+j, str[i], &mbs);
+- if (n == -1) goto err;
++ if (n == (size_t)-1)
++ HANDLE_MBR_ERROR(n, mbs, dst[j], str[i]);
+ j += n;
+ if (buflen < j + MB_CUR_MAX) {
+ if (id != (iconv_t)-1) {