1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

cleanup String::set(integer)

This commit is contained in:
serg@serg.mylan
2006-06-14 23:09:03 +02:00
parent 7549dac044
commit 99fd8f728b
6 changed files with 15 additions and 43 deletions

View File

@ -96,24 +96,14 @@ bool String::realloc(uint32 alloc_length)
return FALSE;
}
bool String::set(longlong num, CHARSET_INFO *cs)
bool String::set(longlong num, bool unsigned_flag, CHARSET_INFO *cs)
{
uint l=20*cs->mbmaxlen+1;
int base= unsigned_flag ? 10 : -10;
if (alloc(l))
return TRUE;
str_length=(uint32) (cs->cset->longlong10_to_str)(cs,Ptr,l,-10,num);
str_charset=cs;
return FALSE;
}
bool String::set(ulonglong num, CHARSET_INFO *cs)
{
uint l=20*cs->mbmaxlen+1;
if (alloc(l))
return TRUE;
str_length=(uint32) (cs->cset->longlong10_to_str)(cs,Ptr,l,10,num);
str_length=(uint32) (cs->cset->longlong10_to_str)(cs,Ptr,l,base,num);
str_charset=cs;
return FALSE;
}