diff options
Diffstat (limited to 'sql/derror.cc')
-rw-r--r-- | sql/derror.cc | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/sql/derror.cc b/sql/derror.cc index 0e74d411b1f..aa7edd639da 100644 --- a/sql/derror.cc +++ b/sql/derror.cc @@ -55,7 +55,7 @@ bool init_errmessage(void) /* Register messages for use with my_error(). */ if (my_error_register(errmsgs, ER_ERROR_FIRST, ER_ERROR_LAST)) { - x_free((gptr) errmsgs); + x_free((uchar*) errmsgs); DBUG_RETURN(TRUE); } @@ -72,11 +72,13 @@ static bool read_texts(const char *file_name,const char ***point, uint error_messages) { register uint i; - uint count,funktpos,length,textcount; + uint count,funktpos,textcount; + size_t length; File file; char name[FN_REFLEN]; - const char *buff; + uchar *buff; uchar head[32],*pos; + const char *errmsg; DBUG_ENTER("read_texts"); *point=0; // If something goes wrong @@ -88,7 +90,7 @@ static bool read_texts(const char *file_name,const char ***point, goto err; /* purecov: inspected */ funktpos=1; - if (my_read(file,(byte*) head,32,MYF(MY_NABP))) goto err; + if (my_read(file,(uchar*) head,32,MYF(MY_NABP))) goto err; if (head[0] != (uchar) 254 || head[1] != (uchar) 254 || head[2] != 2 || head[3] != 1) goto err; /* purecov: inspected */ @@ -122,22 +124,24 @@ Check that the above file is the right version for this program!", unireg_abort(1); } - x_free((gptr) *point); /* Free old language */ + x_free((uchar*) *point); /* Free old language */ if (!(*point= (const char**) - my_malloc((uint) (length+count*sizeof(char*)),MYF(0)))) + my_malloc((size_t) (length+count*sizeof(char*)),MYF(0)))) { funktpos=2; /* purecov: inspected */ goto err; /* purecov: inspected */ } - buff= (char*) (*point + count); + buff= (uchar*) (*point + count); - if (my_read(file,(byte*) buff,(uint) count*2,MYF(MY_NABP))) goto err; - for (i=0, pos= (uchar*) buff ; i< count ; i++) + if (my_read(file, buff, (size_t) count*2,MYF(MY_NABP))) + goto err; + for (i=0, pos= buff ; i< count ; i++) { - (*point)[i]=buff+uint2korr(pos); + (*point)[i]= (char*) buff+uint2korr(pos); pos+=2; } - if (my_read(file,(byte*) buff,(uint) length,MYF(MY_NABP))) goto err; + if (my_read(file, buff, length, MYF(MY_NABP))) + goto err; for (i=1 ; i < textcount ; i++) { @@ -149,16 +153,16 @@ Check that the above file is the right version for this program!", err: switch (funktpos) { case 2: - buff="Not enough memory for messagefile '%s'"; + errmsg= "Not enough memory for messagefile '%s'"; break; case 1: - buff="Can't read from messagefile '%s'"; + errmsg= "Can't read from messagefile '%s'"; break; default: - buff="Can't find messagefile '%s'"; + errmsg= "Can't find messagefile '%s'"; break; } - sql_print_error(buff,name); + sql_print_error(errmsg, name); err1: if (file != FERR) VOID(my_close(file,MYF(MY_WME))); |