From b5dc243e3d7b8864cc8165856a9b47cca754e8d2 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 25 Oct 2005 10:10:53 -0700 Subject: Fix incorrect casts in my_getopt code that capped the maximum of longlong options to the wrong value. (Bug #12925) mysql-test/t/mysql_client_test.test: Add parameter for testing getopt bug mysys/my_getopt.c: Remove incorrect and unnecessary casts tests/mysql_client_test.c: Add test case for Bug #12925 (my_getopt bug) --- mysys/my_getopt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mysys/my_getopt.c') diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 53e46932167..dfc3fb3d39c 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -689,10 +689,10 @@ static longlong getopt_ll(char *arg, const struct my_option *optp, int *err) ulonglong block_size= (optp->block_size ? (ulonglong) optp->block_size : 1L); num= eval_num_suffix(arg, err, (char*) optp->name); - if (num > 0 && (ulonglong) num > (ulonglong) (ulong) optp->max_value && + if (num > 0 && (ulonglong) num > (ulonglong) optp->max_value && optp->max_value) /* if max value is not set -> no upper limit */ - num= (longlong) (ulong) optp->max_value; - num= ((num - (longlong) optp->sub_size) / block_size); + num= (ulonglong) optp->max_value; + num= ((num - optp->sub_size) / block_size); num= (longlong) (num * block_size); return max(num, optp->min_value); } -- cgit v1.2.1