mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-13384 - misc Windows warnings fixed
This commit is contained in:
@@ -354,22 +354,22 @@ public:
|
||||
Ptr=0;
|
||||
str_length=0; /* Safety */
|
||||
}
|
||||
inline bool alloc(uint32 arg_length)
|
||||
inline bool alloc(size_t arg_length)
|
||||
{
|
||||
if (arg_length < Alloced_length)
|
||||
return 0;
|
||||
return real_alloc(arg_length);
|
||||
}
|
||||
bool real_alloc(uint32 arg_length); // Empties old string
|
||||
bool realloc_raw(uint32 arg_length);
|
||||
bool realloc(uint32 arg_length)
|
||||
bool real_alloc(size_t arg_length); // Empties old string
|
||||
bool realloc_raw(size_t arg_length);
|
||||
bool realloc(size_t arg_length)
|
||||
{
|
||||
if (realloc_raw(arg_length))
|
||||
return TRUE;
|
||||
Ptr[arg_length]=0; // This make other funcs shorter
|
||||
return FALSE;
|
||||
}
|
||||
bool realloc_with_extra(uint32 arg_length)
|
||||
bool realloc_with_extra(size_t arg_length)
|
||||
{
|
||||
if (extra_alloc < 4096)
|
||||
extra_alloc= extra_alloc*2+128;
|
||||
@@ -378,7 +378,7 @@ public:
|
||||
Ptr[arg_length]=0; // This make other funcs shorter
|
||||
return FALSE;
|
||||
}
|
||||
bool realloc_with_extra_if_needed(uint32 arg_length)
|
||||
bool realloc_with_extra_if_needed(size_t arg_length)
|
||||
{
|
||||
if (arg_length < Alloced_length)
|
||||
{
|
||||
@@ -388,7 +388,7 @@ public:
|
||||
return realloc_with_extra(arg_length);
|
||||
}
|
||||
// Shrink the buffer, but only if it is allocated on the heap.
|
||||
inline void shrink(uint32 arg_length)
|
||||
inline void shrink(size_t arg_length)
|
||||
{
|
||||
if (!is_alloced())
|
||||
return;
|
||||
@@ -405,7 +405,7 @@ public:
|
||||
else
|
||||
{
|
||||
Ptr=new_ptr;
|
||||
Alloced_length=arg_length;
|
||||
Alloced_length=(uint32)arg_length;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -428,7 +428,7 @@ public:
|
||||
|
||||
bool copy(); // Alloc string if not alloced
|
||||
bool copy(const String &s); // Allocate new string
|
||||
bool copy(const char *s,uint32 arg_length, CHARSET_INFO *cs); // Allocate new string
|
||||
bool copy(const char *s,size_t arg_length, CHARSET_INFO *cs); // Allocate new string
|
||||
static bool needs_conversion(uint32 arg_length,
|
||||
CHARSET_INFO *cs_from, CHARSET_INFO *cs_to,
|
||||
uint32 *offset);
|
||||
@@ -466,10 +466,10 @@ public:
|
||||
}
|
||||
bool append(const String &s);
|
||||
bool append(const char *s);
|
||||
bool append(const LEX_STRING *ls) { return append(ls->str, (uint32)ls->length); }
|
||||
bool append(const LEX_CSTRING *ls) { return append(ls->str, (uint32)ls->length); }
|
||||
bool append(const char *s, uint32 arg_length);
|
||||
bool append(const char *s, uint32 arg_length, CHARSET_INFO *cs);
|
||||
bool append(const LEX_STRING *ls) { return append(ls->str, (uint32) ls->length); }
|
||||
bool append(const LEX_CSTRING *ls) { return append(ls->str, (uint32) ls->length); }
|
||||
bool append(const char *s, size_t size);
|
||||
bool append(const char *s, uint arg_length, CHARSET_INFO *cs);
|
||||
bool append_ulonglong(ulonglong val);
|
||||
bool append_longlong(longlong val);
|
||||
bool append(IO_CACHE* file, uint32 arg_length);
|
||||
@@ -552,10 +552,11 @@ public:
|
||||
float8store(Ptr + str_length, *d);
|
||||
str_length += 8;
|
||||
}
|
||||
void q_append(const char *data, uint32 data_len)
|
||||
void q_append(const char *data, size_t data_len)
|
||||
{
|
||||
memcpy(Ptr + str_length, data, data_len);
|
||||
str_length += data_len;
|
||||
DBUG_ASSERT(str_length <= UINT_MAX32 - data_len);
|
||||
str_length += (uint)data_len;
|
||||
}
|
||||
|
||||
void write_at_position(int position, uint32 value)
|
||||
@@ -634,7 +635,9 @@ public:
|
||||
}
|
||||
bool append_for_single_quote(const char *st)
|
||||
{
|
||||
return append_for_single_quote(st, (uint)strlen(st));
|
||||
size_t len= strlen(st);
|
||||
DBUG_ASSERT(len < UINT_MAX32);
|
||||
return append_for_single_quote(st, (uint32) len);
|
||||
}
|
||||
|
||||
/* Swap two string objects. Efficient way to exchange data without memcpy. */
|
||||
@@ -678,10 +681,11 @@ public:
|
||||
}
|
||||
void q_net_store_data(const uchar *from, size_t length)
|
||||
{
|
||||
DBUG_ASSERT(length < UINT_MAX32);
|
||||
DBUG_ASSERT(Alloced_length >= (str_length + length +
|
||||
net_length_size(length)));
|
||||
q_net_store_length(length);
|
||||
q_append((const char *)from, length);
|
||||
q_append((const char *)from, (uint32) length);
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user