diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/coding.c | 70 |
2 files changed, 48 insertions, 30 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 26ea457a2fe..0e9d8644868 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2004-12-28 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 2 | |||
| 3 | * coding.c (decode_coding_XXX, decode_composition_emacs_mule) | ||
| 4 | (decode_coding_emacs_mule, encode_coding_emacs_mule) | ||
| 5 | (decode_coding_iso2022, encode_designation_at_bol) | ||
| 6 | (encode_coding_iso2022, decode_coding_sjis_big5, decode_eol) | ||
| 7 | (decode_coding): Constify arguments and local vars. | ||
| 8 | |||
| 1 | 2004-12-27 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | 9 | 2004-12-27 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> |
| 2 | 10 | ||
| 3 | * xmenu.c (popup_get_selection): Only pop down dialogs | 11 | * xmenu.c (popup_get_selection): Only pop down dialogs |
diff --git a/src/coding.c b/src/coding.c index c10d4800cbf..f87d02d5758 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -147,7 +147,8 @@ detect_coding_emacs_mule (src, src_end, multibytep) | |||
| 147 | static void | 147 | static void |
| 148 | decode_coding_XXX (coding, source, destination, src_bytes, dst_bytes) | 148 | decode_coding_XXX (coding, source, destination, src_bytes, dst_bytes) |
| 149 | struct coding_system *coding; | 149 | struct coding_system *coding; |
| 150 | unsigned char *source, *destination; | 150 | const unsigned char *source; |
| 151 | unsigned char *destination; | ||
| 151 | int src_bytes, dst_bytes; | 152 | int src_bytes, dst_bytes; |
| 152 | { | 153 | { |
| 153 | ... | 154 | ... |
| @@ -800,12 +801,13 @@ static INLINE int | |||
| 800 | decode_composition_emacs_mule (coding, src, src_end, | 801 | decode_composition_emacs_mule (coding, src, src_end, |
| 801 | destination, dst_end, dst_bytes) | 802 | destination, dst_end, dst_bytes) |
| 802 | struct coding_system *coding; | 803 | struct coding_system *coding; |
| 803 | unsigned char *src, *src_end, **destination, *dst_end; | 804 | const unsigned char *src, *src_end; |
| 805 | unsigned char **destination, *dst_end; | ||
| 804 | int dst_bytes; | 806 | int dst_bytes; |
| 805 | { | 807 | { |
| 806 | unsigned char *dst = *destination; | 808 | unsigned char *dst = *destination; |
| 807 | int method, data_len, nchars; | 809 | int method, data_len, nchars; |
| 808 | unsigned char *src_base = src++; | 810 | const unsigned char *src_base = src++; |
| 809 | /* Store components of composition. */ | 811 | /* Store components of composition. */ |
| 810 | int component[COMPOSITION_DATA_MAX_BUNCH_LENGTH]; | 812 | int component[COMPOSITION_DATA_MAX_BUNCH_LENGTH]; |
| 811 | int ncomponent; | 813 | int ncomponent; |
| @@ -946,23 +948,25 @@ decode_composition_emacs_mule (coding, src, src_end, | |||
| 946 | static void | 948 | static void |
| 947 | decode_coding_emacs_mule (coding, source, destination, src_bytes, dst_bytes) | 949 | decode_coding_emacs_mule (coding, source, destination, src_bytes, dst_bytes) |
| 948 | struct coding_system *coding; | 950 | struct coding_system *coding; |
| 949 | unsigned char *source, *destination; | 951 | const unsigned char *source; |
| 952 | unsigned char *destination; | ||
| 950 | int src_bytes, dst_bytes; | 953 | int src_bytes, dst_bytes; |
| 951 | { | 954 | { |
| 952 | unsigned char *src = source; | 955 | const unsigned char *src = source; |
| 953 | unsigned char *src_end = source + src_bytes; | 956 | const unsigned char *src_end = source + src_bytes; |
| 954 | unsigned char *dst = destination; | 957 | unsigned char *dst = destination; |
| 955 | unsigned char *dst_end = destination + dst_bytes; | 958 | unsigned char *dst_end = destination + dst_bytes; |
| 956 | /* SRC_BASE remembers the start position in source in each loop. | 959 | /* SRC_BASE remembers the start position in source in each loop. |
| 957 | The loop will be exited when there's not enough source code, or | 960 | The loop will be exited when there's not enough source code, or |
| 958 | when there's not enough destination area to produce a | 961 | when there's not enough destination area to produce a |
| 959 | character. */ | 962 | character. */ |
| 960 | unsigned char *src_base; | 963 | const unsigned char *src_base; |
| 961 | 964 | ||
| 962 | coding->produced_char = 0; | 965 | coding->produced_char = 0; |
| 963 | while ((src_base = src) < src_end) | 966 | while ((src_base = src) < src_end) |
| 964 | { | 967 | { |
| 965 | unsigned char tmp[MAX_MULTIBYTE_LENGTH], *p; | 968 | unsigned char tmp[MAX_MULTIBYTE_LENGTH]; |
| 969 | const unsigned char *p; | ||
| 966 | int bytes; | 970 | int bytes; |
| 967 | 971 | ||
| 968 | if (*src == '\r') | 972 | if (*src == '\r') |
| @@ -1116,14 +1120,15 @@ static void encode_eol P_ ((struct coding_system *, const unsigned char *, | |||
| 1116 | static void | 1120 | static void |
| 1117 | encode_coding_emacs_mule (coding, source, destination, src_bytes, dst_bytes) | 1121 | encode_coding_emacs_mule (coding, source, destination, src_bytes, dst_bytes) |
| 1118 | struct coding_system *coding; | 1122 | struct coding_system *coding; |
| 1119 | unsigned char *source, *destination; | 1123 | const unsigned char *source; |
| 1124 | unsigned char *destination; | ||
| 1120 | int src_bytes, dst_bytes; | 1125 | int src_bytes, dst_bytes; |
| 1121 | { | 1126 | { |
| 1122 | unsigned char *src = source; | 1127 | const unsigned char *src = source; |
| 1123 | unsigned char *src_end = source + src_bytes; | 1128 | const unsigned char *src_end = source + src_bytes; |
| 1124 | unsigned char *dst = destination; | 1129 | unsigned char *dst = destination; |
| 1125 | unsigned char *dst_end = destination + dst_bytes; | 1130 | unsigned char *dst_end = destination + dst_bytes; |
| 1126 | unsigned char *src_base; | 1131 | const unsigned char *src_base; |
| 1127 | int c; | 1132 | int c; |
| 1128 | int char_offset; | 1133 | int char_offset; |
| 1129 | int *data; | 1134 | int *data; |
| @@ -1810,11 +1815,12 @@ coding_allocate_composition_data (coding, char_offset) | |||
| 1810 | static void | 1815 | static void |
| 1811 | decode_coding_iso2022 (coding, source, destination, src_bytes, dst_bytes) | 1816 | decode_coding_iso2022 (coding, source, destination, src_bytes, dst_bytes) |
| 1812 | struct coding_system *coding; | 1817 | struct coding_system *coding; |
| 1813 | unsigned char *source, *destination; | 1818 | const unsigned char *source; |
| 1819 | unsigned char *destination; | ||
| 1814 | int src_bytes, dst_bytes; | 1820 | int src_bytes, dst_bytes; |
| 1815 | { | 1821 | { |
| 1816 | unsigned char *src = source; | 1822 | const unsigned char *src = source; |
| 1817 | unsigned char *src_end = source + src_bytes; | 1823 | const unsigned char *src_end = source + src_bytes; |
| 1818 | unsigned char *dst = destination; | 1824 | unsigned char *dst = destination; |
| 1819 | unsigned char *dst_end = destination + dst_bytes; | 1825 | unsigned char *dst_end = destination + dst_bytes; |
| 1820 | /* Charsets invoked to graphic plane 0 and 1 respectively. */ | 1826 | /* Charsets invoked to graphic plane 0 and 1 respectively. */ |
| @@ -1825,7 +1831,7 @@ decode_coding_iso2022 (coding, source, destination, src_bytes, dst_bytes) | |||
| 1825 | (within macro ONE_MORE_BYTE), or when there's not enough | 1831 | (within macro ONE_MORE_BYTE), or when there's not enough |
| 1826 | destination area to produce a character (within macro | 1832 | destination area to produce a character (within macro |
| 1827 | EMIT_CHAR). */ | 1833 | EMIT_CHAR). */ |
| 1828 | unsigned char *src_base; | 1834 | const unsigned char *src_base; |
| 1829 | int c, charset; | 1835 | int c, charset; |
| 1830 | Lisp_Object translation_table; | 1836 | Lisp_Object translation_table; |
| 1831 | Lisp_Object safe_chars; | 1837 | Lisp_Object safe_chars; |
| @@ -2596,7 +2602,8 @@ static unsigned char * | |||
| 2596 | encode_designation_at_bol (coding, translation_table, src, src_end, dst) | 2602 | encode_designation_at_bol (coding, translation_table, src, src_end, dst) |
| 2597 | struct coding_system *coding; | 2603 | struct coding_system *coding; |
| 2598 | Lisp_Object translation_table; | 2604 | Lisp_Object translation_table; |
| 2599 | unsigned char *src, *src_end, *dst; | 2605 | const unsigned char *src, *src_end; |
| 2606 | unsigned char *dst; | ||
| 2600 | { | 2607 | { |
| 2601 | int charset, c, found = 0, reg; | 2608 | int charset, c, found = 0, reg; |
| 2602 | /* Table of charsets to be designated to each graphic register. */ | 2609 | /* Table of charsets to be designated to each graphic register. */ |
| @@ -2637,11 +2644,12 @@ encode_designation_at_bol (coding, translation_table, src, src_end, dst) | |||
| 2637 | static void | 2644 | static void |
| 2638 | encode_coding_iso2022 (coding, source, destination, src_bytes, dst_bytes) | 2645 | encode_coding_iso2022 (coding, source, destination, src_bytes, dst_bytes) |
| 2639 | struct coding_system *coding; | 2646 | struct coding_system *coding; |
| 2640 | unsigned char *source, *destination; | 2647 | const unsigned char *source; |
| 2648 | unsigned char *destination; | ||
| 2641 | int src_bytes, dst_bytes; | 2649 | int src_bytes, dst_bytes; |
| 2642 | { | 2650 | { |
| 2643 | unsigned char *src = source; | 2651 | const unsigned char *src = source; |
| 2644 | unsigned char *src_end = source + src_bytes; | 2652 | const unsigned char *src_end = source + src_bytes; |
| 2645 | unsigned char *dst = destination; | 2653 | unsigned char *dst = destination; |
| 2646 | unsigned char *dst_end = destination + dst_bytes; | 2654 | unsigned char *dst_end = destination + dst_bytes; |
| 2647 | /* Since the maximum bytes produced by each loop is 20, we subtract 19 | 2655 | /* Since the maximum bytes produced by each loop is 20, we subtract 19 |
| @@ -2653,7 +2661,7 @@ encode_coding_iso2022 (coding, source, destination, src_bytes, dst_bytes) | |||
| 2653 | analyze multi-byte codes (within macro ONE_MORE_CHAR), or when | 2661 | analyze multi-byte codes (within macro ONE_MORE_CHAR), or when |
| 2654 | there's not enough destination area to produce encoded codes | 2662 | there's not enough destination area to produce encoded codes |
| 2655 | (within macro EMIT_BYTES). */ | 2663 | (within macro EMIT_BYTES). */ |
| 2656 | unsigned char *src_base; | 2664 | const unsigned char *src_base; |
| 2657 | int c; | 2665 | int c; |
| 2658 | Lisp_Object translation_table; | 2666 | Lisp_Object translation_table; |
| 2659 | Lisp_Object safe_chars; | 2667 | Lisp_Object safe_chars; |
| @@ -3047,12 +3055,13 @@ static void | |||
| 3047 | decode_coding_sjis_big5 (coding, source, destination, | 3055 | decode_coding_sjis_big5 (coding, source, destination, |
| 3048 | src_bytes, dst_bytes, sjis_p) | 3056 | src_bytes, dst_bytes, sjis_p) |
| 3049 | struct coding_system *coding; | 3057 | struct coding_system *coding; |
| 3050 | unsigned char *source, *destination; | 3058 | const unsigned char *source; |
| 3059 | unsigned char *destination; | ||
| 3051 | int src_bytes, dst_bytes; | 3060 | int src_bytes, dst_bytes; |
| 3052 | int sjis_p; | 3061 | int sjis_p; |
| 3053 | { | 3062 | { |
| 3054 | unsigned char *src = source; | 3063 | const unsigned char *src = source; |
| 3055 | unsigned char *src_end = source + src_bytes; | 3064 | const unsigned char *src_end = source + src_bytes; |
| 3056 | unsigned char *dst = destination; | 3065 | unsigned char *dst = destination; |
| 3057 | unsigned char *dst_end = destination + dst_bytes; | 3066 | unsigned char *dst_end = destination + dst_bytes; |
| 3058 | /* SRC_BASE remembers the start position in source in each loop. | 3067 | /* SRC_BASE remembers the start position in source in each loop. |
| @@ -3060,7 +3069,7 @@ decode_coding_sjis_big5 (coding, source, destination, | |||
| 3060 | (within macro ONE_MORE_BYTE), or when there's not enough | 3069 | (within macro ONE_MORE_BYTE), or when there's not enough |
| 3061 | destination area to produce a character (within macro | 3070 | destination area to produce a character (within macro |
| 3062 | EMIT_CHAR). */ | 3071 | EMIT_CHAR). */ |
| 3063 | unsigned char *src_base; | 3072 | const unsigned char *src_base; |
| 3064 | Lisp_Object translation_table; | 3073 | Lisp_Object translation_table; |
| 3065 | 3074 | ||
| 3066 | if (NILP (Venable_character_translation)) | 3075 | if (NILP (Venable_character_translation)) |
| @@ -3320,12 +3329,13 @@ detect_coding_ccl (src, src_end, multibytep) | |||
| 3320 | static void | 3329 | static void |
| 3321 | decode_eol (coding, source, destination, src_bytes, dst_bytes) | 3330 | decode_eol (coding, source, destination, src_bytes, dst_bytes) |
| 3322 | struct coding_system *coding; | 3331 | struct coding_system *coding; |
| 3323 | unsigned char *source, *destination; | 3332 | const unsigned char *source; |
| 3333 | unsigned char *destination; | ||
| 3324 | int src_bytes, dst_bytes; | 3334 | int src_bytes, dst_bytes; |
| 3325 | { | 3335 | { |
| 3326 | unsigned char *src = source; | 3336 | const unsigned char *src = source; |
| 3327 | unsigned char *dst = destination; | 3337 | unsigned char *dst = destination; |
| 3328 | unsigned char *src_end = src + src_bytes; | 3338 | const unsigned char *src_end = src + src_bytes; |
| 3329 | unsigned char *dst_end = dst + dst_bytes; | 3339 | unsigned char *dst_end = dst + dst_bytes; |
| 3330 | Lisp_Object translation_table; | 3340 | Lisp_Object translation_table; |
| 3331 | /* SRC_BASE remembers the start position in source in each loop. | 3341 | /* SRC_BASE remembers the start position in source in each loop. |
| @@ -3333,7 +3343,7 @@ decode_eol (coding, source, destination, src_bytes, dst_bytes) | |||
| 3333 | (within macro ONE_MORE_BYTE), or when there's not enough | 3343 | (within macro ONE_MORE_BYTE), or when there's not enough |
| 3334 | destination area to produce a character (within macro | 3344 | destination area to produce a character (within macro |
| 3335 | EMIT_CHAR). */ | 3345 | EMIT_CHAR). */ |
| 3336 | unsigned char *src_base; | 3346 | const unsigned char *src_base; |
| 3337 | int c; | 3347 | int c; |
| 3338 | 3348 | ||
| 3339 | translation_table = Qnil; | 3349 | translation_table = Qnil; |
| @@ -4860,7 +4870,7 @@ decode_eol_post_ccl (coding, ptr, bytes) | |||
| 4860 | int | 4870 | int |
| 4861 | decode_coding (coding, source, destination, src_bytes, dst_bytes) | 4871 | decode_coding (coding, source, destination, src_bytes, dst_bytes) |
| 4862 | struct coding_system *coding; | 4872 | struct coding_system *coding; |
| 4863 | const unsigned char *source; | 4873 | const const unsigned char *source; |
| 4864 | unsigned char *destination; | 4874 | unsigned char *destination; |
| 4865 | int src_bytes, dst_bytes; | 4875 | int src_bytes, dst_bytes; |
| 4866 | { | 4876 | { |