Commit Graph
2 Commits
Author SHA1 Message Date
Hans de Goede d1a2f179cc Fix -Werror=array-bounds compile error in src/odbc/odbc.c
Use a local variable instead of casting the address of a SQLSMALLINT
to a (size_t *). sizeof(SQLSMALLINT) < sizeof(size_t) so gcc is
rightfully giving the following errors when building on Fedora 34:

/usr/include/sqlucode.h: In function 'SQLErrorW':
odbc.c:130:20: error: array subscript 'size_t[0]' is partly outside array bounds of 'SQLSMALLINT[1]' [-Werror=array-bounds]
  130 |         size_t lin=*_lin, lout=*_lout;
      |                    ^~~~~
odbc.c:974:21: note: while referencing 'pcbErrorMsg8'
  974 |         SQLSMALLINT pcbErrorMsg8;
      |                     ^~~~~~~~~~~~
odbc.c:133:15: error: array subscript 'size_t[0]' is partly outside array bounds of 'SQLSMALLINT[1]' [-Werror=array-bounds]
  133 |         *_lin -= lin;
      |               ^~
odbc.c:974:21: note: while referencing 'pcbErrorMsg8'
  974 |         SQLSMALLINT pcbErrorMsg8;
      |                     ^~~~~~~~~~~~
odbc.c:133:15: error: array subscript 'size_t[0]' is partly outside array bounds of 'SQLSMALLINT[1]' [-Werror=array-bounds]
  133 |         *_lin -= lin;
      |         ~~~~~~^~~~~~
odbc.c:974:21: note: while referencing 'pcbErrorMsg8'
  974 |         SQLSMALLINT pcbErrorMsg8;
      |                     ^~~~~~~~~~~~
cc1: all warnings being treated as errors
2021-07-08 22:16:02 +02:00
Hans de Goede c83cdc1b9b Gray close items until file is open
This fixes a double close SEGV
2012-07-28 00:03:30 +02:00