mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-08 20:50:52 -08:00
* lread.c (openp): Don't stuff size_t into an 'int'.
Use <= on length, not < on length + 1, to avoid GCC 4.6.0 warning about possible signed overflow.
This commit is contained in:
parent
6048fb2a5a
commit
640ee02d54
2 changed files with 11 additions and 7 deletions
|
|
@ -1,5 +1,9 @@
|
|||
2011-04-19 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* lread.c (openp): Don't stuff size_t into an 'int'.
|
||||
Use <= on length, not < on length + 1, to avoid GCC 4.6.0 warning
|
||||
about possible signed overflow.
|
||||
|
||||
* gtkutil.c: Fix problems found by GCC 4.6.0 on Ubuntu 10.10.
|
||||
(GDK_KEY_g): Don't define if already defined.
|
||||
(xg_prepare_tooltip): Avoid pointer signedness problem.
|
||||
|
|
|
|||
14
src/lread.c
14
src/lread.c
|
|
@ -1411,16 +1411,16 @@ int
|
|||
openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *storeptr, Lisp_Object predicate)
|
||||
{
|
||||
register int fd;
|
||||
int fn_size = 100;
|
||||
EMACS_INT fn_size = 100;
|
||||
char buf[100];
|
||||
register char *fn = buf;
|
||||
int absolute = 0;
|
||||
int want_size;
|
||||
EMACS_INT want_length;
|
||||
Lisp_Object filename;
|
||||
struct stat st;
|
||||
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
|
||||
Lisp_Object string, tail, encoded_fn;
|
||||
int max_suffix_len = 0;
|
||||
EMACS_INT max_suffix_len = 0;
|
||||
|
||||
CHECK_STRING (str);
|
||||
|
||||
|
|
@ -1454,11 +1454,11 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *sto
|
|||
continue;
|
||||
}
|
||||
|
||||
/* Calculate maximum size of any filename made from
|
||||
/* Calculate maximum length of any filename made from
|
||||
this path element/specified file name and any possible suffix. */
|
||||
want_size = max_suffix_len + SBYTES (filename) + 1;
|
||||
if (fn_size < want_size)
|
||||
fn = (char *) alloca (fn_size = 100 + want_size);
|
||||
want_length = max_suffix_len + SBYTES (filename);
|
||||
if (fn_size <= want_length)
|
||||
fn = (char *) alloca (fn_size = 100 + want_length);
|
||||
|
||||
/* Loop over suffixes. */
|
||||
for (tail = NILP (suffixes) ? Fcons (empty_unibyte_string, Qnil) : suffixes;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue