rewrite some code to avoid gcc 4.8 complaining
This commit is contained in:
parent
b55d9870e3
commit
c39bfe09ee
6
funcs.c
6
funcs.c
@ -38,7 +38,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.224 2012/10/03 15:13:31 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.225 2012/10/03 16:16:12 tg Exp $");
|
||||
|
||||
#if HAVE_KILLPG
|
||||
/*
|
||||
@ -976,7 +976,9 @@ c_typeset_vardump(struct tbl *vp, uint32_t flag, int thing, bool pflag,
|
||||
* Only report first 'element' of an array with
|
||||
* no set elements.
|
||||
*/
|
||||
} while (any_set && (vp = vp->u.array));
|
||||
if (!any_set)
|
||||
return;
|
||||
} while ((vp = vp->u.array));
|
||||
}
|
||||
|
||||
int
|
||||
|
10
sh.h
10
sh.h
@ -157,7 +157,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef EXTERN
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.590 2012/10/03 15:55:37 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.591 2012/10/03 16:16:13 tg Exp $");
|
||||
#endif
|
||||
#define MKSH_VERSION "R40 2012/09/07"
|
||||
|
||||
@ -1559,9 +1559,11 @@ EXTERN mksh_ari_t histsize; /* history size */
|
||||
/* user and system time of last j_waitjed job */
|
||||
EXTERN struct timeval j_usrtime, j_systime;
|
||||
|
||||
#define notoktomul(fac1, fac2) (((fac1) != 0) && ((fac2) != 0) && \
|
||||
((SIZE_MAX / (fac2)) < (fac1)))
|
||||
#define notoktoadd(val, cnst) ((val) > (SIZE_MAX - (cnst)))
|
||||
#define notok2mul(max, val, c) (((val) != 0) && ((c) != 0) && \
|
||||
(((max) / (c)) < (val)))
|
||||
#define notok2add(max, val, c) ((val) > ((max) - (c)))
|
||||
#define notoktomul(val, cnst) notok2mul(SIZE_MAX, (val), (cnst))
|
||||
#define notoktoadd(val, cnst) notok2add(SIZE_MAX, (val), (cnst))
|
||||
#define checkoktoadd(val, cnst) do { \
|
||||
if (notoktoadd((val), (cnst))) \
|
||||
internal_errorf(Tintovfl, (size_t)(val), \
|
||||
|
12
shf.c
12
shf.c
@ -24,7 +24,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.46 2012/07/01 15:55:00 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.47 2012/10/03 16:16:15 tg Exp $");
|
||||
|
||||
/* flags to shf_emptybuf() */
|
||||
#define EB_READSW 0x01 /* about to switch to reading */
|
||||
@ -842,12 +842,16 @@ shf_vfprintf(struct shf *shf, const char *fmt, va_list args)
|
||||
continue;
|
||||
}
|
||||
if (ksh_isdigit(c)) {
|
||||
bool overflowed = false;
|
||||
|
||||
tmp = c - '0';
|
||||
while (c = *fmt++, ksh_isdigit(c))
|
||||
while (c = *fmt++, ksh_isdigit(c)) {
|
||||
if (notok2mul(2147483647, tmp, 10))
|
||||
overflowed = true;
|
||||
tmp = tmp * 10 + c - '0';
|
||||
}
|
||||
--fmt;
|
||||
if (tmp < 0)
|
||||
/* overflow? */
|
||||
if (overflowed)
|
||||
tmp = 0;
|
||||
if (flags & FL_DOT)
|
||||
precision = tmp;
|
||||
|
Loading…
x
Reference in New Issue
Block a user