Thread: Code inconsistency in convert.c for guid -> string conversion
Hi all, While working on the code of odbc, I noticed an inconsistency in convert.c, found by compiling the code with -Werror. convert.c:4466: error: format '%08lX' expects type 'long unsigned int', but argument 4 has type 'DWORD' By looking closer at the code, the behavior in the code for guid -> string conversion is inconsistent with char2guid using an sscan for the similar reverse operation. I am attaching a patch fixing that. On another note, I found as well the following warning: dlg_specific.c:1491: error: the address of 'conn_settings' will always evaluate as 'true' All of this was reproduced using 09.03.0200. Regards, -- Michael
Attachment
On Mon, Mar 3, 2014 at 11:38 AM, Michael Paquier <michael.paquier@gmail.com> wrote: > On another note, I found as well the following warning: > dlg_specific.c:1491: error: the address of 'conn_settings' will always > evaluate as 'true' Sorry for the imprecision, this warning is caused by this code: if ('\0' != conn_settings[0]) STR_TO_NAME(comval->conn_settings, conn_settings); -- Michael
On 03/03/2014 04:41 AM, Michael Paquier wrote: > On Mon, Mar 3, 2014 at 11:38 AM, Michael Paquier > <michael.paquier@gmail.com> wrote: >> On another note, I found as well the following warning: >> dlg_specific.c:1491: error: the address of 'conn_settings' will always >> evaluate as 'true' > Sorry for the imprecision, this warning is caused by this code: > if ('\0' != conn_settings[0]) > STR_TO_NAME(comval->conn_settings, conn_settings); Thanks, committed. - Heikki
On 03/03/2014 04:38 AM, Michael Paquier wrote: > On another note, I found as well the following warning: > dlg_specific.c:1491: error: the address of 'conn_settings' will always > evaluate as 'true' Yeah, that has bothered me for a long time, but at a quick glance I haven't seen a very good way to fix it. Clearly the "conn_settings == NULL" test is unnecessary here, but the free() call that STR_TO_NAME also does is not, so we can't just replace the macro with an strcpy. Hmm, now that I look at it, we have a macro STRX_TO_NAME which is the same but without the NULL check. So we can just use that; that appears to be how it's used elsewhere too. So, fixed. - Heikki
On Tue, Mar 4, 2014 at 4:44 AM, Heikki Linnakangas <hlinnakangas@vmware.com> wrote: > On 03/03/2014 04:38 AM, Michael Paquier wrote: >> >> On another note, I found as well the following warning: >> dlg_specific.c:1491: error: the address of 'conn_settings' will always >> evaluate as 'true' > > > Yeah, that has bothered me for a long time, but at a quick glance I haven't > seen a very good way to fix it. Clearly the "conn_settings == NULL" test is > unnecessary here, but the free() call that STR_TO_NAME also does is not, so > we can't just replace the macro with an strcpy. > > Hmm, now that I look at it, we have a macro STRX_TO_NAME which is the same > but without the NULL check. So we can just use that; that appears to be how > it's used elsewhere too. Thanks, I was not sure how to fix this one as well. -- Michael