summaryrefslogtreecommitdiff
path: root/textproc/libxml2/patches/patch-ag
blob: 173890eb3a553250dcb3305e3f833c0cf79e46e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
$NetBSD: patch-ag,v 1.9 2011/11/01 19:21:06 spz Exp $

--- encoding.c.orig	2010-11-04 16:40:06.000000000 +0000
+++ encoding.c
@@ -1429,6 +1429,9 @@ xmlInitCharEncodingHandlers(void) {
     xmlRegisterCharEncodingHandlersISO8859x ();
 #endif
 #endif
+#ifdef __NetBSD__ /* XXX needed by selftest */
+    xmlAddEncodingAlias("CP1141", "IBM-1141");
+#endif
 
 }
 
@@ -1928,7 +1931,7 @@ xmlCharEncFirstLineInt(xmlCharEncodingHa
     if (in == NULL) return(-1);
 
     /* calculate space available */
-    written = out->size - out->use;
+    written = out->size - out->use - 1; /* count '\0' */
     toconv = in->use;
     /*
      * echo '<?xml version="1.0" encoding="UCS4"?>' | wc -c => 38
@@ -2059,7 +2062,7 @@ xmlCharEncInFunc(xmlCharEncodingHandler 
     toconv = in->use;
     if (toconv == 0)
         return (0);
-    written = out->size - out->use;
+    written = out->size - out->use - 1; /* count '\0' */
     if (toconv * 2 >= written) {
         xmlBufferGrow(out, out->size + toconv * 2);
         written = out->size - out->use - 1;