diff options
author | Mikael Ronström <mikael@dator9> | 2011-02-10 18:15:19 +0100 |
---|---|---|
committer | Mikael Ronström <mikael@dator9> | 2011-02-10 18:15:19 +0100 |
commit | e3f89e5dbac66b34db735ae44a21e6d489a7f28e (patch) | |
tree | 47a4be74fb4e90a025c800c4e4290a9427824390 /mysys | |
parent | 70136c0aa252d8da2c698f3635ddce8c60b26bc3 (diff) | |
parent | 50c9f1f63d322872a2a36d82fa75eb72c55f6d5c (diff) | |
download | mariadb-git-e3f89e5dbac66b34db735ae44a21e6d489a7f28e.tar.gz |
merge
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/charset.c | 20 | ||||
-rw-r--r-- | mysys/default.c | 2 | ||||
-rw-r--r-- | mysys/mf_format.c | 2 | ||||
-rw-r--r-- | mysys/my_fopen.c | 2 | ||||
-rw-r--r-- | mysys/my_getsystime.c | 2 |
5 files changed, 18 insertions, 10 deletions
diff --git a/mysys/charset.c b/mysys/charset.c index 167d6b8ff6e..c2c46ba3fb4 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -419,6 +419,7 @@ CHARSET_INFO *default_charset_info = &my_charset_latin1; void add_compiled_collation(CHARSET_INFO *cs) { + DBUG_ASSERT(cs->number < array_elements(all_charsets)); all_charsets[cs->number]= cs; cs->state|= MY_CS_AVAILABLE; } @@ -529,14 +530,17 @@ uint get_charset_number(const char *charset_name, uint cs_flags) const char *get_charset_name(uint charset_number) { - CHARSET_INFO *cs; my_pthread_once(&charsets_initialized, init_available_charsets); - cs=all_charsets[charset_number]; - if (cs && (cs->number == charset_number) && cs->name ) - return (char*) cs->name; + if (charset_number < array_elements(all_charsets)) + { + CHARSET_INFO *cs= all_charsets[charset_number]; + + if (cs && (cs->number == charset_number) && cs->name) + return (char*) cs->name; + } - return (char*) "?"; /* this mimics find_type() */ + return "?"; /* this mimics find_type() */ } @@ -545,6 +549,8 @@ static CHARSET_INFO *get_internal_charset(uint cs_number, myf flags) char buf[FN_REFLEN]; CHARSET_INFO *cs; + DBUG_ASSERT(cs_number < array_elements(all_charsets)); + if ((cs= all_charsets[cs_number])) { if (cs->state & MY_CS_READY) /* if CS is already initialized */ @@ -589,8 +595,8 @@ CHARSET_INFO *get_charset(uint cs_number, myf flags) return default_charset_info; my_pthread_once(&charsets_initialized, init_available_charsets); - - if (!cs_number || cs_number > array_elements(all_charsets)) + + if (cs_number >= array_elements(all_charsets)) return NULL; cs=get_internal_charset(cs_number, flags); diff --git a/mysys/default.c b/mysys/default.c index 432c3086254..9a4b990f003 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -179,7 +179,7 @@ fn_expand(const char *filename, char *result_buf) if (my_getwd(dir, sizeof(dir), MYF(0))) DBUG_RETURN(3); DBUG_PRINT("debug", ("dir: %s", dir)); - if (fn_format(result_buf, filename, dir, NULL, flags) == NULL) + if (fn_format(result_buf, filename, dir, "", flags) == NULL) DBUG_RETURN(2); DBUG_PRINT("return", ("result: %s", result_buf)); DBUG_RETURN(0); diff --git a/mysys/mf_format.c b/mysys/mf_format.c index 6afa2938fa3..74f114a966f 100644 --- a/mysys/mf_format.c +++ b/mysys/mf_format.c @@ -31,6 +31,8 @@ char * fn_format(char * to, const char *name, const char *dir, reg1 size_t length; size_t dev_length; DBUG_ENTER("fn_format"); + DBUG_ASSERT(name != NULL); + DBUG_ASSERT(extension != NULL); DBUG_PRINT("enter",("name: %s dir: %s extension: %s flag: %d", name,dir,extension,flag)); diff --git a/mysys/my_fopen.c b/mysys/my_fopen.c index e184c8308fc..6e81b644bae 100644 --- a/mysys/my_fopen.c +++ b/mysys/my_fopen.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB, 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/mysys/my_getsystime.c b/mysys/my_getsystime.c index 01b3b912aae..63280f40f2a 100644 --- a/mysys/my_getsystime.c +++ b/mysys/my_getsystime.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004 MySQL AB, 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by |