summaryrefslogtreecommitdiff
path: root/src/lread.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-04-19 00:22:13 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-04-19 00:22:13 -0700
commit640ee02d548592fda4d274487ef2fdc3873dfc7b (patch)
tree979af1c451bc355895fccf8731063e2371990c31 /src/lread.c
parent6048fb2a5ade88f36ff1e50eb113726c610115d0 (diff)
downloademacs-640ee02d548592fda4d274487ef2fdc3873dfc7b.tar.gz
emacs-640ee02d548592fda4d274487ef2fdc3873dfc7b.tar.bz2
emacs-640ee02d548592fda4d274487ef2fdc3873dfc7b.zip
* 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.
Diffstat (limited to 'src/lread.c')
-rw-r--r--src/lread.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lread.c b/src/lread.c
index d32f0b6a7e2..2f01b931e61 100644
--- a/src/lread.c
+++ b/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;