diff options
author | unknown <monty@mysql.com> | 2005-04-29 17:03:34 +0300 |
---|---|---|
committer | unknown <monty@mysql.com> | 2005-04-29 17:03:34 +0300 |
commit | 97b0821462cd21d5051b3264f072ea3d4a7a8d7f (patch) | |
tree | 0caae1ad50324015508cbda7e4ef72f92ca69c25 /mysys/default.c | |
parent | 2a69f0049b3fd6e765e2f58a81ea7b5e3d5dcd1c (diff) | |
download | mariadb-git-97b0821462cd21d5051b3264f072ea3d4a7a8d7f.tar.gz |
CAST(string_argument AS UNSIGNED) didn't work for big integers above the signed range. (Bug #7036)
Produce warnings of wrong cast of strings to signed/unsigned.
Don't block not resolved IP's if DNS server is down (Bug #8467)
Fix compiler problems with MinGW (Bug #8872)
configure.in:
Fix compiler problems with MinGW (Bug #8872)
include/config-win.h:
Fix compiler problems with MinGW (Bug #8872)
include/my_global.h:
Fix compiler problems with MinGW (Bug #8872)
mysql-test/r/cast.result:
Test for cast to signed/unsigned outside of range (Bug #7036)
mysql-test/t/cast.test:
Test for cast to signed/unsigned outside of range (Bug #7036)
mysys/default.c:
Cleanup (combine identical code).
Done mainly by Jani
sql/field.h:
Added cast_to_int_type() to ensure that enums are casted as numbers
sql/hostname.cc:
Don't block not resolved IP's if DNS server is down (Bug #8467)
sql/item.h:
Added cast_to_int_type() to ensure that enums are casted as numbers
sql/item_func.cc:
CAST(string_argument AS UNSIGNED) didn't work for big integers above the
signed range. (Bug #7036)
Produce warnings of wrong cast of strings to signed/unsigned
sql/item_func.h:
CAST(string_argument AS UNSIGNED) didn't work for big integers above the
signed range. (Bug #7036)
Diffstat (limited to 'mysys/default.c')
-rw-r--r-- | mysys/default.c | 103 |
1 files changed, 58 insertions, 45 deletions
diff --git a/mysys/default.c b/mysys/default.c index 4ee2041bc39..bf23502389d 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -319,6 +319,56 @@ static int search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc, /* + Skip over keyword and get argument after keyword + + SYNOPSIS + get_argument() + keyword Include directive keyword + kwlen Length of keyword + ptr Pointer to the keword in the line under process + line line number + + RETURN + 0 error + # Returns pointer to the argument after the keyword. +*/ + +static char *get_argument(const char *keyword, uint kwlen, + char *ptr, char *name, uint line) +{ + char *end; + + /* Skip over "include / includedir keyword" and following whitespace */ + + for (ptr+= kwlen - 1; + my_isspace(&my_charset_latin1, ptr[0]); + ptr++) + {} + + /* + Trim trailing whitespace from directory name + The -1 below is for the newline added by fgets() + Note that my_isspace() is true for \r and \n + */ + for (end= ptr + strlen(ptr) - 1; + my_isspace(&my_charset_latin1, *(end - 1)); + end--) + {} + end[0]= 0; /* Cut off end space */ + + /* Print error msg if there is nothing after !include* directive */ + if (end <= ptr) + { + fprintf(stderr, + "error: Wrong '!%s' directive in config file: %s at line %d\n", + keyword, name, line); + return 0; + } + return ptr; +} + + +/* Open a configuration file (if exists) and read given options from it SYNOPSIS @@ -426,31 +476,10 @@ static int search_default_file_with_ext(DYNAMIC_ARRAY *args, MEM_ROOT *alloc, sizeof(includedir_keyword) - 1)) && my_isspace(&my_charset_latin1, ptr[sizeof(includedir_keyword) - 1])) { - /* skip over "includedir" and following whitespace */ - for (ptr+= sizeof(includedir_keyword) - 1; - my_isspace(&my_charset_latin1, ptr[0]); ptr++) - {} - - /* - trim trailing whitespace from directory name - The -1 below is for the newline added by fgets() - Note that my_isspace() is true for \r and \n - */ - for (end= ptr + strlen(ptr) - 1; - my_isspace(&my_charset_latin1, *(end - 1)); - end--) - {} - end[0]= 0; - - /* print error msg if there is nothing after !includedir directive */ - if (end <= ptr) - { - fprintf(stderr, - "error: Wrong !includedir directive in config " - "file: %s at line %d\n", - name,line); - goto err; - } + if (!(ptr= get_argument(includedir_keyword, + sizeof(includedir_keyword), + ptr, name, line))) + goto err; if (!(search_dir= my_dir(ptr, MYF(MY_WME)))) goto err; @@ -486,26 +515,10 @@ static int search_default_file_with_ext(DYNAMIC_ARRAY *args, MEM_ROOT *alloc, else if ((!strncmp(ptr, include_keyword, sizeof(include_keyword) - 1)) && my_isspace(&my_charset_latin1, ptr[sizeof(include_keyword)-1])) { - /* skip over `include' and following whitespace */ - for (ptr+= sizeof(include_keyword) - 1; - my_isspace(&my_charset_latin1, ptr[0]); ptr++) - {} - - /* trim trailing whitespace from filename */ - for (end= ptr + strlen(ptr) - 1; - my_isspace(&my_charset_latin1, *(end - 1)); - end--) - {} - end[0]= 0; - - if (end <= ptr) - { - fprintf(stderr, - "error: Wrong !include directive in config " - "file: %s at line %d\n", - name,line); - goto err; - } + if (!(ptr= get_argument(include_keyword, + sizeof(include_keyword), ptr, + name, line))) + goto err; search_default_file_with_ext(args, alloc, "", "", ptr, group, recursion_level + 1); |