]> git.eshelyaron.com Git - emacs.git/commitdiff
(ccl_driver) [CCL_ReadMultibyteChar2]: If SRC points an
authorKenichi Handa <handa@m17n.org>
Thu, 15 Feb 2001 13:10:38 +0000 (13:10 +0000)
committerKenichi Handa <handa@m17n.org>
Thu, 15 Feb 2001 13:10:38 +0000 (13:10 +0000)
invalid mulitbyte sequence, treat *SRC as a character of
eight-bit-graphic.

src/ChangeLog
src/ccl.c

index e004696d3c0e6a55dfad17ba9fb3c5bd08a2c730..c5cd6b416286d23532d52ae9a0a7df7b8a8f31da 100644 (file)
@@ -1,3 +1,9 @@
+2001-02-15  Kenichi Handa  <handa@etl.go.jp>
+
+       * ccl.c (ccl_driver) [CCL_ReadMultibyteChar2]: If SRC points an
+       invalid multibyte sequence, treat *SRC as a character of
+       eight-bit-graphic.
+
 2001-02-15  Eli Zaretskii  <eliz@is.elta.co.il>
 
        * textprop.c (Fset_text_properties): Doc fix.
index 45cc525112de9bfc543df1254679459c0618e4b1..fe7faafb9e5cc9076c118dbd64678c0f2c53dae5 100644 (file)
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -1255,21 +1255,27 @@ ccl_driver (ccl, source, destination, src_bytes, dst_bytes, consumed)
                  reg[rrr] = i;
                  reg[RRR] = CHARSET_ASCII;
                }
-             else if (i <= MAX_CHARSET_OFFICIAL_DIMENSION1)
-               {
-                 if (src >= src_end)
-                   goto ccl_read_multibyte_character_suspend;
-                 reg[RRR] = i;
-                 reg[rrr] = (*src++ & 0x7F);
-               }
              else if (i <= MAX_CHARSET_OFFICIAL_DIMENSION2)
                {
-                 if ((src + 1) >= src_end)
+                 int dimension = BYTES_BY_CHAR_HEAD (i) - 1;
+
+                 if (dimension == 0)
+                   {
+                     /* `i' is a leading code for an undefined charset.  */
+                     reg[RRR] = CHARSET_8_BIT_GRAPHIC;
+                     reg[rrr] = i;
+                   }
+                 else if (src + dimension > src_end)
                    goto ccl_read_multibyte_character_suspend;
-                 reg[RRR] = i;
-                 i = (*src++ & 0x7F);
-                 reg[rrr] = ((i << 7) | (*src & 0x7F));
-                 src++;
+                 else
+                   {
+                     reg[RRR] = i;
+                     i = (*src++ & 0x7F);
+                     if (dimension == 1)
+                       reg[rrr] = i;
+                     else
+                       reg[rrr] = ((i << 7) | (*src++ & 0x7F));
+                   }
                }
              else if ((i == LEADING_CODE_PRIVATE_11)
                       || (i == LEADING_CODE_PRIVATE_12))