mirror of
https://github.com/postgres/postgres.git
synced 2025-04-25 21:42:33 +03:00
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:
parent
8c18f3f0e1
commit
ce8d7bb644
@ -2396,7 +2396,7 @@ radius_add_attribute(radius_packet *packet, uint8 type, const unsigned char *dat
|
|||||||
* fail.
|
* fail.
|
||||||
*/
|
*/
|
||||||
elog(WARNING,
|
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);
|
type, len);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -2673,11 +2673,11 @@ CheckRADIUSAuth(Port *port)
|
|||||||
{
|
{
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
ereport(LOG,
|
ereport(LOG,
|
||||||
(errmsg("RADIUS response was sent from incorrect port: %i",
|
(errmsg("RADIUS response was sent from incorrect port: %d",
|
||||||
ntohs(remoteaddr.sin6_port))));
|
ntohs(remoteaddr.sin6_port))));
|
||||||
#else
|
#else
|
||||||
ereport(LOG,
|
ereport(LOG,
|
||||||
(errmsg("RADIUS response was sent from incorrect port: %i",
|
(errmsg("RADIUS response was sent from incorrect port: %d",
|
||||||
ntohs(remoteaddr.sin_port))));
|
ntohs(remoteaddr.sin_port))));
|
||||||
#endif
|
#endif
|
||||||
continue;
|
continue;
|
||||||
@ -2686,14 +2686,14 @@ CheckRADIUSAuth(Port *port)
|
|||||||
if (packetlength < RADIUS_HEADER_LENGTH)
|
if (packetlength < RADIUS_HEADER_LENGTH)
|
||||||
{
|
{
|
||||||
ereport(LOG,
|
ereport(LOG,
|
||||||
(errmsg("RADIUS response too short: %i", packetlength)));
|
(errmsg("RADIUS response too short: %d", packetlength)));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packetlength != ntohs(receivepacket->length))
|
if (packetlength != ntohs(receivepacket->length))
|
||||||
{
|
{
|
||||||
ereport(LOG,
|
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)));
|
ntohs(receivepacket->length), packetlength)));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2701,7 +2701,7 @@ CheckRADIUSAuth(Port *port)
|
|||||||
if (packet->id != receivepacket->id)
|
if (packet->id != receivepacket->id)
|
||||||
{
|
{
|
||||||
ereport(LOG,
|
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)));
|
receivepacket->id, packet->id)));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2752,7 +2752,7 @@ CheckRADIUSAuth(Port *port)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ereport(LOG,
|
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)));
|
receivepacket->code, port->user_name)));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ TranslateSocketError(void)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ereport(NOTICE,
|
ereport(NOTICE,
|
||||||
(errmsg_internal("unrecognized win32 socket error code: %i", WSAGetLastError())));
|
(errmsg_internal("unrecognized win32 socket error code: %d", WSAGetLastError())));
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -143,11 +143,11 @@ pgwin32_waitforsinglesocket(SOCKET s, int what, int timeout)
|
|||||||
|
|
||||||
if (waitevent == INVALID_HANDLE_VALUE)
|
if (waitevent == INVALID_HANDLE_VALUE)
|
||||||
ereport(ERROR,
|
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))
|
else if (!ResetEvent(waitevent))
|
||||||
ereport(ERROR,
|
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
|
* 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)
|
if (r == WAIT_TIMEOUT)
|
||||||
return 0;
|
return 0;
|
||||||
ereport(ERROR,
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -567,7 +567,7 @@ pgwin32_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, c
|
|||||||
ZeroMemory(&resEvents, sizeof(resEvents));
|
ZeroMemory(&resEvents, sizeof(resEvents));
|
||||||
if (WSAEnumNetworkEvents(sockets[i], events[i], &resEvents) == SOCKET_ERROR)
|
if (WSAEnumNetworkEvents(sockets[i], events[i], &resEvents) == SOCKET_ERROR)
|
||||||
ereport(FATAL,
|
ereport(FATAL,
|
||||||
(errmsg_internal("failed to enumerate network events: %i", (int) GetLastError())));
|
(errmsg_internal("failed to enumerate network events: %d", (int) GetLastError())));
|
||||||
/* Read activity? */
|
/* Read activity? */
|
||||||
if (readfds && FD_ISSET(sockets[i], readfds))
|
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);
|
handleDLL = LoadLibraryEx("netmsg.dll", NULL, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE);
|
||||||
if (handleDLL == NULL)
|
if (handleDLL == NULL)
|
||||||
ereport(FATAL,
|
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));
|
ZeroMemory(&wserrbuf, sizeof(wserrbuf));
|
||||||
@ -658,7 +658,7 @@ pgwin32_socket_strerror(int err)
|
|||||||
NULL) == 0)
|
NULL) == 0)
|
||||||
{
|
{
|
||||||
/* Failed to get id */
|
/* Failed to get id */
|
||||||
sprintf(wserrbuf, "unrecognized winsock error %i", err);
|
sprintf(wserrbuf, "unrecognized winsock error %d", err);
|
||||||
}
|
}
|
||||||
return wserrbuf;
|
return wserrbuf;
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, SOCKET sock,
|
|||||||
ZeroMemory(&resEvents, sizeof(resEvents));
|
ZeroMemory(&resEvents, sizeof(resEvents));
|
||||||
if (WSAEnumNetworkEvents(sock, sockevent, &resEvents) == SOCKET_ERROR)
|
if (WSAEnumNetworkEvents(sock, sockevent, &resEvents) == SOCKET_ERROR)
|
||||||
ereport(FATAL,
|
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) &&
|
if ((wakeEvents & WL_SOCKET_READABLE) &&
|
||||||
(resEvents.lNetworkEvents & FD_READ))
|
(resEvents.lNetworkEvents & FD_READ))
|
||||||
|
@ -217,18 +217,18 @@ progress_report(int tablespacenum, char *fn)
|
|||||||
* call)
|
* call)
|
||||||
*/
|
*/
|
||||||
fprintf(stderr,
|
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,
|
totaldone / 1024, totalsize,
|
||||||
tablespacenum, tablespacecount, "");
|
tablespacenum, tablespacecount, "");
|
||||||
else
|
else
|
||||||
fprintf(stderr,
|
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,
|
totaldone / 1024, totalsize,
|
||||||
percent,
|
percent,
|
||||||
tablespacenum, tablespacecount, fn);
|
tablespacenum, tablespacecount, fn);
|
||||||
}
|
}
|
||||||
else
|
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,
|
totaldone / 1024, totalsize,
|
||||||
percent,
|
percent,
|
||||||
tablespacenum, tablespacecount);
|
tablespacenum, tablespacecount);
|
||||||
@ -269,7 +269,7 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
|
|||||||
ztarfile = gzdopen(dup(fileno(stdout)), "wb");
|
ztarfile = gzdopen(dup(fileno(stdout)), "wb");
|
||||||
if (gzsetparams(ztarfile, compresslevel, Z_DEFAULT_STRATEGY) != Z_OK)
|
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));
|
progname, compresslevel, get_gz_error(ztarfile));
|
||||||
disconnect_and_exit(1);
|
disconnect_and_exit(1);
|
||||||
}
|
}
|
||||||
@ -287,7 +287,7 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
|
|||||||
ztarfile = gzopen(fn, "wb");
|
ztarfile = gzopen(fn, "wb");
|
||||||
if (gzsetparams(ztarfile, compresslevel, Z_DEFAULT_STRATEGY) != Z_OK)
|
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));
|
progname, compresslevel, get_gz_error(ztarfile));
|
||||||
disconnect_and_exit(1);
|
disconnect_and_exit(1);
|
||||||
}
|
}
|
||||||
@ -311,7 +311,7 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
|
|||||||
ztarfile = gzopen(fn, "wb");
|
ztarfile = gzopen(fn, "wb");
|
||||||
if (gzsetparams(ztarfile, compresslevel, Z_DEFAULT_STRATEGY) != Z_OK)
|
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));
|
progname, compresslevel, get_gz_error(ztarfile));
|
||||||
disconnect_and_exit(1);
|
disconnect_and_exit(1);
|
||||||
}
|
}
|
||||||
@ -533,7 +533,7 @@ ReceiveAndUnpackTarFile(PGconn *conn, PGresult *res, int rownum)
|
|||||||
*/
|
*/
|
||||||
if (r != 512)
|
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);
|
progname, r);
|
||||||
disconnect_and_exit(1);
|
disconnect_and_exit(1);
|
||||||
}
|
}
|
||||||
@ -870,7 +870,7 @@ BaseBackup(void)
|
|||||||
*/
|
*/
|
||||||
if (format == 't' && strcmp(basedir, "-") == 0 && PQntuples(res) > 1)
|
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));
|
progname, PQntuples(res));
|
||||||
disconnect_and_exit(1);
|
disconnect_and_exit(1);
|
||||||
}
|
}
|
||||||
|
@ -1663,7 +1663,7 @@ printSSLInfo(void)
|
|||||||
return; /* no SSL */
|
return; /* no SSL */
|
||||||
|
|
||||||
SSL_get_cipher_bits(ssl, &sslbits);
|
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);
|
SSL_get_cipher(ssl), sslbits);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -2355,7 +2355,7 @@ keep_going: /* We will come back to here until there is
|
|||||||
if (!conn->ginbuf.value)
|
if (!conn->ginbuf.value)
|
||||||
{
|
{
|
||||||
printfPQExpBuffer(&conn->errorMessage,
|
printfPQExpBuffer(&conn->errorMessage,
|
||||||
libpq_gettext("out of memory allocating GSSAPI buffer (%i)"),
|
libpq_gettext("out of memory allocating GSSAPI buffer (%d)"),
|
||||||
llen);
|
llen);
|
||||||
goto error_return;
|
goto error_return;
|
||||||
}
|
}
|
||||||
|
@ -319,14 +319,14 @@ winsock_strerror(int err, char *strerrbuf, size_t buflen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!success)
|
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
|
else
|
||||||
{
|
{
|
||||||
strerrbuf[buflen - 1] = '\0';
|
strerrbuf[buflen - 1] = '\0';
|
||||||
offs = strlen(strerrbuf);
|
offs = strlen(strerrbuf);
|
||||||
if (offs > (int) buflen - 64)
|
if (offs > (int) buflen - 64)
|
||||||
offs = buflen - 64;
|
offs = buflen - 64;
|
||||||
sprintf(strerrbuf + offs, " (0x%08X/%i)", err, err);
|
sprintf(strerrbuf + offs, " (0x%08X/%d)", err, err);
|
||||||
}
|
}
|
||||||
return strerrbuf;
|
return strerrbuf;
|
||||||
}
|
}
|
||||||
|
@ -1114,7 +1114,7 @@ identify_system_timezone(void)
|
|||||||
&rootKey) != ERROR_SUCCESS)
|
&rootKey) != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ereport(LOG,
|
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()),
|
(int) GetLastError()),
|
||||||
errdetail("The PostgreSQL time zone will be set to \"%s\".",
|
errdetail("The PostgreSQL time zone will be set to \"%s\".",
|
||||||
"GMT"),
|
"GMT"),
|
||||||
@ -1145,14 +1145,14 @@ identify_system_timezone(void)
|
|||||||
if (r == ERROR_NO_MORE_ITEMS)
|
if (r == ERROR_NO_MORE_ITEMS)
|
||||||
break;
|
break;
|
||||||
ereport(LOG,
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((r = RegOpenKeyEx(rootKey, keyname, 0, KEY_READ, &key)) != ERROR_SUCCESS)
|
if ((r = RegOpenKeyEx(rootKey, keyname, 0, KEY_READ, &key)) != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ereport(LOG,
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1161,7 +1161,7 @@ identify_system_timezone(void)
|
|||||||
if ((r = RegQueryValueEx(key, "Std", NULL, NULL, (unsigned char *) zonename, &namesize)) != ERROR_SUCCESS)
|
if ((r = RegQueryValueEx(key, "Std", NULL, NULL, (unsigned char *) zonename, &namesize)) != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ereport(LOG,
|
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)));
|
keyname, (int) r)));
|
||||||
RegCloseKey(key);
|
RegCloseKey(key);
|
||||||
continue; /* Proceed to look at the next timezone */
|
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)
|
if ((r = RegQueryValueEx(key, "Dlt", NULL, NULL, (unsigned char *) zonename, &namesize)) != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ereport(LOG,
|
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)));
|
keyname, (int) r)));
|
||||||
RegCloseKey(key);
|
RegCloseKey(key);
|
||||||
continue; /* Proceed to look at the next timezone */
|
continue; /* Proceed to look at the next timezone */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user