From 802c41e04d0b4bb193abfff1b7084d3a6c971df6 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 21 Mar 2005 23:41:28 +0200 Subject: Cleanups during review of code Fixed newly introduced bug in rollup client/mysqldump.c: Safer buffer allocation Removed wrong assert mysql-test/r/olap.result: more tests mysql-test/t/olap.test: more tests sql/handler.cc: Simple cleanup Fixed wrong check for next digit (wrong debug output) sql/item.cc: Replace shrink_to_length() with mark_as_const() as the former allowed one to do changes to the string sql/item_sum.cc: Change reference to pointer Trivial optimzation of testing 'allways_null' sql/mysqld.cc: Proper indentation of comment sql/sql_select.cc: Fixed newly introduced bug in rollup sql/sql_string.h: Remove not needed 'shrink_to_length()' Added 'mark_as_const()' to be used when one want to ensure that a string is not changed --- sql/handler.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'sql/handler.cc') diff --git a/sql/handler.cc b/sql/handler.cc index df0d7704163..98fc2be2f8a 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -762,14 +762,13 @@ static char* xid_to_str(char *buf, XID *xid) for (i=0; i < xid->gtrid_length+xid->bqual_length; i++) { uchar c=(uchar)xid->data[i]; - bool is_next_dig; + /* is_next_dig is set if next character is a number */ + bool is_next_dig= FALSE; if (i < XIDDATASIZE) { - char ch=xid->data[i+1]; - is_next_dig=(c >= '0' && c <='9'); + char ch= xid->data[i+1]; + is_next_dig= (ch >= '0' && ch <='9'); } - else - is_next_dig=FALSE; if (i == xid->gtrid_length) { *s++='\''; @@ -782,6 +781,11 @@ static char* xid_to_str(char *buf, XID *xid) if (c < 32 || c > 126) { *s++='\\'; + /* + If next character is a number, write current character with + 3 octal numbers to ensure that the next number is not seen + as part of the octal number + */ if (c > 077 || is_next_dig) *s++=_dig_vec_lower[c >> 6]; if (c > 007 || is_next_dig) -- cgit v1.2.1