pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
[PATCH] Silence GCC warnings, fix build
3+ messages / 2 participants
[nested] [flat]

* [PATCH] Silence GCC warnings, fix build
@ 2013-12-06 17:08 Pavel Raiskup <praiskup@redhat.com>
  2013-12-12 13:28 ` Re: [PATCH] Silence GCC warnings, fix build Pavel Raiskup <praiskup@redhat.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Pavel Raiskup @ 2013-12-06 17:08 UTC (permalink / raw)
  To: pgsql-odbc; +Cc: praiskup@redhat.com

* Makefile.am: Add mylog.h into dependand sources.
* convert.c (mylog): Retype sprintf() parameters.
* specific.c (getCommonDefaults): Don't check array for NULL.
* psqlodbc.c (copy_globals): Initialize the 'to' structure
completely.
---
 Makefile.am    |  2 +-
 convert.c      | 31 ++++++++++++++++++++-----------
 dlg_specific.c |  2 +-
 psqlodbc.c     |  2 +-
 4 files changed, 23 insertions(+), 14 deletions(-)

inline patch 1: Makefile.am, convert.c, dlg_specific.c and 1 more (+23/-14 lines) download inline-1.patchdiff --git a/Makefile.am b/Makefile.am index dfd36ab..f9820a4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -32,7 +32,7 @@ psqlodbca_la_SOURCES = \ descriptor.h dlg_specific.h environ.h \ lobj.h md5.h misc.h multibyte.h pgapifunc.h pgtypes.h \ psqlodbc.h qresult.h resource.h socket.h statement.h tuple.h \ - version.h loadlib.h pgenlist.h + version.h loadlib.h pgenlist.h mylog.h psqlodbcw_la_SOURCES = $(psqlodbca_la_SOURCES) \ odbcapi30w.c odbcapiw.c win_unicode.c diff --git a/convert.c b/convert.c index f647f9c..a7136ce 100644 --- a/convert.c +++ b/convert.c @@ -4376,27 +4376,36 @@ mylog("C_WCHAR=%s(%d)\n", buffer, used); break; case SQL_C_INTERVAL_YEAR: ivsign = ivstruct->interval_sign ? "-" : ""; - sprintf(param_string, "%s%d years", ivsign, ivstruct->intval.year_month.year); + sprintf(param_string, "%s%lu years", ivsign, + (unsigned long)ivstruct->intval.year_month.year); break; case SQL_C_INTERVAL_MONTH: case SQL_C_INTERVAL_YEAR_TO_MONTH: ivsign = ivstruct->interval_sign ? "-" : ""; - sprintf(param_string, "%s%d years %s%d mons", ivsign, ivstruct->intval.year_month.year, ivsign, ivstruct->intval.year_month.month); + sprintf(param_string, "%s%lu years %s%lu mons", ivsign, + (unsigned long)ivstruct->intval.year_month.year, ivsign, + (unsigned long)(ivstruct->intval.year_month.month)); break; case SQL_C_INTERVAL_DAY: ivsign = ivstruct->interval_sign ? "-" : ""; - sprintf(param_string, "%s%d days", ivsign, ivstruct->intval.day_second.day); + sprintf(param_string, "%s%lu days", ivsign, + (unsigned long)ivstruct->intval.day_second.day); break; case SQL_C_INTERVAL_HOUR: case SQL_C_INTERVAL_DAY_TO_HOUR: ivsign = ivstruct->interval_sign ? "-" : ""; - sprintf(param_string, "%s%d days %s%02d:00:00", ivsign, ivstruct->intval.day_second.day, ivsign, ivstruct->intval.day_second.hour); + sprintf(param_string, "%s%lu days %s%02lu:00:00", ivsign, + (unsigned long)ivstruct->intval.day_second.day, ivsign, + (unsigned long)ivstruct->intval.day_second.hour); break; case SQL_C_INTERVAL_MINUTE: case SQL_C_INTERVAL_HOUR_TO_MINUTE: case SQL_C_INTERVAL_DAY_TO_MINUTE: ivsign = ivstruct->interval_sign ? "-" : ""; - sprintf(param_string, "%s%d days %s%02d:%02d:00", ivsign, ivstruct->intval.day_second.day, ivsign, ivstruct->intval.day_second.hour, ivstruct->intval.day_second.minute); + sprintf(param_string, "%s%lu days %s%02lu:%02lu:00", + ivsign, (unsigned long)ivstruct->intval.day_second.day, + ivsign, (unsigned long)ivstruct->intval.day_second.hour, + (unsigned long)ivstruct->intval.day_second.minute); break; case SQL_C_INTERVAL_SECOND: @@ -4404,11 +4413,11 @@ mylog("C_WCHAR=%s(%d)\n", buffer, used); case SQL_C_INTERVAL_HOUR_TO_SECOND: case SQL_C_INTERVAL_MINUTE_TO_SECOND: ivsign = ivstruct->interval_sign ? "-" : ""; - sprintf(param_string, "%s%d days %s%02d:%02d:%02d", - ivsign, ivstruct->intval.day_second.day, - ivsign, ivstruct->intval.day_second.hour, - ivstruct->intval.day_second.minute, - ivstruct->intval.day_second.second); + sprintf(param_string, "%s%lu days %s%02lu:%02lu:%02lu", + ivsign, (unsigned long)ivstruct->intval.day_second.day, + ivsign, (unsigned long)ivstruct->intval.day_second.hour, + (unsigned long)ivstruct->intval.day_second.minute, + (unsigned long)ivstruct->intval.day_second.second); if (ivstruct->intval.day_second.fraction > 0) { int fraction = ivstruct->intval.day_second.fraction, prec = apara->precision; @@ -4428,7 +4437,7 @@ mylog("C_WCHAR=%s(%d)\n", buffer, used); SQLGUID *g = (SQLGUID *) buffer; snprintf (param_string, sizeof(param_string), "%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", - g->Data1, + (unsigned long)g->Data1, g->Data2, g->Data3, g->Data4[0], g->Data4[1], g->Data4[2], g->Data4[3], g->Data4[4], g->Data4[5], g->Data4[6], g->Data4[7]); diff --git a/dlg_specific.c b/dlg_specific.c index 53edd6d..fc06fdf 100644 --- a/dlg_specific.c +++ b/dlg_specific.c @@ -1435,7 +1435,7 @@ getCommonDefaults(const char *section, const char *filename, ConnInfo *ci) SQLGetPrivateProfileString(section, INI_CONNSETTINGS, "", conn_settings, sizeof(conn_settings), filename); if ('\0' != conn_settings[0]) - STR_TO_NAME(comval->conn_settings, conn_settings); + STRX_TO_NAME(comval->conn_settings, (char *)conn_settings); /* Default state for future DSN's Readonly attribute */ SQLGetPrivateProfileString(section, INI_READONLY, "", diff --git a/psqlodbc.c b/psqlodbc.c index 09bd563..349d4e1 100644 --- a/psqlodbc.c +++ b/psqlodbc.c @@ -102,7 +102,7 @@ int initialize_global_cs(void) void copy_globals(GLOBAL_VALUES *to, const GLOBAL_VALUES *from) { - memset(to, 0, sizeof(to)); + memset(to, 0, sizeof(*to)); /*** memcpy(to, from, sizeof(GLOBAL_VALUES)); SET_NAME_DIRECTLY(to->drivername, NULL); -- 1.8.4.2
-- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc ^ permalink raw reply [nested|flat] 3+ messages in thread

* Re: [PATCH] Silence GCC warnings, fix build
  2013-12-06 17:08 [PATCH] Silence GCC warnings, fix build Pavel Raiskup <praiskup@redhat.com>
@ 2013-12-12 13:28 ` Pavel Raiskup <praiskup@redhat.com>
  2013-12-13 14:46   ` Re: [PATCH] Silence GCC warnings, fix build Hiroshi Saito <hiroshi@winpg.jp>
  0 siblings, 1 reply; 3+ messages in thread

From: Pavel Raiskup @ 2013-12-12 13:28 UTC (permalink / raw)
  To: pgsql-odbc; +Cc: Hiroshi Saito <hiroshi@winpg.jp>

I would like to ping on this topic before we submit new release.  Thanks
for your work btw!  Attached are logs from gcc on 32 bit linux.

-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc

Attachments:

buildlog (text/plain, 2.7K) download Without mylog.h mentioned in Makefile.am it does not compile at all! So after I add it there, this is the error output: $ make V=0 make all-am make[1]: Entering directory `/tmp/psqlodbc-09.02.0100' CC info.lo CC bind.lo CC columninfo.lo CC connection.lo CC convert.lo convert.c: In function 'ResolveOneParam': convert.c:4379: warning: format '%d' expects type 'int', but argument 4 has type 'SQLUINTEGER' convert.c:4384: warning: format '%d' expects type 'int', but argument 4 has type 'SQLUINTEGER' convert.c:4384: warning: format '%d' expects type 'int', but argument 6 has type 'SQLUINTEGER' convert.c:4388: warning: format '%d' expects type 'int', but argument 4 has type 'SQLUINTEGER' convert.c:4393: warning: format '%d' expects type 'int', but argument 4 has type 'SQLUINTEGER' convert.c:4393: warning: format '%02d' expects type 'int', but argument 6 has type 'SQLUINTEGER' convert.c:4399: warning: format '%d' expects type 'int', but argument 4 has type 'SQLUINTEGER' convert.c:4399: warning: format '%02d' expects type 'int', but argument 6 has type 'SQLUINTEGER' convert.c:4399: warning: format '%02d' expects type 'int', but argument 7 has type 'SQLUINTEGER' convert.c:4411: warning: format '%d' expects type 'int', but argument 4 has type 'SQLUINTEGER' convert.c:4411: warning: format '%02d' expects type 'int', but argument 6 has type 'SQLUINTEGER' convert.c:4411: warning: format '%02d' expects type 'int', but argument 7 has type 'SQLUINTEGER' convert.c:4411: warning: format '%02d' expects type 'int', but argument 8 has type 'SQLUINTEGER' CC drvconn.lo drvconn.c: In function 'dconn_get_attributes': drvconn.c:439: warning: 'last' may be used uninitialized in this function CC environ.lo CC execute.lo CC lobj.lo CC md5.lo CC misc.lo CC options.lo CC pgtypes.lo CC psqlodbc.lo CC qresult.lo CC results.lo CC socket.lo CC parse.lo CC statement.lo CC tuple.lo CC dlg_specific.lo dlg_specific.c: In function 'getCommonDefaults': dlg_specific.c:1438: warning: the address of 'conn_settings' will always evaluate as 'true' CC loadlib.lo loadlib.c: In function 'CALL_PQconnectdbParams': loadlib.c:439: warning: implicit declaration of function 'PQconnectdbParams' loadlib.c:439: warning: assignment makes pointer from integer without a cast CC multibyte.lo CC odbcapi.lo CC descriptor.lo CC odbcapi30.lo CC pgapi30.lo CC info30.lo CC mylog.lo CC odbcapi30w.lo CC odbcapiw.lo CC win_unicode.lo CCLD psqlodbcw.la make[1]: Leaving directory `/tmp/psqlodbc-09.02.0100'
^ permalink raw reply [nested|flat] 3+ messages in thread

* Re: [PATCH] Silence GCC warnings, fix build
  2013-12-06 17:08 [PATCH] Silence GCC warnings, fix build Pavel Raiskup <praiskup@redhat.com>
  2013-12-12 13:28 ` Re: [PATCH] Silence GCC warnings, fix build Pavel Raiskup <praiskup@redhat.com>
@ 2013-12-13 14:46   ` Hiroshi Saito <hiroshi@winpg.jp>
  0 siblings, 0 replies; 3+ messages in thread

From: Hiroshi Saito @ 2013-12-13 14:46 UTC (permalink / raw)
  To: Pavel Raiskup <praiskup@redhat.com>; +Cc: pgsql-odbc

Hi Pavel-san.

thanks!
I will adjust it.

Regards,
Hiroshi Saito

(2013/12/12 22:28), Pavel Raiskup wrote:
> I would like to ping on this topic before we submit new release.  Thanks
> for your work btw!  Attached are logs from gcc on 32 bit linux.

> Without mylog.h mentioned in Makefile.am it does not compile at all!
So after
> I add it there, this is the error output:




-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2013-12-13 14:46 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-12-06 17:08 [PATCH] Silence GCC warnings, fix build Pavel Raiskup <praiskup@redhat.com>
2013-12-12 13:28 ` Pavel Raiskup <praiskup@redhat.com>
2013-12-13 14:46   ` Hiroshi Saito <hiroshi@winpg.jp>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox