Mercurial > emacs
comparison src/coding.c @ 111997:a5a188ddc758
Minor clean up to silence some gcc warnings.
* src/window.c (Fset_window_buffer):
* src/xterm.c (x_set_frame_alpha): Restructure code to silence
compiler warning.
(handle_one_xevent): Remove unused var `p'.
(do_ewmh_fullscreen): Remove unused var `lval'.
(xembed_set_info): Remove unused var `atom'.
* src/textprop.c (Fremove_list_of_text_properties): Add braces to silence
compiler warning.
* src/fontset.c (fontset_id_valid_p, dump_fontset):
* src/ftfont.c (ftfont_drive_otf): Modernize k&r declaration.
* src/eval.c (Feval, Ffuncall): Avoid unneeded gotos.
* src/dispnew.c (update_frame, update_frame_1): Compile the `do_pause'
label only when it's used.
* src/image.c (x_create_bitmap_from_xpm_data):
* src/dispextern.h (x_create_bitmap_from_xpm_data): Use const char** like
its callers.
* src/coding.c (detect_coding_utf_16): Remove unused vars `src_base' and
`consumed_chars'.
(DECODE_EMACS_MULE_21_COMPOSITION): Remove unused var `charbuf_base'.
(decode_coding_emacs_mule): Remove unused label `retry'.
(detect_eol): Add parens to silence compiler warning.
* src/alloc.c (bytes_used_when_reconsidered): Move to the #ifdef where
it's used to silence the compiler.
(make_number): Modernize k&r declaration.
(mark_char_table): Add parens to silence compiler warning.
| author | Stefan Monnier <monnier@iro.umontreal.ca> |
|---|---|
| date | Sun, 19 Dec 2010 00:43:42 -0500 |
| parents | 141d3f14d8c3 |
| children | 417b1e4d63cd |
comparison
equal
deleted
inserted
replaced
| 111996:90a2d870e83e | 111997:a5a188ddc758 |
|---|---|
| 1605 | 1605 |
| 1606 static int | 1606 static int |
| 1607 detect_coding_utf_16 (struct coding_system *coding, | 1607 detect_coding_utf_16 (struct coding_system *coding, |
| 1608 struct coding_detection_info *detect_info) | 1608 struct coding_detection_info *detect_info) |
| 1609 { | 1609 { |
| 1610 const unsigned char *src = coding->source, *src_base = src; | 1610 const unsigned char *src = coding->source; |
| 1611 const unsigned char *src_end = coding->source + coding->src_bytes; | 1611 const unsigned char *src_end = coding->source + coding->src_bytes; |
| 1612 int multibytep = coding->src_multibyte; | 1612 int multibytep = coding->src_multibyte; |
| 1613 int consumed_chars = 0; | |
| 1614 int c1, c2; | 1613 int c1, c2; |
| 1615 | 1614 |
| 1616 detect_info->checked |= CATEGORY_MASK_UTF_16; | 1615 detect_info->checked |= CATEGORY_MASK_UTF_16; |
| 1617 if (coding->mode & CODING_MODE_LAST_BLOCK | 1616 if (coding->mode & CODING_MODE_LAST_BLOCK |
| 1618 && (coding->src_chars & 1)) | 1617 && (coding->src_chars & 1)) |
| 2275 characters composed by this composition. */ | 2274 characters composed by this composition. */ |
| 2276 | 2275 |
| 2277 #define DECODE_EMACS_MULE_21_COMPOSITION() \ | 2276 #define DECODE_EMACS_MULE_21_COMPOSITION() \ |
| 2278 do { \ | 2277 do { \ |
| 2279 enum composition_method method = c - 0xF2; \ | 2278 enum composition_method method = c - 0xF2; \ |
| 2280 int *charbuf_base = charbuf; \ | |
| 2281 int nbytes, nchars; \ | 2279 int nbytes, nchars; \ |
| 2282 \ | 2280 \ |
| 2283 ONE_MORE_BYTE (c); \ | 2281 ONE_MORE_BYTE (c); \ |
| 2284 if (c < 0) \ | 2282 if (c < 0) \ |
| 2285 goto invalid_code; \ | 2283 goto invalid_code; \ |
| 2631 else | 2629 else |
| 2632 EMACS_MULE_MAYBE_FINISH_COMPOSITION (); | 2630 EMACS_MULE_MAYBE_FINISH_COMPOSITION (); |
| 2633 } | 2631 } |
| 2634 continue; | 2632 continue; |
| 2635 | 2633 |
| 2636 retry: | |
| 2637 src = src_base; | 2634 src = src_base; |
| 2638 consumed_chars = consumed_chars_base; | 2635 consumed_chars = consumed_chars_base; |
| 2639 continue; | 2636 continue; |
| 2640 | 2637 |
| 2641 invalid_code: | 2638 invalid_code: |
| 6258 eol_seen = this_eol; | 6255 eol_seen = this_eol; |
| 6259 else if (eol_seen != this_eol) | 6256 else if (eol_seen != this_eol) |
| 6260 { | 6257 { |
| 6261 /* The found type is different from what found before. | 6258 /* The found type is different from what found before. |
| 6262 Allow for stray ^M characters in DOS EOL files. */ | 6259 Allow for stray ^M characters in DOS EOL files. */ |
| 6263 if (eol_seen == EOL_SEEN_CR && this_eol == EOL_SEEN_CRLF | 6260 if ((eol_seen == EOL_SEEN_CR && this_eol == EOL_SEEN_CRLF) |
| 6264 || eol_seen == EOL_SEEN_CRLF && this_eol == EOL_SEEN_CR) | 6261 || (eol_seen == EOL_SEEN_CRLF |
| 6262 && this_eol == EOL_SEEN_CR)) | |
| 6265 eol_seen = EOL_SEEN_CRLF; | 6263 eol_seen = EOL_SEEN_CRLF; |
| 6266 else | 6264 else |
| 6267 { | 6265 { |
| 6268 eol_seen = EOL_SEEN_LF; | 6266 eol_seen = EOL_SEEN_LF; |
| 6269 break; | 6267 break; |
| 6274 } | 6272 } |
| 6275 src += 2; | 6273 src += 2; |
| 6276 } | 6274 } |
| 6277 } | 6275 } |
| 6278 else | 6276 else |
| 6279 { | 6277 while (src < src_end) |
| 6280 while (src < src_end) | 6278 { |
| 6281 { | 6279 c = *src++; |
| 6282 c = *src++; | 6280 if (c == '\n' || c == '\r') |
| 6283 if (c == '\n' || c == '\r') | 6281 { |
| 6284 { | 6282 int this_eol; |
| 6285 int this_eol; | 6283 |
| 6286 | 6284 if (c == '\n') |
| 6287 if (c == '\n') | 6285 this_eol = EOL_SEEN_LF; |
| 6288 this_eol = EOL_SEEN_LF; | 6286 else if (src >= src_end || *src != '\n') |
| 6289 else if (src >= src_end || *src != '\n') | 6287 this_eol = EOL_SEEN_CR; |
| 6290 this_eol = EOL_SEEN_CR; | 6288 else |
| 6291 else | 6289 this_eol = EOL_SEEN_CRLF, src++; |
| 6292 this_eol = EOL_SEEN_CRLF, src++; | 6290 |
| 6293 | 6291 if (eol_seen == EOL_SEEN_NONE) |
| 6294 if (eol_seen == EOL_SEEN_NONE) | 6292 /* This is the first end-of-line. */ |
| 6295 /* This is the first end-of-line. */ | 6293 eol_seen = this_eol; |
| 6296 eol_seen = this_eol; | 6294 else if (eol_seen != this_eol) |
| 6297 else if (eol_seen != this_eol) | 6295 { |
| 6298 { | 6296 /* The found type is different from what found before. |
| 6299 /* The found type is different from what found before. | 6297 Allow for stray ^M characters in DOS EOL files. */ |
| 6300 Allow for stray ^M characters in DOS EOL files. */ | 6298 if ((eol_seen == EOL_SEEN_CR && this_eol == EOL_SEEN_CRLF) |
| 6301 if (eol_seen == EOL_SEEN_CR && this_eol == EOL_SEEN_CRLF | 6299 || (eol_seen == EOL_SEEN_CRLF && this_eol == EOL_SEEN_CR)) |
| 6302 || eol_seen == EOL_SEEN_CRLF && this_eol == EOL_SEEN_CR) | 6300 eol_seen = EOL_SEEN_CRLF; |
| 6303 eol_seen = EOL_SEEN_CRLF; | 6301 else |
| 6304 else | 6302 { |
| 6305 { | 6303 eol_seen = EOL_SEEN_LF; |
| 6306 eol_seen = EOL_SEEN_LF; | 6304 break; |
| 6307 break; | 6305 } |
| 6308 } | 6306 } |
| 6309 } | 6307 if (++total == MAX_EOL_CHECK_COUNT) |
| 6310 if (++total == MAX_EOL_CHECK_COUNT) | 6308 break; |
| 6311 break; | 6309 } |
| 6312 } | 6310 } |
| 6313 } | |
| 6314 } | |
| 6315 return eol_seen; | 6311 return eol_seen; |
| 6316 } | 6312 } |
| 6317 | 6313 |
| 6318 | 6314 |
| 6319 static Lisp_Object | 6315 static Lisp_Object |
