List:Commits« Previous MessageNext Message »
From:Alexander Barkov Date:December 15 2010 11:35am
Subject:bzr commit into mysql-trunk-bugfixing branch (bar:3430) WL#4616
View as plain text  
#At file:///home/bar/mysql-bzr/mysql-trunk-bugfixing/ based on revid:bar@stripped

 3430 Alexander Barkov	2010-12-15
      WL#4616 UTF16-LE
      Additional patch, to fix Valrgind warnings.

    modified:
      sql/sys_vars.cc
=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc	2010-12-14 13:26:35 +0000
+++ b/sql/sys_vars.cc	2010-12-15 11:35:10 +0000
@@ -480,16 +480,19 @@ static bool check_charset(sys_var *self,
   if (var->value->result_type() == STRING_RESULT)
   {
     String str(buff, sizeof(buff), system_charset_info), *res;
-    if (!(res=var->value->val_str_ascii(&str)))
+    if (!(res= var->value->val_str(&str)))
       var->save_result.ptr= NULL;
-    else if (!(var->save_result.ptr= get_charset_by_csname(res->c_ptr(),
-                                                           MY_CS_PRIMARY,
-                                                           MYF(0))) &&
-             !(var->save_result.ptr= get_old_charset_by_name(res->c_ptr())))
+    else
     {
-      ErrConvString err(res);
-      my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), err.ptr());
-      return true;
+      ErrConvString err(res); /* Get utf8 '\0' terminated string */
+      if (!(var->save_result.ptr= get_charset_by_csname(err.ptr(),
+                                                         MY_CS_PRIMARY,
+                                                         MYF(0))) &&
+          !(var->save_result.ptr= get_old_charset_by_name(err.ptr())))
+      {
+        my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), err.ptr());
+        return true;
+      }
     }
   }
   else // INT_RESULT
@@ -598,13 +601,16 @@ static bool check_collation_not_null(sys
   if (var->value->result_type() == STRING_RESULT)
   {
     String str(buff, sizeof(buff), system_charset_info), *res;
-    if (!(res= var->value->val_str_ascii(&str)))
+    if (!(res= var->value->val_str(&str)))
       var->save_result.ptr= NULL;
-    else if (!(var->save_result.ptr= get_charset_by_name(res->c_ptr(), MYF(0))))
+    else
     {
-      ErrConvString err(res);
-      my_error(ER_UNKNOWN_COLLATION, MYF(0), err.ptr());
-      return true;
+      ErrConvString err(res); /* Get utf8 '\0'-terminated string */
+      if (!(var->save_result.ptr= get_charset_by_name(err.ptr(), MYF(0))))
+      {
+        my_error(ER_UNKNOWN_COLLATION, MYF(0), err.ptr());
+        return true;
+      }
     }
   }
   else // INT_RESULT


Attachment: [text/bzr-bundle] bzr/bar@mysql.com-20101215113510-yn5t2lrp2zhq3xsm.bundle
Thread
bzr commit into mysql-trunk-bugfixing branch (bar:3430) WL#4616Alexander Barkov15 Dec