Commit 9e713511 authored by monty@mysql.com's avatar monty@mysql.com

Merge bk-internal.mysql.com:/home/bk/mysql-4.1

into mysql.com:/home/my/mysql-4.1
parents be8f7641 939ea71e
...@@ -1851,7 +1851,8 @@ AC_CHECK_FUNCS(alarm bcmp bfill bmove bzero chsize cuserid fchmod fcntl \ ...@@ -1851,7 +1851,8 @@ AC_CHECK_FUNCS(alarm bcmp bfill bmove bzero chsize cuserid fchmod fcntl \
# isinf() could be a function or a macro (HPUX) # isinf() could be a function or a macro (HPUX)
AC_MSG_CHECKING(for isinf with <math.h>) AC_MSG_CHECKING(for isinf with <math.h>)
AC_TRY_LINK([#include <math.h>], [float f = 0.0; isinf(f)], AC_TRY_LINK([#include <math.h>], [float f = 0.0; isinf(f)],
AC_MSG_RESULT(yes) AC_DEFINE(HAVE_ISINF,,[isinf() macro or function]), AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_ISINF,,[isinf() macro or function]),
AC_MSG_RESULT(no)) AC_MSG_RESULT(no))
CFLAGS="$ORG_CFLAGS" CFLAGS="$ORG_CFLAGS"
......
...@@ -49,7 +49,7 @@ static struct my_option my_long_options[] = ...@@ -49,7 +49,7 @@ static struct my_option my_long_options[] =
{"help", '?', "Display this help message and exit.", {"help", '?', "Display this help message and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Increase the output level", {"verbose", 'v', "Increase the output level",
0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.", {"version", 'V', "Output version information and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
......
...@@ -674,7 +674,7 @@ typedef SOCKET_SIZE_TYPE size_socket; ...@@ -674,7 +674,7 @@ typedef SOCKET_SIZE_TYPE size_socket;
#define FLT_MAX ((float)3.40282346638528860e+38) #define FLT_MAX ((float)3.40282346638528860e+38)
#endif #endif
#ifndef HAVE_ISINF #if !defined(HAVE_ISINF) && !defined(isinf)
#define isinf(X) 0 #define isinf(X) 0
#endif #endif
......
...@@ -62,10 +62,4 @@ int cli_read_change_user_result(MYSQL *mysql, char *buff, const char *passwd); ...@@ -62,10 +62,4 @@ int cli_read_change_user_result(MYSQL *mysql, char *buff, const char *passwd);
#ifdef EMBEDDED_LIBRARY #ifdef EMBEDDED_LIBRARY
int init_embedded_server(int argc, char **argv, char **groups); int init_embedded_server(int argc, char **argv, char **groups);
void end_embedded_server(); void end_embedded_server();
#else
/* Prevent warnings of unused parameters */
#define init_embedded_server(a,b,c) ((void)a, (void)b, (void)c, 0)
#define end_embedded_server()
#endif /*EMBEDDED_LIBRARY*/ #endif /*EMBEDDED_LIBRARY*/
...@@ -113,7 +113,9 @@ static my_bool org_my_init_done= 0; ...@@ -113,7 +113,9 @@ static my_bool org_my_init_done= 0;
1 could not initialize environment (out of memory or thread keys) 1 could not initialize environment (out of memory or thread keys)
*/ */
int STDCALL mysql_server_init(int argc, char **argv, char **groups) int STDCALL mysql_server_init(int argc __attribute__((unused)),
char **argv __attribute__((unused)),
char **groups __attribute__((unused)))
{ {
int result= 0; int result= 0;
if (!mysql_client_init) if (!mysql_client_init)
...@@ -152,7 +154,9 @@ int STDCALL mysql_server_init(int argc, char **argv, char **groups) ...@@ -152,7 +154,9 @@ int STDCALL mysql_server_init(int argc, char **argv, char **groups)
#if defined(SIGPIPE) && !defined(__WIN__) #if defined(SIGPIPE) && !defined(__WIN__)
(void) signal(SIGPIPE, SIG_IGN); (void) signal(SIGPIPE, SIG_IGN);
#endif #endif
#ifdef EMBEDDED_LIBRARY
result= init_embedded_server(argc, argv, groups); result= init_embedded_server(argc, argv, groups);
#endif
} }
#ifdef THREAD #ifdef THREAD
else else
...@@ -164,7 +168,9 @@ int STDCALL mysql_server_init(int argc, char **argv, char **groups) ...@@ -164,7 +168,9 @@ int STDCALL mysql_server_init(int argc, char **argv, char **groups)
void STDCALL mysql_server_end() void STDCALL mysql_server_end()
{ {
#ifdef EMBEDDED_LIBRARY
end_embedded_server(); end_embedded_server();
#endif
/* If library called my_init(), free memory allocated by it */ /* If library called my_init(), free memory allocated by it */
if (!org_my_init_done) if (!org_my_init_done)
{ {
...@@ -4055,7 +4061,9 @@ static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data) ...@@ -4055,7 +4061,9 @@ static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data)
MYSQL_FIELD *field; MYSQL_FIELD *field;
uchar *null_ptr, bit; uchar *null_ptr, bit;
uchar *row= (uchar*) data->data; uchar *row= (uchar*) data->data;
#ifndef DBUG_OFF
uchar *row_end= row + data->length; uchar *row_end= row + data->length;
#endif
null_ptr= row; null_ptr= row;
row+= (stmt->field_count+9)/8; /* skip null bits */ row+= (stmt->field_count+9)/8; /* skip null bits */
......
...@@ -639,14 +639,21 @@ name ...@@ -639,14 +639,21 @@ name
aaaaaaaaaaccccc aaaaaaaaaaccccc
bbbbbbbbbbddddd bbbbbbbbbbddddd
drop table t1, t2; drop table t1, t2;
create table t1 (c1 INT); create table t1 (c1 INT, c2 INT UNSIGNED);
insert into t1 (c1) values ('21474836461'); insert into t1 values ('21474836461','21474836461');
Warnings: Warnings:
Warning 1265 Data truncated for column 'c1' at row 1 Warning 1265 Data truncated for column 'c1' at row 1
Warning 1265 Data truncated for column 'c2' at row 1
insert into t1 values ('-21474836461','-21474836461');
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
Warning 1265 Data truncated for column 'c2' at row 1
show warnings; show warnings;
Level Code Message Level Code Message
Warning 1265 Data truncated for column 'c1' at row 1 Warning 1265 Data truncated for column 'c1' at row 1
Warning 1265 Data truncated for column 'c2' at row 1
select * from t1; select * from t1;
c1 c1 c2
2147483647 2147483647 4294967295
-2147483648 0
drop table t1; drop table t1;
...@@ -88,11 +88,9 @@ create table t2 (p int primary key, i int, a char(10), key k1(i), key k2(a)); ...@@ -88,11 +88,9 @@ create table t2 (p int primary key, i int, a char(10), key k1(i), key k2(a));
show status like 'key_blocks_used'; show status like 'key_blocks_used';
Variable_name Value Variable_name Value
Key_blocks_used 0 Key_blocks_used 0
show status like 'The below may fail on 64-bit systems (ingo)';
Variable_name Value
show status like 'key_blocks_unused'; show status like 'key_blocks_unused';
Variable_name Value Variable_name Value
Key_blocks_unused 1812 Key_blocks_unused KEY_BLOCKS_UNUSED
insert into t1 values (1, 'qqqq'), (11, 'yyyy'); insert into t1 values (1, 'qqqq'), (11, 'yyyy');
insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'), insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'),
(3, 1, 'yyyy'), (4, 3, 'zzzz'); (3, 1, 'yyyy'), (4, 3, 'zzzz');
...@@ -111,11 +109,9 @@ update t2 set i=2 where i=1; ...@@ -111,11 +109,9 @@ update t2 set i=2 where i=1;
show status like 'key_blocks_used'; show status like 'key_blocks_used';
Variable_name Value Variable_name Value
Key_blocks_used 4 Key_blocks_used 4
show status like 'The below may fail on 64-bit systems (ingo)';
Variable_name Value
show status like 'key_blocks_unused'; show status like 'key_blocks_unused';
Variable_name Value Variable_name Value
Key_blocks_unused 1808 Key_blocks_unused KEY_BLOCKS_UNUSED
cache index t1 key (`primary`) in keycache1; cache index t1 key (`primary`) in keycache1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK test.t1 assign_to_keycache status OK
...@@ -275,11 +271,9 @@ drop table t1,t2,t3; ...@@ -275,11 +271,9 @@ drop table t1,t2,t3;
show status like 'key_blocks_used'; show status like 'key_blocks_used';
Variable_name Value Variable_name Value
Key_blocks_used 4 Key_blocks_used 4
show status like 'The below may fail on 64-bit systems (ingo)';
Variable_name Value
show status like 'key_blocks_unused'; show status like 'key_blocks_unused';
Variable_name Value Variable_name Value
Key_blocks_unused 1812 Key_blocks_unused KEY_BLOCKS_UNUSED
set global keycache2.key_buffer_size=0; set global keycache2.key_buffer_size=0;
set global keycache3.key_buffer_size=100; set global keycache3.key_buffer_size=100;
set global keycache3.key_buffer_size=0; set global keycache3.key_buffer_size=0;
...@@ -385,8 +385,9 @@ drop table t1, t2; ...@@ -385,8 +385,9 @@ drop table t1, t2;
# Test case for conversion of long string value to integer (Bug #3472) # Test case for conversion of long string value to integer (Bug #3472)
# #
create table t1 (c1 INT); create table t1 (c1 INT, c2 INT UNSIGNED);
insert into t1 (c1) values ('21474836461'); insert into t1 values ('21474836461','21474836461');
insert into t1 values ('-21474836461','-21474836461');
show warnings; show warnings;
select * from t1; select * from t1;
drop table t1; drop table t1;
...@@ -67,8 +67,12 @@ create table t1 (p int primary key, a char(10)) delay_key_write=1; ...@@ -67,8 +67,12 @@ create table t1 (p int primary key, a char(10)) delay_key_write=1;
create table t2 (p int primary key, i int, a char(10), key k1(i), key k2(a)); create table t2 (p int primary key, i int, a char(10), key k1(i), key k2(a));
show status like 'key_blocks_used'; show status like 'key_blocks_used';
show status like 'The below may fail on 64-bit systems (ingo)';
show status like 'key_blocks_unused'; # This may fail on 64-bit systems (ingo) # Following results differs on 64 and 32 bit systems because of different
# pointer sizes, which takes up different amount of space in key cache
--replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED
show status like 'key_blocks_unused';
insert into t1 values (1, 'qqqq'), (11, 'yyyy'); insert into t1 values (1, 'qqqq'), (11, 'yyyy');
insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'), insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'),
...@@ -80,8 +84,8 @@ update t1 set p=2 where p=1; ...@@ -80,8 +84,8 @@ update t1 set p=2 where p=1;
update t2 set i=2 where i=1; update t2 set i=2 where i=1;
show status like 'key_blocks_used'; show status like 'key_blocks_used';
show status like 'The below may fail on 64-bit systems (ingo)'; --replace_result 1808 KEY_BLOCKS_UNUSED 1789 KEY_BLOCKS_UNUSED
show status like 'key_blocks_unused'; # This may fail on 64-bit systems (ingo) show status like 'key_blocks_unused';
cache index t1 key (`primary`) in keycache1; cache index t1 key (`primary`) in keycache1;
...@@ -142,8 +146,8 @@ cache index t1,t2 in default; ...@@ -142,8 +146,8 @@ cache index t1,t2 in default;
drop table t1,t2,t3; drop table t1,t2,t3;
show status like 'key_blocks_used'; show status like 'key_blocks_used';
show status like 'The below may fail on 64-bit systems (ingo)'; --replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED
show status like 'key_blocks_unused'; # This may fail on 64-bit systems (ingo) show status like 'key_blocks_unused';
# Cleanup # Cleanup
# We don't reset keycache2 as we want to ensure that mysqld will reset it # We don't reset keycache2 as we want to ensure that mysqld will reset it
......
...@@ -503,6 +503,22 @@ Item *Item_field::get_tmp_table_item(THD *thd) ...@@ -503,6 +503,22 @@ Item *Item_field::get_tmp_table_item(THD *thd)
} }
/*
Create an item from a string we KNOW points to a valid longlong/ulonglong
end \0 terminated number string
*/
Item_int::Item_int(const char *str_arg, uint length)
{
char *end_ptr= (char*) str_arg + length;
int error;
value= my_strtoll10(str_arg, &end_ptr, &error);
max_length= (uint) (end_ptr - str_arg);
name= (char*) str_arg;
fixed= 1;
}
String *Item_int::val_str(String *str) String *Item_int::val_str(String *str)
{ {
// following assert is redundant, because fixed=1 assigned in constructor // following assert is redundant, because fixed=1 assigned in constructor
...@@ -519,6 +535,13 @@ void Item_int::print(String *str) ...@@ -519,6 +535,13 @@ void Item_int::print(String *str)
} }
Item_uint::Item_uint(const char *str_arg, uint length):
Item_int(str_arg, length)
{
unsigned_flag= 1;
}
String *Item_uint::val_str(String *str) String *Item_uint::val_str(String *str)
{ {
// following assert is redundant, because fixed=1 assigned in constructor // following assert is redundant, because fixed=1 assigned in constructor
......
...@@ -456,10 +456,7 @@ public: ...@@ -456,10 +456,7 @@ public:
#endif #endif
Item_int(const char *str_arg,longlong i,uint length) :value(i) Item_int(const char *str_arg,longlong i,uint length) :value(i)
{ max_length=length; name=(char*) str_arg; fixed= 1; } { max_length=length; name=(char*) str_arg; fixed= 1; }
Item_int(const char *str_arg) : Item_int(const char *str_arg, uint length=64);
value(str_arg[0] == '-' ? strtoll(str_arg,(char**) 0,10) :
(longlong) strtoull(str_arg,(char**) 0,10))
{ max_length= (uint) strlen(str_arg); name=(char*) str_arg; fixed= 1; }
enum Type type() const { return INT_ITEM; } enum Type type() const { return INT_ITEM; }
enum Item_result result_type () const { return INT_RESULT; } enum Item_result result_type () const { return INT_RESULT; }
enum_field_types field_type() const { return MYSQL_TYPE_LONGLONG; } enum_field_types field_type() const { return MYSQL_TYPE_LONGLONG; }
...@@ -479,9 +476,7 @@ public: ...@@ -479,9 +476,7 @@ public:
class Item_uint :public Item_int class Item_uint :public Item_int
{ {
public: public:
Item_uint(const char *str_arg, uint length) : Item_uint(const char *str_arg, uint length);
Item_int(str_arg, (longlong) strtoull(str_arg, (char**) 0,10), length)
{ unsigned_flag= 1; }
Item_uint(uint32 i) :Item_int((longlong) i, 10) Item_uint(uint32 i) :Item_int((longlong) i, 10)
{ unsigned_flag= 1; } { unsigned_flag= 1; }
double val() double val()
......
...@@ -735,8 +735,12 @@ class Item_func_group_concat : public Item_sum ...@@ -735,8 +735,12 @@ class Item_func_group_concat : public Item_sum
} }
longlong val_int() longlong val_int()
{ {
String *res; res=val_str(&str_value); String *res;
return res ? strtoll(res->c_ptr(),(char**) 0,10) : (longlong) 0; char *end_ptr;
int error;
res= val_str(&str_value);
end_ptr= (char*) res->ptr()+ res->length();
return res ? my_strtoll10(res->ptr(), &end_ptr, &error) : (longlong) 0;
} }
String* val_str(String* str); String* val_str(String* str);
Item *copy_or_same(THD* thd); Item *copy_or_same(THD* thd);
......
...@@ -1666,7 +1666,7 @@ bool Item_date_add_interval::get_date(TIME *ltime, uint fuzzy_date) ...@@ -1666,7 +1666,7 @@ bool Item_date_add_interval::get_date(TIME *ltime, uint fuzzy_date)
days--; days--;
sec+= 3600*LL(24); sec+= 3600*LL(24);
} }
ltime->second_part= microseconds; ltime->second_part= (uint) microseconds;
ltime->second= (uint) (sec % 60); ltime->second= (uint) (sec % 60);
ltime->minute= (uint) (sec/60 % 60); ltime->minute= (uint) (sec/60 % 60);
ltime->hour= (uint) (sec/3600); ltime->hour= (uint) (sec/3600);
......
...@@ -235,9 +235,9 @@ long my_strntol_8bit(CHARSET_INFO *cs, ...@@ -235,9 +235,9 @@ long my_strntol_8bit(CHARSET_INFO *cs,
char **endptr, int *err) char **endptr, int *err)
{ {
int negative; int negative;
register ulong cutoff; register uint32 cutoff;
register unsigned int cutlim; register unsigned int cutlim;
register ulong i; register uint32 i;
register const char *s; register const char *s;
register unsigned char c; register unsigned char c;
const char *save, *e; const char *save, *e;
...@@ -297,8 +297,8 @@ long my_strntol_8bit(CHARSET_INFO *cs, ...@@ -297,8 +297,8 @@ long my_strntol_8bit(CHARSET_INFO *cs,
#endif #endif
save = s; save = s;
cutoff = ((ulong)~0L) / (unsigned long int) base; cutoff = ((uint32)~0L) / (uint32) base;
cutlim = (uint) (((ulong)~0L) % (unsigned long int) base); cutlim = (uint) (((uint32)~0L) % (uint32) base);
overflow = 0; overflow = 0;
i = 0; i = 0;
...@@ -318,7 +318,7 @@ long my_strntol_8bit(CHARSET_INFO *cs, ...@@ -318,7 +318,7 @@ long my_strntol_8bit(CHARSET_INFO *cs,
overflow = 1; overflow = 1;
else else
{ {
i *= (ulong) base; i *= (uint32) base;
i += c; i += c;
} }
} }
...@@ -331,16 +331,16 @@ long my_strntol_8bit(CHARSET_INFO *cs, ...@@ -331,16 +331,16 @@ long my_strntol_8bit(CHARSET_INFO *cs,
if (negative) if (negative)
{ {
if (i > (ulong) LONG_MIN) if (i > (uint32) INT_MIN32)
overflow = 1; overflow = 1;
} }
else if (i > (ulong) LONG_MAX) else if (i > INT_MAX32)
overflow = 1; overflow = 1;
if (overflow) if (overflow)
{ {
err[0]= ERANGE; err[0]= ERANGE;
return negative ? LONG_MIN : LONG_MAX; return negative ? INT_MIN32 : INT_MAX32;
} }
return (negative ? -((long) i) : (long) i); return (negative ? -((long) i) : (long) i);
...@@ -358,9 +358,9 @@ ulong my_strntoul_8bit(CHARSET_INFO *cs, ...@@ -358,9 +358,9 @@ ulong my_strntoul_8bit(CHARSET_INFO *cs,
char **endptr, int *err) char **endptr, int *err)
{ {
int negative; int negative;
register ulong cutoff; register uint32 cutoff;
register unsigned int cutlim; register unsigned int cutlim;
register ulong i; register uint32 i;
register const char *s; register const char *s;
register unsigned char c; register unsigned char c;
const char *save, *e; const char *save, *e;
...@@ -419,8 +419,8 @@ ulong my_strntoul_8bit(CHARSET_INFO *cs, ...@@ -419,8 +419,8 @@ ulong my_strntoul_8bit(CHARSET_INFO *cs,
#endif #endif
save = s; save = s;
cutoff = ((ulong)~0L) / (unsigned long int) base; cutoff = ((uint32)~0L) / (uint32) base;
cutlim = (uint) (((ulong)~0L) % (unsigned long int) base); cutlim = (uint) (((uint32)~0L) % (uint32) base);
overflow = 0; overflow = 0;
i = 0; i = 0;
...@@ -440,7 +440,7 @@ ulong my_strntoul_8bit(CHARSET_INFO *cs, ...@@ -440,7 +440,7 @@ ulong my_strntoul_8bit(CHARSET_INFO *cs,
overflow = 1; overflow = 1;
else else
{ {
i *= (ulong) base; i *= (uint32) base;
i += c; i += c;
} }
} }
...@@ -454,7 +454,7 @@ ulong my_strntoul_8bit(CHARSET_INFO *cs, ...@@ -454,7 +454,7 @@ ulong my_strntoul_8bit(CHARSET_INFO *cs,
if (overflow) if (overflow)
{ {
err[0]= ERANGE; err[0]= ERANGE;
return ((ulong)~0L); return (~(uint32) 0);
} }
return (negative ? -((long) i) : (long) i); return (negative ? -((long) i) : (long) i);
......
...@@ -406,8 +406,8 @@ long my_strntol_ucs2(CHARSET_INFO *cs, ...@@ -406,8 +406,8 @@ long my_strntol_ucs2(CHARSET_INFO *cs,
int cnv; int cnv;
my_wc_t wc; my_wc_t wc;
register unsigned int cutlim; register unsigned int cutlim;
register ulong cutoff; register uint32 cutoff;
register ulong res; register uint32 res;
register const uchar *s= (const uchar*) nptr; register const uchar *s= (const uchar*) nptr;
register const uchar *e= (const uchar*) nptr+l; register const uchar *e= (const uchar*) nptr+l;
const uchar *save; const uchar *save;
...@@ -446,8 +446,8 @@ bs: ...@@ -446,8 +446,8 @@ bs:
overflow = 0; overflow = 0;
res = 0; res = 0;
save = s; save = s;
cutoff = ((ulong)~0L) / (unsigned long int) base; cutoff = ((uint32)~0L) / (uint32) base;
cutlim = (uint) (((ulong)~0L) % (unsigned long int) base); cutlim = (uint) (((uint32)~0L) % (uint32) base);
do { do {
if ((cnv=cs->cset->mb_wc(cs,&wc,s,e))>0) if ((cnv=cs->cset->mb_wc(cs,&wc,s,e))>0)
...@@ -467,7 +467,7 @@ bs: ...@@ -467,7 +467,7 @@ bs:
overflow = 1; overflow = 1;
else else
{ {
res *= (ulong) base; res *= (uint32) base;
res += wc; res += wc;
} }
} }
...@@ -496,16 +496,16 @@ bs: ...@@ -496,16 +496,16 @@ bs:
if (negative) if (negative)
{ {
if (res > (ulong) LONG_MIN) if (res > (uint32) INT_MIN32)
overflow = 1; overflow = 1;
} }
else if (res > (ulong) LONG_MAX) else if (res > INT_MAX32)
overflow = 1; overflow = 1;
if (overflow) if (overflow)
{ {
err[0]=ERANGE; err[0]=ERANGE;
return negative ? LONG_MIN : LONG_MAX; return negative ? INT_MIN32 : INT_MAX32;
} }
return (negative ? -((long) res) : (long) res); return (negative ? -((long) res) : (long) res);
...@@ -521,8 +521,8 @@ ulong my_strntoul_ucs2(CHARSET_INFO *cs, ...@@ -521,8 +521,8 @@ ulong my_strntoul_ucs2(CHARSET_INFO *cs,
int cnv; int cnv;
my_wc_t wc; my_wc_t wc;
register unsigned int cutlim; register unsigned int cutlim;
register ulong cutoff; register uint32 cutoff;
register ulong res; register uint32 res;
register const uchar *s= (const uchar*) nptr; register const uchar *s= (const uchar*) nptr;
register const uchar *e= (const uchar*) nptr+l; register const uchar *e= (const uchar*) nptr+l;
const uchar *save; const uchar *save;
...@@ -561,8 +561,8 @@ bs: ...@@ -561,8 +561,8 @@ bs:
overflow = 0; overflow = 0;
res = 0; res = 0;
save = s; save = s;
cutoff = ((ulong)~0L) / (unsigned long int) base; cutoff = ((uint32)~0L) / (uint32) base;
cutlim = (uint) (((ulong)~0L) % (unsigned long int) base); cutlim = (uint) (((uint32)~0L) % (uint32) base);
do do
{ {
...@@ -583,7 +583,7 @@ bs: ...@@ -583,7 +583,7 @@ bs:
overflow = 1; overflow = 1;
else else
{ {
res *= (ulong) base; res *= (uint32) base;
res += wc; res += wc;
} }
} }
...@@ -613,11 +613,10 @@ bs: ...@@ -613,11 +613,10 @@ bs:
if (overflow) if (overflow)
{ {
err[0]=(ERANGE); err[0]=(ERANGE);
return ((ulong)~0L); return (~(uint32) 0);
} }
return (negative ? -((long) res) : (long) res); return (negative ? -((long) res) : (long) res);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment