summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@mishka.local>2005-06-27 20:31:00 +0300
committerunknown <monty@mishka.local>2005-06-27 20:31:00 +0300
commit76d444fcb64d0272c0f8efd450edc7087a105723 (patch)
tree11c3f63ec13344e241e69b6178f65e8bd56e71b1 /sql
parent6c46a993d7efe183d931ce2f25287afedf223544 (diff)
downloadmariadb-git-76d444fcb64d0272c0f8efd450edc7087a105723.tar.gz
Portability fixes
Fixes while reviewing new pushed code NULL as argument to encrypt/decrypt should return NULL without a warning client/mysqldump.c: Cleanup Ensure we free allocated memory Portability fixes client/mysqltest.c: Cleanup of code during review Portability fixes (Don't use 'bool') mysql-test/r/func_encrypt.result: NULL as argument to encrypt/decrypt should return NULL without a warning mysql-test/r/func_encrypt_nossl.result: Added test of NULL argument mysql-test/t/func_encrypt_nossl.test: Added test of NULL argument sql/handler.cc: Cleanup during code review sql/item_strfunc.cc: NULL as argument to encrypt/decrypt should return NULL without a warning sql/sql_parse.cc: Fix wrong merge (fix was not needed as the previous code was reverted) sql/sql_table.cc: Removed extra new line
Diffstat (limited to 'sql')
-rw-r--r--sql/handler.cc16
-rw-r--r--sql/item_strfunc.cc6
-rw-r--r--sql/sql_parse.cc1
-rw-r--r--sql/sql_table.cc1
4 files changed, 10 insertions, 14 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index dacfc7d9ac5..cb1d88a30d4 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -1357,14 +1357,12 @@ int ha_create_table_from_engine(THD* thd,
HA_CREATE_INFO create_info;
TABLE table;
DBUG_ENTER("ha_create_table_from_engine");
- DBUG_PRINT("enter", ("name '%s'.'%s'",
- db, name));
+ DBUG_PRINT("enter", ("name '%s'.'%s'", db, name));
bzero((char*) &create_info,sizeof(create_info));
-
- if(error= ha_discover(thd, db, name, &frmblob, &frmlen))
+ if ((error= ha_discover(thd, db, name, &frmblob, &frmlen)))
{
- // Table could not be discovered and thus not created
+ /* Table could not be discovered and thus not created */
DBUG_RETURN(error);
}
@@ -1375,11 +1373,10 @@ int ha_create_table_from_engine(THD* thd,
(void)strxnmov(path,FN_REFLEN,mysql_data_home,"/",db,"/",name,NullS);
// Save the frm file
- if (writefrm(path, frmblob, frmlen))
- {
- my_free((char*) frmblob, MYF(MY_ALLOW_ZERO_PTR));
+ error= writefrm(path, frmblob, frmlen);
+ my_free((char*) frmblob, MYF(0));
+ if (error)
DBUG_RETURN(2);
- }
if (openfrm(path,"",0,(uint) READ_ALL, 0, &table))
DBUG_RETURN(3);
@@ -1395,7 +1392,6 @@ int ha_create_table_from_engine(THD* thd,
}
error=table.file->create(path,&table,&create_info);
VOID(closefrm(&table));
- my_free((char*) frmblob, MYF(MY_ALLOW_ZERO_PTR));
DBUG_RETURN(error != 0);
}
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index ceb925be4d2..881a8a7c915 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -381,8 +381,8 @@ String *Item_func_des_encrypt::val_str(String *str)
uint key_number, res_length, tail;
String *res= args[0]->val_str(str);
- if ((null_value=args[0]->null_value))
- goto error;
+ if ((null_value= args[0]->null_value))
+ return 0; // ENCRYPT(NULL) == NULL
if ((res_length=res->length()) == 0)
return &my_empty_string;
@@ -474,7 +474,7 @@ String *Item_func_des_decrypt::val_str(String *str)
uint length=res->length(),tail;
if ((null_value=args[0]->null_value))
- goto error;
+ return 0;
length=res->length();
if (length < 9 || (length % 8) != 1 || !((*res)[0] & 128))
return res; // Skip decryption if not encrypted
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index c7442f06891..c0283f81315 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2897,6 +2897,7 @@ unsent_create_error:
}
else
res= -1;
+ first_local_table->next= tables;
lex->select_lex.table_list.first= (byte*) first_local_table;
break;
}
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index d7a07d17761..b68b20c32a3 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -255,7 +255,6 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
table->real_name);
else
error= 1;
-
}
else
{