diff options
author | monty@mysql.com <> | 2004-01-20 00:15:01 +0100 |
---|---|---|
committer | monty@mysql.com <> | 2004-01-20 00:15:01 +0100 |
commit | b078d2df64e46a8fc4f4d266dccd7906e084d559 (patch) | |
tree | d20bcd6bae79e9d29ece05ef1bb92e9041747f39 /mysys | |
parent | 0eb607006879210b04278d0a961e28e72616645d (diff) | |
parent | eb0ae211c589ca767a464b47da2fda98fabce674 (diff) | |
download | mariadb-git-b078d2df64e46a8fc4f4d266dccd7906e084d559.tar.gz |
merge
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/charset.c | 16 | ||||
-rw-r--r-- | mysys/default.c | 3 | ||||
-rw-r--r-- | mysys/mf_iocache.c | 4 | ||||
-rw-r--r-- | mysys/my_getopt.c | 29 |
4 files changed, 41 insertions, 11 deletions
diff --git a/mysys/charset.c b/mysys/charset.c index fec0778213f..c0d8b183c17 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -131,7 +131,8 @@ static void simple_cs_init_functions(CHARSET_INFO *cs) cs->coll= &my_collation_8bit_simple_ci_handler; cs->cset= &my_charset_8bit_handler; - cs->mbmaxlen = 1; + cs->mbminlen= 1; + cs->mbmaxlen= 1; } @@ -273,6 +274,7 @@ static int simple_cs_copy_data(CHARSET_INFO *to, CHARSET_INFO *from) if (create_fromuni(to)) goto err; } + to->mbminlen= 1; to->mbmaxlen= 1; return 0; @@ -357,7 +359,7 @@ static int add_collation(CHARSET_INFO *cs) } -#define MAX_BUF 1024*16 +#define MY_MAX_ALLOWED_BUF 1024*1024 #define MY_CHARSET_INDEX "Index.xml" const char *charsets_dir= NULL; @@ -369,16 +371,19 @@ static my_bool my_read_charset_file(const char *filename, myf myflags) char *buf; int fd; uint len; + MY_STAT stat_info; - if (!(buf= (char *)my_malloc(MAX_BUF,myflags))) - return FALSE; + if (!my_stat(filename, &stat_info, MYF(MY_WME)) || + ((len= (uint)stat_info.st_size) > MY_MAX_ALLOWED_BUF) || + !(buf= (char *)my_malloc(len,myflags))) + return TRUE; if ((fd=my_open(filename,O_RDONLY,myflags)) < 0) { my_free(buf,myflags); return TRUE; } - len=read(fd,buf,MAX_BUF); + len=read(fd,buf,len); my_close(fd,myflags); if (my_parse_charset_xml(buf,len,add_collation)) @@ -543,6 +548,7 @@ static CHARSET_INFO *get_internal_charset(uint cs_number, myf flags) cs= (cs->state & MY_CS_AVAILABLE) ? cs : NULL; } pthread_mutex_unlock(&THR_LOCK_charset); + pthread_mutex_unlock(&THR_LOCK_charset); return cs; } diff --git a/mysys/default.c b/mysys/default.c index 3a751eb4e29..81e1fd06374 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -461,7 +461,8 @@ static char *remove_end_comment(char *ptr) else if (quote == *ptr) quote= 0; } - if (!quote && *ptr == '#') /* We are not inside a comment */ + /* We are not inside a comment */ + if (!quote && (*ptr == '#' || *ptr == ';')) { *ptr= 0; return ptr; diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c index b5c80d9482f..1dd3108e151 100644 --- a/mysys/mf_iocache.c +++ b/mysys/mf_iocache.c @@ -1175,8 +1175,8 @@ int _flush_io_cache(IO_CACHE *info, int need_append_buffer_lock) info IO_CACHE Handle to free NOTES - It's currently safe to call this if one has called io_cache_init() - on the 'info' object, even if io_cache_init() failed. + It's currently safe to call this if one has called init_io_cache() + on the 'info' object, even if init_io_cache() failed. This function is also safe to call twice with the same handle. RETURN diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 76f8f6bf852..b278eaa36e1 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -285,6 +285,19 @@ int handle_options(int *argc, char ***argv, return EXIT_AMBIGUOUS_OPTION; } } + if ((optp->var_type & GET_TYPE_MASK) == GET_DISABLED) + { + if (my_getopt_print_errors) + fprintf(stderr, + "%s: %s: Option '%s' used, but is disabled\n", my_progname, + option_is_loose ? "WARNING" : "ERROR", opt_str); + if (option_is_loose) + { + (*argc)--; + continue; + } + return EXIT_OPTION_DISABLED; + } if (must_be_var && (optp->var_type & GET_TYPE_MASK) == GET_NO_ARG) { if (my_getopt_print_errors) @@ -358,6 +371,14 @@ int handle_options(int *argc, char ***argv, { /* Option recognized. Find next what to do with it */ opt_found= 1; + if ((optp->var_type & GET_TYPE_MASK) == GET_DISABLED) + { + if (my_getopt_print_errors) + fprintf(stderr, + "%s: ERROR: Option '-%c' used, but is disabled\n", + my_progname, optp->id); + return EXIT_OPTION_DISABLED; + } if ((optp->var_type & GET_TYPE_MASK) == GET_BOOL && optp->arg_type == NO_ARG) { @@ -550,7 +571,7 @@ static int findopt(char *optpat, uint length, const struct my_option **opt_res, char **ffname) { - int count; + uint count; struct my_option *opt= (struct my_option *) *opt_res; for (count= 0; opt->name; opt++) @@ -562,7 +583,8 @@ static int findopt(char *optpat, uint length, *ffname= (char *) opt->name; /* We only need to know one prev */ if (!opt->name[length]) /* Exact match */ return 1; - count++; + if (!count || strcmp(*ffname, opt->name)) /* Don't count synonyms */ + count++; } } return count; @@ -882,7 +904,8 @@ void my_print_variables(const struct my_option *options) longlong2str(*((ulonglong*) value), buff, 10); printf("%s\n", buff); break; - default: /* dummy default to avoid compiler warnings */ + default: + printf("(Disabled)\n"); break; } } |