diff options
author | Michael Widenius <monty@askmonty.org> | 2013-03-26 00:03:13 +0200 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2013-03-26 00:03:13 +0200 |
commit | 068c61978e3a81836d52b8caf11e044290159ad1 (patch) | |
tree | 2cbca861ab2cebe3bd99379ca9668bb483ca0d2a /sql/derror.cc | |
parent | 35bc8f9f4353b64da215e52ff6f1612a8ce66f43 (diff) | |
download | mariadb-git-068c61978e3a81836d52b8caf11e044290159ad1.tar.gz |
Temporary commit of 10.0-merge
Diffstat (limited to 'sql/derror.cc')
-rw-r--r-- | sql/derror.cc | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/sql/derror.cc b/sql/derror.cc index 665427f45bc..abe642bea79 100644 --- a/sql/derror.cc +++ b/sql/derror.cc @@ -146,8 +146,8 @@ bool read_texts(const char *file_name, const char *language, const char ***point, uint error_messages) { register uint i; - uint count,funktpos,textcount; - size_t length; + uint count,funktpos; + size_t offset, length; File file; char name[FN_REFLEN]; char lang_path[FN_REFLEN]; @@ -186,9 +186,8 @@ bool read_texts(const char *file_name, const char *language, goto err; funktpos=2; if (head[0] != (uchar) 254 || head[1] != (uchar) 254 || - head[2] != 2 || head[3] != 2) + head[2] != 2 || head[3] != 3) goto err; /* purecov: inspected */ - textcount=head[4]; error_message_charset_info= system_charset_info; length=uint4korr(head+6); count=uint2korr(head+10); @@ -203,7 +202,7 @@ Error message file '%s' had only %d error messages, but it should contain at lea } if (!(*point= (const char**) - my_malloc((size_t) (max(length,count*2)+count*sizeof(char*)),MYF(0)))) + my_malloc((size_t) (MY_MAX(length,count*2)+count*sizeof(char*)),MYF(0)))) { funktpos=3; /* purecov: inspected */ goto err; /* purecov: inspected */ @@ -212,18 +211,15 @@ Error message file '%s' had only %d error messages, but it should contain at lea if (mysql_file_read(file, buff, (size_t) count*2, MYF(MY_NABP))) goto err; - for (i=0, pos= buff ; i< count ; i++) + for (i=0, offset=0, pos= buff ; i< count ; i++) { - (*point)[i]= (char*) buff+uint2korr(pos); + (*point)[i]= (char*) buff+offset; + offset+= uint2korr(pos); pos+=2; } if (mysql_file_read(file, buff, length, MYF(MY_NABP))) goto err; - for (i=1 ; i < textcount ; i++) - { - point[i]= *point +uint2korr(head+10+i+i); - } (void) mysql_file_close(file, MYF(0)); i= check_error_mesg(file_name, *point); |