Commit d2f54d57 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

Fixed some simple warnings on Windows.

parent 12e4feab
......@@ -38,10 +38,10 @@ int func1()
int main (int argc, char *argv[])
{
int i;
#ifdef DBUG_OFF
return 1;
#endif
#else
int i;
if (argc == 1)
return 0;
......@@ -83,4 +83,5 @@ int main (int argc, char *argv[])
DBUG_SET(""); /* to not have my_end() in the traces */
my_end(0);
return 0;
#endif /* DBUG_OFF */
}
......@@ -67,7 +67,7 @@ static struct my_option my_long_options[] =
{"defaults-extra-file", 'e',
"Read this file after the global config file and before the config "
"file in the users home directory; should be the first option",
&my_defaults_extra_file, &my_defaults_extra_file, 0,
(void *)&my_defaults_extra_file, (void *)&my_defaults_extra_file, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"defaults-group-suffix", 'g',
"In addition to the given groups, read also groups with this suffix",
......@@ -75,8 +75,8 @@ static struct my_option my_long_options[] =
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"extra-file", 'e',
"Deprecated. Synonym for --defaults-extra-file.",
&my_defaults_extra_file,
&my_defaults_extra_file, 0, GET_STR,
(void *)&my_defaults_extra_file,
(void *)&my_defaults_extra_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"no-defaults", 'n', "Return an empty string (useful for scripts).",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
......
......@@ -2969,10 +2969,6 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
const char *scramble_plugin;
ulong pkt_length;
NET *net= &mysql->net;
#ifdef MYSQL_SERVER
thr_alarm_t alarmed;
ALARM alarm_buff;
#endif
#ifdef __WIN__
HANDLE hPipe=INVALID_HANDLE_VALUE;
#endif
......@@ -3181,17 +3177,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
my_snprintf(host_info=buff, sizeof(buff)-1, ER(CR_TCP_CONNECTION), host);
DBUG_PRINT("info",("Server name: '%s'. TCP sock: %d", host, port));
#ifdef MYSQL_SERVER
thr_alarm_init(&alarmed);
thr_alarm(&alarmed, mysql->options.connect_timeout, &alarm_buff);
#endif
DBUG_PRINT("info",("IP '%s'", "client"));
#ifdef MYSQL_SERVER
thr_end_alarm(&alarmed);
#endif
memset(&hints, 0, sizeof(hints));
hints.ai_socktype= SOCK_STREAM;
hints.ai_protocol= IPPROTO_TCP;
......
......@@ -150,7 +150,7 @@ class Item_func :public Item_result_field
void count_only_length();
void count_real_length();
void count_decimal_length();
inline bool get_arg0_date(MYSQL_TIME *ltime, uint fuzzy_date)
inline bool get_arg0_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
{
return (null_value=args[0]->get_date(ltime, fuzzy_date));
}
......
......@@ -2220,8 +2220,8 @@ static void network_init(void)
{
#ifdef HAVE_SYS_UN_H
struct sockaddr_un UNIXaddr;
#endif
int arg;
#endif
DBUG_ENTER("network_init");
if (MYSQL_CALLBACK_ELSE(thread_scheduler, init, (), 0))
......
......@@ -167,7 +167,7 @@ extern "C" sig_handler handle_fatal_signal(int sig)
"where mysqld died. If you see no messages after this, something went\n"
"terribly wrong...\n");
my_print_stacktrace(thd ? (uchar*) thd->thread_stack : NULL,
my_thread_stack_size);
(ulong)my_thread_stack_size);
}
if (thd)
{
......
......@@ -4155,8 +4155,8 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
{
int error= 0;
String error_msg;
ulong inc_pos;
ulong event_pos;
ulonglong inc_pos;
ulonglong event_pos;
Relay_log_info *rli= &mi->rli;
mysql_mutex_t *log_lock= rli->relay_log.get_log_lock();
ulong s_id;
......
......@@ -618,8 +618,8 @@ Open streams: %10lu\n",
(ulong) my_file_opened,
(ulong) my_stream_opened);
ALARM_INFO alarm_info;
#ifndef DONT_USE_THR_ALARM
ALARM_INFO alarm_info;
thr_alarm_info(&alarm_info);
printf("\nAlarm status:\n\
Active alarms: %u\n\
......
......@@ -214,6 +214,15 @@ IF (MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 8)
PROPERTIES COMPILE_FLAGS -Od)
ENDIF()
IF(MSVC)
# Avoid "unreferenced label" warning in generated file
GET_FILENAME_COMPONENT(_SRC_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
SET_SOURCE_FILES_PROPERTIES(${_SRC_DIR}/pars/pars0grm.c
PROPERTIES COMPILE_FLAGS "/wd4102")
SET_SOURCE_FILES_PROPERTIES(${_SRC_DIR}/pars/lexyy.c
PROPERTIES COMPILE_FLAGS "/wd4003")
ENDIF()
SET(INNOBASE_SOURCES btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea.c
buf/buf0buddy.c buf/buf0buf.c buf/buf0flu.c buf/buf0lru.c buf/buf0rea.c
data/data0data.c data/data0type.c
......
......@@ -23,7 +23,9 @@
#include <my_global.h>
#include <my_sys.h>
#include <tap.h>
#ifdef _WIN32
#include <direct.h> /* rmdir */
#endif
#ifndef WITH_ARIA_STORAGE_ENGINE
/*
If Aria is not compiled in, normally we don't come to building this test.
......
......@@ -289,7 +289,7 @@ int main(int argc __attribute__((unused)),
fprintf(stderr, "End of memory\n");
exit(1);
}
for (i= 0; i < (LONG_BUFFER_SIZE + 7 * 2 + 2); i++)
for (i= 0; i < (uint32)(LONG_BUFFER_SIZE + 7 * 2 + 2); i++)
long_buffer[i]= (i & 0xFF);
#ifndef DBUG_OFF
......
......@@ -823,16 +823,14 @@ const char *sanitize_table_schema_name(const char *unsafe)
intptr first= (intptr) &table_share_array[0];
intptr last= (intptr) &table_share_array[table_share_max];
PFS_table_share dummy;
/* Check if unsafe points inside table_share_array[] */
if (likely((first <= ptr) && (ptr < last)))
{
intptr offset= (ptr - first) % sizeof(PFS_table_share);
intptr from= my_offsetof(PFS_table_share, m_key.m_hash_key);
intptr len= sizeof(dummy.m_key.m_hash_key);
/* Check if unsafe points inside PFS_table_share::m_key::m_hash_key */
if (likely((from <= offset) && (offset < from + len)))
if (likely((from <= offset) && (offset < from + PFS_TABLESHARE_HASHKEY_SIZE)))
{
PFS_table_share *base= (PFS_table_share*) (ptr - offset);
/* Check if unsafe really is the schema name */
......@@ -849,16 +847,14 @@ const char *sanitize_table_object_name(const char *unsafe)
intptr first= (intptr) &table_share_array[0];
intptr last= (intptr) &table_share_array[table_share_max];
PFS_table_share dummy;
/* Check if unsafe points inside table_share_array[] */
if (likely((first <= ptr) && (ptr < last)))
{
intptr offset= (ptr - first) % sizeof(PFS_table_share);
intptr from= my_offsetof(PFS_table_share, m_key.m_hash_key);
intptr len= sizeof(dummy.m_key.m_hash_key);
/* Check if unsafe points inside PFS_table_share::m_key::m_hash_key */
if (likely((from <= offset) && (offset < from + len)))
if (likely((from <= offset) && (offset < from + PFS_TABLESHARE_HASHKEY_SIZE)))
{
PFS_table_share *base= (PFS_table_share*) (ptr - offset);
/* Check if unsafe really is the table name */
......
......@@ -128,6 +128,8 @@ struct PFS_thread_class
bool m_enabled;
};
#define PFS_TABLESHARE_HASHKEY_SIZE (NAME_LEN + 1 + NAME_LEN + 1)
/** Key identifying a table share. */
struct PFS_table_share_key
{
......@@ -137,7 +139,7 @@ struct PFS_table_share_key
the format is "<schema_name><0x00><object_name><0x00>"
@see create_table_def_key
*/
char m_hash_key[NAME_LEN + 1 + NAME_LEN + 1];
char m_hash_key[PFS_TABLESHARE_HASHKEY_SIZE];
/** Length in bytes of @c m_hash_key. */
uint m_key_length;
};
......
......@@ -50,7 +50,6 @@
#else
// Windows-specific
#include <io.h>
#define strcasecmp stricmp
#define snprintf _snprintf
#define RECV_FLAGS 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment