/[emacs]/emacs/src/coding.c
ViewVC logotype

Diff of /emacs/src/coding.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.313 by handa, Tue Jan 18 00:11:43 2005 UTC revision 1.314 by handa, Mon Feb 14 01:01:50 2005 UTC
# Line 6361  encode_coding_string (str, coding, nocop Line 6361  encode_coding_string (str, coding, nocop
6361    
6362    if (SYMBOLP (coding->pre_write_conversion)    if (SYMBOLP (coding->pre_write_conversion)
6363        && !NILP (Ffboundp (coding->pre_write_conversion)))        && !NILP (Ffboundp (coding->pre_write_conversion)))
6364      str = run_pre_post_conversion_on_str (str, coding, 1);      {
6365          str = run_pre_post_conversion_on_str (str, coding, 1);
6366          /* As STR is just newly generated, we don't have to copy it
6367             anymore.  */
6368          nocopy = 1;
6369        }
6370    
6371    from = 0;    from = 0;
6372    to = SCHARS (str);    to = SCHARS (str);
# Line 6369  encode_coding_string (str, coding, nocop Line 6374  encode_coding_string (str, coding, nocop
6374    
6375    /* Encoding routines determine the multibyteness of the source text    /* Encoding routines determine the multibyteness of the source text
6376       by coding->src_multibyte.  */       by coding->src_multibyte.  */
6377    coding->src_multibyte = STRING_MULTIBYTE (str);    coding->src_multibyte = SCHARS (str) < SBYTES (str);
6378    coding->dst_multibyte = 0;    coding->dst_multibyte = 0;
6379    if (! CODING_REQUIRE_ENCODING (coding))    if (! CODING_REQUIRE_ENCODING (coding))
6380      {      goto no_need_of_encoding;
       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));  
     }  
6381    
6382    if (coding->composing != COMPOSITION_DISABLED)    if (coding->composing != COMPOSITION_DISABLED)
6383      coding_save_composition (coding, from, to, str);      coding_save_composition (coding, from, to, str);
# Line 6399  encode_coding_string (str, coding, nocop Line 6393  encode_coding_string (str, coding, nocop
6393        if (from == to_byte)        if (from == to_byte)
6394          {          {
6395            coding_free_composition_data (coding);            coding_free_composition_data (coding);
6396            return (nocopy ? str : Fcopy_sequence (str));            goto no_need_of_encoding;
6397          }          }
6398        shrinked_bytes = from + (SBYTES (str) - to_byte);        shrinked_bytes = from + (SBYTES (str) - to_byte);
6399      }      }
# Line 6444  encode_coding_string (str, coding, nocop Line 6438  encode_coding_string (str, coding, nocop
6438    coding_free_composition_data (coding);    coding_free_composition_data (coding);
6439    
6440    return newstr;    return newstr;
6441    
6442     no_need_of_encoding:
6443      coding->consumed = SBYTES (str);
6444      coding->consumed_char = SCHARS (str);
6445      if (STRING_MULTIBYTE (str))
6446        {
6447          if (nocopy)
6448            /* We are sure that STR doesn't contain a multibyte
6449               character.  */
6450            STRING_SET_UNIBYTE (str);
6451          else
6452            {
6453              str = Fstring_as_unibyte (str);
6454              nocopy = 1;
6455            }
6456        }
6457      coding->produced = SBYTES (str);
6458      coding->produced_char = SCHARS (str);
6459      return (nocopy ? str : Fcopy_sequence (str));
6460  }  }
6461    
6462    

Legend:
Removed from v.1.313  
changed lines
  Added in v.1.314

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26