summaryrefslogtreecommitdiff
path: root/sql/hostname.cc
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2018-02-06 12:55:58 +0000
committerVladislav Vaintroub <wlad@mariadb.com>2018-02-06 12:55:58 +0000
commit6c279ad6a71c63cb595fde7c951aadb31c3dbebc (patch)
tree3603f88e1b3bd1e622edb182cccd882dd31ddc8a /sql/hostname.cc
parentf271100836d8a91a775894ec36b869a66a3145e5 (diff)
downloadmariadb-git-6c279ad6a71c63cb595fde7c951aadb31c3dbebc.tar.gz
MDEV-15091 : Windows, 64bit: reenable and fix warning C4267 (conversion from 'size_t' to 'type', possible loss of data)
Handle string length as size_t, consistently (almost always:)) Change function prototypes to accept size_t, where in the past ulong or uint were used. change local/member variables to size_t when appropriate. This fix excludes rocksdb, spider,spider, sphinx and connect for now.
Diffstat (limited to 'sql/hostname.cc')
-rw-r--r--sql/hostname.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/sql/hostname.cc b/sql/hostname.cc
index 0e60dde893c..56bd407f1dd 100644
--- a/sql/hostname.cc
+++ b/sql/hostname.cc
@@ -180,7 +180,7 @@ void hostname_cache_unlock()
static void prepare_hostname_cache_key(const char *ip_string,
char *ip_key)
{
- int ip_string_length= strlen(ip_string);
+ size_t ip_string_length= strlen(ip_string);
DBUG_ASSERT(ip_string_length < HOST_ENTRY_KEY_SIZE);
memset(ip_key, 0, HOST_ENTRY_KEY_SIZE);
@@ -229,12 +229,12 @@ static void add_hostname_impl(const char *ip_key, const char *hostname,
{
if (hostname != NULL)
{
- uint len= strlen(hostname);
+ size_t len= strlen(hostname);
if (len > sizeof(entry->m_hostname) - 1)
len= sizeof(entry->m_hostname) - 1;
memcpy(entry->m_hostname, hostname, len);
entry->m_hostname[len]= '\0';
- entry->m_hostname_length= len;
+ entry->m_hostname_length= (uint)len;
DBUG_PRINT("info",
("Adding/Updating '%s' -> '%s' (validated) to the hostname cache...'",
@@ -946,7 +946,7 @@ int ip_to_hostname(struct sockaddr_storage *ip_storage,
{
err_status=
- vio_get_normalized_ip_string(addr_info->ai_addr, addr_info->ai_addrlen,
+ vio_get_normalized_ip_string(addr_info->ai_addr, (int)addr_info->ai_addrlen,
ip_buffer, sizeof (ip_buffer));
DBUG_ASSERT(!err_status);
}
@@ -990,7 +990,7 @@ int ip_to_hostname(struct sockaddr_storage *ip_storage,
char ip_buffer[HOST_ENTRY_KEY_SIZE];
err_status=
- vio_get_normalized_ip_string(addr_info->ai_addr, addr_info->ai_addrlen,
+ vio_get_normalized_ip_string(addr_info->ai_addr, (int)addr_info->ai_addrlen,
ip_buffer, sizeof (ip_buffer));
DBUG_ASSERT(!err_status);