mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext
This commit is contained in:
@ -32,9 +32,9 @@
|
||||
** String functions
|
||||
*****************************************************************************/
|
||||
|
||||
bool String::real_alloc(uint32 length)
|
||||
bool String::real_alloc(size_t length)
|
||||
{
|
||||
uint32 arg_length= ALIGN_SIZE(length + 1);
|
||||
size_t arg_length= ALIGN_SIZE(length + 1);
|
||||
DBUG_ASSERT(arg_length > length);
|
||||
if (arg_length <= length)
|
||||
return TRUE; /* Overflow */
|
||||
@ -46,7 +46,8 @@ bool String::real_alloc(uint32 length)
|
||||
(thread_specific ?
|
||||
MY_THREAD_SPECIFIC : 0)))))
|
||||
return TRUE;
|
||||
Alloced_length=arg_length;
|
||||
DBUG_ASSERT(length < UINT_MAX32);
|
||||
Alloced_length=(uint32) arg_length;
|
||||
alloced=1;
|
||||
}
|
||||
Ptr[0]=0;
|
||||
@ -81,7 +82,7 @@ bool String::real_alloc(uint32 length)
|
||||
|
||||
@retval true An error occurred when attempting to allocate memory.
|
||||
*/
|
||||
bool String::realloc_raw(uint32 alloc_length)
|
||||
bool String::realloc_raw(size_t alloc_length)
|
||||
{
|
||||
if (Alloced_length <= alloc_length)
|
||||
{
|
||||
@ -113,7 +114,8 @@ bool String::realloc_raw(uint32 alloc_length)
|
||||
else
|
||||
return TRUE; // Signal error
|
||||
Ptr= new_ptr;
|
||||
Alloced_length= len;
|
||||
DBUG_ASSERT(len < UINT_MAX32);
|
||||
Alloced_length= (uint32)len;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
@ -195,7 +197,7 @@ bool String::set_real(double num,uint decimals, CHARSET_INFO *cs)
|
||||
if (decimals >= FLOATING_POINT_DECIMALS)
|
||||
{
|
||||
len= my_gcvt(num, MY_GCVT_ARG_DOUBLE, sizeof(buff) - 1, buff, NULL);
|
||||
return copy(buff, len, &my_charset_latin1, cs, &dummy_errors);
|
||||
return copy(buff, (uint)len, &my_charset_latin1, cs, &dummy_errors);
|
||||
}
|
||||
len= my_fcvt(num, decimals, buff, NULL);
|
||||
return copy(buff, (uint32) len, &my_charset_latin1, cs,
|
||||
@ -235,10 +237,11 @@ bool String::copy(const String &str)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool String::copy(const char *str,uint32 arg_length, CHARSET_INFO *cs)
|
||||
bool String::copy(const char *str,size_t arg_length, CHARSET_INFO *cs)
|
||||
{
|
||||
if (alloc(arg_length))
|
||||
return TRUE;
|
||||
DBUG_ASSERT(arg_length < UINT_MAX32);
|
||||
if ((str_length=arg_length))
|
||||
memcpy(Ptr,str,arg_length);
|
||||
Ptr[arg_length]=0;
|
||||
@ -495,8 +498,10 @@ bool String::append(const String &s)
|
||||
Append an ASCII string to the a string of the current character set
|
||||
*/
|
||||
|
||||
bool String::append(const char *s,uint32 arg_length)
|
||||
bool String::append(const char *s,size_t size)
|
||||
{
|
||||
DBUG_ASSERT(size <= UINT_MAX32);
|
||||
uint32 arg_length= (uint32) size;
|
||||
if (!arg_length)
|
||||
return FALSE;
|
||||
|
||||
@ -540,7 +545,7 @@ bool String::append_longlong(longlong val)
|
||||
if (realloc(str_length+MAX_BIGINT_WIDTH+2))
|
||||
return TRUE;
|
||||
char *end= (char*) longlong10_to_str(val, (char*) Ptr + str_length, -10);
|
||||
str_length= end - Ptr;
|
||||
str_length= (uint32)(end - Ptr);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -550,7 +555,7 @@ bool String::append_ulonglong(ulonglong val)
|
||||
if (realloc(str_length+MAX_BIGINT_WIDTH+2))
|
||||
return TRUE;
|
||||
char *end= (char*) longlong10_to_str(val, (char*) Ptr + str_length, 10);
|
||||
str_length= end - Ptr;
|
||||
str_length= (uint32) (end - Ptr);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -559,7 +564,7 @@ bool String::append_ulonglong(ulonglong val)
|
||||
with character set recoding
|
||||
*/
|
||||
|
||||
bool String::append(const char *s,uint32 arg_length, CHARSET_INFO *cs)
|
||||
bool String::append(const char *s, uint arg_length, CHARSET_INFO *cs)
|
||||
{
|
||||
uint32 offset;
|
||||
|
||||
@ -646,7 +651,7 @@ bool String::append_with_prefill(const char *s,uint32 arg_length,
|
||||
|
||||
uint32 String::numchars() const
|
||||
{
|
||||
return str_charset->cset->numchars(str_charset, Ptr, Ptr+str_length);
|
||||
return (uint32) str_charset->cset->numchars(str_charset, Ptr, Ptr+str_length);
|
||||
}
|
||||
|
||||
int String::charpos(longlong i,uint32 offset)
|
||||
@ -775,7 +780,7 @@ void String::qs_append(const char *str, uint32 len)
|
||||
void String::qs_append(double d)
|
||||
{
|
||||
char *buff = Ptr + str_length;
|
||||
str_length+= my_gcvt(d, MY_GCVT_ARG_DOUBLE, FLOATING_POINT_BUFFER - 1, buff,
|
||||
str_length+= (uint32) my_gcvt(d, MY_GCVT_ARG_DOUBLE, FLOATING_POINT_BUFFER - 1, buff,
|
||||
NULL);
|
||||
}
|
||||
|
||||
@ -1079,10 +1084,10 @@ String_copier::well_formed_copy(CHARSET_INFO *to_cs,
|
||||
my_charset_same(from_cs, to_cs))
|
||||
{
|
||||
m_cannot_convert_error_pos= NULL;
|
||||
return to_cs->cset->copy_fix(to_cs, to, to_length, from, from_length,
|
||||
return (uint) to_cs->cset->copy_fix(to_cs, to, to_length, from, from_length,
|
||||
nchars, this);
|
||||
}
|
||||
return my_convert_fix(to_cs, to, to_length, from_cs, from, from_length,
|
||||
return (uint) my_convert_fix(to_cs, to, to_length, from_cs, from, from_length,
|
||||
nchars, this, this);
|
||||
}
|
||||
|
||||
@ -1217,5 +1222,5 @@ uint convert_to_printable(char *to, size_t to_len,
|
||||
memcpy(dots, STRING_WITH_LEN("...\0"));
|
||||
else
|
||||
*t= '\0';
|
||||
return t - to;
|
||||
return (uint) (t - to);
|
||||
}
|
||||
|
Reference in New Issue
Block a user