Fix a sizeof braino.

Somebody (probably me) got a little over-happy with sizeof.
This commit is contained in:
Bill Currie 2010-11-14 19:22:47 +09:00
parent f63e505c92
commit 824e33c82b

View file

@ -216,12 +216,13 @@ Qdopen (int fd, const char *mode)
QFile *file; QFile *file;
char *m, *p; char *m, *p;
int zip = 0; int zip = 0;
int len = strlen (mode);
m = alloca (strlen (mode) + 1); m = alloca (len + 1);
#ifdef _WIN32 #ifdef _WIN32
setmode (fd, O_BINARY); setmode (fd, O_BINARY);
#endif #endif
for (p = m; *mode && p - m < ((int) sizeof (m) - 1); mode++) { for (p = m; *mode && p - m < len; mode++) {
if (*mode == 'z') { if (*mode == 'z') {
zip = 1; zip = 1;
continue; continue;