diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2016-07-27 01:52:04 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2016-07-27 01:52:04 +0000 |
commit | d438b20c13d558cc65271fdd17007c533cc06881 (patch) | |
tree | a652875b14930d76d1c0e1cbc28d1b3812ff52e5 /usr.bin/printf | |
parent | a8f9fd19d458f3bc77d7ef8db833fec8994a594a (diff) |
fix signed char extension bugs. from fade@cock.li. ok guenther.
As a personal remark, I'll add that it's not necessary to cast a value
to a function's return type. The compiler is happy to do that for you.
But such casts can hide warnings and bugs.
Diffstat (limited to 'usr.bin/printf')
-rw-r--r-- | usr.bin/printf/printf.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/printf/printf.c b/usr.bin/printf/printf.c index 73eb5b28cbb..c0a76f04859 100644 --- a/usr.bin/printf/printf.c +++ b/usr.bin/printf/printf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: printf.c,v 1.24 2015/10/09 01:37:08 deraadt Exp $ */ +/* $OpenBSD: printf.c,v 1.25 2016/07/27 01:52:03 tedu Exp $ */ /* * Copyright (c) 1989 The Regents of the University of California. @@ -439,7 +439,7 @@ getlong(void) return(0L); if (**gargv == '\"' || **gargv == '\'') - return (long) *((*gargv++)+1); + return (unsigned char) *((*gargv++)+1); errno = 0; val = strtol (*gargv, &ep, 0); @@ -457,7 +457,7 @@ getulong(void) return(0UL); if (**gargv == '\"' || **gargv == '\'') - return (unsigned long) *((*gargv++)+1); + return (unsigned char) *((*gargv++)+1); errno = 0; val = strtoul (*gargv, &ep, 0); @@ -475,7 +475,7 @@ getdouble(void) return(0.0); if (**gargv == '\"' || **gargv == '\'') - return (double) *((*gargv++)+1); + return (unsigned char) *((*gargv++)+1); errno = 0; val = strtod (*gargv, &ep); |