summaryrefslogtreecommitdiff
path: root/sql/sql_string.cc
diff options
context:
space:
mode:
authorMartin Hansson <mhansson@mysql.com>2009-06-16 16:36:15 +0200
committerMartin Hansson <mhansson@mysql.com>2009-06-16 16:36:15 +0200
commitacc642c87cb7abb0ff49996ec2f7eda0bc969493 (patch)
tree4e202e6d5e7d51dc49fb2e560a3ccd568144b324 /sql/sql_string.cc
parenteecf06873e1a9448dea86f3cf9ff79738d93d556 (diff)
downloadmariadb-git-acc642c87cb7abb0ff49996ec2f7eda0bc969493.tar.gz
Bug#45168: assertion with convert() and empty set value
The assertion in String::copy was added in order to avoid valgrind errors when the destination was the same as the source. Eased restriction to allow for the case when str == NULL.
Diffstat (limited to 'sql/sql_string.cc')
-rw-r--r--sql/sql_string.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index 61731f3b984..7759985ba85 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -322,14 +322,23 @@ bool String::set_or_copy_aligned(const char *str,uint32 arg_length,
return copy_aligned(str, arg_length, offset, cs);
}
- /* Copy with charset conversion */
+
+/**
+ Copies the character data into this String, with optional character set
+ conversion.
+
+ @return
+ FALSE ok
+ TRUE Could not allocate result buffer
+
+*/
bool String::copy(const char *str, uint32 arg_length,
CHARSET_INFO *from_cs, CHARSET_INFO *to_cs, uint *errors)
{
uint32 offset;
-
- DBUG_ASSERT(str != Ptr);
+
+ DBUG_ASSERT(!str || str != Ptr);
if (!needs_conversion(arg_length, from_cs, to_cs, &offset))
{