diff options
author | unknown <monty@mysql.com> | 2004-05-07 01:43:17 +0300 |
---|---|---|
committer | unknown <monty@mysql.com> | 2004-05-07 01:43:17 +0300 |
commit | f3544f3c5dd137e125a980c151e53ab71b23aba5 (patch) | |
tree | f2717f686b72c32ff82659eaf22da3a53b8deb1a /strings | |
parent | ffdf46a58ac73ce0862f1cf632e4254170ed6116 (diff) | |
download | mariadb-git-f3544f3c5dd137e125a980c151e53ab71b23aba5.tar.gz |
Portability fixes
Change strtoll -> my_strtoll10()
Fixed bug in my_strntoul() and my_strntol() where we got different values on 32 and 64 bit systems (Bug #3472)
configure.in:
Fixed problem on IRIX64 (One can't have AC_MSG_RESULT on same row as AC_DEFINE
extra/my_print_defaults.c:
Fixed wrong definition for 'verbose'
include/my_global.h:
Portability fix (IRIX64)
libmysql/client_settings.h:
Remove compiler warnings
libmysql/libmysql.c:
Remove compiler warnings
mysql-test/r/func_str.result:
Updated results
mysql-test/r/key_cache.result:
Updated results to not depend on key_blocks_unused
mysql-test/t/func_str.test:
More test of long overflow
mysql-test/t/key_cache.test:
Updated results to not depend on key_blocks_unused
sql/item.cc:
Portability fix (don't use strtoll())
sql/item.h:
Portability fix (don't use strtoll())
sql/item_sum.h:
Portability fix (don't use strtoll())
sql/item_timefunc.cc:
Fixed compiler warning
strings/ctype-simple.c:
Fixed bug in my_strntoul() and my_strntol() where we got different values on 32 and 64 bit systems
strings/ctype-ucs2.c:
Fixed bug in my_strntoul() and my_strntol() where we got different values on 32 and 64 bit systems
Diffstat (limited to 'strings')
-rw-r--r-- | strings/ctype-simple.c | 28 | ||||
-rw-r--r-- | strings/ctype-ucs2.c | 29 |
2 files changed, 28 insertions, 29 deletions
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index c8eb3c07a3f..ba1fc1c424a 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -235,9 +235,9 @@ long my_strntol_8bit(CHARSET_INFO *cs, char **endptr, int *err) { int negative; - register ulong cutoff; + register uint32 cutoff; register unsigned int cutlim; - register ulong i; + register uint32 i; register const char *s; register unsigned char c; const char *save, *e; @@ -297,8 +297,8 @@ long my_strntol_8bit(CHARSET_INFO *cs, #endif save = s; - cutoff = ((ulong)~0L) / (unsigned long int) base; - cutlim = (uint) (((ulong)~0L) % (unsigned long int) base); + cutoff = ((uint32)~0L) / (uint32) base; + cutlim = (uint) (((uint32)~0L) % (uint32) base); overflow = 0; i = 0; @@ -318,7 +318,7 @@ long my_strntol_8bit(CHARSET_INFO *cs, overflow = 1; else { - i *= (ulong) base; + i *= (uint32) base; i += c; } } @@ -331,16 +331,16 @@ long my_strntol_8bit(CHARSET_INFO *cs, if (negative) { - if (i > (ulong) LONG_MIN) + if (i > (uint32) INT_MIN32) overflow = 1; } - else if (i > (ulong) LONG_MAX) + else if (i > INT_MAX32) overflow = 1; if (overflow) { err[0]= ERANGE; - return negative ? LONG_MIN : LONG_MAX; + return negative ? INT_MIN32 : INT_MAX32; } return (negative ? -((long) i) : (long) i); @@ -358,9 +358,9 @@ ulong my_strntoul_8bit(CHARSET_INFO *cs, char **endptr, int *err) { int negative; - register ulong cutoff; + register uint32 cutoff; register unsigned int cutlim; - register ulong i; + register uint32 i; register const char *s; register unsigned char c; const char *save, *e; @@ -419,8 +419,8 @@ ulong my_strntoul_8bit(CHARSET_INFO *cs, #endif save = s; - cutoff = ((ulong)~0L) / (unsigned long int) base; - cutlim = (uint) (((ulong)~0L) % (unsigned long int) base); + cutoff = ((uint32)~0L) / (uint32) base; + cutlim = (uint) (((uint32)~0L) % (uint32) base); overflow = 0; i = 0; @@ -440,7 +440,7 @@ ulong my_strntoul_8bit(CHARSET_INFO *cs, overflow = 1; else { - i *= (ulong) base; + i *= (uint32) base; i += c; } } @@ -454,7 +454,7 @@ ulong my_strntoul_8bit(CHARSET_INFO *cs, if (overflow) { err[0]= ERANGE; - return ((ulong)~0L); + return (~(uint32) 0); } return (negative ? -((long) i) : (long) i); diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index 99d97a9614b..59c1706fd26 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -406,8 +406,8 @@ long my_strntol_ucs2(CHARSET_INFO *cs, int cnv; my_wc_t wc; register unsigned int cutlim; - register ulong cutoff; - register ulong res; + register uint32 cutoff; + register uint32 res; register const uchar *s= (const uchar*) nptr; register const uchar *e= (const uchar*) nptr+l; const uchar *save; @@ -446,8 +446,8 @@ bs: overflow = 0; res = 0; save = s; - cutoff = ((ulong)~0L) / (unsigned long int) base; - cutlim = (uint) (((ulong)~0L) % (unsigned long int) base); + cutoff = ((uint32)~0L) / (uint32) base; + cutlim = (uint) (((uint32)~0L) % (uint32) base); do { if ((cnv=cs->cset->mb_wc(cs,&wc,s,e))>0) @@ -467,7 +467,7 @@ bs: overflow = 1; else { - res *= (ulong) base; + res *= (uint32) base; res += wc; } } @@ -496,16 +496,16 @@ bs: if (negative) { - if (res > (ulong) LONG_MIN) + if (res > (uint32) INT_MIN32) overflow = 1; } - else if (res > (ulong) LONG_MAX) + else if (res > INT_MAX32) overflow = 1; if (overflow) { err[0]=ERANGE; - return negative ? LONG_MIN : LONG_MAX; + return negative ? INT_MIN32 : INT_MAX32; } return (negative ? -((long) res) : (long) res); @@ -521,8 +521,8 @@ ulong my_strntoul_ucs2(CHARSET_INFO *cs, int cnv; my_wc_t wc; register unsigned int cutlim; - register ulong cutoff; - register ulong res; + register uint32 cutoff; + register uint32 res; register const uchar *s= (const uchar*) nptr; register const uchar *e= (const uchar*) nptr+l; const uchar *save; @@ -561,8 +561,8 @@ bs: overflow = 0; res = 0; save = s; - cutoff = ((ulong)~0L) / (unsigned long int) base; - cutlim = (uint) (((ulong)~0L) % (unsigned long int) base); + cutoff = ((uint32)~0L) / (uint32) base; + cutlim = (uint) (((uint32)~0L) % (uint32) base); do { @@ -583,7 +583,7 @@ bs: overflow = 1; else { - res *= (ulong) base; + res *= (uint32) base; res += wc; } } @@ -613,11 +613,10 @@ bs: if (overflow) { err[0]=(ERANGE); - return ((ulong)~0L); + return (~(uint32) 0); } return (negative ? -((long) res) : (long) res); - } |