summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <dlenev@brandersnatch.localdomain>2004-05-27 17:54:40 +0400
committerunknown <dlenev@brandersnatch.localdomain>2004-05-27 17:54:40 +0400
commit2d1384e44282bc9518d61fb4e9c149a40612f26f (patch)
tree0a3ac45d591f6d81591a9b4ec19f2d45e2c29570 /sql
parenta1bcf38257fcb124b1ed8432137d82aed95da32d (diff)
downloadmariadb-git-2d1384e44282bc9518d61fb4e9c149a40612f26f.tar.gz
Made my_snprintf() behavior snprintf() compatible when printing %x arguments (it should
produce hex digits in lower case). (fixed version) Replaced _dig_vec array with two _dig_vec_upper/_dig_vec_lower arrays. Added extra argument to int2str function which controls case of digits you get. Replaced lot of invocations of int2str for decimal radix with more optimized int10_to_str() function. Removed unused my_itoa/my_ltoa functions. client/mysql.cc: Replaced int2str invocations with radix argument equal to 10 with optimized int10_to_str() call. client/mysqladmin.c: Replaced int2str invocations with radix argument equal to 10 with optimized int10_to_str() call. dbug/dbug.c: _dig_vec became _dig_vec_upper. include/m_string.h: _dig_vec is obsoleted by _dig_vec_upper/_dig_vec_lower. my_itoa()/my_ltoa() functions were removed because they were never used in our code. int2str() now has one more argument which controls case of digits it will produce. include/my_global.h: my_itoa()/my_ltoa() functions were removed because they were never used in our code. isam/isamchk.c: Replaced int2str invocations with radix argument equal to 10 with optimized int10_to_str() call. libmysql/libmysql.def: _dig_vec is obsoleted by _dig_vec_upper/_dig_vec_lower. myisam/myisamchk.c: Replaced int2str invocation with radix argument equal to 10 with optimized int10_to_str() call. mysys/mf_tempfile.c: _dig_vec became _dig_vec_upper. mysys/my_error.c: Replaced int2str invocations with radix argument equal to 10 with optimized int10_to_str() call. mysys/my_tempnam.c: _dig_vec became _dig_vec_upper. sql-common/client.c: Replaced int2str invocation with radix argument equal to 10 with optimized int10_to_str() call. sql/item_strfunc.cc: _dig_vec became _dig_vec_upper. Also we don't need hex[] array in this file now because we have _dig_vec_lower instead. sql/mysqld.cc: Replaced int2str invocations with radix argument equal to 10 with optimized int10_to_str() call. sql/password.c: _dig_vec became _dig_vec_upper. sql/sql_bitmap.h: _dig_vec became _dig_vec_upper. strings/int2str.c: Replaced _dig_vec by _dig_vec_upper/_dig_vec_lower pair. int2str() now has one more argument which controls case of digits it will produce. my_itoa()/my_ltoa() functions were removed because they were never used in our code. strings/longlong2str-x86.s: _dig_vec became _dig_vec_upper. strings/longlong2str.c: _dig_vec became _dig_vec_upper. strings/my_vsnprintf.c: If my_snprintf() is printing %x argument it should produce lower case hexadecimal digits to be snprintf() compatible.
Diffstat (limited to 'sql')
-rw-r--r--sql/item_strfunc.cc13
-rw-r--r--sql/mysqld.cc6
-rw-r--r--sql/password.c4
-rw-r--r--sql/sql_bitmap.h8
4 files changed, 14 insertions, 17 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 676d8c1386a..c6401218fe2 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2285,8 +2285,8 @@ String *Item_func_hex::val_str(String *str)
from++, to+=2)
{
uint tmp=(uint) (uchar) *from;
- to[0]=_dig_vec[tmp >> 4];
- to[1]=_dig_vec[tmp & 15];
+ to[0]=_dig_vec_upper[tmp >> 4];
+ to[1]=_dig_vec_upper[tmp & 15];
}
return &tmp_value;
}
@@ -2746,9 +2746,6 @@ static uint nanoseq;
static ulonglong uuid_time=0;
static char clock_seq_and_node_str[]="-0000-000000000000";
-/* we cannot use _dig_vec[] as letters should be lowercase */
-static const char hex[] = "0123456789abcdef";
-
/* number of 100-nanosecond intervals between
1582-10-15 00:00:00.00 and 1970-01-01 00:00:00.00 */
#define UUID_TIME_OFFSET ((ulonglong) 141427 * 24 * 60 * 60 * 1000 * 10 )
@@ -2761,7 +2758,7 @@ static void tohex(char *to, uint from, uint len)
to+= len;
while (len--)
{
- *--to= hex[from & 15];
+ *--to= _dig_vec_lower[from & 15];
from >>= 4;
}
}
@@ -2798,8 +2795,8 @@ String *Item_func_uuid::val_str(String *str)
s=clock_seq_and_node_str+sizeof(clock_seq_and_node_str)-1;
for (i=sizeof(mac)-1 ; i>=0 ; i--)
{
- *--s=hex[mac[i] & 15];
- *--s=hex[mac[i] >> 4];
+ *--s=_dig_vec_lower[mac[i] & 15];
+ *--s=_dig_vec_lower[mac[i] >> 4];
}
randominit(&uuid_rand, tmp + (ulong)start_time, tmp + bytes_sent);
set_clock_seq_str();
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 042f2ecd8e7..fbe70705be3 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -3015,7 +3015,7 @@ int main(int argc, char **argv)
need to have an unique named hEventShudown through the
application PID e.g.: MySQLShutdown1890; MySQLShutdown2342
*/
- int2str((int) GetCurrentProcessId(),strmov(shutdown_event_name,
+ int10_to_str((int) GetCurrentProcessId(),strmov(shutdown_event_name,
"MySQLShutdown"), 10);
/* Must be initialized early for comparison of service name */
@@ -3635,7 +3635,7 @@ pthread_handler_decl(handle_connections_shared_memory,arg)
HANDLE event_server_read= 0;
THD *thd= 0;
- p= int2str(connect_number, connect_number_char, 10);
+ p= int10_to_str(connect_number, connect_number_char, 10);
/*
The name of event and file-mapping events create agree next rule:
shared_memory_base_name+unique_part+number_of_connection
@@ -6224,7 +6224,7 @@ static void create_pid_file()
O_WRONLY | O_TRUNC, MYF(MY_WME))) >= 0)
{
char buff[21], *end;
- end= int2str((long) getpid(), buff, 10);
+ end= int10_to_str((long) getpid(), buff, 10);
*end++= '\n';
(void) my_write(file, (byte*) buff, (uint) (end-buff),MYF(MY_WME));
(void) my_close(file, MYF(0));
diff --git a/sql/password.c b/sql/password.c
index 9f4910d8c60..49f149969c9 100644
--- a/sql/password.c
+++ b/sql/password.c
@@ -321,8 +321,8 @@ octet2hex(char *to, const uint8 *str, uint len)
const uint8 *str_end= str + len;
for (; str != str_end; ++str)
{
- *to++= _dig_vec[(*str & 0xF0) >> 4];
- *to++= _dig_vec[*str & 0x0F];
+ *to++= _dig_vec_upper[(*str & 0xF0) >> 4];
+ *to++= _dig_vec_upper[*str & 0x0F];
}
*to= '\0';
}
diff --git a/sql/sql_bitmap.h b/sql/sql_bitmap.h
index 96570c508e6..5c51f3ecb67 100644
--- a/sql/sql_bitmap.h
+++ b/sql/sql_bitmap.h
@@ -64,15 +64,15 @@ public:
char *s=buf; int i;
for (i=sizeof(buffer)-1; i>=0 ; i--)
{
- if ((*s=_dig_vec[buffer[i] >> 4]) != '0')
+ if ((*s=_dig_vec_upper[buffer[i] >> 4]) != '0')
break;
- if ((*s=_dig_vec[buffer[i] & 15]) != '0')
+ if ((*s=_dig_vec_upper[buffer[i] & 15]) != '0')
break;
}
for (s++, i-- ; i>=0 ; i--)
{
- *s++=_dig_vec[buffer[i] >> 4];
- *s++=_dig_vec[buffer[i] & 15];
+ *s++=_dig_vec_upper[buffer[i] >> 4];
+ *s++=_dig_vec_upper[buffer[i] & 15];
}
*s=0;
return buf;