From 716188f1d407acf8181966396d6c0923716f4546 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 24 Mar 2017 10:02:31 +0100 Subject: [PATCH] Fix some warnings on Windows compilation - silence warnings in ed25519 reference implementation - fix signed/unsigned warning in popular header item_func.h --- plugin/auth_ed25519/CMakeLists.txt | 6 +++++- sql/item_func.h | 2 +- sql/sql_lex.cc | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/plugin/auth_ed25519/CMakeLists.txt b/plugin/auth_ed25519/CMakeLists.txt index fb3a841ef9d..f340218dc02 100644 --- a/plugin/auth_ed25519/CMakeLists.txt +++ b/plugin/auth_ed25519/CMakeLists.txt @@ -14,8 +14,12 @@ SET(REF10_SOURCES INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) ADD_CONVENIENCE_LIBRARY(ref10 ${REF10_SOURCES}) +IF(MSVC) + # Silence conversion (integer truncantion) warnings from reference code + SET_TARGET_PROPERTIES(ref10 PROPERTIES COMPILE_FLAGS "/wd4244 /wd4146") +ENDIF() -MYSQL_ADD_PLUGIN(auth_ed25519 server_ed25519.c ${REF10_SOURCES} MODULE_ONLY) +MYSQL_ADD_PLUGIN(auth_ed25519 server_ed25519.c MODULE_ONLY LINK_LIBRARIES ref10) MYSQL_ADD_PLUGIN(client_ed25519 client_ed25519.c MODULE_ONLY CLIENT LINK_LIBRARIES mysys_ssl ref10 COMPONENT ClientPlugins) diff --git a/sql/item_func.h b/sql/item_func.h index ad69054b49c..4d58e974a75 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -633,7 +633,7 @@ public: Reserve max_length to fit at least one character for one digit, plus one character for the sign (if signed). */ - set_if_bigger(char_length, 1 + (unsigned_flag ? 0 : 1)); + set_if_bigger(char_length, 1U + (unsigned_flag ? 0 : 1)); fix_char_length(char_length); } virtual void print(String *str, enum_query_type query_type); diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index bc0b88a7be7..e401e96194c 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -469,7 +469,7 @@ int my_wc_mb_utf8_with_escape(CHARSET_INFO *cs, my_wc_t escape, my_wc_t wc, DBUG_ASSERT(escape > 0); if (str + 1 >= end) return MY_CS_TOOSMALL2; // Not enough space, need at least two bytes. - *str= escape; + *str= (uchar)escape; int cnvres= my_charset_utf8_handler.wc_mb(cs, wc, str + 1, end); if (cnvres > 0) return cnvres + 1; // The character was normally put