You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-07 02:42:49 +03:00
Support for -Wlogical-op flag and warning fixes (Patch provided by Monty)
This commit is contained in:
@@ -134,7 +134,7 @@ SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DDBUG_OFF
|
||||
|
||||
IF(CMAKE_COMPILER_IS_GNUCC)
|
||||
INCLUDE(CheckCCompilerFlag)
|
||||
SET(GCC_FLAGS -Wunused -Wno-uninitialized -Wall -Wextra -Wformat-security -Wno-init-self -Wwrite-strings -Wshift-count-overflow -Wdeclaration-after-statement)
|
||||
SET(GCC_FLAGS -Wunused -Wlogical-op -Wno-uninitialized -Wall -Wextra -Wformat-security -Wno-init-self -Wwrite-strings -Wshift-count-overflow -Wdeclaration-after-statement)
|
||||
FOREACH(GCC_FLAG ${GCC_FLAGS})
|
||||
CHECK_C_COMPILER_FLAG("${GCC_FLAG}" HAS_${GCC_FLAG}_FLAG)
|
||||
IF(${HAS_${GCC_FLAG}_FLAG})
|
||||
|
@@ -163,103 +163,103 @@
|
||||
*/
|
||||
/* Types we may use */
|
||||
#cmakedefine SIZEOF_CHAR @SIZEOF_CHAR@
|
||||
#if SIZEOF_CHAR
|
||||
#if defined(SIZEOF_CHAR)
|
||||
# define HAVE_CHAR 1
|
||||
#endif
|
||||
|
||||
#cmakedefine SIZEOF_CHARP @SIZEOF_CHARP@
|
||||
#if SIZEOF_CHARP
|
||||
#if defined(SIZEOF_CHARP)
|
||||
# define HAVE_CHARP 1
|
||||
#endif
|
||||
|
||||
#cmakedefine SIZEOF_SHORT @SIZEOF_SHORT@
|
||||
#if SIZEOF_SHORT
|
||||
#if defined(SIZEOF_SHORT)
|
||||
# define HAVE_SHORT 1
|
||||
#endif
|
||||
|
||||
#cmakedefine SIZEOF_INT @SIZEOF_INT@
|
||||
#if SIZEOF_INT
|
||||
#if defined(SIZEOF_INT)
|
||||
# define HAVE_INT 1
|
||||
#endif
|
||||
|
||||
#cmakedefine SIZEOF_LONG @SIZEOF_LONG@
|
||||
#if SIZEOF_LONG
|
||||
#if defined(SIZEOF_LONG)
|
||||
# define HAVE_LONG 1
|
||||
#endif
|
||||
|
||||
#cmakedefine SIZEOF_LONG_LONG @SIZEOF_LONG_LONG@
|
||||
#if SIZEOF_LONG_LONG
|
||||
#if defined(SIZEOF_LONG_LONG)
|
||||
# define HAVE_LONG_LONG 1
|
||||
#endif
|
||||
|
||||
|
||||
#cmakedefine SIZEOF_SIGSET_T @SIZEOF_SIGSET_T@
|
||||
#if SIZEOF_SIGSET_T
|
||||
#if defined(SIZEOF_SIGSET_T)
|
||||
# define HAVE_SIGSET_T 1
|
||||
#endif
|
||||
|
||||
#cmakedefine SIZEOF_SIZE_T @SIZEOF_SIZE_T@
|
||||
#if SIZEOF_SIZE_T
|
||||
#if defined(SIZEOF_SIZE_T)
|
||||
# define HAVE_SIZE_T 1
|
||||
#endif
|
||||
|
||||
#cmakedefine SIZEOF_UCHAR @SIZEOF_UCHAR@
|
||||
#if SIZEOF_UCHAR
|
||||
#if defined(SIZEOF_UCHAR)
|
||||
# define HAVE_UCHAR 1
|
||||
#endif
|
||||
|
||||
#cmakedefine SIZEOF_UINT @SIZEOF_UINT@
|
||||
#if SIZEOF_UINT
|
||||
#if defined(SIZEOF_UINT)
|
||||
# define HAVE_UINT 1
|
||||
#endif
|
||||
|
||||
#cmakedefine SIZEOF_ULONG @SIZEOF_ULONG@
|
||||
#if SIZEOF_ULONG
|
||||
#if defined(SIZEOF_ULONG)
|
||||
# define HAVE_ULONG 1
|
||||
#endif
|
||||
|
||||
#cmakedefine SIZEOF_INT8 @SIZEOF_INT8@
|
||||
#if SIZEOF_INT8
|
||||
#if defined(SIZEOF_INT8)
|
||||
# define HAVE_INT8 1
|
||||
#endif
|
||||
#cmakedefine SIZEOF_UINT8 @SIZEOF_UINT8@
|
||||
#if SIZEOF_UINT8
|
||||
#if defined(SIZEOF_UINT8)
|
||||
# define HAVE_UINT8 1
|
||||
#endif
|
||||
|
||||
#cmakedefine SIZEOF_INT16 @SIZEOF_INT16@
|
||||
#if SIZEOF_INT16
|
||||
#if defined(SIZEOF_INT16)
|
||||
# define HAVE_INT16 1
|
||||
#endif
|
||||
#cmakedefine SIZEOF_UINT16 @SIZEOF_UINT16@
|
||||
#if SIZEOF_UINT16
|
||||
#if defined(SIZEOF_UINT16)
|
||||
# define HAVE_UINT16 1
|
||||
#endif
|
||||
|
||||
#cmakedefine SIZEOF_INT32 @SIZEOF_INT32@
|
||||
#if SIZEOF_INT32
|
||||
#if defined(SIZEOF_INT32)
|
||||
# define HAVE_INT32 1
|
||||
#endif
|
||||
#cmakedefine SIZEOF_UINT32 @SIZEOF_UINT32@
|
||||
#if SIZEOF_UINT32
|
||||
#if defined(SIZEOF_UINT32)
|
||||
# define HAVE_UINT32 1
|
||||
#endif
|
||||
#cmakedefine SIZEOF_U_INT32_T @SIZEOF_U_INT32_T@
|
||||
#if SIZEOF_U_INT32_T
|
||||
#if defined(SIZEOF_U_INT32_T)
|
||||
# define HAVE_U_INT32_T 1
|
||||
#endif
|
||||
|
||||
#cmakedefine SIZEOF_INT64 @SIZEOF_INT64@
|
||||
#if SIZEOF_INT64
|
||||
#if defined(SIZEOF_INT64)
|
||||
# define HAVE_INT64 1
|
||||
#endif
|
||||
#cmakedefine SIZEOF_UINT64 @SIZEOF_UINT64@
|
||||
#if SIZEOF_UINT64
|
||||
#if defined(SIZEOF_UINT64)
|
||||
# define HAVE_UINT64 1
|
||||
#endif
|
||||
|
||||
#cmakedefine SIZEOF_SOCKLEN_T @SIZEOF_SOCKLEN_T@
|
||||
#if SIZEOF_SOCKLEN_T
|
||||
#if defined(SIZEOF_SOCKLEN_T)
|
||||
# define HAVE_SOCKLEN_T 1
|
||||
#endif
|
||||
|
||||
|
@@ -185,11 +185,11 @@ double my_ulonglong2double(unsigned long long A);
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#if TIME_WITH_SYS_TIME
|
||||
#if defined(TIME_WITH_SYS_TIME)
|
||||
# include <sys/time.h>
|
||||
# include <time.h>
|
||||
#else
|
||||
# if HAVE_SYS_TIME_H
|
||||
# if defined(HAVE_SYS_TIME_H)
|
||||
# include <sys/time.h>
|
||||
# else
|
||||
# include <time.h>
|
||||
@@ -671,7 +671,7 @@ typedef ulonglong uint64;
|
||||
The following is done with a if to not get problems with pre-processors
|
||||
with late define evaluation
|
||||
*/
|
||||
#if SIZEOF_OFF_T == 4
|
||||
#if defined(SIZEOF_OFF_T) && SIZEOF_OFF_T == 4
|
||||
#define SYSTEM_SIZEOF_OFF_T 4
|
||||
#else
|
||||
#define SYSTEM_SIZEOF_OFF_T 8
|
||||
@@ -682,7 +682,7 @@ typedef ulonglong uint64;
|
||||
#define SYSTEM_SIZEOF_OFF_T SIZEOF_OFF_T
|
||||
#endif /* USE_RAID */
|
||||
|
||||
#if SIZEOF_OFF_T > 4
|
||||
#if defined(SIZEOF_OFF_T) && SIZEOF_OFF_T > 4
|
||||
typedef ulonglong my_off_t;
|
||||
#else
|
||||
typedef unsigned long my_off_t;
|
||||
|
@@ -259,7 +259,7 @@ static unsigned int mysql_mbcharlen_utf8(unsigned int utf8)
|
||||
|
||||
static unsigned int check_mb_big5(const char *start, const char *end)
|
||||
{
|
||||
return (valid_big5head(*(start)) && (end - start) > 1 && valid_big5tail(*(start + 1)) ? 2 : 0);
|
||||
return (valid_big5head(*((const uchar*) start)) && (end - start) > 1 && valid_big5tail(*((const uchar*) start + 1)) ? 2 : 0);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -507,7 +507,7 @@ void read_user_name(char *name)
|
||||
str="UNKNOWN_USER";
|
||||
}
|
||||
ma_strmake(name,str,USERNAME_LENGTH);
|
||||
#elif HAVE_CUSERID
|
||||
#elif defined(HAVE_CUSERID)
|
||||
(void) cuserid(name);
|
||||
#else
|
||||
ma_strmake(name,"UNKNOWN_USER", USERNAME_LENGTH);
|
||||
|
@@ -42,7 +42,7 @@
|
||||
#ifdef HAVE_TLS_SESSION_CACHE
|
||||
#undef HAVE_TLS_SESSION_CACHE
|
||||
#endif
|
||||
#if OPENSSL_USE_BIOMETHOD
|
||||
#if defined(OPENSSL_USE_BIOMETHOD)
|
||||
#undef OPENSSL_USE_BIOMETHOD
|
||||
#endif
|
||||
#ifndef HAVE_OPENSSL_DEFAULT
|
||||
@@ -69,7 +69,7 @@ static pthread_mutex_t LOCK_openssl_config;
|
||||
#ifndef HAVE_OPENSSL_1_1_API
|
||||
static pthread_mutex_t *LOCK_crypto= NULL;
|
||||
#endif
|
||||
#if OPENSSL_USE_BIOMETHOD
|
||||
#if defined(OPENSSL_USE_BIOMETHOD)
|
||||
static int ma_bio_read(BIO *h, char *buf, int size);
|
||||
static int ma_bio_write(BIO *h, const char *buf, int size);
|
||||
static BIO_METHOD ma_BIO_method;
|
||||
@@ -350,7 +350,7 @@ int ma_tls_start(char *errmsg __attribute__((unused)), size_t errmsg_len __attri
|
||||
OpenSSL_add_all_algorithms();
|
||||
#endif
|
||||
disable_sigpipe();
|
||||
#if OPENSSL_USE_BIOMETHOD
|
||||
#ifdef OPENSSL_USE_BIOMETHOD
|
||||
memcpy(&ma_BIO_method, BIO_s_socket(), sizeof(BIO_METHOD));
|
||||
ma_BIO_method.bread= ma_bio_read;
|
||||
ma_BIO_method.bwrite= ma_bio_write;
|
||||
@@ -582,7 +582,7 @@ my_bool ma_tls_connect(MARIADB_TLS *ctls)
|
||||
MYSQL *mysql;
|
||||
MARIADB_PVIO *pvio;
|
||||
int rc;
|
||||
#if OPENSSL_USE_BIOMETHOD
|
||||
#ifdef OPENSSL_USE_BIOMETHOD
|
||||
BIO_METHOD *bio_method= NULL;
|
||||
BIO *bio;
|
||||
#endif
|
||||
@@ -596,7 +596,7 @@ my_bool ma_tls_connect(MARIADB_TLS *ctls)
|
||||
|
||||
SSL_clear(ssl);
|
||||
|
||||
#if OPENSSL_USE_BIOMETHOD
|
||||
#ifdef OPENSSL_USE_BIOMETHOD
|
||||
bio= BIO_new(&ma_BIO_method);
|
||||
bio->ptr= pvio;
|
||||
SSL_set_bio(ssl, bio, bio);
|
||||
|
Reference in New Issue
Block a user