diff options
| author | Paul Eggert | 2014-01-25 17:20:24 -0800 |
|---|---|---|
| committer | Paul Eggert | 2014-01-25 17:20:24 -0800 |
| commit | e6f29a682914083dd1a7ed5a4391ae72b7f3e764 (patch) | |
| tree | 197cbbe9e361c1ab9f6819603bd6f36de34ce517 /src/coding.c | |
| parent | 0113a5e128256b6cc40a4be2536ebadd160d5d77 (diff) | |
| download | emacs-e6f29a682914083dd1a7ed5a4391ae72b7f3e764.tar.gz emacs-e6f29a682914083dd1a7ed5a4391ae72b7f3e764.zip | |
When decoding, prefer ptrdiff_t to int for buffer positions etc.
* coding.c (detect_coding_utf_8, emacs_mule_char)
(detect_coding_iso_2022, encode_coding_iso_2022, check_ascii)
(check_utf_8, decode_coding):
* coding.h (struct coding_system.errors):
Use ptrdiff_t, not int, for integer values derived from buffer and
string positions.
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/coding.c b/src/coding.c index e4b9238599e..01964eba4d3 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -1202,7 +1202,7 @@ detect_coding_utf_8 (struct coding_system *coding, | |||
| 1202 | bool multibytep = coding->src_multibyte; | 1202 | bool multibytep = coding->src_multibyte; |
| 1203 | ptrdiff_t consumed_chars = 0; | 1203 | ptrdiff_t consumed_chars = 0; |
| 1204 | bool bom_found = 0; | 1204 | bool bom_found = 0; |
| 1205 | int nchars = coding->head_ascii; | 1205 | ptrdiff_t nchars = coding->head_ascii; |
| 1206 | int eol_seen = coding->eol_seen; | 1206 | int eol_seen = coding->eol_seen; |
| 1207 | 1207 | ||
| 1208 | detect_info->checked |= CATEGORY_MASK_UTF_8; | 1208 | detect_info->checked |= CATEGORY_MASK_UTF_8; |
| @@ -2013,7 +2013,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, | |||
| 2013 | int charset_ID; | 2013 | int charset_ID; |
| 2014 | unsigned code; | 2014 | unsigned code; |
| 2015 | int c; | 2015 | int c; |
| 2016 | int consumed_chars = 0; | 2016 | ptrdiff_t consumed_chars = 0; |
| 2017 | bool mseq_found = 0; | 2017 | bool mseq_found = 0; |
| 2018 | 2018 | ||
| 2019 | ONE_MORE_BYTE (c); | 2019 | ONE_MORE_BYTE (c); |
| @@ -3190,7 +3190,7 @@ detect_coding_iso_2022 (struct coding_system *coding, | |||
| 3190 | if (! single_shifting | 3190 | if (! single_shifting |
| 3191 | && ! (rejected & CATEGORY_MASK_ISO_8_2)) | 3191 | && ! (rejected & CATEGORY_MASK_ISO_8_2)) |
| 3192 | { | 3192 | { |
| 3193 | int len = 1; | 3193 | ptrdiff_t len = 1; |
| 3194 | while (src < src_end) | 3194 | while (src < src_end) |
| 3195 | { | 3195 | { |
| 3196 | src_base = src; | 3196 | src_base = src; |
| @@ -4456,7 +4456,7 @@ encode_coding_iso_2022 (struct coding_system *coding) | |||
| 4456 | { | 4456 | { |
| 4457 | /* We have to produce designation sequences if any now. */ | 4457 | /* We have to produce designation sequences if any now. */ |
| 4458 | unsigned char desig_buf[16]; | 4458 | unsigned char desig_buf[16]; |
| 4459 | int nbytes; | 4459 | ptrdiff_t nbytes; |
| 4460 | ptrdiff_t offset; | 4460 | ptrdiff_t offset; |
| 4461 | 4461 | ||
| 4462 | charset_map_loaded = 0; | 4462 | charset_map_loaded = 0; |
| @@ -6211,7 +6211,7 @@ static Lisp_Object adjust_coding_eol_type (struct coding_system *coding, | |||
| 6211 | EOL_SEEN_LF, EOL_SEEN_CR, and EOL_SEEN_CRLF, but the value is | 6211 | EOL_SEEN_LF, EOL_SEEN_CR, and EOL_SEEN_CRLF, but the value is |
| 6212 | reliable only when all the source bytes are ASCII. */ | 6212 | reliable only when all the source bytes are ASCII. */ |
| 6213 | 6213 | ||
| 6214 | static int | 6214 | static ptrdiff_t |
| 6215 | check_ascii (struct coding_system *coding) | 6215 | check_ascii (struct coding_system *coding) |
| 6216 | { | 6216 | { |
| 6217 | const unsigned char *src, *end; | 6217 | const unsigned char *src, *end; |
| @@ -6283,12 +6283,12 @@ check_ascii (struct coding_system *coding) | |||
| 6283 | the value is reliable only when all the source bytes are valid | 6283 | the value is reliable only when all the source bytes are valid |
| 6284 | UTF-8. */ | 6284 | UTF-8. */ |
| 6285 | 6285 | ||
| 6286 | static int | 6286 | static ptrdiff_t |
| 6287 | check_utf_8 (struct coding_system *coding) | 6287 | check_utf_8 (struct coding_system *coding) |
| 6288 | { | 6288 | { |
| 6289 | const unsigned char *src, *end; | 6289 | const unsigned char *src, *end; |
| 6290 | int eol_seen; | 6290 | int eol_seen; |
| 6291 | int nchars = coding->head_ascii; | 6291 | ptrdiff_t nchars = coding->head_ascii; |
| 6292 | 6292 | ||
| 6293 | if (coding->head_ascii < 0) | 6293 | if (coding->head_ascii < 0) |
| 6294 | check_ascii (coding); | 6294 | check_ascii (coding); |
| @@ -7414,7 +7414,7 @@ decode_coding (struct coding_system *coding) | |||
| 7414 | coding->carryover_bytes = 0; | 7414 | coding->carryover_bytes = 0; |
| 7415 | if (coding->consumed < coding->src_bytes) | 7415 | if (coding->consumed < coding->src_bytes) |
| 7416 | { | 7416 | { |
| 7417 | int nbytes = coding->src_bytes - coding->consumed; | 7417 | ptrdiff_t nbytes = coding->src_bytes - coding->consumed; |
| 7418 | const unsigned char *src; | 7418 | const unsigned char *src; |
| 7419 | 7419 | ||
| 7420 | coding_set_source (coding); | 7420 | coding_set_source (coding); |