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
CONC-329: change pvio_*_blocking to return int to accomidate SOCKET_ERROR(-1)
POWER and other architectures that define char(as my_bool) to be unsigned (as the C standard leaves this undefined). This resulted in error branches being unreachabe as indicated by the below compile warnings. plugins/pvio/pvio_socket.c:763:42: warning: comparison of constant -1 with expression of type 'my_bool' (aka 'char') is always false [-Wtautological-constant-out-of-range-compare] if (pvio_socket_blocking(pvio, 1, 0) == SOCKET_ERROR) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~ plugins/pvio/pvio_socket.c:875:46: warning: comparison of constant -1 with expression of type 'my_bool' (aka 'char') is always false [-Wtautological-constant-out-of-range-compare] if (pvio_socket_blocking(pvio, 0, 0) == SOCKET_ERROR) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~ plugins/pvio/pvio_socket.c:907:42: warning: comparison of constant -1 with expression of type 'my_bool' (aka 'char') is always false [-Wtautological-constant-out-of-range-compare] if (pvio_socket_blocking(pvio, 1, 0) == SOCKET_ERROR) ma_hext2int: signed char - prevent compiler errors when char is unsigned. libmariadb/ma_tls.c:169:31: warning: comparison of constant -1 with expression of type 'char' is always false [-Wtautological-constant-out-of-range-compare] if ((d1 = ma_hex2int(*p)) == - 1 || ~~~~~~~~~~~~~~~~~~~~~ ^ ~~~ libmariadb/ma_tls.c:170:35: warning: comparison of constant -1 with expression of type 'char' is always false [-Wtautological-constant-out-of-range-compare] (d2 = ma_hex2int(*(p+1))) == -1 || ~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~ To fix this all the pvio_*_blocking functions have been changed to use int as a return value. Other my_bool/char differences fixed: mariadb_dyncol_val_str: fix prototype to use char - like implemented function. unittest: bind.is_null is my_bool* so we use a my_bool.
This commit is contained in:
@@ -30,7 +30,7 @@ static int test_view(MYSQL *mysql)
|
||||
MYSQL_BIND my_bind[1];
|
||||
char str_data[50];
|
||||
ulong length = 0L;
|
||||
long is_null = 0L;
|
||||
my_bool is_null = 0;
|
||||
const char *query=
|
||||
"SELECT COUNT(*) FROM v1 WHERE SERVERNAME=?";
|
||||
|
||||
@@ -84,7 +84,7 @@ static int test_view(MYSQL *mysql)
|
||||
my_bind[0].buffer_length= 50;
|
||||
my_bind[0].length= &length;
|
||||
length= 4;
|
||||
my_bind[0].is_null= (char*)&is_null;
|
||||
my_bind[0].is_null= &is_null;
|
||||
rc= mysql_stmt_bind_param(stmt, my_bind);
|
||||
check_stmt_rc(rc, stmt);
|
||||
|
||||
@@ -301,7 +301,7 @@ static int test_view_insert(MYSQL *mysql)
|
||||
MYSQL_BIND my_bind[1];
|
||||
int my_val = 0;
|
||||
ulong my_length = 0L;
|
||||
long my_null = 0L;
|
||||
my_bool my_null = 0;
|
||||
const char *query=
|
||||
"insert into v1 values (?)";
|
||||
|
||||
@@ -328,7 +328,7 @@ static int test_view_insert(MYSQL *mysql)
|
||||
my_bind[0].buffer_type = MYSQL_TYPE_LONG;
|
||||
my_bind[0].buffer = (char *)&my_val;
|
||||
my_bind[0].length = &my_length;
|
||||
my_bind[0].is_null = (char*)&my_null;
|
||||
my_bind[0].is_null = &my_null;
|
||||
rc= mysql_stmt_bind_param(insert_stmt, my_bind);
|
||||
check_stmt_rc(rc, select_stmt);
|
||||
|
||||
|
Reference in New Issue
Block a user