]> granicus.if.org Git - postgresql/commitdiff
Replace printf format %i by %d
authorPeter Eisentraut <peter_e@gmx.net>
Tue, 26 Jul 2011 19:54:29 +0000 (22:54 +0300)
committerPeter Eisentraut <peter_e@gmx.net>
Tue, 26 Jul 2011 19:54:29 +0000 (22:54 +0300)
They are identical, but the overwhelming majority of the code uses %d,
so standardize on that.

src/backend/libpq/auth.c
src/backend/port/win32/socket.c
src/backend/port/win32_latch.c
src/bin/pg_basebackup/pg_basebackup.c
src/bin/psql/command.c
src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/win32.c
src/timezone/pgtz.c

index 591a00885de882de1aa12f6ac085a1ae93909ee1..d1538809f85c4b4b48367e5c29355529c729d49b 100644 (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;
                }
index b730f8eeda9016626a806de8757ffa1bc8e65b79..2649268c18d450bbf44e4b35768bd9661bf3d7e0 100644 (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;
 }
index b35441b3bfb61cc9938c23e74a74c5a236ec3a9f..8d59ad493f6404f4c7bd12821453a9bb16c120b1 100644 (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))
index bafaab6c001ccfd08f3659561c14bb23a73597bf..121fc04cfaa3930e1cb140d0de3056e2e11b0660 100644 (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);
        }
index aeabe5bf3c37fcecfc70bb13d5ec3ac7afad75f9..7d2490ab8abe6b9e942cf25de96d96bf81542f92 100644 (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
 
index 9e4807e8a96cac13c40e38a24bdb845c4824f1e6..352358214534e8d59422552ea9a3e41138b7a87e 100644 (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;
                                                }
index d77fc48b5ebe1c0b977cd458a571297bfa65b116..20dfec912efd6d0dac9cc7e7d059014b657d4272 100644 (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;
 }
index ce6e7d1add96399ecdc02a2469b4a7f10d5aedc5..dfd7ee1ebb4bf5f030d1ea557c8cc7e6e87b7c67 100644 (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 */