From 301d0de34c5126636c8a9e704bf10ea0d43dcd51 Mon Sep 17 00:00:00 2001 From: Georg Richter Date: Sun, 1 Nov 2015 08:34:12 +0100 Subject: [PATCH] Windows fixes: fixed type mismatch warnings in client_plugin.c fixed prototypes and const/non const warnings in windows pvio removed debug from msi package added plugin dependencies for msi package --- cmake/plugins.cmake | 28 +++++---- include/ma_pvio.h | 10 ++-- include/mysql_async.h | 2 +- libmariadb/client_plugin.c.in | 2 +- libmariadb/get_password.c | 5 +- libmariadb/ma_pvio.c | 4 +- libmariadb/mysql_async.c | 2 +- plugins/pvio/pvio_npipe.c | 73 +++++++++++++++--------- plugins/pvio/pvio_shmem.c | 30 ++++------ win/packaging/CMakeLists.txt | 47 +++++++-------- win/packaging/mariadb-connector-c.xml.in | 13 +---- 11 files changed, 111 insertions(+), 105 deletions(-) diff --git a/cmake/plugins.cmake b/cmake/plugins.cmake index 3ee53145..133bee18 100644 --- a/cmake/plugins.cmake +++ b/cmake/plugins.cmake @@ -1,11 +1,15 @@ # plugin configuration -MACRO(REGISTER_PLUGIN name source struct type allow) +MACRO(REGISTER_PLUGIN name source struct type target allow) IF(PLUGINS) LIST(REMOVE_ITEM PLUGINS ${name}) ENDIF() SET(${name}_PLUGIN_SOURCE ${source}) + MARK_AS_ADVANCED(${name}_PLUGIN_SOURCE}) SET(${name}_PLUGIN_TYPE ${type}) + IF(NOT ${target} STREQUAL "") + SET(${name}_PLUGIN_TARGET ${target}) + ENDIF() SET(${name}_PLUGIN_STRUCT ${struct}) SET(${name}_PLUGIN_SOURCE ${source}) SET(${name}_PLUGIN_CHG ${allow}) @@ -15,26 +19,28 @@ ENDMACRO() MARK_AS_ADVANCED(PLUGINS) # CIO -REGISTER_PLUGIN("SOCKET" "${CMAKE_SOURCE_DIR}/plugins/pvio/pvio_socket.c" "pvio_socket_plugin" "STATIC" 0) +REGISTER_PLUGIN("SOCKET" "${CMAKE_SOURCE_DIR}/plugins/pvio/pvio_socket.c" "pvio_socket_plugin" "STATIC" pvio_socket 0) IF(WIN32) - REGISTER_PLUGIN("NPIPE" "${CMAKE_SOURCE_DIR}/plugins/pvio/pvio_npipe.c" "pvio_npipe_plugin" "DYNAMIC" 1) - REGISTER_PLUGIN("SHMEM" "${CMAKE_SOURCE_DIR}/plugins/pvio/pvio_shmem.c" "pvio_shmem_plugin" "DYNAMIC" 1) + REGISTER_PLUGIN("NPIPE" "${CMAKE_SOURCE_DIR}/plugins/pvio/pvio_npipe.c" "pvio_npipe_plugin" "STATIC" pvio_npipe 1) + REGISTER_PLUGIN("SHMEM" "${CMAKE_SOURCE_DIR}/plugins/pvio/pvio_shmem.c" "pvio_shmem_plugin" "DYNAMIC" pvio_shmem 1) ENDIF() # AUTHENTICATION -REGISTER_PLUGIN("AUTH_NATIVE" "${CMAKE_SOURCE_DIR}/plugins/auth/my_auth.c" "native_password_client_plugin" "STATIC" 0) -REGISTER_PLUGIN("AUTH_OLDPASSWORD" "${CMAKE_SOURCE_DIR}/plugins/auth/my_auth.c" "old_password_client_plugin" "STATIC" 0) -REGISTER_PLUGIN("AUTH_DIALOG" "${CMAKE_SOURCE_DIR}/plugins/auth/dialog.c" "auth_dialog_plugin" "DYNAMIC" 1) -REGISTER_PLUGIN("AUTH_CLEARTEXT" "${CMAKE_SOURCE_DIR}/plugins/auth/mariadb_clear_text.c" "auth_cleartext_plugin" "DYNAMIC" 1) +REGISTER_PLUGIN("AUTH_NATIVE" "${CMAKE_SOURCE_DIR}/plugins/auth/my_auth.c" "native_password_client_plugin" "STATIC" "" 0) +REGISTER_PLUGIN("AUTH_OLDPASSWORD" "${CMAKE_SOURCE_DIR}/plugins/auth/my_auth.c" "old_password_client_plugin" "STATIC" "" 0) +REGISTER_PLUGIN("AUTH_DIALOG" "${CMAKE_SOURCE_DIR}/plugins/auth/dialog.c" "auth_dialog_plugin" "DYNAMIC" dialog 1) +REGISTER_PLUGIN("AUTH_CLEARTEXT" "${CMAKE_SOURCE_DIR}/plugins/auth/mariadb_clear_text.c" "auth_cleartext_plugin" "DYNAMIC" "mysql_clear_password" 1) #Remote_IO -REGISTER_PLUGIN("REMOTEIO" "${CMAKE_SOURCE_DIR}/plugins/io/remote_io.c" "remote_io_plugin" "DYNAMIC" 1) +IF(CURL_FOUND) + REGISTER_PLUGIN("REMOTEIO" "${CMAKE_SOURCE_DIR}/plugins/io/remote_io.c" "remote_io_plugin" "DYNAMIC" "remote_io" 1) +ENDIF() #Trace -REGISTER_PLUGIN("TRACE_EXAMPLE" "${CMAKE_SOURCE_DIR}/plugins/trace/trace_example.c" "trace_example_plugin" "DYNAMIC" 1) +REGISTER_PLUGIN("TRACE_EXAMPLE" "${CMAKE_SOURCE_DIR}/plugins/trace/trace_example.c" "trace_example_plugin" "DYNAMIC" "trace_example" 1) #Connection -REGISTER_PLUGIN("REPLICATION" "${CMAKE_SOURCE_DIR}/plugins/connection/replication.c" "connection_replication_plugin" "STATIC" 1) +REGISTER_PLUGIN("REPLICATION" "${CMAKE_SOURCE_DIR}/plugins/connection/replication.c" "connection_replication_plugin" "STATIC" "" 1) # Allow registration of additional plugins IF(PLUGIN_CONF_FILE) diff --git a/include/ma_pvio.h b/include/ma_pvio.h index e112ace6..5aff34a4 100644 --- a/include/ma_pvio.h +++ b/include/ma_pvio.h @@ -53,7 +53,7 @@ typedef struct st_pvio_callback { struct st_pvio_callback *next; } PVIO_CALLBACK; -struct st_ma_pvio { +typedef struct st_ma_pvio { void *data; /* read ahead cache */ uchar *cache; @@ -69,7 +69,7 @@ struct st_ma_pvio { FILE *fp; void (*set_error)(MYSQL *mysql, unsigned int error_nr, const char *sqlstate, const char *format, ...); void (*callback)(MARIADB_PVIO *pvio, my_bool is_read, const char *buffer, size_t length); -}; +} MARIADB_PVIO; typedef struct st_ma_pvio_cinfo { @@ -84,8 +84,8 @@ struct st_ma_pvio_methods { my_bool (*set_timeout)(MARIADB_PVIO *pvio, enum enum_pvio_timeout type, int timeout); int (*get_timeout)(MARIADB_PVIO *pvio, enum enum_pvio_timeout type); - size_t (*read)(MARIADB_PVIO *pvio, const uchar *buffer, size_t length); - size_t (*async_read)(MARIADB_PVIO *pvio, const uchar *buffer, size_t length); + size_t (*read)(MARIADB_PVIO *pvio, uchar *buffer, size_t length); + size_t (*async_read)(MARIADB_PVIO *pvio, uchar *buffer, size_t length); size_t (*write)(MARIADB_PVIO *pvio, const uchar *buffer, size_t length); size_t (*async_write)(MARIADB_PVIO *pvio, const uchar *buffer, size_t length); int (*wait_io_or_timeout)(MARIADB_PVIO *pvio, my_bool is_read, int timeout); @@ -103,7 +103,7 @@ struct st_ma_pvio_methods MARIADB_PVIO *ma_pvio_init(MA_PVIO_CINFO *cinfo); void ma_pvio_close(MARIADB_PVIO *pvio); size_t ma_pvio_cache_read(MARIADB_PVIO *pvio, uchar *buffer, size_t length); -size_t ma_pvio_read(MARIADB_PVIO *pvio, const uchar *buffer, size_t length); +size_t ma_pvio_read(MARIADB_PVIO *pvio, uchar *buffer, size_t length); size_t ma_pvio_write(MARIADB_PVIO *pvio, const uchar *buffer, size_t length); int ma_pvio_get_timeout(MARIADB_PVIO *pvio, enum enum_pvio_timeout type); my_bool ma_pvio_set_timeout(MARIADB_PVIO *pvio, enum enum_pvio_timeout type, int timeout); diff --git a/include/mysql_async.h b/include/mysql_async.h index 52ec0ba3..56d4e2bf 100644 --- a/include/mysql_async.h +++ b/include/mysql_async.h @@ -22,7 +22,7 @@ extern int my_connect_async(MARIADB_PVIO *pvio, const struct sockaddr *name, uint namelen, int vio_timeout); extern ssize_t my_recv_async(MARIADB_PVIO *pvio, - const unsigned char *buf, size_t size, int timeout); + unsigned char *buf, size_t size, int timeout); extern ssize_t my_send_async(MARIADB_PVIO *pvio, const unsigned char *buf, size_t size, int timeout); diff --git a/libmariadb/client_plugin.c.in b/libmariadb/client_plugin.c.in index dba290ff..0e2d5952 100644 --- a/libmariadb/client_plugin.c.in +++ b/libmariadb/client_plugin.c.in @@ -109,7 +109,7 @@ static int get_plugin_nr(int type) return -1; } -static my_bool check_plugin_version(struct st_mysql_client_plugin *plugin, int version, char *errmsg) +static my_bool check_plugin_version(struct st_mysql_client_plugin *plugin, unsigned int version, char *errmsg) { if (plugin->interface_version < version || (plugin->interface_version >> 8) > (version >> 8)) diff --git a/libmariadb/get_password.c b/libmariadb/get_password.c index fb78da9c..2eafb7a8 100644 --- a/libmariadb/get_password.c +++ b/libmariadb/get_password.c @@ -51,8 +51,11 @@ static char *get_password(FILE *file, char *buffer, int length) { char inChar; int CharsProcessed= 1; +#ifdef _WIN32 + DWORD Offset= 0; +#else int Offset= 0; - +#endif memset(buffer, 0, length); do diff --git a/libmariadb/ma_pvio.c b/libmariadb/ma_pvio.c index 2257d465..089de263 100644 --- a/libmariadb/ma_pvio.c +++ b/libmariadb/ma_pvio.c @@ -170,7 +170,7 @@ my_bool ma_pvio_set_timeout(MARIADB_PVIO *pvio, /* }}} */ /* {{{ size_t ma_pvio_read_async */ -static size_t ma_pvio_read_async(MARIADB_PVIO *pvio, const uchar *buffer, size_t length) +static size_t ma_pvio_read_async(MARIADB_PVIO *pvio, uchar *buffer, size_t length) { ssize_t res; struct mysql_async_context *b= pvio->async_context; @@ -201,7 +201,7 @@ static size_t ma_pvio_read_async(MARIADB_PVIO *pvio, const uchar *buffer, size_t /* }}} */ /* {{{ size_t ma_pvio_read */ -size_t ma_pvio_read(MARIADB_PVIO *pvio, const uchar *buffer, size_t length) +size_t ma_pvio_read(MARIADB_PVIO *pvio, uchar *buffer, size_t length) { size_t r= -1; if (!pvio) diff --git a/libmariadb/mysql_async.c b/libmariadb/mysql_async.c index a28be289..0ed3ba47 100644 --- a/libmariadb/mysql_async.c +++ b/libmariadb/mysql_async.c @@ -135,7 +135,7 @@ my_connect_async(MARIADB_PVIO *pvio, #endif ssize_t -my_recv_async(MARIADB_PVIO *pvio, const unsigned char *buf, size_t size, int timeout) +my_recv_async(MARIADB_PVIO *pvio, unsigned char *buf, size_t size, int timeout) { ssize_t res; struct mysql_async_context *b= pvio->async_context; diff --git a/plugins/pvio/pvio_npipe.c b/plugins/pvio/pvio_npipe.c index 54932939..82f9761a 100644 --- a/plugins/pvio/pvio_npipe.c +++ b/plugins/pvio/pvio_npipe.c @@ -30,38 +30,34 @@ #include #include -#ifdef HAVE_NPIPE_DYNAMIC -#define my_malloc(A, B) malloc((A)) -#undef my_free -#define my_free(A,B) free(((A))) -#endif - /* Function prototypes */ my_bool pvio_npipe_set_timeout(MARIADB_PVIO *pvio, enum enum_pvio_timeout type, int timeout); int pvio_npipe_get_timeout(MARIADB_PVIO *pvio, enum enum_pvio_timeout type); size_t pvio_npipe_read(MARIADB_PVIO *pvio, uchar *buffer, size_t length); -size_t pvio_npipe_write(MARIADB_PVIO *pvio, uchar *buffer, size_t length); +size_t pvio_npipe_write(MARIADB_PVIO *pvio, const uchar *buffer, size_t length); int pvio_npipe_wait_io_or_timeout(MARIADB_PVIO *pvio, my_bool is_read, int timeout); my_bool pvio_npipe_blocking(MARIADB_PVIO *pvio, my_bool value, my_bool *old_value); my_bool pvio_npipe_connect(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo); my_bool pvio_npipe_close(MARIADB_PVIO *pvio); int pvio_npipe_fast_send(MARIADB_PVIO *pvio); int pvio_npipe_keepalive(MARIADB_PVIO *pvio); -my_socket pvio_npipe_get_socket(MARIADB_PVIO *pvio); +my_bool pvio_npipe_get_handle(MARIADB_PVIO *pvio, void *handle); my_bool pvio_npipe_is_blocking(MARIADB_PVIO *pvio); struct st_ma_pvio_methods pvio_npipe_methods= { pvio_npipe_set_timeout, pvio_npipe_get_timeout, pvio_npipe_read, + NULL, pvio_npipe_write, + NULL, pvio_npipe_wait_io_or_timeout, pvio_npipe_blocking, pvio_npipe_connect, pvio_npipe_close, pvio_npipe_fast_send, pvio_npipe_keepalive, - pvio_npipe_get_socket, + pvio_npipe_get_handle, pvio_npipe_is_blocking }; @@ -87,7 +83,6 @@ struct st_pvio_npipe { HANDLE pipe; OVERLAPPED overlapped; size_t rw_size; - int fcntl_mode; MYSQL *mysql; }; @@ -117,7 +112,7 @@ size_t pvio_npipe_read(MARIADB_PVIO *pvio, uchar *buffer, size_t length) cpipe= (struct st_pvio_npipe *)pvio->data; - if (ReadFile(cpipe->pipe, buffer, length, &dwRead, &cpipe->overlapped)) + if (ReadFile(cpipe->pipe, (LPVOID)buffer, length, &dwRead, &cpipe->overlapped)) { r= (size_t)dwRead; goto end; @@ -131,7 +126,7 @@ end: return r; } -size_t pvio_npipe_write(MARIADB_PVIO *pvio, uchar *buffer, size_t length) +size_t pvio_npipe_write(MARIADB_PVIO *pvio, const uchar *buffer, size_t length) { DWORD dwWrite= 0; size_t r= -1; @@ -171,10 +166,11 @@ int pvio_npipe_wait_io_or_timeout(MARIADB_PVIO *pvio, my_bool is_read, int timeo status= WaitForSingleObject(cpipe->overlapped.hEvent, timeout); if (status == WAIT_OBJECT_0) { - if (GetOverlappedResult(cpipe->pipe, &cpipe->overlapped, &cpipe->rw_size, FALSE)) + if (GetOverlappedResult(cpipe->pipe, &cpipe->overlapped, (LPDWORD)&cpipe->rw_size, FALSE)) return 0; } - /* other status codes are: WAIT_ABANDONED, WAIT_TIMEOUT and WAIT_FAILED */ + /* For other status codes (WAIT_ABANDONED, WAIT_TIMEOUT and WAIT_FAILED) + we return error */ save_error= GetLastError(); CancelIo(cpipe->pipe); SetLastError(save_error); @@ -184,12 +180,27 @@ int pvio_npipe_wait_io_or_timeout(MARIADB_PVIO *pvio, my_bool is_read, int timeo my_bool pvio_npipe_blocking(MARIADB_PVIO *pvio, my_bool block, my_bool *previous_mode) { /* not supported */ + DWORD flags= 0; + struct st_pvio_npipe *cpipe= NULL; + + cpipe= (struct st_pvio_npipe *)pvio->data; + + if (previous_mode) + { + if (!GetNamedPipeHandleState(cpipe->pipe, &flags, NULL, NULL, NULL, NULL, 0)) + return 1; + *previous_mode= flags & PIPE_NOWAIT ? 0 : 1; + } + + flags= block ? PIPE_WAIT : PIPE_NOWAIT; + if (!SetNamedPipeHandleState(cpipe->pipe, &flags, NULL, NULL)) + return 1; return 0; } int pvio_npipe_keepalive(MARIADB_PVIO *pvio) { - /* not supported */ + /* keep alive is used for TCP/IP connections only */ return 0; } @@ -205,7 +216,7 @@ my_bool pvio_npipe_connect(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo) if (!pvio || !cinfo) return 1; - if (!(cpipe= (struct st_pvio_npipe *)my_malloc(sizeof(struct st_pvio_npipe), MYF(0)))) + if (!(cpipe= (struct st_pvio_npipe *)LocalAlloc(sizeof(struct st_pvio_npipe), 0))) { PVIO_SET_ERROR(cinfo->mysql, CR_OUT_OF_MEMORY, unknown_sqlstate, 0, ""); return 1; @@ -244,14 +255,14 @@ my_bool pvio_npipe_connect(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo) if (GetLastError() != ERROR_PIPE_BUSY) { - pvio->set_error(pvio, CR_NAMEDPIPEOPEN_ERROR, SQLSTATE_UNKNOWN, 0, + pvio->set_error(pvio->mysql, CR_NAMEDPIPEOPEN_ERROR, SQLSTATE_UNKNOWN, 0, cinfo->host, cinfo->unix_socket, GetLastError()); goto end; } if (has_timedout || !WaitNamedPipe(szPipeName, pvio->timeout[PVIO_CONNECT_TIMEOUT])) { - pvio->set_error(pvio, CR_NAMEDPIPEWAIT_ERROR, SQLSTATE_UNKNOWN, 0, + pvio->set_error(pvio->mysql, CR_NAMEDPIPEWAIT_ERROR, SQLSTATE_UNKNOWN, 0, cinfo->host, cinfo->unix_socket, GetLastError()); goto end; } @@ -261,7 +272,7 @@ my_bool pvio_npipe_connect(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo) dwMode = PIPE_READMODE_BYTE | PIPE_WAIT; if (!SetNamedPipeHandleState(cpipe->pipe, &dwMode, NULL, NULL)) { - pvio->set_error(pvio, CR_NAMEDPIPESETSTATE_ERROR, SQLSTATE_UNKNOWN, 0, + pvio->set_error(pvio->mysql, CR_NAMEDPIPESETSTATE_ERROR, SQLSTATE_UNKNOWN, 0, cinfo->host, cinfo->unix_socket, (ulong) GetLastError()); goto end; } @@ -269,7 +280,7 @@ my_bool pvio_npipe_connect(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo) /* Register event handler for overlapped IO */ if (!(cpipe->overlapped.hEvent= CreateEvent(NULL, FALSE, FALSE, NULL))) { - pvio->set_error(pvio, CR_EVENT_CREATE_FAILED, SQLSTATE_UNKNOWN, 0, + pvio->set_error(pvio->mysql, CR_EVENT_CREATE_FAILED, SQLSTATE_UNKNOWN, 0, GetLastError()); goto end; } @@ -280,7 +291,7 @@ end: { if (cpipe->pipe != INVALID_HANDLE_VALUE) CloseHandle(cpipe->pipe); - my_free((gptr)cpipe, MYF(0)); + LocalFree(cpipe); pvio->data= NULL; } return 1; @@ -303,22 +314,32 @@ my_bool pvio_npipe_close(MARIADB_PVIO *pvio) CloseHandle(cpipe->pipe); cpipe->pipe= INVALID_HANDLE_VALUE; } - my_free((gptr)pvio->data, MYF(0)); + LocalFree(pvio->data); pvio->data= NULL; } return r; } -my_socket pvio_npipe_get_socket(MARIADB_PVIO *pvio) +my_bool pvio_npipe_get_handle(MARIADB_PVIO *pvio, void *handle) { if (pvio && pvio->data) - return (my_socket)((struct st_pvio_npipe *)pvio->data)->pipe; - return INVALID_SOCKET; + { + *(HANDLE *)handle= ((struct st_pvio_npipe *)pvio->data)->pipe; + return 0; + } + return 1; } my_bool pvio_npipe_is_blocking(MARIADB_PVIO *pvio) { - return 1; + DWORD flags= 0; + struct st_pvio_npipe *cpipe= NULL; + + cpipe= (struct st_pvio_npipe *)pvio->data; + + if (!GetNamedPipeHandleState(cpipe->pipe, &flags, NULL, NULL, NULL, NULL, 0)) + return 1; + return (flags & PIPE_NOWAIT) ? 0 : 1; } #endif diff --git a/plugins/pvio/pvio_shmem.c b/plugins/pvio/pvio_shmem.c index 06a68f3d..218c88f2 100644 --- a/plugins/pvio/pvio_shmem.c +++ b/plugins/pvio/pvio_shmem.c @@ -29,19 +29,13 @@ #include #include -#ifdef HAVE_SHMEM_DYNAMIC -#define my_malloc(A, B) malloc((A)) -#undef my_free -#define my_free(A,B) free(((A))) -#endif - #define SHM_DEFAULT_NAME "MYSQL" #define PVIO_SHM_BUFFER_SIZE 16000 + 4 my_bool pvio_shm_set_timeout(MARIADB_PVIO *pvio, enum enum_pvio_timeout type, int timeout); int pvio_shm_get_timeout(MARIADB_PVIO *pvio, enum enum_pvio_timeout type); -size_t pvio_shm_read(MARIADB_PVIO *pvio, const uchar *buffer, size_t length); -size_t pvio_shm_write(MARIADB_PVIO *pvio, uchar *buffer, size_t length); +size_t pvio_shm_read(MARIADB_PVIO *pvio, uchar *buffer, size_t length); +size_t pvio_shm_write(MARIADB_PVIO *pvio, const uchar *buffer, size_t length); int pvio_shm_wait_io_or_timeout(MARIADB_PVIO *pvio, my_bool is_read, int timeout); my_bool pvio_shm_blocking(MARIADB_PVIO *pvio, my_bool value, my_bool *old_value); my_bool pvio_shm_connect(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo); @@ -123,7 +117,7 @@ int pvio_shm_get_timeout(MARIADB_PVIO *pvio, enum enum_pvio_timeout type) return pvio->timeout[type] / 1000; } -size_t pvio_shm_read(MARIADB_PVIO *pvio, const uchar *buffer, size_t length) +size_t pvio_shm_read(MARIADB_PVIO *pvio, uchar *buffer, size_t length) { PVIO_SHM *pvio_shm= (PVIO_SHM *)pvio->data; size_t copy_size= length; @@ -151,7 +145,7 @@ size_t pvio_shm_read(MARIADB_PVIO *pvio, const uchar *buffer, size_t length) return -1; } /* server sent data */ - pvio_shm->read_pos= pvio_shm->map; + pvio_shm->read_pos= (char *)pvio_shm->map; pvio_shm->buffer_size= uint4korr(pvio_shm->read_pos); pvio_shm->read_pos+= 4; } @@ -161,7 +155,7 @@ size_t pvio_shm_read(MARIADB_PVIO *pvio, const uchar *buffer, size_t length) if (copy_size) { - memcpy(buffer, pvio_shm->read_pos, pvio_shm->buffer_size); + memcpy(buffer, (uchar *)pvio_shm->read_pos, pvio_shm->buffer_size); pvio_shm->read_pos+= copy_size; pvio_shm->buffer_size-= copy_size; } @@ -174,12 +168,12 @@ size_t pvio_shm_read(MARIADB_PVIO *pvio, const uchar *buffer, size_t length) return copy_size; } -size_t pvio_shm_write(MARIADB_PVIO *pvio, uchar *buffer, size_t length) +size_t pvio_shm_write(MARIADB_PVIO *pvio, const uchar *buffer, size_t length) { HANDLE events[2]; PVIO_SHM *pvio_shm= (PVIO_SHM *)pvio->data; size_t bytes_to_write= length; - uchar *buffer_pos= buffer; + uchar *buffer_pos= (uchar *)buffer; if (!pvio_shm) return -1; @@ -216,6 +210,7 @@ size_t pvio_shm_write(MARIADB_PVIO *pvio, uchar *buffer, size_t length) int pvio_shm_wait_io_or_timeout(MARIADB_PVIO *pvio, my_bool is_read, int timeout) { + return 0; } my_bool pvio_shm_blocking(MARIADB_PVIO *pvio, my_bool block, my_bool *previous_mode) @@ -244,8 +239,6 @@ my_bool pvio_shm_connect(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo) uchar i= 0; int len; DWORD cid; - char connection_id[28]; - char *connection_id_str; DWORD dwDesiredAccess= EVENT_MODIFY_STATE | SYNCHRONIZE; HANDLE hdlConnectRequest= NULL, hdlConnectRequestAnswer= NULL, @@ -269,7 +262,7 @@ my_bool pvio_shm_connect(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo) cinfo->mysql->options.shared_memory_base_name : SHM_DEFAULT_NAME; - if (!(shm_name= LocalAlloc(LMEM_ZEROINIT, strlen(base_memory_name) + 40))) + if (!(shm_name= (char *)LocalAlloc(LMEM_ZEROINIT, strlen(base_memory_name) + 40))) { PVIO_SET_ERROR(cinfo->mysql, CR_OUT_OF_MEMORY, unknown_sqlstate, 0, ""); goto error; @@ -394,7 +387,7 @@ error: pvio->data= (void *)pvio_shm; pvio->mysql= cinfo->mysql; pvio->type= cinfo->type; - pvio_shm->read_pos= pvio_shm->map; + pvio_shm->read_pos= (char *)pvio_shm->map; pvio->mysql->net.pvio= pvio; return 0; } @@ -433,8 +426,9 @@ my_bool pvio_shm_close(MARIADB_PVIO *pvio) return 0; } -my_socket pvio_shm_get_socket(MARIADB_PVIO *pvio) +my_bool pvio_shm_get_socket(MARIADB_PVIO *pvio, void *handle) { + return 1; } my_bool pvio_shm_is_blocking(MARIADB_PVIO *pvio) diff --git a/win/packaging/CMakeLists.txt b/win/packaging/CMakeLists.txt index dd8f4454..1b774a84 100644 --- a/win/packaging/CMakeLists.txt +++ b/win/packaging/CMakeLists.txt @@ -8,8 +8,6 @@ SET(PRODUCT_INSTALL_DIR "MariaDB") SET(PRODUCT_MANUFACTURER "MariaDB Corporation") SET(PRODUCT_VERSION "${CPACK_PACKAGE_VERSION}") -MESSAGE(STATUS "sizeof ${CMAKE_SIZEOF_VOID_P}") - IF (${CMAKE_SIZEOF_VOID_P} EQUAL 8) SET(PRODUCT_NAME "${PRODUCT_NAME} 64-bit") SET(PLATFORM "win64") @@ -25,27 +23,23 @@ ELSE() SET(FOLDER "ProgramFilesFolder") ENDIF() -IF (WITH_SIGNCODE) - SET(SIGN_OPTIONS " /a /t http://timestamp.verisign.com/scripts/timstamp.dll ") - EXECUTE_PROCESS( - COMMAND signtool sign ${SIGN_OPTIONS} ${CLIENT_LIB_DIR}/libmariadb.dll) - EXECUTE_PROCESS( - COMMAND signtool sign ${SIGN_OPTIONS} ${CLIENT_LIB_DIR}/libmariadb.lib) - EXECUTE_PROCESS( - COMMAND signtool sign ${SIGN_OPTIONS} ${CLIENT_LIB_DIR}/mariadbclient.lib) - EXECUTE_PROCESS( - COMMAND signtool sign ${SIGN_OPTIONS} ${CLIENT_DBG_DIR}/libmariadb.dll) - EXECUTE_PROCESS( - COMMAND signtool sign ${SIGN_OPTIONS} ${CLIENT_DBG_DIR}/libmariadb.lib) - EXECUTE_PROCESS( - COMMAND signtool sign ${SIGN_OPTIONS} ${CLIENT_DBG_DIR}/mariadbclient.lib) - EXECUTE_PROCESS( - COMMAND signtool sign ${SIGN_OPTIONS} ${CMAKE_BINARY_DIR}/plugins/auth/${CMAKE_BUILD_TYPE}/dialog.dll) - EXECUTE_PROCESS( - COMMAND signtool sign ${SIGN_OPTIONS} ${CMAKE_BINARY_DIR}/plugins/auth/${CMAKE_BUILD_TYPE}/mysql_clear_password.dll) -ENDIF() +# +# process dynamic plugins +# +FOREACH(plugin ${PLUGINS}) + IF(${${plugin}_PLUGIN_TYPE} STREQUAL "DYNAMIC") + SET(TARGET ${${plugin}_PLUGIN_TARGET}) + # Get dependencies + SET(DYNAMIC_TARGETS ${DYNAMIC_TARGETS} ${TARGET}) -FILE(READ ${CMAKE_BINARY_DIR}/win/packaging/plugin.conf MARIADB_PLUGINS) + # build file list + SET(FILE ${${plugin}_PLUGIN_SOURCE}) + GET_FILENAME_COMPONENT(FILE ${FILE} DIRECTORY) + STRING(REPLACE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} FILE ${FILE}) + SET(FILE ${FILE}/RelWithDebInfo/${TARGET}.dll) + SET(MARIADB_PLUGINS "${MARIADB_PLUGINS} \n") + ENDIF() +ENDFOREACH() FOREACH(src ${MARIADB_CLIENT_INCLUDES}) STRING(REPLACE "-" "_" src_id ${src}) @@ -63,8 +57,6 @@ IF(NOT WIX_DIR) SET(WIX_DIR $ENV{WIX}/bin) ENDIF() -CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/win/packaging/mariadb-connector-c.xml.in - ${CMAKE_BINARY_DIR}/win/packaging/mariadb-connector-c.xml) SET(MSI_PACKAGE "mariadb-connector-c-${PRODUCT_VERSION}-${PLATFORM}.msi") IF(WITH_SIGNCODE) @@ -82,12 +74,13 @@ ADD_CUSTOM_TARGET( COMMAND ${WIX_DIR}/light.exe -ext WixUIExtension mariadb-connector-c.wixobj -o ${MSI_PACKAGE}) ADD_CUSTOM_TARGET(WIXOBJ - DEPENDS mariadb-connector-c.xml + DEPENDS mariadb-connector-c.xml} COMMAND ${WIX_DIR}/candle.exe mariadb-connector-c.xml -o mariadb-connector-c.wixobj) SET_TARGET_PROPERTIES(${MSI_PACKAGE} PROPERTIES EXCLUDE_FROM_ALL OFF) SET_TARGET_PROPERTIES(${WIXOBJ} PROPERTIES EXCLUDE_FROM_ALL OFF) ADD_DEPENDENCIES(${MSI_PACKAGE} WIXOBJ) -ADD_DEPENDENCIES(WIXOBJ libmariadb mariadbclient dialog mysql_clear_password) - +ADD_DEPENDENCIES(WIXOBJ libmariadb mariadbclient mariadb_client_plugin_info ${DYNAMIC_TARGETS}) +CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/win/packaging/mariadb-connector-c.xml.in + ${CMAKE_BINARY_DIR}/win/packaging/mariadb-connector-c.xml) diff --git a/win/packaging/mariadb-connector-c.xml.in b/win/packaging/mariadb-connector-c.xml.in index ddc2dbe0..b2786d20 100644 --- a/win/packaging/mariadb-connector-c.xml.in +++ b/win/packaging/mariadb-connector-c.xml.in @@ -17,11 +17,7 @@ - - - - @@ -58,11 +54,7 @@ - - - - - + @MARIADB_PLUGINS@ - - - @MARIADB_INCLUDE_FILES@