Changeset: e83475d49d23 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e83475d49d23
Modified Files:
clients/mapilib/mapi.c
clients/odbc/driver/ODBCConvert.c
configure.ag
tools/merovingian/daemon/discoveryrunner.c
Branch: Apr2011
Log Message:
Make arguments and corresponding format string conversions match;
and let icc complain about (future) mismatches.
TODO:
Keep an eye on testing to verify that format string qualifiers
"h" & "hh" are standard and portable...
diffs (102 lines):
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -3287,19 +3287,19 @@
switch (hdl->params[i].intype) {
case MAPI_TINY:
checkSpace(5);
- sprintf(hdl->query + k, "%d", *(signed char *)
src);
+ sprintf(hdl->query + k, "%hhd", *(signed char
*) src);
break;
case MAPI_UTINY:
checkSpace(5);
- sprintf(hdl->query + k, "%u", *(unsigned char
*) src);
+ sprintf(hdl->query + k, "%hhu", *(unsigned char
*) src);
break;
case MAPI_SHORT:
checkSpace(10);
- sprintf(hdl->query + k, "%d", *(short *) src);
+ sprintf(hdl->query + k, "%hd", *(short *) src);
break;
case MAPI_USHORT:
checkSpace(10);
- sprintf(hdl->query + k, "%u", *(unsigned short
*) src);
+ sprintf(hdl->query + k, "%hu", *(unsigned short
*) src);
break;
case MAPI_INT:
checkSpace(20);
@@ -3336,7 +3336,7 @@
case MAPI_DATE:
checkSpace(50);
sprintf(hdl->query + k,
- "DATE '%04d-%02u-%02u'",
+ "DATE '%04hd-%02hu-%02hu'",
((MapiDate *) src)->year,
((MapiDate *) src)->month,
((MapiDate *) src)->day);
@@ -3344,7 +3344,7 @@
case MAPI_TIME:
checkSpace(60);
sprintf(hdl->query + k,
- "TIME '%02u:%02u:%02u'",
+ "TIME '%02hu:%02hu:%02hu'",
((MapiTime *) src)->hour,
((MapiTime *) src)->minute,
((MapiTime *) src)->second);
@@ -3352,7 +3352,7 @@
case MAPI_DATETIME:
checkSpace(110);
sprintf(hdl->query + k,
- "TIMESTAMP '%04d-%02u-%02u
%02u:%02u:%02u.%09u'",
+ "TIMESTAMP '%04hd-%02hu-%02hu
%02hu:%02hu:%02hu.%09u'",
((MapiDateTime *) src)->year,
((MapiDateTime *) src)->month,
((MapiDateTime *) src)->day,
diff --git a/clients/odbc/driver/ODBCConvert.c
b/clients/odbc/driver/ODBCConvert.c
--- a/clients/odbc/driver/ODBCConvert.c
+++ b/clients/odbc/driver/ODBCConvert.c
@@ -2862,7 +2862,10 @@
}
/* fall through */
case SQL_C_TYPE_DATE:
- snprintf(data, sizeof(data), "DATE '%u-%02u-%02u'",
dval.year, dval.month, dval.day);
+ snprintf(data, sizeof(data), "DATE '%u-%02u-%02u'",
+ (unsigned int) dval.year,
+ (unsigned int) dval.month,
+ (unsigned int) dval.day);
assigns(buf, bufpos, buflen, data, stmt);
break;
default:
@@ -2961,7 +2964,7 @@
/* fall through */
case SQL_C_TYPE_TIMESTAMP:
snprintf(data, sizeof(data),
- "TIMESTAMP '%u-%02d-%02d %02u:%02u:%02u",
+ "TIMESTAMP '%u-%02u-%02u %02u:%02u:%02u",
(unsigned int) tsval.year,
(unsigned int) tsval.month,
(unsigned int) tsval.day,
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -638,6 +638,8 @@
dnl Be rigid; MonetDB code is supposed to adhere to this... ;-)
dnl Let warning #266 "function declared implicitly" become an error.
X_CFLAGS="$X_CFLAGS -we266"
+ dnl Let remark #181 "argument is incompatible with corresponding
format string conversion" become an error.
+ X_CFLAGS="$X_CFLAGS -we181"
X_CFLAGS="$X_CFLAGS -Werror"
dnl ... however, some things aren't solved, yet:
dnl (for the time being,) we need to disable some warnings (making
them remarks doesn't seem to work with -Werror):
diff --git a/tools/merovingian/daemon/discoveryrunner.c
b/tools/merovingian/daemon/discoveryrunner.c
--- a/tools/merovingian/daemon/discoveryrunner.c
+++ b/tools/merovingian/daemon/discoveryrunner.c
@@ -347,7 +347,7 @@
val = "";
snprintf(buf, 512, "ANNC %s%s%s
mapi:monetdb://%s:%u/ %d",
stats->dbname, val[0]
== '\0' ? "" : "/", val,
- _mero_hostname,
getConfNum(_mero_props, "port"),
+ _mero_hostname,
(unsigned int)getConfNum(_mero_props, "port"),
discttl->ival + 60);
broadcast(buf);
}
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list