You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Bojan Smojver <bo...@rexursive.com> on 2008/06/18 02:12:32 UTC
Warnings for apr_dbd_odbc.c on 64-bit platforms
I'm getting these on Fedora 9, x86_64:
-----------------------
dbd/apr_dbd_odbc.c: In function ‘odbc_open’:
dbd/apr_dbd_odbc.c:1010: warning: cast to pointer from integer of
different size
dbd/apr_dbd_odbc.c: In function ‘odbc_start_transaction’:
dbd/apr_dbd_odbc.c:1101: warning: cast to pointer from integer of
different size
dbd/apr_dbd_odbc.c: In function ‘odbc_get_entry’:
dbd/apr_dbd_odbc.c:1310: warning: cast from pointer to integer of
different size
dbd/apr_dbd_odbc.c: In function ‘odbc_transaction_mode_set’:
dbd/apr_dbd_odbc.c:1496: warning: cast to pointer from integer of
different size
-----------------------
That's for these lines:
-----------------------
rc = SQLSetConnectAttr(hdbc, attrs[i], (void *) attrvals[i], 0);
...
rc = SQLSetConnectAttr(handle->dbc, SQL_ATTR_TXN_ISOLATION, (void *)
handle->transaction_mode, 0);
...
if ((signed int) p > 0)
...
rc = SQLSetConnectAttr(trans->dbc, SQL_ATTR_TXN_ISOLATION,
(void *) mode, 0);
-----------------------
Pointers on 64-bit Linux machines are 64-bit values, integers are 32-bit
values, hence the warnings.
Just making sure all this is really intended here...
--
Bojan
Re: Warnings for apr_dbd_odbc.c on 64-bit platforms
Posted by Bojan Smojver <bo...@rexursive.com>.
On Tue, 2008-06-17 at 22:02 -0400, Tom Donovan wrote:
>
> The Microsoft ODBC docs at http://msdn.microsoft.com/en-us/library/ms713605(VS.85).aspx say:
>
> SQLPOINTER ValuePtr
> [Input] Pointer to the value to be associated with Attribute. Depending on the value of
> Attribute, ValuePtr will be a 32-bit unsigned integer value or will point to a null-terminated
> character string. Note that if the Attribute argument is a driver-specific value, the value in
> ValuePtr may be a signed integer.
>
> The DB2 CLI/ODBC docs say the same -
> http://publib.boulder.ibm.com/infocenter/db2luw/v8/topic/com.ibm.db2.udb.doc/ad/r0000646.htm
>
> UnixODBC & iODBC usually treat the MS ODBC docs as authoritative, so it seems likely that this is as
> intended. I don't have a 64-bit system to give it a try on.
>
> hmmm... ODBC really shows its age here!
Yeah, it does. SQLPOINTER on Linux is defined as void *, so it will be a
64-bit value on 64-bit systems, contrary to the above 32-bit assumption.
This kind of pointer/integer mixing is really a bad idea, but there is
nothing we can do about it, I guess.
Thanks for the input.
--
Bojan
Re: Warnings for apr_dbd_odbc.c on 64-bit platforms
Posted by Tom Donovan <do...@bellatlantic.net>.
Tom Donovan wrote:
> Bojan Smojver wrote:
>> I'm getting these on Fedora 9, x86_64:
>> -----------------------
>> dbd/apr_dbd_odbc.c: In function ‘odbc_open’:
>> dbd/apr_dbd_odbc.c:1010: warning: cast to pointer from integer of
>> different size
>> dbd/apr_dbd_odbc.c: In function ‘odbc_start_transaction’:
>> dbd/apr_dbd_odbc.c:1101: warning: cast to pointer from integer of
>> different size
>> dbd/apr_dbd_odbc.c: In function ‘odbc_get_entry’:
>> dbd/apr_dbd_odbc.c:1310: warning: cast from pointer to integer of
>> different size
>> dbd/apr_dbd_odbc.c: In function ‘odbc_transaction_mode_set’:
>> dbd/apr_dbd_odbc.c:1496: warning: cast to pointer from integer of
>> different size
>> -----------------------
>>
>> That's for these lines:
>> -----------------------
>> rc = SQLSetConnectAttr(hdbc, attrs[i], (void *) attrvals[i], 0);
>> ...
>> rc = SQLSetConnectAttr(handle->dbc, SQL_ATTR_TXN_ISOLATION, (void *)
>> handle->transaction_mode, 0);
>> ...
>> if ((signed int) p > 0)
>> ...
>> rc = SQLSetConnectAttr(trans->dbc, SQL_ATTR_TXN_ISOLATION,
>> (void *) mode, 0);
>> -----------------------
>>
re: if ((signed int) p > 0)
I checked in a safer test for null or -1 value pointers.
r669062 (trunk), r669063 (1.3.x)
-tom-
Re: Warnings for apr_dbd_odbc.c on 64-bit platforms
Posted by Tom Donovan <do...@bellatlantic.net>.
Bojan Smojver wrote:
> I'm getting these on Fedora 9, x86_64:
> -----------------------
> dbd/apr_dbd_odbc.c: In function ‘odbc_open’:
> dbd/apr_dbd_odbc.c:1010: warning: cast to pointer from integer of
> different size
> dbd/apr_dbd_odbc.c: In function ‘odbc_start_transaction’:
> dbd/apr_dbd_odbc.c:1101: warning: cast to pointer from integer of
> different size
> dbd/apr_dbd_odbc.c: In function ‘odbc_get_entry’:
> dbd/apr_dbd_odbc.c:1310: warning: cast from pointer to integer of
> different size
> dbd/apr_dbd_odbc.c: In function ‘odbc_transaction_mode_set’:
> dbd/apr_dbd_odbc.c:1496: warning: cast to pointer from integer of
> different size
> -----------------------
>
> That's for these lines:
> -----------------------
> rc = SQLSetConnectAttr(hdbc, attrs[i], (void *) attrvals[i], 0);
> ...
> rc = SQLSetConnectAttr(handle->dbc, SQL_ATTR_TXN_ISOLATION, (void *)
> handle->transaction_mode, 0);
> ...
> if ((signed int) p > 0)
> ...
> rc = SQLSetConnectAttr(trans->dbc, SQL_ATTR_TXN_ISOLATION,
> (void *) mode, 0);
> -----------------------
>
> Pointers on 64-bit Linux machines are 64-bit values, integers are 32-bit
> values, hence the warnings.
>
> Just making sure all this is really intended here...
>
The Microsoft ODBC docs at http://msdn.microsoft.com/en-us/library/ms713605(VS.85).aspx say:
SQLPOINTER ValuePtr
[Input] Pointer to the value to be associated with Attribute. Depending on the value of
Attribute, ValuePtr will be a 32-bit unsigned integer value or will point to a null-terminated
character string. Note that if the Attribute argument is a driver-specific value, the value in
ValuePtr may be a signed integer.
The DB2 CLI/ODBC docs say the same -
http://publib.boulder.ibm.com/infocenter/db2luw/v8/topic/com.ibm.db2.udb.doc/ad/r0000646.htm
UnixODBC & iODBC usually treat the MS ODBC docs as authoritative, so it seems likely that this is as
intended. I don't have a 64-bit system to give it a try on.
hmmm... ODBC really shows its age here!
-tom-