diff options
| author | Paul Eggert | 2013-03-23 19:40:51 -0700 |
|---|---|---|
| committer | Paul Eggert | 2013-03-23 19:40:51 -0700 |
| commit | a9ebfa0b3eb23056f523742e53ce79279cae1bd0 (patch) | |
| tree | edb8a5c891743c7fa8ca2839903b3283e6c6bb71 | |
| parent | f8ce376ec852149b64afa282860ec778a4fec328 (diff) | |
| download | emacs-a9ebfa0b3eb23056f523742e53ce79279cae1bd0.tar.gz emacs-a9ebfa0b3eb23056f523742e53ce79279cae1bd0.zip | |
Static checking by GCC 4.8-20130319.
* image.c (gif_load): Assume pass < 3 to pacify GCC.
* process.c (Fset_process_datagram_address)
(Fmake_network_process): Check get_lisp_to_sockaddr_size return value.
* xdisp.c (get_char_face_and_encoding):
(get_glyph_face_and_encoding): Ensure that *CHAR2B is initialized.
(get_glyph_face_and_encoding): Prepare face before possibly using it.
(get_per_char_metric): Don't use CHAR2B if it might not be initialized.
| -rw-r--r-- | src/ChangeLog | 11 | ||||
| -rw-r--r-- | src/image.c | 5 | ||||
| -rw-r--r-- | src/process.c | 5 | ||||
| -rw-r--r-- | src/xdisp.c | 34 |
4 files changed, 34 insertions, 21 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index c4e57537522..16e70324af2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2013-03-24 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Static checking by GCC 4.8-20130319. | ||
| 4 | * image.c (gif_load): Assume pass < 3 to pacify GCC. | ||
| 5 | * process.c (Fset_process_datagram_address) | ||
| 6 | (Fmake_network_process): Check get_lisp_to_sockaddr_size return value. | ||
| 7 | * xdisp.c (get_char_face_and_encoding): | ||
| 8 | (get_glyph_face_and_encoding): Ensure that *CHAR2B is initialized. | ||
| 9 | (get_glyph_face_and_encoding): Prepare face before possibly using it. | ||
| 10 | (get_per_char_metric): Don't use CHAR2B if it might not be initialized. | ||
| 11 | |||
| 1 | 2013-03-24 Ken Brown <kbrown@cornell.edu> | 12 | 2013-03-24 Ken Brown <kbrown@cornell.edu> |
| 2 | 13 | ||
| 3 | * w32fns.c (emacs_abort) [CYGWIN]: Define `_open' as a macro to | 14 | * w32fns.c (emacs_abort) [CYGWIN]: Define `_open' as a macro to |
diff --git a/src/image.c b/src/image.c index 3eec8b6c13d..21f486176df 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -7373,11 +7373,10 @@ gif_load (struct frame *f, struct image *img) | |||
| 7373 | y < subimg_height; | 7373 | y < subimg_height; |
| 7374 | y++, row += interlace_increment[pass]) | 7374 | y++, row += interlace_increment[pass]) |
| 7375 | { | 7375 | { |
| 7376 | if (row >= subimg_height) | 7376 | while (subimg_height <= row) |
| 7377 | { | 7377 | { |
| 7378 | lint_assume (pass < 3); | ||
| 7378 | row = interlace_start[++pass]; | 7379 | row = interlace_start[++pass]; |
| 7379 | while (row >= subimg_height) | ||
| 7380 | row = interlace_start[++pass]; | ||
| 7381 | } | 7380 | } |
| 7382 | 7381 | ||
| 7383 | for (x = 0; x < subimg_width; x++) | 7382 | for (x = 0; x < subimg_width; x++) |
diff --git a/src/process.c b/src/process.c index bafdca9bd63..ed71ff76e6a 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -2155,7 +2155,7 @@ Returns nil upon error setting address, ADDRESS otherwise. */) | |||
| 2155 | channel = XPROCESS (process)->infd; | 2155 | channel = XPROCESS (process)->infd; |
| 2156 | 2156 | ||
| 2157 | len = get_lisp_to_sockaddr_size (address, &family); | 2157 | len = get_lisp_to_sockaddr_size (address, &family); |
| 2158 | if (datagram_address[channel].len != len) | 2158 | if (len == 0 || datagram_address[channel].len != len) |
| 2159 | return Qnil; | 2159 | return Qnil; |
| 2160 | conv_lisp_to_sockaddr (family, address, datagram_address[channel].sa, len); | 2160 | conv_lisp_to_sockaddr (family, address, datagram_address[channel].sa, len); |
| 2161 | return address; | 2161 | return address; |
| @@ -3269,7 +3269,8 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3269 | { | 3269 | { |
| 3270 | int rfamily, rlen; | 3270 | int rfamily, rlen; |
| 3271 | rlen = get_lisp_to_sockaddr_size (remote, &rfamily); | 3271 | rlen = get_lisp_to_sockaddr_size (remote, &rfamily); |
| 3272 | if (rfamily == lres->ai_family && rlen == lres->ai_addrlen) | 3272 | if (rlen != 0 && rfamily == lres->ai_family |
| 3273 | && rlen == lres->ai_addrlen) | ||
| 3273 | conv_lisp_to_sockaddr (rfamily, remote, | 3274 | conv_lisp_to_sockaddr (rfamily, remote, |
| 3274 | datagram_address[s].sa, rlen); | 3275 | datagram_address[s].sa, rlen); |
| 3275 | } | 3276 | } |
diff --git a/src/xdisp.c b/src/xdisp.c index 02a8e56b3bd..25b143d362a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -22391,16 +22391,16 @@ get_char_face_and_encoding (struct frame *f, int c, int face_id, | |||
| 22391 | XChar2b *char2b, int display_p) | 22391 | XChar2b *char2b, int display_p) |
| 22392 | { | 22392 | { |
| 22393 | struct face *face = FACE_FROM_ID (f, face_id); | 22393 | struct face *face = FACE_FROM_ID (f, face_id); |
| 22394 | unsigned code = 0; | ||
| 22394 | 22395 | ||
| 22395 | if (face->font) | 22396 | if (face->font) |
| 22396 | { | 22397 | { |
| 22397 | unsigned code = face->font->driver->encode_char (face->font, c); | 22398 | code = face->font->driver->encode_char (face->font, c); |
| 22398 | 22399 | ||
| 22399 | if (code != FONT_INVALID_CODE) | 22400 | if (code == FONT_INVALID_CODE) |
| 22400 | STORE_XCHAR2B (char2b, (code >> 8), (code & 0xFF)); | 22401 | code = 0; |
| 22401 | else | ||
| 22402 | STORE_XCHAR2B (char2b, 0, 0); | ||
| 22403 | } | 22402 | } |
| 22403 | STORE_XCHAR2B (char2b, (code >> 8), (code & 0xFF)); | ||
| 22404 | 22404 | ||
| 22405 | /* Make sure X resources of the face are allocated. */ | 22405 | /* Make sure X resources of the face are allocated. */ |
| 22406 | #ifdef HAVE_X_WINDOWS | 22406 | #ifdef HAVE_X_WINDOWS |
| @@ -22424,31 +22424,30 @@ get_glyph_face_and_encoding (struct frame *f, struct glyph *glyph, | |||
| 22424 | XChar2b *char2b, int *two_byte_p) | 22424 | XChar2b *char2b, int *two_byte_p) |
| 22425 | { | 22425 | { |
| 22426 | struct face *face; | 22426 | struct face *face; |
| 22427 | unsigned code = 0; | ||
| 22427 | 22428 | ||
| 22428 | eassert (glyph->type == CHAR_GLYPH); | 22429 | eassert (glyph->type == CHAR_GLYPH); |
| 22429 | face = FACE_FROM_ID (f, glyph->face_id); | 22430 | face = FACE_FROM_ID (f, glyph->face_id); |
| 22430 | 22431 | ||
| 22432 | /* Make sure X resources of the face are allocated. */ | ||
| 22433 | eassert (face != NULL); | ||
| 22434 | PREPARE_FACE_FOR_DISPLAY (f, face); | ||
| 22435 | |||
| 22431 | if (two_byte_p) | 22436 | if (two_byte_p) |
| 22432 | *two_byte_p = 0; | 22437 | *two_byte_p = 0; |
| 22433 | 22438 | ||
| 22434 | if (face->font) | 22439 | if (face->font) |
| 22435 | { | 22440 | { |
| 22436 | unsigned code; | ||
| 22437 | |||
| 22438 | if (CHAR_BYTE8_P (glyph->u.ch)) | 22441 | if (CHAR_BYTE8_P (glyph->u.ch)) |
| 22439 | code = CHAR_TO_BYTE8 (glyph->u.ch); | 22442 | code = CHAR_TO_BYTE8 (glyph->u.ch); |
| 22440 | else | 22443 | else |
| 22441 | code = face->font->driver->encode_char (face->font, glyph->u.ch); | 22444 | code = face->font->driver->encode_char (face->font, glyph->u.ch); |
| 22442 | 22445 | ||
| 22443 | if (code != FONT_INVALID_CODE) | 22446 | if (code == FONT_INVALID_CODE) |
| 22444 | STORE_XCHAR2B (char2b, (code >> 8), (code & 0xFF)); | 22447 | code = 0; |
| 22445 | else | ||
| 22446 | STORE_XCHAR2B (char2b, 0, 0); | ||
| 22447 | } | 22448 | } |
| 22448 | 22449 | ||
| 22449 | /* Make sure X resources of the face are allocated. */ | 22450 | STORE_XCHAR2B (char2b, (code >> 8), (code & 0xFF)); |
| 22450 | eassert (face != NULL); | ||
| 22451 | PREPARE_FACE_FOR_DISPLAY (f, face); | ||
| 22452 | return face; | 22451 | return face; |
| 22453 | } | 22452 | } |
| 22454 | 22453 | ||
| @@ -22758,9 +22757,12 @@ static struct font_metrics * | |||
| 22758 | get_per_char_metric (struct font *font, XChar2b *char2b) | 22757 | get_per_char_metric (struct font *font, XChar2b *char2b) |
| 22759 | { | 22758 | { |
| 22760 | static struct font_metrics metrics; | 22759 | static struct font_metrics metrics; |
| 22761 | unsigned code = (XCHAR2B_BYTE1 (char2b) << 8) | XCHAR2B_BYTE2 (char2b); | 22760 | unsigned code; |
| 22762 | 22761 | ||
| 22763 | if (! font || code == FONT_INVALID_CODE) | 22762 | if (! font) |
| 22763 | return NULL; | ||
| 22764 | code = (XCHAR2B_BYTE1 (char2b) << 8) | XCHAR2B_BYTE2 (char2b); | ||
| 22765 | if (code == FONT_INVALID_CODE) | ||
| 22764 | return NULL; | 22766 | return NULL; |
| 22765 | font->driver->text_extents (font, &code, 1, &metrics); | 22767 | font->driver->text_extents (font, &code, 1, &metrics); |
| 22766 | return &metrics; | 22768 | return &metrics; |