diff options
| author | Karoly Lorentey | 2005-02-19 00:06:48 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2005-02-19 00:06:48 +0000 |
| commit | 60c73d2ed638e5d51643c65a0fc6dea618fc72c8 (patch) | |
| tree | 3d9e0adc703f9cfd5df162c66ac15999c4106738 /src/coding.c | |
| parent | c20213c90736fc9c2a6eca2ca44d6e200dbf5efe (diff) | |
| parent | 8a59305430c68ee23d3cc7ab7487ab3acebdbe7f (diff) | |
| download | emacs-60c73d2ed638e5d51643c65a0fc6dea618fc72c8.tar.gz emacs-60c73d2ed638e5d51643c65a0fc6dea618fc72c8.zip | |
Merged from miles@gnu.org--gnu-2005 (patch 14-16, 95-106)
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-95
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-96
Move Gnus images into etc/images
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-97
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-98
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-99
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-100
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-101
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-102
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-103
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-104
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-105
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-106
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-14
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-15
Update from CVS: lisp/imap.el (imap-log): Doc fix.
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-16
Merge from emacs--cvs-trunk--0
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-295
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/src/coding.c b/src/coding.c index 11a7061c837..9cd493ab062 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -6357,7 +6357,12 @@ encode_coding_string (str, coding, nocopy) | |||
| 6357 | 6357 | ||
| 6358 | if (SYMBOLP (coding->pre_write_conversion) | 6358 | if (SYMBOLP (coding->pre_write_conversion) |
| 6359 | && !NILP (Ffboundp (coding->pre_write_conversion))) | 6359 | && !NILP (Ffboundp (coding->pre_write_conversion))) |
| 6360 | str = run_pre_post_conversion_on_str (str, coding, 1); | 6360 | { |
| 6361 | str = run_pre_post_conversion_on_str (str, coding, 1); | ||
| 6362 | /* As STR is just newly generated, we don't have to copy it | ||
| 6363 | anymore. */ | ||
| 6364 | nocopy = 1; | ||
| 6365 | } | ||
| 6361 | 6366 | ||
| 6362 | from = 0; | 6367 | from = 0; |
| 6363 | to = SCHARS (str); | 6368 | to = SCHARS (str); |
| @@ -6365,21 +6370,10 @@ encode_coding_string (str, coding, nocopy) | |||
| 6365 | 6370 | ||
| 6366 | /* Encoding routines determine the multibyteness of the source text | 6371 | /* Encoding routines determine the multibyteness of the source text |
| 6367 | by coding->src_multibyte. */ | 6372 | by coding->src_multibyte. */ |
| 6368 | coding->src_multibyte = STRING_MULTIBYTE (str); | 6373 | coding->src_multibyte = SCHARS (str) < SBYTES (str); |
| 6369 | coding->dst_multibyte = 0; | 6374 | coding->dst_multibyte = 0; |
| 6370 | if (! CODING_REQUIRE_ENCODING (coding)) | 6375 | if (! CODING_REQUIRE_ENCODING (coding)) |
| 6371 | { | 6376 | goto no_need_of_encoding; |
| 6372 | coding->consumed = SBYTES (str); | ||
| 6373 | coding->consumed_char = SCHARS (str); | ||
| 6374 | if (STRING_MULTIBYTE (str)) | ||
| 6375 | { | ||
| 6376 | str = Fstring_as_unibyte (str); | ||
| 6377 | nocopy = 1; | ||
| 6378 | } | ||
| 6379 | coding->produced = SBYTES (str); | ||
| 6380 | coding->produced_char = SCHARS (str); | ||
| 6381 | return (nocopy ? str : Fcopy_sequence (str)); | ||
| 6382 | } | ||
| 6383 | 6377 | ||
| 6384 | if (coding->composing != COMPOSITION_DISABLED) | 6378 | if (coding->composing != COMPOSITION_DISABLED) |
| 6385 | coding_save_composition (coding, from, to, str); | 6379 | coding_save_composition (coding, from, to, str); |
| @@ -6395,7 +6389,7 @@ encode_coding_string (str, coding, nocopy) | |||
| 6395 | if (from == to_byte) | 6389 | if (from == to_byte) |
| 6396 | { | 6390 | { |
| 6397 | coding_free_composition_data (coding); | 6391 | coding_free_composition_data (coding); |
| 6398 | return (nocopy ? str : Fcopy_sequence (str)); | 6392 | goto no_need_of_encoding; |
| 6399 | } | 6393 | } |
| 6400 | shrinked_bytes = from + (SBYTES (str) - to_byte); | 6394 | shrinked_bytes = from + (SBYTES (str) - to_byte); |
| 6401 | } | 6395 | } |
| @@ -6440,6 +6434,25 @@ encode_coding_string (str, coding, nocopy) | |||
| 6440 | coding_free_composition_data (coding); | 6434 | coding_free_composition_data (coding); |
| 6441 | 6435 | ||
| 6442 | return newstr; | 6436 | return newstr; |
| 6437 | |||
| 6438 | no_need_of_encoding: | ||
| 6439 | coding->consumed = SBYTES (str); | ||
| 6440 | coding->consumed_char = SCHARS (str); | ||
| 6441 | if (STRING_MULTIBYTE (str)) | ||
| 6442 | { | ||
| 6443 | if (nocopy) | ||
| 6444 | /* We are sure that STR doesn't contain a multibyte | ||
| 6445 | character. */ | ||
| 6446 | STRING_SET_UNIBYTE (str); | ||
| 6447 | else | ||
| 6448 | { | ||
| 6449 | str = Fstring_as_unibyte (str); | ||
| 6450 | nocopy = 1; | ||
| 6451 | } | ||
| 6452 | } | ||
| 6453 | coding->produced = SBYTES (str); | ||
| 6454 | coding->produced_char = SCHARS (str); | ||
| 6455 | return (nocopy ? str : Fcopy_sequence (str)); | ||
| 6443 | } | 6456 | } |
| 6444 | 6457 | ||
| 6445 | 6458 | ||