File: detect-coding-iso2022.diff

package info (click to toggle)
emacs21 21.4a%2B1-3etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 59,104 kB
  • ctags: 58,909
  • sloc: lisp: 493,229; ansic: 237,175; xml: 4,262; sh: 4,109; makefile: 2,479; perl: 1,069; cs: 776; asm: 254; csh: 9; sed: 4
file content (39 lines) | stat: -rw-r--r-- 1,217 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
38
39
* Emacs should no longer silently modify a binary file when instructed not to.
  Patch: detect-coding-iso2022.diff
  Provided-by: Kenichi Handa <handa@etl.go.jp> 
  Added-by: Rob Browning <rlb@defaultvalue.org>
  Status: backported from upstream fix of 2002-07-26

  Emacs should no longer modify a binary file when told to use a
  raw-text or no-conversion for the encoding during a save.

diff -urNad /home/rlb/deb/emacs21/trunk/src/coding.c trunk/src/coding.c
--- /home/rlb/deb/emacs21/trunk/src/coding.c	2003-09-09 17:28:48.000000000 -0500
+++ trunk/src/coding.c	2003-09-11 22:16:16.000000000 -0500
@@ -1359,6 +1359,7 @@
   while (mask && src < src_end)
     {
       ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep);
+    retry:
       switch (c)
 	{
 	case ISO_CODE_ESC:
@@ -1556,6 +1557,8 @@
 		  && mask & CODING_CATEGORY_MASK_ISO_8_2)
 		{
 		  int i = 1;
+
+		  c = -1;
 		  while (src < src_end)
 		    {
 		      ONE_MORE_BYTE_CHECK_MULTIBYTE (c, multibytep);
@@ -1568,6 +1571,9 @@
 		    mask &= ~CODING_CATEGORY_MASK_ISO_8_2;
 		  else
 		    mask_found |= CODING_CATEGORY_MASK_ISO_8_2;
+		  if (c >= 0)
+		    /* This means that we have read one extra byte.  */
+		    goto retry;
 		}
 	    }
 	  break;