You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-08 14:02:17 +03:00
Fixes for Win64 build
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef uchar *(*hash_get_key)(const uchar *,size_t*,my_bool);
|
||||
typedef uchar *(*hash_get_key)(const uchar *,uint*,my_bool);
|
||||
typedef void (*hash_free_key)(void *);
|
||||
|
||||
/* flags for hash_init */
|
||||
|
@@ -404,10 +404,10 @@ void STDCALL mysql_close(MYSQL *sock);
|
||||
int STDCALL mysql_select_db(MYSQL *mysql, const char *db);
|
||||
int STDCALL mysql_query(MYSQL *mysql, const char *q);
|
||||
int STDCALL mysql_send_query(MYSQL *mysql, const char *q,
|
||||
unsigned int length);
|
||||
unsigned long length);
|
||||
int STDCALL mysql_read_query_result(MYSQL *mysql);
|
||||
int STDCALL mysql_real_query(MYSQL *mysql, const char *q,
|
||||
unsigned int length);
|
||||
unsigned long length);
|
||||
int STDCALL mysql_create_db(MYSQL *mysql, const char *DB);
|
||||
int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
|
||||
int STDCALL mysql_shutdown(MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level);
|
||||
|
@@ -68,8 +68,10 @@ typedef struct st_plugin_vio_info
|
||||
{
|
||||
enum { MYSQL_VIO_INVALID, MYSQL_VIO_TCP, MYSQL_VIO_SOCKET,
|
||||
MYSQL_VIO_PIPE, MYSQL_VIO_MEMORY } protocol;
|
||||
#ifndef _WIN32
|
||||
int socket; /**< it's set, if the protocol is SOCKET or TCP */
|
||||
#ifdef _WIN32
|
||||
#else
|
||||
SOCKET socket; /**< it's set, if the protocol is SOCKET or TCP */
|
||||
HANDLE handle; /**< it's set, if the protocol is PIPE or MEMORY */
|
||||
#endif
|
||||
} MYSQL_PLUGIN_VIO_INFO;
|
||||
|
@@ -98,7 +98,7 @@ inline char*
|
||||
hash_key(HASH *hash,const uchar *record,uint *length,my_bool first)
|
||||
{
|
||||
if (hash->get_key)
|
||||
return (*hash->get_key)(record,(size_t *)length,first);
|
||||
return (*hash->get_key)(record,(uint *)length,first);
|
||||
*length=hash->key_length;
|
||||
return (uchar*) record+hash->key_offset;
|
||||
}
|
||||
|
@@ -166,7 +166,7 @@ int socket_block(my_socket s,my_bool blocked)
|
||||
#endif
|
||||
}
|
||||
|
||||
static int connect2(my_socket s, const struct sockaddr *name, uint namelen,
|
||||
static int connect2(my_socket s, const struct sockaddr *name, size_t namelen,
|
||||
uint timeout)
|
||||
{
|
||||
int res, s_err;
|
||||
@@ -179,13 +179,13 @@ static int connect2(my_socket s, const struct sockaddr *name, uint namelen,
|
||||
#endif
|
||||
|
||||
if (!timeout)
|
||||
return connect(s, (struct sockaddr*) name, namelen);
|
||||
return connect(s, (struct sockaddr*) name, (int)namelen);
|
||||
|
||||
/* set socket to non blocking */
|
||||
if (socket_block(s, 0) == SOCKET_ERROR)
|
||||
return -1;
|
||||
|
||||
res= connect(s, (struct sockaddr*) name, namelen);
|
||||
res= connect(s, (struct sockaddr*) name, (int)namelen);
|
||||
if (res == 0)
|
||||
return res;
|
||||
|
||||
@@ -222,7 +222,7 @@ static int connect2(my_socket s, const struct sockaddr *name, uint namelen,
|
||||
memset(&tv, 0, sizeof(struct timeval));
|
||||
tv.tv_sec= timeout;
|
||||
|
||||
res= select(s+1, NULL, &sfds, &efds, &tv);
|
||||
res= select((int)s+1, NULL, &sfds, &efds, &tv);
|
||||
if (res < 1)
|
||||
return -1;
|
||||
#endif
|
||||
@@ -1850,10 +1850,10 @@ MYSQL *mthd_my_real_connect(MYSQL *mysql, const char *host, const char *user,
|
||||
scramble_len= pkt_scramble_len;
|
||||
scramble_plugin= scramble_data + scramble_len;
|
||||
if (scramble_data + scramble_len > end_pkt)
|
||||
scramble_len= end_pkt - scramble_data;
|
||||
scramble_len= (uint)(end_pkt - scramble_data);
|
||||
} else
|
||||
{
|
||||
scramble_len= end_pkt - scramble_data;
|
||||
scramble_len= (uint)(end_pkt - scramble_data);
|
||||
scramble_plugin= native_password_plugin_name;
|
||||
}
|
||||
} else
|
||||
@@ -1913,7 +1913,7 @@ MYSQL *mthd_my_real_connect(MYSQL *mysql, const char *host, const char *user,
|
||||
|
||||
for (;begin < end; begin++)
|
||||
{
|
||||
if (mysql_real_query(mysql, *begin, strlen(*begin)))
|
||||
if (mysql_real_query(mysql, *begin, (unsigned long)strlen(*begin)))
|
||||
goto error;
|
||||
|
||||
/* check if query produced a result set */
|
||||
@@ -2222,7 +2222,7 @@ mysql_query(MYSQL *mysql, const char *query)
|
||||
*/
|
||||
|
||||
int STDCALL
|
||||
mysql_send_query(MYSQL* mysql, const char* query, uint length)
|
||||
mysql_send_query(MYSQL* mysql, const char* query, unsigned long length)
|
||||
{
|
||||
return simple_command(mysql, MYSQL_COM_QUERY, query, length, 1,0);
|
||||
}
|
||||
@@ -2277,7 +2277,7 @@ get_info:
|
||||
}
|
||||
|
||||
int STDCALL
|
||||
mysql_real_query(MYSQL *mysql, const char *query, uint length)
|
||||
mysql_real_query(MYSQL *mysql, const char *query, unsigned long length)
|
||||
{
|
||||
DBUG_ENTER("mysql_real_query");
|
||||
DBUG_PRINT("enter",("handle: %lx",mysql));
|
||||
@@ -2887,7 +2887,7 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg)
|
||||
CHECK_OPT_EXTENSION_SET(&mysql->options);
|
||||
if (hash_inited(&mysql->options.extension->connect_attrs) &&
|
||||
(p= (uchar *)hash_search(&mysql->options.extension->connect_attrs, (uchar *)arg,
|
||||
arg ? strlen((char *)arg) : 0)))
|
||||
arg ? (uint)strlen((char *)arg) : 0)))
|
||||
{
|
||||
size_t key_len= *(size_t *)p;
|
||||
mysql->options.extension->connect_attrs_len-= key_len;
|
||||
@@ -2915,7 +2915,7 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg)
|
||||
}
|
||||
|
||||
uchar *ma_get_hash_key(const uchar *hash_entry,
|
||||
size_t *length,
|
||||
unsigned int *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
{
|
||||
/* Hash entry has the following format:
|
||||
@@ -2926,8 +2926,9 @@ uchar *ma_get_hash_key(const uchar *hash_entry,
|
||||
value
|
||||
*/
|
||||
uchar *p= (uchar *)hash_entry;
|
||||
*length=*((size_t*)p);
|
||||
size_t len=*((size_t*)p);
|
||||
p+= sizeof(size_t);
|
||||
*length= (uint)len;
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -3358,7 +3359,7 @@ ulong STDCALL mysql_hex_string(char *to, const char *from,
|
||||
from++;
|
||||
}
|
||||
*to= 0;
|
||||
return (to - start);
|
||||
return (ulong)(to - start);
|
||||
}
|
||||
|
||||
my_bool STDCALL mariadb_connection(MYSQL *mysql)
|
||||
|
@@ -469,9 +469,9 @@ static int client_mpvio_write_packet(struct st_plugin_vio *mpv,
|
||||
if (mpvio->packets_written == 0)
|
||||
{
|
||||
if (mpvio->mysql_change_user)
|
||||
res= send_change_user_packet(mpvio, pkt, pkt_len);
|
||||
res= send_change_user_packet(mpvio, pkt, (int)pkt_len);
|
||||
else
|
||||
res= send_client_reply_packet(mpvio, pkt, pkt_len);
|
||||
res= send_client_reply_packet(mpvio, pkt, (int)pkt_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -653,7 +653,7 @@ int run_plugin_auth(MYSQL *mysql, char *data, uint data_len,
|
||||
/* new "use different plugin" packet */
|
||||
uint len;
|
||||
auth_plugin_name= (char*)mysql->net.read_pos + 1;
|
||||
len= strlen(auth_plugin_name); /* safe as my_net_read always appends \0 */
|
||||
len= (uint)strlen(auth_plugin_name); /* safe as my_net_read always appends \0 */
|
||||
mpvio.cached_server_reply.pkt_len= pkt_length - len - 2;
|
||||
mpvio.cached_server_reply.pkt= mysql->net.read_pos + len + 2;
|
||||
}
|
||||
|
@@ -97,7 +97,7 @@ int mysql_local_infile_init(void **ptr, const char *filename, void *userdata)
|
||||
#ifdef _WIN32
|
||||
else
|
||||
{
|
||||
if ((Length= MultiByteToWideChar(CodePage, 0, info->filename, strlen(info->filename), NULL, 0)))
|
||||
if ((Length= MultiByteToWideChar(CodePage, 0, info->filename, (int)strlen(info->filename), NULL, 0)))
|
||||
{
|
||||
if (!(w_filename= (wchar_t *)my_malloc((Length + 1) * sizeof(wchar_t), MYF(MY_ZEROFILL))))
|
||||
{
|
||||
@@ -106,7 +106,7 @@ int mysql_local_infile_init(void **ptr, const char *filename, void *userdata)
|
||||
ER(CR_OUT_OF_MEMORY));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
Length= MultiByteToWideChar(CodePage, 0, info->filename, strlen(info->filename), w_filename, Length);
|
||||
Length= MultiByteToWideChar(CodePage, 0, info->filename, (int)strlen(info->filename), w_filename, (int)Length);
|
||||
}
|
||||
if (Length == 0)
|
||||
{
|
||||
|
@@ -644,7 +644,7 @@ my_real_read(NET *net, size_t *complen)
|
||||
len=uint3korr(net->buff+net->where_b);
|
||||
if (!len)
|
||||
goto end;
|
||||
helping = max(len,*complen) + net->where_b;
|
||||
helping = max(len,(ulong)*complen) + net->where_b;
|
||||
/* The necessary size of net->buff */
|
||||
if (helping >= net->max_packet)
|
||||
{
|
||||
@@ -692,7 +692,7 @@ ulong my_net_read(NET *net)
|
||||
do
|
||||
{
|
||||
length+= len;
|
||||
net->where_b+= len;
|
||||
net->where_b+= (unsigned long)len;
|
||||
} while (len == MAX_PACKET_LENGTH);
|
||||
net->where_b= last_pos;
|
||||
if (len != packet_error)
|
||||
@@ -701,7 +701,7 @@ ulong my_net_read(NET *net)
|
||||
net->read_pos = net->buff + net->where_b;
|
||||
if (len != packet_error)
|
||||
net->read_pos[len]=0; /* Safeguard for mysql_use_result */
|
||||
return len;
|
||||
return (ulong)len;
|
||||
#ifdef HAVE_COMPRESS
|
||||
}
|
||||
else
|
||||
@@ -751,8 +751,8 @@ ulong my_net_read(NET *net)
|
||||
net->last_errno=ER_NET_UNCOMPRESS_ERROR;
|
||||
break;
|
||||
}
|
||||
net->buf_length+=len;
|
||||
net->remain_in_buf+=len;
|
||||
net->buf_length+=(unsigned long)len;
|
||||
net->remain_in_buf+=(unsigned long)len;
|
||||
}
|
||||
if (len != packet_error)
|
||||
{
|
||||
@@ -761,5 +761,5 @@ ulong my_net_read(NET *net)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return len;
|
||||
return (ulong)len;
|
||||
}
|
||||
|
@@ -208,12 +208,12 @@ size_t vio_read(Vio * vio, gptr buf, size_t size)
|
||||
if (!DosRead((HFILE)vio->hPipe, buf, size, &length))
|
||||
DBUG_RETURN(-1);
|
||||
#else
|
||||
if (!ReadFile(vio->hPipe, buf, size, &length, NULL))
|
||||
if (!ReadFile(vio->hPipe, buf, (DWORD)size, &length, NULL))
|
||||
DBUG_RETURN(-1);
|
||||
#endif
|
||||
DBUG_RETURN(length);
|
||||
}
|
||||
r = recv(vio->sd, buf, size,0);
|
||||
r = recv(vio->sd, buf, (int)size,0);
|
||||
#else
|
||||
errno=0; /* For linux */
|
||||
r = read(vio->sd, buf, size);
|
||||
@@ -235,7 +235,7 @@ size_t vio_read(Vio * vio, gptr buf, size_t size)
|
||||
my_bool vio_read_peek(Vio *vio, size_t *bytes)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (ioctlsocket(vio->sd, FIONREAD, bytes))
|
||||
if (ioctlsocket(vio->sd, FIONREAD, (unsigned long)bytes))
|
||||
return TRUE;
|
||||
#else
|
||||
char buffer[1024];
|
||||
@@ -271,12 +271,12 @@ size_t vio_write(Vio * vio, const gptr buf, size_t size)
|
||||
if (!DosWrite((HFILE)vio->hPipe, (char*) buf, size, &length))
|
||||
DBUG_RETURN(-1);
|
||||
#else
|
||||
if (!WriteFile(vio->hPipe, (char*) buf, size, &length, NULL))
|
||||
if (!WriteFile(vio->hPipe, (char*) buf, (DWORD)size, &length, NULL))
|
||||
DBUG_RETURN(-1);
|
||||
#endif
|
||||
DBUG_RETURN(length);
|
||||
}
|
||||
r = send(vio->sd, buf, size,0);
|
||||
r = send(vio->sd, buf, (int)size,0);
|
||||
#else
|
||||
r = write(vio->sd, buf, size);
|
||||
#endif /* _WIN32 */
|
||||
|
@@ -597,9 +597,9 @@ int test_connection_timeout(MYSQL *my)
|
||||
return FAIL;
|
||||
}
|
||||
elapsed= time(NULL) - start;
|
||||
diag("elapsed: %d", elapsed);
|
||||
diag("elapsed: %d, timeout: %d", elapsed, timeout);
|
||||
mysql_close(mysql);
|
||||
FAIL_IF(elapsed +1 > timeout, "timeout ignored")
|
||||
FAIL_IF(elapsed > timeout + 1, "timeout ignored")
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@@ -286,7 +286,7 @@ static int test_fetch_offset(MYSQL *mysql)
|
||||
stmt= mysql_stmt_init(mysql);
|
||||
FAIL_IF(!stmt, mysql_error(mysql));
|
||||
|
||||
rc= mysql_stmt_prepare(stmt, query, strlen(query));
|
||||
rc= mysql_stmt_prepare(stmt, query, (unsigned long)strlen(query));
|
||||
check_stmt_rc(rc,stmt);
|
||||
|
||||
memset(my_bind, '\0', sizeof(my_bind));
|
||||
|
@@ -6,10 +6,19 @@ SET(PRODUCT_NAME "MariaDB C Client Library")
|
||||
SET(PRODUCT_MANUFACTURER "MariaDB")
|
||||
SET(PRODUCT_VERSION "${MYSQL_CLIENT_VERSION_MAJOR}.${MYSQL_CLIENT_VERSION_MINOR}.${MYSQL_CLIENT_VERSION_PATCH}")
|
||||
|
||||
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
MESSAGE(STATUS "sizeof ${CMAKE_SIZEOF_VOID_P}")
|
||||
|
||||
IF(${MSI_64})
|
||||
SET(PRODUCT_NAME "${PRODUCT_NAME} 64-bit")
|
||||
SET(PLATFORM "win64")
|
||||
SET(IS_WIN64 "yes")
|
||||
SET(WIXPLATFORM "x64")
|
||||
SET(FOLDER "ProgramFiles64Folder")
|
||||
ELSE()
|
||||
SET(PLATFORM "win32")
|
||||
SET(IS_WIN64 "no")
|
||||
SET(WIXPLATFORM "x86")
|
||||
SET(FOLDER "ProgramFilesFolder")
|
||||
ENDIF()
|
||||
|
||||
FOREACH(src ${MARIADB_CLIENT_INCLUDES})
|
||||
|
@@ -3,7 +3,7 @@
|
||||
<Product Id="*" Name="@PRODUCT_NAME@" Language="1033"
|
||||
Version="@PRODUCT_VERSION@"
|
||||
Manufacturer="@PRODUCT_MANUFACTURER@" UpgradeCode="E4CC4F1C-3991-49D9-85A7-7AA76C5DC67A">
|
||||
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
|
||||
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Platform="@WIXPLATFORM@"/>
|
||||
|
||||
<MajorUpgrade DowngradeErrorMessage="A newer version of @PRODUCT_NAME@ is already installed." />
|
||||
<MediaTemplate EmbedCab="yes" />
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
<Fragment>
|
||||
<Directory Id="TARGETDIR" Name="SourceDir">
|
||||
<Directory Id="ProgramFilesFolder">
|
||||
<Directory Id="@FOLDER@">
|
||||
<Directory Id="Mariadb" Name="@PRODUCT_MANUFACTURER@">
|
||||
<Directory Id="INSTALLFOLDER" Name="@PRODUCT_NAME@" >
|
||||
<Directory Id="instlib" Name="lib">
|
||||
@@ -43,26 +43,26 @@
|
||||
|
||||
<Fragment>
|
||||
<!--<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">-->
|
||||
<Component Id="RegistryKeys" Guid="755726EA-9706-413D-86B3-E70582FF2819" DiskId="1" Directory="INSTALLFOLDER">
|
||||
<Component Id="RegistryKeys" Guid="755726EA-9706-413D-86B3-E70582FF2819" DiskId="1" Directory="INSTALLFOLDER" Win64="@IS_WIN64@">
|
||||
<RegistryKey Id="Version" Root="HKLM" Key="SOFTWARE\@PRODUCT_MANUFACTURER@\@PRODUCT_NAME@" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes">
|
||||
<RegistryValue Name="Version" Type="string" Value="@PRODUCT_VERSION@"/>
|
||||
</RegistryKey>
|
||||
</Component>
|
||||
<Component Id="Library" Guid="89E28283-23AE-4F10-B743-B5FA485E9F9A" KeyPath="yes" DiskId="1" Directory="instlib">
|
||||
<Component Id="Library" Guid="89E28283-23AE-4F10-B743-B5FA485E9F9A" KeyPath="yes" DiskId="1" Directory="instlib" Win64="@IS_WIN64@">
|
||||
<File Id="libdll" Name="libmariadb.dll" DiskId="1" Source="@CLIENT_LIB_DIR@/libmariadb.dll" />
|
||||
<File Id="libdllimp" Name="libmariadb.lib" DiskId="1" Source="@CLIENT_LIB_DIR@/libmariadb.lib" />
|
||||
<File Id="libstatic" Name="mariadbclient.lib" DiskId="1" Source="@CLIENT_LIB_DIR@/mariadbclient.lib" />
|
||||
</Component>
|
||||
<Component Id="DebugLibrary" Guid="1b8f741d-e7d9-48f1-9e11-9270216d1dc7" KeyPath="yes" DiskId="1" Directory="instlib_debug">
|
||||
<Component Id="DebugLibrary" Guid="1b8f741d-e7d9-48f1-9e11-9270216d1dc7" KeyPath="yes" DiskId="1" Directory="instlib_debug" Win64="@IS_WIN64@">
|
||||
<File Id="dlibdll" Name="libmariadb.dll" DiskId="1" Source="@CLIENT_DBG_DIR@/libmariadb.dll" />
|
||||
<File Id="dlibdllimp" Name="libmariadb.lib" DiskId="1" Source="@CLIENT_DBG_DIR@/libmariadb.lib" />
|
||||
<File Id="dlibstatic" Name="mariadbclient.lib" DiskId="1" Source="@CLIENT_DBG_DIR@/mariadbclient.lib" />
|
||||
</Component>
|
||||
<Component Id="Debug" Guid="FFAFCCCC-4E0C-4A87-840C-53B63C8A427A" KeyPath="yes" Directory="instlib" DiskId="1">
|
||||
<Component Id="Debug" Guid="FFAFCCCC-4E0C-4A87-840C-53B63C8A427A" KeyPath="yes" Directory="instlib" DiskId="1" Win64="@IS_WIN64@">
|
||||
<File Id="libdllpdb" Name="libmariadb.pdb" DiskId="1" Source="@CLIENT_LIB_DIR@/libmariadb.pdb" />
|
||||
<File Id="libstaticpdb" Name="mariadbclient.pdb" DiskId="1" Source="@CLIENT_LIB_DIR@/mariadbclient.pdb" />
|
||||
</Component>
|
||||
<Component Id="Includes" Guid="5CFB93CC-FC30-4E13-B665-E52690AB56E3" KeyPath="yes" Directory="instinclude" DiskId="1">
|
||||
<Component Id="Includes" Guid="5CFB93CC-FC30-4E13-B665-E52690AB56E3" KeyPath="yes" Directory="instinclude" DiskId="1" Win64="@IS_WIN64@">
|
||||
@MARIADB_INCLUDE_FILES@
|
||||
</Component>
|
||||
<!-- </ComponentGroup> -->
|
||||
|
Reference in New Issue
Block a user