Replace printf format %i by %d

They are identical, but the overwhelming majority of the code uses %d,
so standardize on that.
This commit is contained in:
Peter Eisentraut 2011-07-26 22:54:29 +03:00
parent 8c18f3f0e1
commit ce8d7bb644
8 changed files with 32 additions and 32 deletions

View File

@ -2396,7 +2396,7 @@ radius_add_attribute(radius_packet *packet, uint8 type, const unsigned char *dat
* fail.
*/
elog(WARNING,
"Adding attribute code %i with length %i to radius packet would create oversize packet, ignoring",
"Adding attribute code %d with length %d to radius packet would create oversize packet, ignoring",
type, len);
return;
@ -2673,11 +2673,11 @@ CheckRADIUSAuth(Port *port)
{
#ifdef HAVE_IPV6
ereport(LOG,
(errmsg("RADIUS response was sent from incorrect port: %i",
(errmsg("RADIUS response was sent from incorrect port: %d",
ntohs(remoteaddr.sin6_port))));
#else
ereport(LOG,
(errmsg("RADIUS response was sent from incorrect port: %i",
(errmsg("RADIUS response was sent from incorrect port: %d",
ntohs(remoteaddr.sin_port))));
#endif
continue;
@ -2686,14 +2686,14 @@ CheckRADIUSAuth(Port *port)
if (packetlength < RADIUS_HEADER_LENGTH)
{
ereport(LOG,
(errmsg("RADIUS response too short: %i", packetlength)));
(errmsg("RADIUS response too short: %d", packetlength)));
continue;
}
if (packetlength != ntohs(receivepacket->length))
{
ereport(LOG,
(errmsg("RADIUS response has corrupt length: %i (actual length %i)",
(errmsg("RADIUS response has corrupt length: %d (actual length %d)",
ntohs(receivepacket->length), packetlength)));
continue;
}
@ -2701,7 +2701,7 @@ CheckRADIUSAuth(Port *port)
if (packet->id != receivepacket->id)
{
ereport(LOG,
(errmsg("RADIUS response is to a different request: %i (should be %i)",
(errmsg("RADIUS response is to a different request: %d (should be %d)",
receivepacket->id, packet->id)));
continue;
}
@ -2752,7 +2752,7 @@ CheckRADIUSAuth(Port *port)
else
{
ereport(LOG,
(errmsg("RADIUS response has invalid code (%i) for user \"%s\"",
(errmsg("RADIUS response has invalid code (%d) for user \"%s\"",
receivepacket->code, port->user_name)));
continue;
}

View File

@ -99,7 +99,7 @@ TranslateSocketError(void)
break;
default:
ereport(NOTICE,
(errmsg_internal("unrecognized win32 socket error code: %i", WSAGetLastError())));
(errmsg_internal("unrecognized win32 socket error code: %d", WSAGetLastError())));
errno = EINVAL;
}
}
@ -143,11 +143,11 @@ pgwin32_waitforsinglesocket(SOCKET s, int what, int timeout)
if (waitevent == INVALID_HANDLE_VALUE)
ereport(ERROR,
(errmsg_internal("could not create socket waiting event: %i", (int) GetLastError())));
(errmsg_internal("could not create socket waiting event: %d", (int) GetLastError())));
}
else if (!ResetEvent(waitevent))
ereport(ERROR,
(errmsg_internal("could not reset socket waiting event: %i", (int) GetLastError())));
(errmsg_internal("could not reset socket waiting event: %d", (int) GetLastError())));
/*
* make sure we don't multiplex this kernel event object with a different
@ -221,7 +221,7 @@ pgwin32_waitforsinglesocket(SOCKET s, int what, int timeout)
if (r == WAIT_TIMEOUT)
return 0;
ereport(ERROR,
(errmsg_internal("unrecognized return value from WaitForMultipleObjects: %i (%i)", r, (int) GetLastError())));
(errmsg_internal("unrecognized return value from WaitForMultipleObjects: %d (%d)", r, (int) GetLastError())));
return 0;
}
@ -567,7 +567,7 @@ pgwin32_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, c
ZeroMemory(&resEvents, sizeof(resEvents));
if (WSAEnumNetworkEvents(sockets[i], events[i], &resEvents) == SOCKET_ERROR)
ereport(FATAL,
(errmsg_internal("failed to enumerate network events: %i", (int) GetLastError())));
(errmsg_internal("failed to enumerate network events: %d", (int) GetLastError())));
/* Read activity? */
if (readfds && FD_ISSET(sockets[i], readfds))
{
@ -645,7 +645,7 @@ pgwin32_socket_strerror(int err)
handleDLL = LoadLibraryEx("netmsg.dll", NULL, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE);
if (handleDLL == NULL)
ereport(FATAL,
(errmsg_internal("could not load netmsg.dll: %i", (int) GetLastError())));
(errmsg_internal("could not load netmsg.dll: %d", (int) GetLastError())));
}
ZeroMemory(&wserrbuf, sizeof(wserrbuf));
@ -658,7 +658,7 @@ pgwin32_socket_strerror(int err)
NULL) == 0)
{
/* Failed to get id */
sprintf(wserrbuf, "unrecognized winsock error %i", err);
sprintf(wserrbuf, "unrecognized winsock error %d", err);
}
return wserrbuf;
}

View File

@ -189,7 +189,7 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, SOCKET sock,
ZeroMemory(&resEvents, sizeof(resEvents));
if (WSAEnumNetworkEvents(sock, sockevent, &resEvents) == SOCKET_ERROR)
ereport(FATAL,
(errmsg_internal("failed to enumerate network events: %i", (int) GetLastError())));
(errmsg_internal("failed to enumerate network events: %d", (int) GetLastError())));
if ((wakeEvents & WL_SOCKET_READABLE) &&
(resEvents.lNetworkEvents & FD_READ))

View File

@ -217,18 +217,18 @@ progress_report(int tablespacenum, char *fn)
* call)
*/
fprintf(stderr,
INT64_FORMAT "/" INT64_FORMAT " kB (100%%) %i/%i tablespaces %35s\r",
INT64_FORMAT "/" INT64_FORMAT " kB (100%%) %d/%d tablespaces %35s\r",
totaldone / 1024, totalsize,
tablespacenum, tablespacecount, "");
else
fprintf(stderr,
INT64_FORMAT "/" INT64_FORMAT " kB (%i%%) %i/%i tablespaces (%-30.30s)\r",
INT64_FORMAT "/" INT64_FORMAT " kB (%d%%) %d/%d tablespaces (%-30.30s)\r",
totaldone / 1024, totalsize,
percent,
tablespacenum, tablespacecount, fn);
}
else
fprintf(stderr, INT64_FORMAT "/" INT64_FORMAT " kB (%i%%) %i/%i tablespaces\r",
fprintf(stderr, INT64_FORMAT "/" INT64_FORMAT " kB (%d%%) %d/%d tablespaces\r",
totaldone / 1024, totalsize,
percent,
tablespacenum, tablespacecount);
@ -269,7 +269,7 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
ztarfile = gzdopen(dup(fileno(stdout)), "wb");
if (gzsetparams(ztarfile, compresslevel, Z_DEFAULT_STRATEGY) != Z_OK)
{
fprintf(stderr, _("%s: could not set compression level %i: %s\n"),
fprintf(stderr, _("%s: could not set compression level %d: %s\n"),
progname, compresslevel, get_gz_error(ztarfile));
disconnect_and_exit(1);
}
@ -287,7 +287,7 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
ztarfile = gzopen(fn, "wb");
if (gzsetparams(ztarfile, compresslevel, Z_DEFAULT_STRATEGY) != Z_OK)
{
fprintf(stderr, _("%s: could not set compression level %i: %s\n"),
fprintf(stderr, _("%s: could not set compression level %d: %s\n"),
progname, compresslevel, get_gz_error(ztarfile));
disconnect_and_exit(1);
}
@ -311,7 +311,7 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
ztarfile = gzopen(fn, "wb");
if (gzsetparams(ztarfile, compresslevel, Z_DEFAULT_STRATEGY) != Z_OK)
{
fprintf(stderr, _("%s: could not set compression level %i: %s\n"),
fprintf(stderr, _("%s: could not set compression level %d: %s\n"),
progname, compresslevel, get_gz_error(ztarfile));
disconnect_and_exit(1);
}
@ -533,7 +533,7 @@ ReceiveAndUnpackTarFile(PGconn *conn, PGresult *res, int rownum)
*/
if (r != 512)
{
fprintf(stderr, _("%s: invalid tar block header size: %i\n"),
fprintf(stderr, _("%s: invalid tar block header size: %d\n"),
progname, r);
disconnect_and_exit(1);
}
@ -870,7 +870,7 @@ BaseBackup(void)
*/
if (format == 't' && strcmp(basedir, "-") == 0 && PQntuples(res) > 1)
{
fprintf(stderr, _("%s: can only write single tablespace to stdout, database has %i\n"),
fprintf(stderr, _("%s: can only write single tablespace to stdout, database has %d\n"),
progname, PQntuples(res));
disconnect_and_exit(1);
}

View File

@ -1663,7 +1663,7 @@ printSSLInfo(void)
return; /* no SSL */
SSL_get_cipher_bits(ssl, &sslbits);
printf(_("SSL connection (cipher: %s, bits: %i)\n"),
printf(_("SSL connection (cipher: %s, bits: %d)\n"),
SSL_get_cipher(ssl), sslbits);
#else

View File

@ -2355,7 +2355,7 @@ keep_going: /* We will come back to here until there is
if (!conn->ginbuf.value)
{
printfPQExpBuffer(&conn->errorMessage,
libpq_gettext("out of memory allocating GSSAPI buffer (%i)"),
libpq_gettext("out of memory allocating GSSAPI buffer (%d)"),
llen);
goto error_return;
}

View File

@ -319,14 +319,14 @@ winsock_strerror(int err, char *strerrbuf, size_t buflen)
}
if (!success)
sprintf(strerrbuf, libpq_gettext("Unknown socket error (0x%08X/%i)"), err, err);
sprintf(strerrbuf, libpq_gettext("Unknown socket error (0x%08X/%d)"), err, err);
else
{
strerrbuf[buflen - 1] = '\0';
offs = strlen(strerrbuf);
if (offs > (int) buflen - 64)
offs = buflen - 64;
sprintf(strerrbuf + offs, " (0x%08X/%i)", err, err);
sprintf(strerrbuf + offs, " (0x%08X/%d)", err, err);
}
return strerrbuf;
}

View File

@ -1114,7 +1114,7 @@ identify_system_timezone(void)
&rootKey) != ERROR_SUCCESS)
{
ereport(LOG,
(errmsg("could not open registry key to identify system time zone: %i",
(errmsg("could not open registry key to identify system time zone: %d",
(int) GetLastError()),
errdetail("The PostgreSQL time zone will be set to \"%s\".",
"GMT"),
@ -1145,14 +1145,14 @@ identify_system_timezone(void)
if (r == ERROR_NO_MORE_ITEMS)
break;
ereport(LOG,
(errmsg_internal("could not enumerate registry subkeys to identify system time zone: %i", (int) r)));
(errmsg_internal("could not enumerate registry subkeys to identify system time zone: %d", (int) r)));
break;
}
if ((r = RegOpenKeyEx(rootKey, keyname, 0, KEY_READ, &key)) != ERROR_SUCCESS)
{
ereport(LOG,
(errmsg_internal("could not open registry subkey to identify system time zone: %i", (int) r)));
(errmsg_internal("could not open registry subkey to identify system time zone: %d", (int) r)));
break;
}
@ -1161,7 +1161,7 @@ identify_system_timezone(void)
if ((r = RegQueryValueEx(key, "Std", NULL, NULL, (unsigned char *) zonename, &namesize)) != ERROR_SUCCESS)
{
ereport(LOG,
(errmsg_internal("could not query value for key \"std\" to identify system time zone \"%s\": %i",
(errmsg_internal("could not query value for key \"std\" to identify system time zone \"%s\": %d",
keyname, (int) r)));
RegCloseKey(key);
continue; /* Proceed to look at the next timezone */
@ -1178,7 +1178,7 @@ identify_system_timezone(void)
if ((r = RegQueryValueEx(key, "Dlt", NULL, NULL, (unsigned char *) zonename, &namesize)) != ERROR_SUCCESS)
{
ereport(LOG,
(errmsg_internal("could not query value for key \"dlt\" to identify system time zone \"%s\": %i",
(errmsg_internal("could not query value for key \"dlt\" to identify system time zone \"%s\": %d",
keyname, (int) r)));
RegCloseKey(key);
continue; /* Proceed to look at the next timezone */