diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 83 | ||||
| -rw-r--r-- | src/Makefile.in | 2 | ||||
| -rw-r--r-- | src/callint.c | 35 | ||||
| -rw-r--r-- | src/casetab.c | 10 | ||||
| -rw-r--r-- | src/category.c | 4 | ||||
| -rw-r--r-- | src/charset.c | 33 | ||||
| -rw-r--r-- | src/chartab.c | 15 | ||||
| -rw-r--r-- | src/coding.c | 50 | ||||
| -rw-r--r-- | src/deps.mk | 1 | ||||
| -rw-r--r-- | src/doc.c | 4 | ||||
| -rw-r--r-- | src/editfns.c | 2 | ||||
| -rw-r--r-- | src/eval.c | 49 | ||||
| -rw-r--r-- | src/fns.c | 2 | ||||
| -rw-r--r-- | src/ftfont.c | 29 | ||||
| -rw-r--r-- | src/intervals.c | 2 | ||||
| -rw-r--r-- | src/keyboard.c | 4 | ||||
| -rw-r--r-- | src/lisp.h | 12 | ||||
| -rw-r--r-- | src/m/amdx86-64.h | 1 | ||||
| -rw-r--r-- | src/m/ia64.h | 1 | ||||
| -rw-r--r-- | src/m/ibms390x.h | 2 | ||||
| -rw-r--r-- | src/nsfns.m | 15 | ||||
| -rw-r--r-- | src/syntax.c | 10 | ||||
| -rw-r--r-- | src/sysdep.c | 3 | ||||
| -rw-r--r-- | src/term.c | 2 | ||||
| -rw-r--r-- | src/window.c | 4 | ||||
| -rw-r--r-- | src/xdisp.c | 19 | ||||
| -rw-r--r-- | src/xfns.c | 2 | ||||
| -rw-r--r-- | src/xmenu.c | 21 | ||||
| -rw-r--r-- | src/xterm.c | 2 |
29 files changed, 278 insertions, 141 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 3eaf1e326b5..6d300875518 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,86 @@ | |||
| 1 | 2011-04-10 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Fix more problems found by GCC 4.6.0's static checks. | ||
| 4 | |||
| 5 | * xdisp.c (vmessage): Use a better test for character truncation. | ||
| 6 | |||
| 7 | * charset.c (load_charset_map): <, not <=, for optimization, | ||
| 8 | and to avoid potential problems with integer overflow. | ||
| 9 | * chartab.c (sub_char_table_set_range, char_table_set_range): Likewise. | ||
| 10 | * casetab.c (set_identity, shuffle): Likewise. | ||
| 11 | * editfns.c (Fformat): Likewise. | ||
| 12 | * syntax.c (skip_chars): Likewise. | ||
| 13 | |||
| 14 | * xmenu.c (set_frame_menubar): Allocate smaller local vectors. | ||
| 15 | This also lets GCC 4.6.0 generate slightly better loop code. | ||
| 16 | |||
| 17 | * callint.c (Fcall_interactively): <, not <=, for optimization. | ||
| 18 | (Fcall_interactively): Count the number of arguments produced, | ||
| 19 | not the number of arguments given. This is simpler and lets GCC | ||
| 20 | 4.6.0 generate slightly better code. | ||
| 21 | |||
| 22 | * ftfont.c: Distingish more carefully between FcChar8 and char. | ||
| 23 | The previous code passed unsigned char * to a functions like | ||
| 24 | strlen and xstrcasecmp that expect char *, which does not | ||
| 25 | conform to the C standard. | ||
| 26 | (get_adstyle_property, ftfont_pattern_entity): Use FcChar8 for | ||
| 27 | arguments to FcPatternGetString, and explicitly cast FcChar8 * to | ||
| 28 | char * when the C standard requires it. | ||
| 29 | |||
| 30 | * keyboard.c (read_char): Remove unused var. | ||
| 31 | |||
| 32 | * eval.c: Port to Windows vsnprintf (Bug#8435). | ||
| 33 | Include <limits.h>. | ||
| 34 | (SIZE_MAX): Define if the headers do not. | ||
| 35 | (verror): Do not give up if vsnprintf returns a negative count. | ||
| 36 | Instead, grow the buffer. This ports to Windows vsnprintf, which | ||
| 37 | does not conform to C99. Problem reported by Eli Zaretskii. | ||
| 38 | Also, simplify the allocation scheme, by avoiding the need for | ||
| 39 | calling realloc, and removing the ALLOCATED variable. | ||
| 40 | |||
| 41 | * eval.c (verror): Initial buffer size is 4000 (not 200) bytes. | ||
| 42 | |||
| 43 | Remove invocations of doprnt, as Emacs now uses vsnprintf. | ||
| 44 | But keep the doprint source code for now, as we might revamp it | ||
| 45 | and use it again (Bug#8435). | ||
| 46 | * lisp.h (doprnt): Remove. | ||
| 47 | * Makefile.in (base_obj): Remove doprnt.o. | ||
| 48 | * deps.mk (doprnt.o): Remove. | ||
| 49 | |||
| 50 | error: Print 32- and 64-bit integers portably (Bug#8435). | ||
| 51 | Without this change, on typical 64-bit hosts error ("...%d...", N) | ||
| 52 | was used to print both 32- and 64-bit integers N, which relied on | ||
| 53 | undefined behavior. | ||
| 54 | * lisp.h, src/m/amdx86-64.h, src/m/ia64.h, src/m/ibms390x.h (pEd): | ||
| 55 | New macro. | ||
| 56 | * lisp.h (error, verror): Mark as printf-like functions. | ||
| 57 | * eval.c (verror): Use vsnprintf, not doprnt, to do the real work. | ||
| 58 | Report overflow in size calculations when allocating printf buffer. | ||
| 59 | Do not truncate output string at its first null byte. | ||
| 60 | * xdisp.c (vmessage): Use vsnprintf, not doprnt, to do the real work. | ||
| 61 | Truncate the output at a character boundary, since vsnprintf does not | ||
| 62 | do that. | ||
| 63 | * charset.c (check_iso_charset_parameter): Convert internal | ||
| 64 | character to string before calling 'error', since %c now has the | ||
| 65 | printf meaning. | ||
| 66 | * coding.c (Fdecode_sjis_char, Fdecode_big5_char): Avoid int | ||
| 67 | overflow when computing char to be passed to 'error'. Do not | ||
| 68 | pass Lisp_Object to 'error'; pass the integer instead. | ||
| 69 | * nsfns.m (Fns_do_applescript): Use int, not long, since it's | ||
| 70 | formatted with plain %d. | ||
| 71 | |||
| 72 | * eval.c (internal_lisp_condition_case): Don't pass spurious arg. | ||
| 73 | |||
| 74 | * keyboard.c (access_keymap_keyremap): Print func name, not garbage. | ||
| 75 | |||
| 76 | * coding.c (Fdecode_sjis_char): Don't assume CODE fits in int. | ||
| 77 | |||
| 78 | * xterm.c (x_catch_errors): Remove duplicate declaration. | ||
| 79 | |||
| 80 | * term.c (maybe_fatal): Mark its 3rd arg as a printf format, too. | ||
| 81 | |||
| 82 | * xdisp.c, lisp.h (message_nolog): Remove; unused. | ||
| 83 | |||
| 1 | 2011-04-10 Jim Meyering <meyering@redhat.com> | 84 | 2011-04-10 Jim Meyering <meyering@redhat.com> |
| 2 | 85 | ||
| 3 | use ssize_t and size_t for read- and write-like emacs_gnutls_* functions | 86 | use ssize_t and size_t for read- and write-like emacs_gnutls_* functions |
diff --git a/src/Makefile.in b/src/Makefile.in index e1195968f7f..154d6abba4e 100644 --- a/src/Makefile.in +++ b/src/Makefile.in | |||
| @@ -354,7 +354,7 @@ base_obj = dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \ | |||
| 354 | syntax.o $(UNEXEC_OBJ) bytecode.o \ | 354 | syntax.o $(UNEXEC_OBJ) bytecode.o \ |
| 355 | process.o gnutls.o callproc.o \ | 355 | process.o gnutls.o callproc.o \ |
| 356 | region-cache.o sound.o atimer.o \ | 356 | region-cache.o sound.o atimer.o \ |
| 357 | doprnt.o intervals.o textprop.o composite.o xml.o \ | 357 | intervals.o textprop.o composite.o xml.o \ |
| 358 | $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) | 358 | $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) |
| 359 | obj = $(base_obj) $(NS_OBJC_OBJ) | 359 | obj = $(base_obj) $(NS_OBJC_OBJ) |
| 360 | 360 | ||
diff --git a/src/callint.c b/src/callint.c index 60570369d9e..047fbcdb467 100644 --- a/src/callint.c +++ b/src/callint.c | |||
| @@ -269,8 +269,8 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 269 | recorded as a call to the function named callint_argfuns[varies[i]]. */ | 269 | recorded as a call to the function named callint_argfuns[varies[i]]. */ |
| 270 | int *varies; | 270 | int *varies; |
| 271 | 271 | ||
| 272 | register size_t i, j; | 272 | register size_t i; |
| 273 | size_t count; | 273 | size_t nargs; |
| 274 | int foo; | 274 | int foo; |
| 275 | char prompt1[100]; | 275 | char prompt1[100]; |
| 276 | char *tem1; | 276 | char *tem1; |
| @@ -445,30 +445,29 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 445 | else break; | 445 | else break; |
| 446 | } | 446 | } |
| 447 | 447 | ||
| 448 | /* Count the number of arguments the interactive spec would have | 448 | /* Count the number of arguments, which is one plus the number of arguments |
| 449 | us give to the function. */ | 449 | the interactive spec would have us give to the function. */ |
| 450 | tem = string; | 450 | tem = string; |
| 451 | for (j = 0; *tem;) | 451 | for (nargs = 1; *tem; ) |
| 452 | { | 452 | { |
| 453 | /* 'r' specifications ("point and mark as 2 numeric args") | 453 | /* 'r' specifications ("point and mark as 2 numeric args") |
| 454 | produce *two* arguments. */ | 454 | produce *two* arguments. */ |
| 455 | if (*tem == 'r') | 455 | if (*tem == 'r') |
| 456 | j += 2; | 456 | nargs += 2; |
| 457 | else | 457 | else |
| 458 | j++; | 458 | nargs++; |
| 459 | tem = strchr (tem, '\n'); | 459 | tem = strchr (tem, '\n'); |
| 460 | if (tem) | 460 | if (tem) |
| 461 | ++tem; | 461 | ++tem; |
| 462 | else | 462 | else |
| 463 | break; | 463 | break; |
| 464 | } | 464 | } |
| 465 | count = j; | ||
| 466 | 465 | ||
| 467 | args = (Lisp_Object *) alloca ((count + 1) * sizeof (Lisp_Object)); | 466 | args = (Lisp_Object *) alloca (nargs * sizeof (Lisp_Object)); |
| 468 | visargs = (Lisp_Object *) alloca ((count + 1) * sizeof (Lisp_Object)); | 467 | visargs = (Lisp_Object *) alloca (nargs * sizeof (Lisp_Object)); |
| 469 | varies = (int *) alloca ((count + 1) * sizeof (int)); | 468 | varies = (int *) alloca (nargs * sizeof (int)); |
| 470 | 469 | ||
| 471 | for (i = 0; i < (count + 1); i++) | 470 | for (i = 0; i < nargs; i++) |
| 472 | { | 471 | { |
| 473 | args[i] = Qnil; | 472 | args[i] = Qnil; |
| 474 | visargs[i] = Qnil; | 473 | visargs[i] = Qnil; |
| @@ -476,8 +475,8 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 476 | } | 475 | } |
| 477 | 476 | ||
| 478 | GCPRO5 (prefix_arg, function, *args, *visargs, up_event); | 477 | GCPRO5 (prefix_arg, function, *args, *visargs, up_event); |
| 479 | gcpro3.nvars = (count + 1); | 478 | gcpro3.nvars = nargs; |
| 480 | gcpro4.nvars = (count + 1); | 479 | gcpro4.nvars = nargs; |
| 481 | 480 | ||
| 482 | if (!NILP (enable)) | 481 | if (!NILP (enable)) |
| 483 | specbind (Qenable_recursive_minibuffers, Qt); | 482 | specbind (Qenable_recursive_minibuffers, Qt); |
| @@ -809,14 +808,14 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 809 | if (arg_from_tty || !NILP (record_flag)) | 808 | if (arg_from_tty || !NILP (record_flag)) |
| 810 | { | 809 | { |
| 811 | visargs[0] = function; | 810 | visargs[0] = function; |
| 812 | for (i = 1; i < count + 1; i++) | 811 | for (i = 1; i < nargs; i++) |
| 813 | { | 812 | { |
| 814 | if (varies[i] > 0) | 813 | if (varies[i] > 0) |
| 815 | visargs[i] = Fcons (intern (callint_argfuns[varies[i]]), Qnil); | 814 | visargs[i] = Fcons (intern (callint_argfuns[varies[i]]), Qnil); |
| 816 | else | 815 | else |
| 817 | visargs[i] = quotify_arg (args[i]); | 816 | visargs[i] = quotify_arg (args[i]); |
| 818 | } | 817 | } |
| 819 | Vcommand_history = Fcons (Flist (count + 1, visargs), | 818 | Vcommand_history = Fcons (Flist (nargs, visargs), |
| 820 | Vcommand_history); | 819 | Vcommand_history); |
| 821 | /* Don't keep command history around forever. */ | 820 | /* Don't keep command history around forever. */ |
| 822 | if (INTEGERP (Vhistory_length) && XINT (Vhistory_length) > 0) | 821 | if (INTEGERP (Vhistory_length) && XINT (Vhistory_length) > 0) |
| @@ -829,7 +828,7 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 829 | 828 | ||
| 830 | /* If we used a marker to hold point, mark, or an end of the region, | 829 | /* If we used a marker to hold point, mark, or an end of the region, |
| 831 | temporarily, convert it to an integer now. */ | 830 | temporarily, convert it to an integer now. */ |
| 832 | for (i = 1; i <= count; i++) | 831 | for (i = 1; i < nargs; i++) |
| 833 | if (varies[i] >= 1 && varies[i] <= 4) | 832 | if (varies[i] >= 1 && varies[i] <= 4) |
| 834 | XSETINT (args[i], marker_position (args[i])); | 833 | XSETINT (args[i], marker_position (args[i])); |
| 835 | 834 | ||
| @@ -846,7 +845,7 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 846 | specbind (Qcommand_debug_status, Qnil); | 845 | specbind (Qcommand_debug_status, Qnil); |
| 847 | 846 | ||
| 848 | temporarily_switch_to_single_kboard (NULL); | 847 | temporarily_switch_to_single_kboard (NULL); |
| 849 | val = Ffuncall (count + 1, args); | 848 | val = Ffuncall (nargs, args); |
| 850 | UNGCPRO; | 849 | UNGCPRO; |
| 851 | return unbind_to (speccount, val); | 850 | return unbind_to (speccount, val); |
| 852 | } | 851 | } |
diff --git a/src/casetab.c b/src/casetab.c index 56f6b065358..9a1accf6940 100644 --- a/src/casetab.c +++ b/src/casetab.c | |||
| @@ -191,7 +191,8 @@ set_identity (Lisp_Object table, Lisp_Object c, Lisp_Object elt) | |||
| 191 | { | 191 | { |
| 192 | if (NATNUMP (elt)) | 192 | if (NATNUMP (elt)) |
| 193 | { | 193 | { |
| 194 | int from, to; | 194 | int from; |
| 195 | unsigned to; | ||
| 195 | 196 | ||
| 196 | if (CONSP (c)) | 197 | if (CONSP (c)) |
| 197 | { | 198 | { |
| @@ -200,7 +201,7 @@ set_identity (Lisp_Object table, Lisp_Object c, Lisp_Object elt) | |||
| 200 | } | 201 | } |
| 201 | else | 202 | else |
| 202 | from = to = XINT (c); | 203 | from = to = XINT (c); |
| 203 | for (; from <= to; from++) | 204 | for (to++; from < to; from++) |
| 204 | CHAR_TABLE_SET (table, from, make_number (from)); | 205 | CHAR_TABLE_SET (table, from, make_number (from)); |
| 205 | } | 206 | } |
| 206 | } | 207 | } |
| @@ -215,7 +216,8 @@ shuffle (Lisp_Object table, Lisp_Object c, Lisp_Object elt) | |||
| 215 | { | 216 | { |
| 216 | if (NATNUMP (elt)) | 217 | if (NATNUMP (elt)) |
| 217 | { | 218 | { |
| 218 | int from, to; | 219 | int from; |
| 220 | unsigned to; | ||
| 219 | 221 | ||
| 220 | if (CONSP (c)) | 222 | if (CONSP (c)) |
| 221 | { | 223 | { |
| @@ -225,7 +227,7 @@ shuffle (Lisp_Object table, Lisp_Object c, Lisp_Object elt) | |||
| 225 | else | 227 | else |
| 226 | from = to = XINT (c); | 228 | from = to = XINT (c); |
| 227 | 229 | ||
| 228 | for (; from <= to; from++) | 230 | for (to++; from < to; from++) |
| 229 | { | 231 | { |
| 230 | Lisp_Object tem = Faref (table, elt); | 232 | Lisp_Object tem = Faref (table, elt); |
| 231 | Faset (table, elt, make_number (from)); | 233 | Faset (table, elt, make_number (from)); |
diff --git a/src/category.c b/src/category.c index cc7ff88474f..bba030360c4 100644 --- a/src/category.c +++ b/src/category.c | |||
| @@ -128,7 +128,7 @@ the current buffer's category table. */) | |||
| 128 | table = check_category_table (table); | 128 | table = check_category_table (table); |
| 129 | 129 | ||
| 130 | if (!NILP (CATEGORY_DOCSTRING (table, XFASTINT (category)))) | 130 | if (!NILP (CATEGORY_DOCSTRING (table, XFASTINT (category)))) |
| 131 | error ("Category `%c' is already defined", XFASTINT (category)); | 131 | error ("Category `%c' is already defined", (int) XFASTINT (category)); |
| 132 | if (!NILP (Vpurify_flag)) | 132 | if (!NILP (Vpurify_flag)) |
| 133 | docstring = Fpurecopy (docstring); | 133 | docstring = Fpurecopy (docstring); |
| 134 | CATEGORY_DOCSTRING (table, XFASTINT (category)) = docstring; | 134 | CATEGORY_DOCSTRING (table, XFASTINT (category)) = docstring; |
| @@ -373,7 +373,7 @@ then delete CATEGORY from the category set instead of adding it. */) | |||
| 373 | table = check_category_table (table); | 373 | table = check_category_table (table); |
| 374 | 374 | ||
| 375 | if (NILP (CATEGORY_DOCSTRING (table, XFASTINT (category)))) | 375 | if (NILP (CATEGORY_DOCSTRING (table, XFASTINT (category)))) |
| 376 | error ("Undefined category: %c", XFASTINT (category)); | 376 | error ("Undefined category: %c", (int) XFASTINT (category)); |
| 377 | 377 | ||
| 378 | set_value = NILP (reset) ? Qt : Qnil; | 378 | set_value = NILP (reset) ? Qt : Qnil; |
| 379 | 379 | ||
diff --git a/src/charset.c b/src/charset.c index 32836d459f3..00206cccf0b 100644 --- a/src/charset.c +++ b/src/charset.c | |||
| @@ -317,7 +317,7 @@ load_charset_map (struct charset *charset, struct charset_map_entries *entries, | |||
| 317 | for (i = 0; i < n_entries; i++) | 317 | for (i = 0; i < n_entries; i++) |
| 318 | { | 318 | { |
| 319 | unsigned from, to; | 319 | unsigned from, to; |
| 320 | int from_index, to_index; | 320 | int from_index, to_index, lim_index; |
| 321 | int from_c, to_c; | 321 | int from_c, to_c; |
| 322 | int idx = i % 0x10000; | 322 | int idx = i % 0x10000; |
| 323 | 323 | ||
| @@ -339,6 +339,7 @@ load_charset_map (struct charset *charset, struct charset_map_entries *entries, | |||
| 339 | } | 339 | } |
| 340 | if (from_index < 0 || to_index < 0) | 340 | if (from_index < 0 || to_index < 0) |
| 341 | continue; | 341 | continue; |
| 342 | lim_index = to_index + 1; | ||
| 342 | 343 | ||
| 343 | if (to_c > max_char) | 344 | if (to_c > max_char) |
| 344 | max_char = to_c; | 345 | max_char = to_c; |
| @@ -348,10 +349,10 @@ load_charset_map (struct charset *charset, struct charset_map_entries *entries, | |||
| 348 | if (control_flag == 1) | 349 | if (control_flag == 1) |
| 349 | { | 350 | { |
| 350 | if (charset->method == CHARSET_METHOD_MAP) | 351 | if (charset->method == CHARSET_METHOD_MAP) |
| 351 | for (; from_index <= to_index; from_index++, from_c++) | 352 | for (; from_index < lim_index; from_index++, from_c++) |
| 352 | ASET (vec, from_index, make_number (from_c)); | 353 | ASET (vec, from_index, make_number (from_c)); |
| 353 | else | 354 | else |
| 354 | for (; from_index <= to_index; from_index++, from_c++) | 355 | for (; from_index < lim_index; from_index++, from_c++) |
| 355 | CHAR_TABLE_SET (Vchar_unify_table, | 356 | CHAR_TABLE_SET (Vchar_unify_table, |
| 356 | CHARSET_CODE_OFFSET (charset) + from_index, | 357 | CHARSET_CODE_OFFSET (charset) + from_index, |
| 357 | make_number (from_c)); | 358 | make_number (from_c)); |
| @@ -360,7 +361,7 @@ load_charset_map (struct charset *charset, struct charset_map_entries *entries, | |||
| 360 | { | 361 | { |
| 361 | if (charset->method == CHARSET_METHOD_MAP | 362 | if (charset->method == CHARSET_METHOD_MAP |
| 362 | && CHARSET_COMPACT_CODES_P (charset)) | 363 | && CHARSET_COMPACT_CODES_P (charset)) |
| 363 | for (; from_index <= to_index; from_index++, from_c++) | 364 | for (; from_index < lim_index; from_index++, from_c++) |
| 364 | { | 365 | { |
| 365 | unsigned code = INDEX_TO_CODE_POINT (charset, from_index); | 366 | unsigned code = INDEX_TO_CODE_POINT (charset, from_index); |
| 366 | 367 | ||
| @@ -368,17 +369,17 @@ load_charset_map (struct charset *charset, struct charset_map_entries *entries, | |||
| 368 | CHAR_TABLE_SET (table, from_c, make_number (code)); | 369 | CHAR_TABLE_SET (table, from_c, make_number (code)); |
| 369 | } | 370 | } |
| 370 | else | 371 | else |
| 371 | for (; from_index <= to_index; from_index++, from_c++) | 372 | for (; from_index < lim_index; from_index++, from_c++) |
| 372 | { | 373 | { |
| 373 | if (NILP (CHAR_TABLE_REF (table, from_c))) | 374 | if (NILP (CHAR_TABLE_REF (table, from_c))) |
| 374 | CHAR_TABLE_SET (table, from_c, make_number (from_index)); | 375 | CHAR_TABLE_SET (table, from_c, make_number (from_index)); |
| 375 | } | 376 | } |
| 376 | } | 377 | } |
| 377 | else if (control_flag == 3) | 378 | else if (control_flag == 3) |
| 378 | for (; from_index <= to_index; from_index++, from_c++) | 379 | for (; from_index < lim_index; from_index++, from_c++) |
| 379 | SET_TEMP_CHARSET_WORK_DECODER (from_c, from_index); | 380 | SET_TEMP_CHARSET_WORK_DECODER (from_c, from_index); |
| 380 | else if (control_flag == 4) | 381 | else if (control_flag == 4) |
| 381 | for (; from_index <= to_index; from_index++, from_c++) | 382 | for (; from_index < lim_index; from_index++, from_c++) |
| 382 | SET_TEMP_CHARSET_WORK_ENCODER (from_c, from_index); | 383 | SET_TEMP_CHARSET_WORK_ENCODER (from_c, from_index); |
| 383 | else /* control_flag == 0 */ | 384 | else /* control_flag == 0 */ |
| 384 | { | 385 | { |
| @@ -493,7 +494,7 @@ load_charset_map_from_file (struct charset *charset, Lisp_Object mapfile, int co | |||
| 493 | unbind_to (count, Qnil); | 494 | unbind_to (count, Qnil); |
| 494 | if (fd < 0 | 495 | if (fd < 0 |
| 495 | || ! (fp = fdopen (fd, "r"))) | 496 | || ! (fp = fdopen (fd, "r"))) |
| 496 | error ("Failure in loading charset map: %S", SDATA (mapfile)); | 497 | error ("Failure in loading charset map: %s", SDATA (mapfile)); |
| 497 | 498 | ||
| 498 | /* Use SAFE_ALLOCA instead of alloca, as `charset_map_entries' is | 499 | /* Use SAFE_ALLOCA instead of alloca, as `charset_map_entries' is |
| 499 | large (larger than MAX_ALLOCA). */ | 500 | large (larger than MAX_ALLOCA). */ |
| @@ -1000,7 +1001,7 @@ usage: (define-charset-internal ...) */) | |||
| 1000 | { | 1001 | { |
| 1001 | CHECK_NUMBER (val); | 1002 | CHECK_NUMBER (val); |
| 1002 | if (XINT (val) < '0' || XINT (val) > 127) | 1003 | if (XINT (val) < '0' || XINT (val) > 127) |
| 1003 | error ("Invalid iso-final-char: %d", XINT (val)); | 1004 | error ("Invalid iso-final-char: %"pEd, XINT (val)); |
| 1004 | charset.iso_final = XINT (val); | 1005 | charset.iso_final = XINT (val); |
| 1005 | } | 1006 | } |
| 1006 | 1007 | ||
| @@ -1022,7 +1023,7 @@ usage: (define-charset-internal ...) */) | |||
| 1022 | { | 1023 | { |
| 1023 | CHECK_NATNUM (val); | 1024 | CHECK_NATNUM (val); |
| 1024 | if ((XINT (val) > 0 && XINT (val) <= 128) || XINT (val) >= 256) | 1025 | if ((XINT (val) > 0 && XINT (val) <= 128) || XINT (val) >= 256) |
| 1025 | error ("Invalid emacs-mule-id: %d", XINT (val)); | 1026 | error ("Invalid emacs-mule-id: %"pEd, XINT (val)); |
| 1026 | charset.emacs_mule_id = XINT (val); | 1027 | charset.emacs_mule_id = XINT (val); |
| 1027 | } | 1028 | } |
| 1028 | 1029 | ||
| @@ -1440,11 +1441,17 @@ check_iso_charset_parameter (Lisp_Object dimension, Lisp_Object chars, Lisp_Obje | |||
| 1440 | CHECK_NATNUM (final_char); | 1441 | CHECK_NATNUM (final_char); |
| 1441 | 1442 | ||
| 1442 | if (XINT (dimension) > 3) | 1443 | if (XINT (dimension) > 3) |
| 1443 | error ("Invalid DIMENSION %d, it should be 1, 2, or 3", XINT (dimension)); | 1444 | error ("Invalid DIMENSION %"pEd", it should be 1, 2, or 3", |
| 1445 | XINT (dimension)); | ||
| 1444 | if (XINT (chars) != 94 && XINT (chars) != 96) | 1446 | if (XINT (chars) != 94 && XINT (chars) != 96) |
| 1445 | error ("Invalid CHARS %d, it should be 94 or 96", XINT (chars)); | 1447 | error ("Invalid CHARS %"pEd", it should be 94 or 96", XINT (chars)); |
| 1446 | if (XINT (final_char) < '0' || XINT (final_char) > '~') | 1448 | if (XINT (final_char) < '0' || XINT (final_char) > '~') |
| 1447 | error ("Invalid FINAL-CHAR %c, it should be `0'..`~'", XINT (chars)); | 1449 | { |
| 1450 | unsigned char str[MAX_MULTIBYTE_LENGTH + 1]; | ||
| 1451 | int len = CHAR_STRING (XINT (chars), str); | ||
| 1452 | str[len] = '\0'; | ||
| 1453 | error ("Invalid FINAL-CHAR %s, it should be `0'..`~'", str); | ||
| 1454 | } | ||
| 1448 | } | 1455 | } |
| 1449 | 1456 | ||
| 1450 | 1457 | ||
diff --git a/src/chartab.c b/src/chartab.c index 9ad182131e9..7a0a3aabbb6 100644 --- a/src/chartab.c +++ b/src/chartab.c | |||
| @@ -392,7 +392,8 @@ sub_char_table_set_range (Lisp_Object *table, int depth, int min_char, int from, | |||
| 392 | *table = val; | 392 | *table = val; |
| 393 | else | 393 | else |
| 394 | { | 394 | { |
| 395 | int i, j; | 395 | int i; |
| 396 | unsigned j; | ||
| 396 | 397 | ||
| 397 | depth++; | 398 | depth++; |
| 398 | if (! SUB_CHAR_TABLE_P (*table)) | 399 | if (! SUB_CHAR_TABLE_P (*table)) |
| @@ -404,7 +405,7 @@ sub_char_table_set_range (Lisp_Object *table, int depth, int min_char, int from, | |||
| 404 | i = CHARTAB_IDX (from, depth, min_char); | 405 | i = CHARTAB_IDX (from, depth, min_char); |
| 405 | j = CHARTAB_IDX (to, depth, min_char); | 406 | j = CHARTAB_IDX (to, depth, min_char); |
| 406 | min_char += chartab_chars[depth] * i; | 407 | min_char += chartab_chars[depth] * i; |
| 407 | for (; i <= j; i++, min_char += chartab_chars[depth]) | 408 | for (j++; i < j; i++, min_char += chartab_chars[depth]) |
| 408 | sub_char_table_set_range (XSUB_CHAR_TABLE (*table)->contents + i, | 409 | sub_char_table_set_range (XSUB_CHAR_TABLE (*table)->contents + i, |
| 409 | depth, min_char, from, to, val); | 410 | depth, min_char, from, to, val); |
| 410 | } | 411 | } |
| @@ -416,16 +417,16 @@ char_table_set_range (Lisp_Object table, int from, int to, Lisp_Object val) | |||
| 416 | { | 417 | { |
| 417 | struct Lisp_Char_Table *tbl = XCHAR_TABLE (table); | 418 | struct Lisp_Char_Table *tbl = XCHAR_TABLE (table); |
| 418 | Lisp_Object *contents = tbl->contents; | 419 | Lisp_Object *contents = tbl->contents; |
| 419 | int i, min_char; | 420 | int i; |
| 420 | 421 | ||
| 421 | if (from == to) | 422 | if (from == to) |
| 422 | char_table_set (table, from, val); | 423 | char_table_set (table, from, val); |
| 423 | else | 424 | else |
| 424 | { | 425 | { |
| 425 | for (i = CHARTAB_IDX (from, 0, 0), min_char = i * chartab_chars[0]; | 426 | unsigned lim = to / chartab_chars[0] + 1; |
| 426 | min_char <= to; | 427 | for (i = CHARTAB_IDX (from, 0, 0); i < lim; i++) |
| 427 | i++, min_char += chartab_chars[0]) | 428 | sub_char_table_set_range (contents + i, 0, i * chartab_chars[0], |
| 428 | sub_char_table_set_range (contents + i, 0, min_char, from, to, val); | 429 | from, to, val); |
| 429 | if (ASCII_CHAR_P (from)) | 430 | if (ASCII_CHAR_P (from)) |
| 430 | tbl->ascii = char_table_ascii (table); | 431 | tbl->ascii = char_table_ascii (table); |
| 431 | } | 432 | } |
diff --git a/src/coding.c b/src/coding.c index a2e90e631d1..711ada59c85 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -9024,14 +9024,15 @@ Return the corresponding character. */) | |||
| 9024 | { | 9024 | { |
| 9025 | Lisp_Object spec, attrs, val; | 9025 | Lisp_Object spec, attrs, val; |
| 9026 | struct charset *charset_roman, *charset_kanji, *charset_kana, *charset; | 9026 | struct charset *charset_roman, *charset_kanji, *charset_kana, *charset; |
| 9027 | EMACS_INT ch; | ||
| 9027 | int c; | 9028 | int c; |
| 9028 | 9029 | ||
| 9029 | CHECK_NATNUM (code); | 9030 | CHECK_NATNUM (code); |
| 9030 | c = XFASTINT (code); | 9031 | ch = XFASTINT (code); |
| 9031 | CHECK_CODING_SYSTEM_GET_SPEC (Vsjis_coding_system, spec); | 9032 | CHECK_CODING_SYSTEM_GET_SPEC (Vsjis_coding_system, spec); |
| 9032 | attrs = AREF (spec, 0); | 9033 | attrs = AREF (spec, 0); |
| 9033 | 9034 | ||
| 9034 | if (ASCII_BYTE_P (c) | 9035 | if (ASCII_BYTE_P (ch) |
| 9035 | && ! NILP (CODING_ATTR_ASCII_COMPAT (attrs))) | 9036 | && ! NILP (CODING_ATTR_ASCII_COMPAT (attrs))) |
| 9036 | return code; | 9037 | return code; |
| 9037 | 9038 | ||
| @@ -9040,26 +9041,31 @@ Return the corresponding character. */) | |||
| 9040 | charset_kana = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val); | 9041 | charset_kana = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val); |
| 9041 | charset_kanji = CHARSET_FROM_ID (XINT (XCAR (val))); | 9042 | charset_kanji = CHARSET_FROM_ID (XINT (XCAR (val))); |
| 9042 | 9043 | ||
| 9043 | if (c <= 0x7F) | 9044 | if (ch <= 0x7F) |
| 9044 | charset = charset_roman; | ||
| 9045 | else if (c >= 0xA0 && c < 0xDF) | ||
| 9046 | { | 9045 | { |
| 9046 | c = ch; | ||
| 9047 | charset = charset_roman; | ||
| 9048 | } | ||
| 9049 | else if (ch >= 0xA0 && ch < 0xDF) | ||
| 9050 | { | ||
| 9051 | c = ch - 0x80; | ||
| 9047 | charset = charset_kana; | 9052 | charset = charset_kana; |
| 9048 | c -= 0x80; | ||
| 9049 | } | 9053 | } |
| 9050 | else | 9054 | else |
| 9051 | { | 9055 | { |
| 9052 | int c1 = c >> 8, c2 = c & 0xFF; | 9056 | EMACS_INT c1 = ch >> 8; |
| 9057 | int c2 = ch & 0xFF; | ||
| 9053 | 9058 | ||
| 9054 | if (c1 < 0x81 || (c1 > 0x9F && c1 < 0xE0) || c1 > 0xEF | 9059 | if (c1 < 0x81 || (c1 > 0x9F && c1 < 0xE0) || c1 > 0xEF |
| 9055 | || c2 < 0x40 || c2 == 0x7F || c2 > 0xFC) | 9060 | || c2 < 0x40 || c2 == 0x7F || c2 > 0xFC) |
| 9056 | error ("Invalid code: %d", code); | 9061 | error ("Invalid code: %"pEd, ch); |
| 9062 | c = ch; | ||
| 9057 | SJIS_TO_JIS (c); | 9063 | SJIS_TO_JIS (c); |
| 9058 | charset = charset_kanji; | 9064 | charset = charset_kanji; |
| 9059 | } | 9065 | } |
| 9060 | c = DECODE_CHAR (charset, c); | 9066 | c = DECODE_CHAR (charset, c); |
| 9061 | if (c < 0) | 9067 | if (c < 0) |
| 9062 | error ("Invalid code: %d", code); | 9068 | error ("Invalid code: %"pEd, ch); |
| 9063 | return make_number (c); | 9069 | return make_number (c); |
| 9064 | } | 9070 | } |
| 9065 | 9071 | ||
| @@ -9099,14 +9105,15 @@ Return the corresponding character. */) | |||
| 9099 | { | 9105 | { |
| 9100 | Lisp_Object spec, attrs, val; | 9106 | Lisp_Object spec, attrs, val; |
| 9101 | struct charset *charset_roman, *charset_big5, *charset; | 9107 | struct charset *charset_roman, *charset_big5, *charset; |
| 9108 | EMACS_INT ch; | ||
| 9102 | int c; | 9109 | int c; |
| 9103 | 9110 | ||
| 9104 | CHECK_NATNUM (code); | 9111 | CHECK_NATNUM (code); |
| 9105 | c = XFASTINT (code); | 9112 | ch = XFASTINT (code); |
| 9106 | CHECK_CODING_SYSTEM_GET_SPEC (Vbig5_coding_system, spec); | 9113 | CHECK_CODING_SYSTEM_GET_SPEC (Vbig5_coding_system, spec); |
| 9107 | attrs = AREF (spec, 0); | 9114 | attrs = AREF (spec, 0); |
| 9108 | 9115 | ||
| 9109 | if (ASCII_BYTE_P (c) | 9116 | if (ASCII_BYTE_P (ch) |
| 9110 | && ! NILP (CODING_ATTR_ASCII_COMPAT (attrs))) | 9117 | && ! NILP (CODING_ATTR_ASCII_COMPAT (attrs))) |
| 9111 | return code; | 9118 | return code; |
| 9112 | 9119 | ||
| @@ -9114,19 +9121,24 @@ Return the corresponding character. */) | |||
| 9114 | charset_roman = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val); | 9121 | charset_roman = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val); |
| 9115 | charset_big5 = CHARSET_FROM_ID (XINT (XCAR (val))); | 9122 | charset_big5 = CHARSET_FROM_ID (XINT (XCAR (val))); |
| 9116 | 9123 | ||
| 9117 | if (c <= 0x7F) | 9124 | if (ch <= 0x7F) |
| 9118 | charset = charset_roman; | 9125 | { |
| 9126 | c = ch; | ||
| 9127 | charset = charset_roman; | ||
| 9128 | } | ||
| 9119 | else | 9129 | else |
| 9120 | { | 9130 | { |
| 9121 | int b1 = c >> 8, b2 = c & 0x7F; | 9131 | EMACS_INT b1 = ch >> 8; |
| 9132 | int b2 = ch & 0x7F; | ||
| 9122 | if (b1 < 0xA1 || b1 > 0xFE | 9133 | if (b1 < 0xA1 || b1 > 0xFE |
| 9123 | || b2 < 0x40 || (b2 > 0x7E && b2 < 0xA1) || b2 > 0xFE) | 9134 | || b2 < 0x40 || (b2 > 0x7E && b2 < 0xA1) || b2 > 0xFE) |
| 9124 | error ("Invalid code: %d", code); | 9135 | error ("Invalid code: %"pEd, ch); |
| 9136 | c = ch; | ||
| 9125 | charset = charset_big5; | 9137 | charset = charset_big5; |
| 9126 | } | 9138 | } |
| 9127 | c = DECODE_CHAR (charset, (unsigned )c); | 9139 | c = DECODE_CHAR (charset, c); |
| 9128 | if (c < 0) | 9140 | if (c < 0) |
| 9129 | error ("Invalid code: %d", code); | 9141 | error ("Invalid code: %"pEd, ch); |
| 9130 | return make_number (c); | 9142 | return make_number (c); |
| 9131 | } | 9143 | } |
| 9132 | 9144 | ||
| @@ -9298,7 +9310,7 @@ usage: (find-operation-coding-system OPERATION ARGUMENTS...) */) | |||
| 9298 | || (EQ (operation, Qinsert_file_contents) && CONSP (target) | 9310 | || (EQ (operation, Qinsert_file_contents) && CONSP (target) |
| 9299 | && STRINGP (XCAR (target)) && BUFFERP (XCDR (target))) | 9311 | && STRINGP (XCAR (target)) && BUFFERP (XCDR (target))) |
| 9300 | || (EQ (operation, Qopen_network_stream) && INTEGERP (target)))) | 9312 | || (EQ (operation, Qopen_network_stream) && INTEGERP (target)))) |
| 9301 | error ("Invalid %dth argument", XFASTINT (target_idx) + 1); | 9313 | error ("Invalid %"pEd"th argument", XFASTINT (target_idx) + 1); |
| 9302 | if (CONSP (target)) | 9314 | if (CONSP (target)) |
| 9303 | target = XCAR (target); | 9315 | target = XCAR (target); |
| 9304 | 9316 | ||
| @@ -9774,7 +9786,7 @@ usage: (define-coding-system-internal ...) */) | |||
| 9774 | CHECK_CHARSET_GET_ID (tmp1, id); | 9786 | CHECK_CHARSET_GET_ID (tmp1, id); |
| 9775 | CHECK_NATNUM_CDR (val); | 9787 | CHECK_NATNUM_CDR (val); |
| 9776 | if (XINT (XCDR (val)) >= 4) | 9788 | if (XINT (XCDR (val)) >= 4) |
| 9777 | error ("Invalid graphic register number: %d", XINT (XCDR (val))); | 9789 | error ("Invalid graphic register number: %"pEd, XINT (XCDR (val))); |
| 9778 | XSETCAR (val, make_number (id)); | 9790 | XSETCAR (val, make_number (id)); |
| 9779 | } | 9791 | } |
| 9780 | 9792 | ||
diff --git a/src/deps.mk b/src/deps.mk index be5d3694fca..2df1577ef78 100644 --- a/src/deps.mk +++ b/src/deps.mk | |||
| @@ -82,7 +82,6 @@ dispnew.o: dispnew.c systime.h commands.h process.h frame.h coding.h \ | |||
| 82 | # doc.o's dependency on buildobj.h is in src/Makefile.in. | 82 | # doc.o's dependency on buildobj.h is in src/Makefile.in. |
| 83 | doc.o: doc.c lisp.h $(config_h) buffer.h keyboard.h keymap.h \ | 83 | doc.o: doc.c lisp.h $(config_h) buffer.h keyboard.h keymap.h \ |
| 84 | character.h systime.h coding.h composite.h ../lib/unistd.h globals.h | 84 | character.h systime.h coding.h composite.h ../lib/unistd.h globals.h |
| 85 | doprnt.o: doprnt.c character.h lisp.h globals.h ../lib/unistd.h $(config_h) | ||
| 86 | dosfns.o: buffer.h termchar.h termhooks.h frame.h blockinput.h window.h \ | 85 | dosfns.o: buffer.h termchar.h termhooks.h frame.h blockinput.h window.h \ |
| 87 | msdos.h dosfns.h dispextern.h charset.h coding.h atimer.h systime.h \ | 86 | msdos.h dosfns.h dispextern.h charset.h coding.h atimer.h systime.h \ |
| 88 | lisp.h $(config_h) | 87 | lisp.h $(config_h) |
| @@ -154,7 +154,7 @@ get_doc_string (Lisp_Object filepos, int unibyte, int definition) | |||
| 154 | if (0 > lseek (fd, position - offset, 0)) | 154 | if (0 > lseek (fd, position - offset, 0)) |
| 155 | { | 155 | { |
| 156 | emacs_close (fd); | 156 | emacs_close (fd); |
| 157 | error ("Position %ld out of range in doc string file \"%s\"", | 157 | error ("Position %"pEd" out of range in doc string file \"%s\"", |
| 158 | position, name); | 158 | position, name); |
| 159 | } | 159 | } |
| 160 | 160 | ||
| @@ -669,7 +669,7 @@ the same file name is found in the `doc-directory'. */) | |||
| 669 | ; /* Just a source file name boundary marker. Ignore it. */ | 669 | ; /* Just a source file name boundary marker. Ignore it. */ |
| 670 | 670 | ||
| 671 | else | 671 | else |
| 672 | error ("DOC file invalid at position %d", pos); | 672 | error ("DOC file invalid at position %"pEd, pos); |
| 673 | } | 673 | } |
| 674 | } | 674 | } |
| 675 | pos += end - buf; | 675 | pos += end - buf; |
diff --git a/src/editfns.c b/src/editfns.c index cd424f277bf..e754a074ba8 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -3674,7 +3674,7 @@ usage: (format STRING &rest OBJECTS) */) | |||
| 3674 | if (!info) | 3674 | if (!info) |
| 3675 | info = (struct info *) alloca (nbytes); | 3675 | info = (struct info *) alloca (nbytes); |
| 3676 | memset (info, 0, nbytes); | 3676 | memset (info, 0, nbytes); |
| 3677 | for (i = 0; i <= nargs; i++) | 3677 | for (i = 0; i < nargs + 1; i++) |
| 3678 | info[i].start = -1; | 3678 | info[i].start = -1; |
| 3679 | if (!discarded) | 3679 | if (!discarded) |
| 3680 | SAFE_ALLOCA (discarded, char *, SBYTES (args[0])); | 3680 | SAFE_ALLOCA (discarded, char *, SBYTES (args[0])); |
diff --git a/src/eval.c b/src/eval.c index 93da7799bec..0f9e012b823 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -18,6 +18,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | #include <config.h> | 20 | #include <config.h> |
| 21 | #include <limits.h> | ||
| 21 | #include <setjmp.h> | 22 | #include <setjmp.h> |
| 22 | #include "lisp.h" | 23 | #include "lisp.h" |
| 23 | #include "blockinput.h" | 24 | #include "blockinput.h" |
| @@ -30,6 +31,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 30 | #include "xterm.h" | 31 | #include "xterm.h" |
| 31 | #endif | 32 | #endif |
| 32 | 33 | ||
| 34 | #ifndef SIZE_MAX | ||
| 35 | # define SIZE_MAX ((size_t) -1) | ||
| 36 | #endif | ||
| 37 | |||
| 33 | /* This definition is duplicated in alloc.c and keyboard.c. */ | 38 | /* This definition is duplicated in alloc.c and keyboard.c. */ |
| 34 | /* Putting it in lisp.h makes cc bomb out! */ | 39 | /* Putting it in lisp.h makes cc bomb out! */ |
| 35 | 40 | ||
| @@ -1401,7 +1406,7 @@ internal_lisp_condition_case (volatile Lisp_Object var, Lisp_Object bodyform, | |||
| 1401 | || (CONSP (tem) | 1406 | || (CONSP (tem) |
| 1402 | && (SYMBOLP (XCAR (tem)) | 1407 | && (SYMBOLP (XCAR (tem)) |
| 1403 | || CONSP (XCAR (tem)))))) | 1408 | || CONSP (XCAR (tem)))))) |
| 1404 | error ("Invalid condition handler", tem); | 1409 | error ("Invalid condition handler"); |
| 1405 | } | 1410 | } |
| 1406 | 1411 | ||
| 1407 | c.tag = Qnil; | 1412 | c.tag = Qnil; |
| @@ -1976,33 +1981,39 @@ find_handler_clause (Lisp_Object handlers, Lisp_Object conditions, | |||
| 1976 | void | 1981 | void |
| 1977 | verror (const char *m, va_list ap) | 1982 | verror (const char *m, va_list ap) |
| 1978 | { | 1983 | { |
| 1979 | char buf[200]; | 1984 | char buf[4000]; |
| 1980 | EMACS_INT size = 200; | 1985 | size_t size = sizeof buf; |
| 1981 | int mlen; | 1986 | size_t size_max = |
| 1987 | min (MOST_POSITIVE_FIXNUM, min (INT_MAX, SIZE_MAX - 1)) + 1; | ||
| 1982 | char *buffer = buf; | 1988 | char *buffer = buf; |
| 1983 | int allocated = 0; | 1989 | int used; |
| 1984 | Lisp_Object string; | 1990 | Lisp_Object string; |
| 1985 | 1991 | ||
| 1986 | mlen = strlen (m); | ||
| 1987 | |||
| 1988 | while (1) | 1992 | while (1) |
| 1989 | { | 1993 | { |
| 1990 | EMACS_INT used; | 1994 | used = vsnprintf (buffer, size, m, ap); |
| 1991 | used = doprnt (buffer, size, m, m + mlen, ap); | 1995 | |
| 1992 | if (used < size) | 1996 | if (used < 0) |
| 1993 | break; | ||
| 1994 | size *= 2; | ||
| 1995 | if (allocated) | ||
| 1996 | buffer = (char *) xrealloc (buffer, size); | ||
| 1997 | else | ||
| 1998 | { | 1997 | { |
| 1999 | buffer = (char *) xmalloc (size); | 1998 | /* Non-C99 vsnprintf, such as w32, returns -1 when SIZE is too small. |
| 2000 | allocated = 1; | 1999 | Guess a larger USED to work around the incompatibility. */ |
| 2000 | used = (size <= size_max / 2 ? 2 * size | ||
| 2001 | : size < size_max ? size_max - 1 | ||
| 2002 | : size_max); | ||
| 2001 | } | 2003 | } |
| 2004 | else if (used < size) | ||
| 2005 | break; | ||
| 2006 | if (size_max <= used) | ||
| 2007 | memory_full (); | ||
| 2008 | size = used + 1; | ||
| 2009 | |||
| 2010 | if (buffer != buf) | ||
| 2011 | xfree (buffer); | ||
| 2012 | buffer = (char *) xmalloc (size); | ||
| 2002 | } | 2013 | } |
| 2003 | 2014 | ||
| 2004 | string = build_string (buffer); | 2015 | string = make_string (buffer, used); |
| 2005 | if (allocated) | 2016 | if (buffer != buf) |
| 2006 | xfree (buffer); | 2017 | xfree (buffer); |
| 2007 | 2018 | ||
| 2008 | xsignal1 (Qerror, string); | 2019 | xsignal1 (Qerror, string); |
| @@ -1076,7 +1076,7 @@ an error is signaled. */) | |||
| 1076 | EMACS_INT converted = str_to_unibyte (SDATA (string), str, chars, 0); | 1076 | EMACS_INT converted = str_to_unibyte (SDATA (string), str, chars, 0); |
| 1077 | 1077 | ||
| 1078 | if (converted < chars) | 1078 | if (converted < chars) |
| 1079 | error ("Can't convert the %dth character to unibyte", converted); | 1079 | error ("Can't convert the %"pEd"th character to unibyte", converted); |
| 1080 | string = make_unibyte_string ((char *) str, chars); | 1080 | string = make_unibyte_string ((char *) str, chars); |
| 1081 | xfree (str); | 1081 | xfree (str); |
| 1082 | } | 1082 | } |
diff --git a/src/ftfont.c b/src/ftfont.c index 06ba6d7fe25..2e66222d268 100644 --- a/src/ftfont.c +++ b/src/ftfont.c | |||
| @@ -160,11 +160,13 @@ static struct | |||
| 160 | static Lisp_Object | 160 | static Lisp_Object |
| 161 | get_adstyle_property (FcPattern *p) | 161 | get_adstyle_property (FcPattern *p) |
| 162 | { | 162 | { |
| 163 | unsigned char *str, *end; | 163 | FcChar8 *fcstr; |
| 164 | char *str, *end; | ||
| 164 | Lisp_Object adstyle; | 165 | Lisp_Object adstyle; |
| 165 | 166 | ||
| 166 | if (FcPatternGetString (p, FC_STYLE, 0, (FcChar8 **) &str) != FcResultMatch) | 167 | if (FcPatternGetString (p, FC_STYLE, 0, &fcstr) != FcResultMatch) |
| 167 | return Qnil; | 168 | return Qnil; |
| 169 | str = (char *) fcstr; | ||
| 168 | for (end = str; *end && *end != ' '; end++); | 170 | for (end = str; *end && *end != ' '; end++); |
| 169 | if (*end) | 171 | if (*end) |
| 170 | { | 172 | { |
| @@ -189,19 +191,20 @@ static Lisp_Object | |||
| 189 | ftfont_pattern_entity (FcPattern *p, Lisp_Object extra) | 191 | ftfont_pattern_entity (FcPattern *p, Lisp_Object extra) |
| 190 | { | 192 | { |
| 191 | Lisp_Object key, cache, entity; | 193 | Lisp_Object key, cache, entity; |
| 192 | unsigned char *file, *str; | 194 | FcChar8 *str; |
| 195 | char *file; | ||
| 193 | int idx; | 196 | int idx; |
| 194 | int numeric; | 197 | int numeric; |
| 195 | double dbl; | 198 | double dbl; |
| 196 | FcBool b; | 199 | FcBool b; |
| 197 | 200 | ||
| 198 | if (FcPatternGetString (p, FC_FILE, 0, (FcChar8 **) &file) != FcResultMatch) | 201 | if (FcPatternGetString (p, FC_FILE, 0, &str) != FcResultMatch) |
| 199 | return Qnil; | 202 | return Qnil; |
| 200 | if (FcPatternGetInteger (p, FC_INDEX, 0, &idx) != FcResultMatch) | 203 | if (FcPatternGetInteger (p, FC_INDEX, 0, &idx) != FcResultMatch) |
| 201 | return Qnil; | 204 | return Qnil; |
| 202 | 205 | ||
| 203 | key = Fcons (make_unibyte_string ((char *) file, strlen ((char *) file)), | 206 | file = (char *) str; |
| 204 | make_number (idx)); | 207 | key = Fcons (make_unibyte_string (file, strlen (file)), make_number (idx)); |
| 205 | cache = ftfont_lookup_cache (key, FTFONT_CACHE_FOR_ENTITY); | 208 | cache = ftfont_lookup_cache (key, FTFONT_CACHE_FOR_ENTITY); |
| 206 | entity = XCAR (cache); | 209 | entity = XCAR (cache); |
| 207 | if (! NILP (entity)) | 210 | if (! NILP (entity)) |
| @@ -219,10 +222,16 @@ ftfont_pattern_entity (FcPattern *p, Lisp_Object extra) | |||
| 219 | ASET (entity, FONT_TYPE_INDEX, Qfreetype); | 222 | ASET (entity, FONT_TYPE_INDEX, Qfreetype); |
| 220 | ASET (entity, FONT_REGISTRY_INDEX, Qiso10646_1); | 223 | ASET (entity, FONT_REGISTRY_INDEX, Qiso10646_1); |
| 221 | 224 | ||
| 222 | if (FcPatternGetString (p, FC_FOUNDRY, 0, (FcChar8 **) &str) == FcResultMatch) | 225 | if (FcPatternGetString (p, FC_FOUNDRY, 0, &str) == FcResultMatch) |
| 223 | ASET (entity, FONT_FOUNDRY_INDEX, font_intern_prop (str, strlen (str), 1)); | 226 | { |
| 224 | if (FcPatternGetString (p, FC_FAMILY, 0, (FcChar8 **) &str) == FcResultMatch) | 227 | char *s = (char *) str; |
| 225 | ASET (entity, FONT_FAMILY_INDEX, font_intern_prop (str, strlen (str), 1)); | 228 | ASET (entity, FONT_FOUNDRY_INDEX, font_intern_prop (s, strlen (s), 1)); |
| 229 | } | ||
| 230 | if (FcPatternGetString (p, FC_FAMILY, 0, &str) == FcResultMatch) | ||
| 231 | { | ||
| 232 | char *s = (char *) str; | ||
| 233 | ASET (entity, FONT_FAMILY_INDEX, font_intern_prop (s, strlen (s), 1)); | ||
| 234 | } | ||
| 226 | if (FcPatternGetInteger (p, FC_WEIGHT, 0, &numeric) == FcResultMatch) | 235 | if (FcPatternGetInteger (p, FC_WEIGHT, 0, &numeric) == FcResultMatch) |
| 227 | { | 236 | { |
| 228 | if (numeric >= FC_WEIGHT_REGULAR && numeric < FC_WEIGHT_MEDIUM) | 237 | if (numeric >= FC_WEIGHT_REGULAR && numeric < FC_WEIGHT_MEDIUM) |
diff --git a/src/intervals.c b/src/intervals.c index 729e6810f74..952f826778c 100644 --- a/src/intervals.c +++ b/src/intervals.c | |||
| @@ -777,7 +777,7 @@ update_interval (register INTERVAL i, EMACS_INT pos) | |||
| 777 | i = i->right; /* Move to the right child */ | 777 | i = i->right; /* Move to the right child */ |
| 778 | } | 778 | } |
| 779 | else if (NULL_PARENT (i)) | 779 | else if (NULL_PARENT (i)) |
| 780 | error ("Point %d after end of properties", pos); | 780 | error ("Point %"pEd" after end of properties", pos); |
| 781 | else | 781 | else |
| 782 | i = INTERVAL_PARENT (i); | 782 | i = INTERVAL_PARENT (i); |
| 783 | continue; | 783 | continue; |
diff --git a/src/keyboard.c b/src/keyboard.c index 5a3031259d9..5df4f1b1ff4 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -3090,7 +3090,6 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event | |||
| 3090 | /* Process the help character specially if enabled */ | 3090 | /* Process the help character specially if enabled */ |
| 3091 | if (!NILP (Vhelp_form) && help_char_p (c)) | 3091 | if (!NILP (Vhelp_form) && help_char_p (c)) |
| 3092 | { | 3092 | { |
| 3093 | Lisp_Object tem0; | ||
| 3094 | int count = SPECPDL_INDEX (); | 3093 | int count = SPECPDL_INDEX (); |
| 3095 | 3094 | ||
| 3096 | help_form_saved_window_configs | 3095 | help_form_saved_window_configs |
| @@ -8777,7 +8776,8 @@ access_keymap_keyremap (Lisp_Object map, Lisp_Object key, Lisp_Object prompt, | |||
| 8777 | (To ignore it safely, we would need to gcpro a bunch of | 8776 | (To ignore it safely, we would need to gcpro a bunch of |
| 8778 | other variables.) */ | 8777 | other variables.) */ |
| 8779 | if (! (VECTORP (next) || STRINGP (next))) | 8778 | if (! (VECTORP (next) || STRINGP (next))) |
| 8780 | error ("Function %s returns invalid key sequence", tem); | 8779 | error ("Function %s returns invalid key sequence", |
| 8780 | SSDATA (SYMBOL_NAME (tem))); | ||
| 8781 | } | 8781 | } |
| 8782 | return next; | 8782 | return next; |
| 8783 | } | 8783 | } |
diff --git a/src/lisp.h b/src/lisp.h index e538b5dc3b1..4859862c88f 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -38,6 +38,7 @@ extern void check_cons_list (void); | |||
| 38 | #ifndef EMACS_INT | 38 | #ifndef EMACS_INT |
| 39 | #define EMACS_INT long | 39 | #define EMACS_INT long |
| 40 | #define BITS_PER_EMACS_INT BITS_PER_LONG | 40 | #define BITS_PER_EMACS_INT BITS_PER_LONG |
| 41 | #define pEd "ld" | ||
| 41 | #endif | 42 | #endif |
| 42 | #ifndef EMACS_UINT | 43 | #ifndef EMACS_UINT |
| 43 | #define EMACS_UINT unsigned long | 44 | #define EMACS_UINT unsigned long |
| @@ -46,6 +47,7 @@ extern void check_cons_list (void); | |||
| 46 | #ifndef EMACS_INT | 47 | #ifndef EMACS_INT |
| 47 | #define EMACS_INT int | 48 | #define EMACS_INT int |
| 48 | #define BITS_PER_EMACS_INT BITS_PER_INT | 49 | #define BITS_PER_EMACS_INT BITS_PER_INT |
| 50 | #define pEd "d" | ||
| 49 | #endif | 51 | #endif |
| 50 | #ifndef EMACS_UINT | 52 | #ifndef EMACS_UINT |
| 51 | #define EMACS_UINT unsigned int | 53 | #define EMACS_UINT unsigned int |
| @@ -2628,7 +2630,6 @@ extern Lisp_Object current_message (void); | |||
| 2628 | extern void set_message (const char *s, Lisp_Object, EMACS_INT, int); | 2630 | extern void set_message (const char *s, Lisp_Object, EMACS_INT, int); |
| 2629 | extern void clear_message (int, int); | 2631 | extern void clear_message (int, int); |
| 2630 | extern void message (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); | 2632 | extern void message (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); |
| 2631 | extern void message_nolog (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); | ||
| 2632 | extern void message1 (const char *); | 2633 | extern void message1 (const char *); |
| 2633 | extern void message1_nolog (const char *); | 2634 | extern void message1_nolog (const char *); |
| 2634 | extern void message2 (const char *, EMACS_INT, int); | 2635 | extern void message2 (const char *, EMACS_INT, int); |
| @@ -2781,9 +2782,7 @@ extern Lisp_Object internal_with_output_to_temp_buffer | |||
| 2781 | extern void float_to_string (char *, double); | 2782 | extern void float_to_string (char *, double); |
| 2782 | extern void syms_of_print (void); | 2783 | extern void syms_of_print (void); |
| 2783 | 2784 | ||
| 2784 | /* Defined in doprnt.c */ | 2785 | /* Defined in lread.c. */ |
| 2785 | extern EMACS_INT doprnt (char *, int, const char *, const char *, va_list); | ||
| 2786 | |||
| 2787 | extern Lisp_Object Qvariable_documentation, Qstandard_input; | 2786 | extern Lisp_Object Qvariable_documentation, Qstandard_input; |
| 2788 | extern Lisp_Object Qbackquote, Qcomma, Qcomma_at, Qcomma_dot, Qfunction; | 2787 | extern Lisp_Object Qbackquote, Qcomma, Qcomma_at, Qcomma_dot, Qfunction; |
| 2789 | extern Lisp_Object initial_obarray; | 2788 | extern Lisp_Object initial_obarray; |
| @@ -2873,8 +2872,9 @@ extern Lisp_Object internal_condition_case_n (Lisp_Object (*) (size_t, Lisp_Obje | |||
| 2873 | extern void specbind (Lisp_Object, Lisp_Object); | 2872 | extern void specbind (Lisp_Object, Lisp_Object); |
| 2874 | extern void record_unwind_protect (Lisp_Object (*) (Lisp_Object), Lisp_Object); | 2873 | extern void record_unwind_protect (Lisp_Object (*) (Lisp_Object), Lisp_Object); |
| 2875 | extern Lisp_Object unbind_to (int, Lisp_Object); | 2874 | extern Lisp_Object unbind_to (int, Lisp_Object); |
| 2876 | extern void error (const char *, ...) NO_RETURN; | 2875 | extern void error (const char *, ...) NO_RETURN ATTRIBUTE_FORMAT_PRINTF (1, 2); |
| 2877 | extern void verror (const char *, va_list) NO_RETURN; | 2876 | extern void verror (const char *, va_list) |
| 2877 | NO_RETURN ATTRIBUTE_FORMAT_PRINTF (1, 0); | ||
| 2878 | extern void do_autoload (Lisp_Object, Lisp_Object); | 2878 | extern void do_autoload (Lisp_Object, Lisp_Object); |
| 2879 | extern Lisp_Object un_autoload (Lisp_Object); | 2879 | extern Lisp_Object un_autoload (Lisp_Object); |
| 2880 | EXFUN (Ffetch_bytecode, 1); | 2880 | EXFUN (Ffetch_bytecode, 1); |
diff --git a/src/m/amdx86-64.h b/src/m/amdx86-64.h index 441f41b4444..dbca9b5b838 100644 --- a/src/m/amdx86-64.h +++ b/src/m/amdx86-64.h | |||
| @@ -28,6 +28,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 28 | 28 | ||
| 29 | /* Define the type to use. */ | 29 | /* Define the type to use. */ |
| 30 | #define EMACS_INT long | 30 | #define EMACS_INT long |
| 31 | #define pEd "ld" | ||
| 31 | #define EMACS_UINT unsigned long | 32 | #define EMACS_UINT unsigned long |
| 32 | 33 | ||
| 33 | /* Define XPNTR to avoid or'ing with DATA_SEG_BITS */ | 34 | /* Define XPNTR to avoid or'ing with DATA_SEG_BITS */ |
diff --git a/src/m/ia64.h b/src/m/ia64.h index 101d56e648b..a1374d7c224 100644 --- a/src/m/ia64.h +++ b/src/m/ia64.h | |||
| @@ -28,6 +28,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 28 | 28 | ||
| 29 | /* Define the type to use. */ | 29 | /* Define the type to use. */ |
| 30 | #define EMACS_INT long | 30 | #define EMACS_INT long |
| 31 | #define pEd "ld" | ||
| 31 | #define EMACS_UINT unsigned long | 32 | #define EMACS_UINT unsigned long |
| 32 | 33 | ||
| 33 | #ifdef REL_ALLOC | 34 | #ifdef REL_ALLOC |
diff --git a/src/m/ibms390x.h b/src/m/ibms390x.h index d4ef5c291ef..14228b61e56 100644 --- a/src/m/ibms390x.h +++ b/src/m/ibms390x.h | |||
| @@ -24,6 +24,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 24 | 24 | ||
| 25 | /* Define the type to use. */ | 25 | /* Define the type to use. */ |
| 26 | #define EMACS_INT long | 26 | #define EMACS_INT long |
| 27 | #define pEd "ld" | ||
| 27 | #define EMACS_UINT unsigned long | 28 | #define EMACS_UINT unsigned long |
| 28 | 29 | ||
| 29 | /* On the 64 bit architecture, we can use 60 bits for addresses */ | 30 | /* On the 64 bit architecture, we can use 60 bits for addresses */ |
| @@ -31,4 +32,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 31 | 32 | ||
| 32 | /* Define XPNTR to avoid or'ing with DATA_SEG_BITS */ | 33 | /* Define XPNTR to avoid or'ing with DATA_SEG_BITS */ |
| 33 | #define XPNTR(a) XUINT (a) | 34 | #define XPNTR(a) XUINT (a) |
| 34 | |||
diff --git a/src/nsfns.m b/src/nsfns.m index 6a5adbd7bf3..d4445d1d627 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -483,7 +483,7 @@ ns_set_name_internal (FRAME_PTR f, Lisp_Object name) | |||
| 483 | if (!STRINGP (f->icon_name)) | 483 | if (!STRINGP (f->icon_name)) |
| 484 | encoded_icon_name = encoded_name; | 484 | encoded_icon_name = encoded_name; |
| 485 | else | 485 | else |
| 486 | encoded_icon_name = ENCODE_UTF_8 (f->icon_name); | 486 | encoded_icon_name = ENCODE_UTF_8 (f->icon_name); |
| 487 | 487 | ||
| 488 | str = [NSString stringWithUTF8String: SDATA (encoded_icon_name)]; | 488 | str = [NSString stringWithUTF8String: SDATA (encoded_icon_name)]; |
| 489 | 489 | ||
| @@ -637,7 +637,7 @@ ns_set_name_as_filename (struct frame *f) | |||
| 637 | 637 | ||
| 638 | if (FRAME_ICONIFIED_P (f)) | 638 | if (FRAME_ICONIFIED_P (f)) |
| 639 | [[view window] setMiniwindowTitle: str]; | 639 | [[view window] setMiniwindowTitle: str]; |
| 640 | else | 640 | else |
| 641 | { | 641 | { |
| 642 | NSString *fstr; | 642 | NSString *fstr; |
| 643 | 643 | ||
| @@ -1021,8 +1021,8 @@ frame_parm_handler ns_frame_parm_handlers[] = | |||
| 1021 | 0, /* x_set_fullscreen will ignore */ | 1021 | 0, /* x_set_fullscreen will ignore */ |
| 1022 | x_set_font_backend, /* generic OK */ | 1022 | x_set_font_backend, /* generic OK */ |
| 1023 | x_set_alpha, | 1023 | x_set_alpha, |
| 1024 | 0, /* x_set_sticky */ | 1024 | 0, /* x_set_sticky */ |
| 1025 | 0, /* x_set_tool_bar_position */ | 1025 | 0, /* x_set_tool_bar_position */ |
| 1026 | }; | 1026 | }; |
| 1027 | 1027 | ||
| 1028 | 1028 | ||
| @@ -2044,7 +2044,7 @@ In case the execution fails, an error is signaled. */) | |||
| 2044 | (Lisp_Object script) | 2044 | (Lisp_Object script) |
| 2045 | { | 2045 | { |
| 2046 | Lisp_Object result; | 2046 | Lisp_Object result; |
| 2047 | long status; | 2047 | int status; |
| 2048 | 2048 | ||
| 2049 | CHECK_STRING (script); | 2049 | CHECK_STRING (script); |
| 2050 | check_ns (); | 2050 | check_ns (); |
| @@ -2330,7 +2330,7 @@ If omitted or nil, that stands for the selected frame's display. */) | |||
| 2330 | { | 2330 | { |
| 2331 | struct ns_display_info *dpyinfo; | 2331 | struct ns_display_info *dpyinfo; |
| 2332 | check_ns (); | 2332 | check_ns (); |
| 2333 | 2333 | ||
| 2334 | dpyinfo = check_ns_display_info (display); | 2334 | dpyinfo = check_ns_display_info (display); |
| 2335 | /* We force 24+ bit depths to 24-bit to prevent an overflow. */ | 2335 | /* We force 24+ bit depths to 24-bit to prevent an overflow. */ |
| 2336 | return make_number (1 << min (dpyinfo->n_planes, 24)); | 2336 | return make_number (1 << min (dpyinfo->n_planes, 24)); |
| @@ -2373,7 +2373,7 @@ compute_tip_xy (struct frame *f, | |||
| 2373 | pt.y = x_display_pixel_height (FRAME_NS_DISPLAY_INFO (f)) - XINT (top) | 2373 | pt.y = x_display_pixel_height (FRAME_NS_DISPLAY_INFO (f)) - XINT (top) |
| 2374 | - height; | 2374 | - height; |
| 2375 | } | 2375 | } |
| 2376 | 2376 | ||
| 2377 | /* Ensure in bounds. (Note, screen origin = lower left.) */ | 2377 | /* Ensure in bounds. (Note, screen origin = lower left.) */ |
| 2378 | if (INTEGERP (left)) | 2378 | if (INTEGERP (left)) |
| 2379 | *root_x = pt.x; | 2379 | *root_x = pt.x; |
| @@ -2655,4 +2655,3 @@ be used as the image of the icon representing the frame. */); | |||
| 2655 | check_window_system_func = check_ns; | 2655 | check_window_system_func = check_ns; |
| 2656 | 2656 | ||
| 2657 | } | 2657 | } |
| 2658 | |||
diff --git a/src/syntax.c b/src/syntax.c index 56176f32418..1301c0689ad 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -1541,7 +1541,8 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl | |||
| 1541 | 1541 | ||
| 1542 | if (c <= c2) | 1542 | if (c <= c2) |
| 1543 | { | 1543 | { |
| 1544 | while (c <= c2) | 1544 | unsigned lim2 = c2 + 1; |
| 1545 | while (c < lim2) | ||
| 1545 | fastmap[c++] = 1; | 1546 | fastmap[c++] = 1; |
| 1546 | if (! ASCII_CHAR_P (c2)) | 1547 | if (! ASCII_CHAR_P (c2)) |
| 1547 | string_has_eight_bit = 1; | 1548 | string_has_eight_bit = 1; |
| @@ -1681,7 +1682,8 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl | |||
| 1681 | } | 1682 | } |
| 1682 | if (! ASCII_CHAR_P (c)) | 1683 | if (! ASCII_CHAR_P (c)) |
| 1683 | { | 1684 | { |
| 1684 | while (leading_code <= leading_code2) | 1685 | unsigned lim2 = leading_code2 + 1; |
| 1686 | while (leading_code < lim2) | ||
| 1685 | fastmap[leading_code++] = 1; | 1687 | fastmap[leading_code++] = 1; |
| 1686 | if (c <= c2) | 1688 | if (c <= c2) |
| 1687 | { | 1689 | { |
| @@ -1713,9 +1715,9 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl | |||
| 1713 | for (i = 0; i < n_char_ranges; i += 2) | 1715 | for (i = 0; i < n_char_ranges; i += 2) |
| 1714 | { | 1716 | { |
| 1715 | int c1 = char_ranges[i]; | 1717 | int c1 = char_ranges[i]; |
| 1716 | int c2 = char_ranges[i + 1]; | 1718 | unsigned lim2 = char_ranges[i + 1] + 1; |
| 1717 | 1719 | ||
| 1718 | for (; c1 <= c2; c1++) | 1720 | for (; c1 < lim2; c1++) |
| 1719 | { | 1721 | { |
| 1720 | int b = CHAR_TO_BYTE_SAFE (c1); | 1722 | int b = CHAR_TO_BYTE_SAFE (c1); |
| 1721 | if (b >= 0) | 1723 | if (b >= 0) |
diff --git a/src/sysdep.c b/src/sysdep.c index a165a9ca52f..f4f767dac3f 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -2361,7 +2361,8 @@ serial_configure (struct Lisp_Process *p, | |||
| 2361 | CHECK_NUMBER (tem); | 2361 | CHECK_NUMBER (tem); |
| 2362 | err = cfsetspeed (&attr, XINT (tem)); | 2362 | err = cfsetspeed (&attr, XINT (tem)); |
| 2363 | if (err != 0) | 2363 | if (err != 0) |
| 2364 | error ("cfsetspeed(%d) failed: %s", XINT (tem), emacs_strerror (errno)); | 2364 | error ("cfsetspeed(%"pEd") failed: %s", XINT (tem), |
| 2365 | emacs_strerror (errno)); | ||
| 2365 | childp2 = Fplist_put (childp2, QCspeed, tem); | 2366 | childp2 = Fplist_put (childp2, QCspeed, tem); |
| 2366 | 2367 | ||
| 2367 | /* Configure bytesize. */ | 2368 | /* Configure bytesize. */ |
diff --git a/src/term.c b/src/term.c index 9be9950d5eb..ea856543a7d 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -86,7 +86,7 @@ static void dissociate_if_controlling_tty (int fd); | |||
| 86 | static void delete_tty (struct terminal *); | 86 | static void delete_tty (struct terminal *); |
| 87 | static void maybe_fatal (int must_succeed, struct terminal *terminal, | 87 | static void maybe_fatal (int must_succeed, struct terminal *terminal, |
| 88 | const char *str1, const char *str2, ...) | 88 | const char *str1, const char *str2, ...) |
| 89 | NO_RETURN ATTRIBUTE_FORMAT_PRINTF (4, 5); | 89 | NO_RETURN ATTRIBUTE_FORMAT_PRINTF (3, 5) ATTRIBUTE_FORMAT_PRINTF (4, 5); |
| 90 | static void vfatal (const char *str, va_list ap) | 90 | static void vfatal (const char *str, va_list ap) |
| 91 | NO_RETURN ATTRIBUTE_FORMAT_PRINTF (1, 0); | 91 | NO_RETURN ATTRIBUTE_FORMAT_PRINTF (1, 0); |
| 92 | 92 | ||
diff --git a/src/window.c b/src/window.c index d023f9a29cd..a8a6fceaaee 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -3801,7 +3801,7 @@ See Info node `(elisp)Splitting Windows' for more details and examples. */) | |||
| 3801 | error ("Window height %d too small (after splitting)", size_int); | 3801 | error ("Window height %d too small (after splitting)", size_int); |
| 3802 | if (size_int + window_safe_height > XFASTINT (o->total_lines)) | 3802 | if (size_int + window_safe_height > XFASTINT (o->total_lines)) |
| 3803 | error ("Window height %d too small (after splitting)", | 3803 | error ("Window height %d too small (after splitting)", |
| 3804 | XFASTINT (o->total_lines) - size_int); | 3804 | (int) (XFASTINT (o->total_lines) - size_int)); |
| 3805 | if (NILP (o->parent) | 3805 | if (NILP (o->parent) |
| 3806 | || NILP (XWINDOW (o->parent)->vchild)) | 3806 | || NILP (XWINDOW (o->parent)->vchild)) |
| 3807 | { | 3807 | { |
| @@ -3818,7 +3818,7 @@ See Info node `(elisp)Splitting Windows' for more details and examples. */) | |||
| 3818 | error ("Window width %d too small (after splitting)", size_int); | 3818 | error ("Window width %d too small (after splitting)", size_int); |
| 3819 | if (size_int + window_safe_width > XFASTINT (o->total_cols)) | 3819 | if (size_int + window_safe_width > XFASTINT (o->total_cols)) |
| 3820 | error ("Window width %d too small (after splitting)", | 3820 | error ("Window width %d too small (after splitting)", |
| 3821 | XFASTINT (o->total_cols) - size_int); | 3821 | (int) (XFASTINT (o->total_cols) - size_int)); |
| 3822 | if (NILP (o->parent) | 3822 | if (NILP (o->parent) |
| 3823 | || NILP (XWINDOW (o->parent)->hchild)) | 3823 | || NILP (XWINDOW (o->parent)->hchild)) |
| 3824 | { | 3824 | { |
diff --git a/src/xdisp.c b/src/xdisp.c index 827ff6d3133..6fd3945511b 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -8408,10 +8408,19 @@ vmessage (const char *m, va_list ap) | |||
| 8408 | { | 8408 | { |
| 8409 | if (m) | 8409 | if (m) |
| 8410 | { | 8410 | { |
| 8411 | EMACS_INT len; | 8411 | char *buf = FRAME_MESSAGE_BUF (f); |
| 8412 | size_t bufsize = FRAME_MESSAGE_BUF_SIZE (f); | ||
| 8413 | int len; | ||
| 8412 | 8414 | ||
| 8413 | len = doprnt (FRAME_MESSAGE_BUF (f), | 8415 | memset (buf, 0, bufsize); |
| 8414 | FRAME_MESSAGE_BUF_SIZE (f), m, (char *)0, ap); | 8416 | len = vsnprintf (buf, bufsize, m, ap); |
| 8417 | |||
| 8418 | /* Do any truncation at a character boundary. */ | ||
| 8419 | if (! (0 <= len && len < bufsize)) | ||
| 8420 | for (len = strnlen (buf, bufsize); | ||
| 8421 | len && ! CHAR_HEAD_P (buf[len - 1]); | ||
| 8422 | len--) | ||
| 8423 | continue; | ||
| 8415 | 8424 | ||
| 8416 | message2 (FRAME_MESSAGE_BUF (f), len, 0); | 8425 | message2 (FRAME_MESSAGE_BUF (f), len, 0); |
| 8417 | } | 8426 | } |
| @@ -8435,6 +8444,7 @@ message (const char *m, ...) | |||
| 8435 | } | 8444 | } |
| 8436 | 8445 | ||
| 8437 | 8446 | ||
| 8447 | #if 0 | ||
| 8438 | /* The non-logging version of message. */ | 8448 | /* The non-logging version of message. */ |
| 8439 | 8449 | ||
| 8440 | void | 8450 | void |
| @@ -8449,6 +8459,7 @@ message_nolog (const char *m, ...) | |||
| 8449 | Vmessage_log_max = old_log_max; | 8459 | Vmessage_log_max = old_log_max; |
| 8450 | va_end (ap); | 8460 | va_end (ap); |
| 8451 | } | 8461 | } |
| 8462 | #endif | ||
| 8452 | 8463 | ||
| 8453 | 8464 | ||
| 8454 | /* Display the current message in the current mini-buffer. This is | 8465 | /* Display the current message in the current mini-buffer. This is |
| @@ -19503,7 +19514,7 @@ decode_mode_spec (struct window *w, register int c, int field_width, | |||
| 19503 | EMACS_INT limit = BUF_BEGV (b); | 19514 | EMACS_INT limit = BUF_BEGV (b); |
| 19504 | EMACS_INT limit_byte = BUF_BEGV_BYTE (b); | 19515 | EMACS_INT limit_byte = BUF_BEGV_BYTE (b); |
| 19505 | EMACS_INT position; | 19516 | EMACS_INT position; |
| 19506 | EMACS_INT distance = | 19517 | EMACS_INT distance = |
| 19507 | (height * 2 + 30) * line_number_display_limit_width; | 19518 | (height * 2 + 30) * line_number_display_limit_width; |
| 19508 | 19519 | ||
| 19509 | if (startpos - distance > limit) | 19520 | if (startpos - distance > limit) |
diff --git a/src/xfns.c b/src/xfns.c index 8e5639681df..04b8e44b561 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -215,7 +215,7 @@ check_x_display_info (Lisp_Object object) | |||
| 215 | struct terminal *t = get_terminal (object, 1); | 215 | struct terminal *t = get_terminal (object, 1); |
| 216 | 216 | ||
| 217 | if (t->type != output_x_window) | 217 | if (t->type != output_x_window) |
| 218 | error ("Terminal %d is not an X display", XINT (object)); | 218 | error ("Terminal %"pEd" is not an X display", XINT (object)); |
| 219 | 219 | ||
| 220 | dpyinfo = t->display_info.x; | 220 | dpyinfo = t->display_info.x; |
| 221 | } | 221 | } |
diff --git a/src/xmenu.c b/src/xmenu.c index dbf8145f737..b1f7dfb26bc 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -966,6 +966,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) | |||
| 966 | Lisp_Object *previous_items | 966 | Lisp_Object *previous_items |
| 967 | = (Lisp_Object *) alloca (previous_menu_items_used | 967 | = (Lisp_Object *) alloca (previous_menu_items_used |
| 968 | * sizeof (Lisp_Object)); | 968 | * sizeof (Lisp_Object)); |
| 969 | EMACS_UINT subitems; | ||
| 969 | 970 | ||
| 970 | /* If we are making a new widget, its contents are empty, | 971 | /* If we are making a new widget, its contents are empty, |
| 971 | do always reinitialize them. */ | 972 | do always reinitialize them. */ |
| @@ -1010,21 +1011,21 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) | |||
| 1010 | 1011 | ||
| 1011 | menu_items = f->menu_bar_vector; | 1012 | menu_items = f->menu_bar_vector; |
| 1012 | menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0; | 1013 | menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0; |
| 1013 | submenu_start = (int *) alloca (XVECTOR (items)->size * sizeof (int *)); | 1014 | subitems = XVECTOR (items)->size / 4; |
| 1014 | submenu_end = (int *) alloca (XVECTOR (items)->size * sizeof (int *)); | 1015 | submenu_start = (int *) alloca (subitems * sizeof (int *)); |
| 1015 | submenu_n_panes = (int *) alloca (XVECTOR (items)->size * sizeof (int)); | 1016 | submenu_end = (int *) alloca (subitems * sizeof (int *)); |
| 1016 | submenu_top_level_items | 1017 | submenu_n_panes = (int *) alloca (subitems * sizeof (int)); |
| 1017 | = (int *) alloca (XVECTOR (items)->size * sizeof (int *)); | 1018 | submenu_top_level_items = (int *) alloca (subitems * sizeof (int *)); |
| 1018 | init_menu_items (); | 1019 | init_menu_items (); |
| 1019 | for (i = 0; i < XVECTOR (items)->size; i += 4) | 1020 | for (i = 0; i < subitems; i++) |
| 1020 | { | 1021 | { |
| 1021 | Lisp_Object key, string, maps; | 1022 | Lisp_Object key, string, maps; |
| 1022 | 1023 | ||
| 1023 | last_i = i; | 1024 | last_i = i; |
| 1024 | 1025 | ||
| 1025 | key = XVECTOR (items)->contents[i]; | 1026 | key = XVECTOR (items)->contents[4 * i]; |
| 1026 | string = XVECTOR (items)->contents[i + 1]; | 1027 | string = XVECTOR (items)->contents[4 * i + 1]; |
| 1027 | maps = XVECTOR (items)->contents[i + 2]; | 1028 | maps = XVECTOR (items)->contents[4 * i + 2]; |
| 1028 | if (NILP (string)) | 1029 | if (NILP (string)) |
| 1029 | break; | 1030 | break; |
| 1030 | 1031 | ||
| @@ -1051,7 +1052,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) | |||
| 1051 | wv->help = Qnil; | 1052 | wv->help = Qnil; |
| 1052 | first_wv = wv; | 1053 | first_wv = wv; |
| 1053 | 1054 | ||
| 1054 | for (i = 0; i < last_i; i += 4) | 1055 | for (i = 0; i < last_i; i++) |
| 1055 | { | 1056 | { |
| 1056 | menu_items_n_panes = submenu_n_panes[i]; | 1057 | menu_items_n_panes = submenu_n_panes[i]; |
| 1057 | wv = digest_single_submenu (submenu_start[i], submenu_end[i], | 1058 | wv = digest_single_submenu (submenu_start[i], submenu_end[i], |
diff --git a/src/xterm.c b/src/xterm.c index d1ff5b85a29..b3e33b7c0bb 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -7539,8 +7539,6 @@ x_error_catcher (Display *display, XErrorEvent *event) | |||
| 7539 | 7539 | ||
| 7540 | Calling x_uncatch_errors resumes the normal error handling. */ | 7540 | Calling x_uncatch_errors resumes the normal error handling. */ |
| 7541 | 7541 | ||
| 7542 | void x_check_errors (Display *dpy, const char *format); | ||
| 7543 | |||
| 7544 | void | 7542 | void |
| 7545 | x_catch_errors (Display *dpy) | 7543 | x_catch_errors (Display *dpy) |
| 7546 | { | 7544 | { |