luadbi
luadbi copied to clipboard
Avoid incompatible pointer type error on x86 (32 bit)
Build using GCC 14 fails on Fedora Rawhide (= 41) on i686 like this:
dbd/mysql/statement.c: In function ‘statement_execute’: dbd/mysql/statement.c:271:40: error: assignment to ‘long unsigned int *’ from incompatible pointer type ‘size_t *’ {aka ‘unsigned int *’} [-Wincompatible-pointer-types]
271 | bind[i].length = str_len;
| ^
make: *** [Makefile:82: build/dbd_mysql_statement.o] Error 1
Thus for x86 (32 bit) cast size_t *
(= unsigned int *
) to unsigned long *
(= long unsigned int *
); fixes #72 finally.
It's unsigned long *length;
(= long unsigned int *
) for at least:
MySQL:
- https://github.com/mysql/mysql-server/blob/trunk/include/mysql.h#L653
- https://github.com/mysql/mysql-server/blob/8.0/include/mysql.h#L656
- https://github.com/mysql/mysql-server/blob/5.7/include/mysql.h#L582
MariaDB:
- https://github.com/MariaDB/server/blob/11.5/include/mysql.h#L706
- https://github.com/MariaDB/server/blob/10.11/include/mysql.h#L705
- https://github.com/MariaDB/server/blob/5.5/include/mysql.h#L672
MariaDB Connector/C:
- https://github.com/mariadb-corporation/mariadb-connector-c/blob/master/include/mariadb_stmt.h#L107
- https://github.com/mariadb-corporation/mariadb-connector-c/blob/3.3/include/mariadb_stmt.h#L106
- https://github.com/mariadb-corporation/mariadb-connector-c/blob/2.1/include/my_stmt.h#L85