emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/coding.c


From: Kenichi Handa
Subject: [Emacs-diffs] Changes to emacs/src/coding.c
Date: Sun, 13 Feb 2005 20:01:51 -0500

Index: emacs/src/coding.c
diff -c emacs/src/coding.c:1.313 emacs/src/coding.c:1.314
*** emacs/src/coding.c:1.313    Tue Jan 18 00:11:43 2005
--- emacs/src/coding.c  Mon Feb 14 01:01:50 2005
***************
*** 6361,6367 ****
  
    if (SYMBOLP (coding->pre_write_conversion)
        && !NILP (Ffboundp (coding->pre_write_conversion)))
!     str = run_pre_post_conversion_on_str (str, coding, 1);
  
    from = 0;
    to = SCHARS (str);
--- 6361,6372 ----
  
    if (SYMBOLP (coding->pre_write_conversion)
        && !NILP (Ffboundp (coding->pre_write_conversion)))
!     {
!       str = run_pre_post_conversion_on_str (str, coding, 1);
!       /* As STR is just newly generated, we don't have to copy it
!        anymore.  */
!       nocopy = 1;
!     }
  
    from = 0;
    to = SCHARS (str);
***************
*** 6369,6389 ****
  
    /* Encoding routines determine the multibyteness of the source text
       by coding->src_multibyte.  */
!   coding->src_multibyte = STRING_MULTIBYTE (str);
    coding->dst_multibyte = 0;
    if (! CODING_REQUIRE_ENCODING (coding))
!     {
!       coding->consumed = SBYTES (str);
!       coding->consumed_char = SCHARS (str);
!       if (STRING_MULTIBYTE (str))
!       {
!         str = Fstring_as_unibyte (str);
!         nocopy = 1;
!       }
!       coding->produced = SBYTES (str);
!       coding->produced_char = SCHARS (str);
!       return (nocopy ? str : Fcopy_sequence (str));
!     }
  
    if (coding->composing != COMPOSITION_DISABLED)
      coding_save_composition (coding, from, to, str);
--- 6374,6383 ----
  
    /* Encoding routines determine the multibyteness of the source text
       by coding->src_multibyte.  */
!   coding->src_multibyte = SCHARS (str) < SBYTES (str);
    coding->dst_multibyte = 0;
    if (! CODING_REQUIRE_ENCODING (coding))
!     goto no_need_of_encoding;
  
    if (coding->composing != COMPOSITION_DISABLED)
      coding_save_composition (coding, from, to, str);
***************
*** 6399,6405 ****
        if (from == to_byte)
        {
          coding_free_composition_data (coding);
!         return (nocopy ? str : Fcopy_sequence (str));
        }
        shrinked_bytes = from + (SBYTES (str) - to_byte);
      }
--- 6393,6399 ----
        if (from == to_byte)
        {
          coding_free_composition_data (coding);
!         goto no_need_of_encoding;
        }
        shrinked_bytes = from + (SBYTES (str) - to_byte);
      }
***************
*** 6444,6449 ****
--- 6438,6462 ----
    coding_free_composition_data (coding);
  
    return newstr;
+ 
+  no_need_of_encoding:
+   coding->consumed = SBYTES (str);
+   coding->consumed_char = SCHARS (str);
+   if (STRING_MULTIBYTE (str))
+     {
+       if (nocopy)
+       /* We are sure that STR doesn't contain a multibyte
+          character.  */
+       STRING_SET_UNIBYTE (str);
+       else
+       {
+         str = Fstring_as_unibyte (str);
+         nocopy = 1;
+       }
+     }
+   coding->produced = SBYTES (str);
+   coding->produced_char = SCHARS (str);
+   return (nocopy ? str : Fcopy_sequence (str));
  }
  
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]