File: 02-src-libiconv-c-utf8.patch

package info (click to toggle)
recode 3.6-24
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 11,700 kB
  • sloc: ansic: 89,467; sh: 16,490; python: 1,281; lisp: 1,027; perl: 335; makefile: 309; lex: 171
file content (37 lines) | stat: -rw-r--r-- 1,027 bytes parent folder | download | duplicates (3)
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
33
34
35
36
37
From: Bruno Haible
Subject: UTF-8 should now work
Bug-Debian: https://bugs.debian.org/94966
X-Debian-version: 3.6-3

--- a/src/libiconv.c
+++ b/src/libiconv.c
@@ -1,5 +1,5 @@
 /* Conversion of files between different charsets and surfaces.
-   Copyright  1999, 2000 Free Software Foundation, Inc.
+   Copyright  1999, 2000, 2001 Free Software Foundation, Inc.
    Contributed by Franois Pinard <pinard@iro.umontreal.ca>, 1999,
    and Bruno Haible <haible@clisp.cons.org>, 2000.
 
@@ -195,12 +195,17 @@
 	 memcpy() doesn't do here, because the regions might overlap.
 	 memmove() isn't worth it, because we rarely have to move more
 	 than 12 bytes.  */
-      if (input > input_buffer && input_left > 0)
+      cursor = input_buffer;
+      if (input_left > 0)
 	{
-	  cursor = input_buffer;
-	  do
-	    *cursor++ = *input++;
-	  while (--input_left > 0);
+	  if (input > input_buffer)
+	    {
+	      do
+		*cursor++ = *input++;
+	      while (--input_left > 0);
+	    }
+	  else
+	    cursor += input_left;
 	}
     }