]> git.sommitrealweird.co.uk Git - onak.git/commitdiff
Clean up remaining uses of %llX for printing keyids
authorJonathan McDowell <noodles@earth.li>
Wed, 16 Mar 2011 04:15:22 +0000 (21:15 -0700)
committerJonathan McDowell <noodles@earth.li>
Wed, 16 Mar 2011 04:15:22 +0000 (21:15 -0700)
  It should be PRIX64 to ensure we use the right format for both 32 and
  64 bit platforms.

keyd.c
keydb.c
keydb_dynamic.c
keydb_file.c
keydb_fs.c
keydb_pg.c
lookup.c

diff --git a/keyd.c b/keyd.c
index c802264fb332882ef523173a5ddd8c9a12da6270..eab3b5495b951ecbe52b023829975b9b4e61a294 100644 (file)
--- a/keyd.c
+++ b/keyd.c
@@ -69,7 +69,7 @@ void iteratefunc(void *ctx, struct openpgp_publickey *key)
                storebuf.buffer = malloc(8192);
 
                logthing(LOGTHING_TRACE,
-                               "Iterating over 0x%016llX.",
+                               "Iterating over 0x%016" PRIX64 ".",
                                get_keyid(key));
 
                flatten_publickey(key,
@@ -164,7 +164,8 @@ int sock_do(int fd)
                        storebuf.offset = 0;
                        if (ret == 0) {
                                logthing(LOGTHING_INFO,
-                                               "Fetching 0x%llX, result: %d",
+                                               "Fetching 0x%" PRIX64
+                                               ", result: %d",
                                                keyid,
                                                config.dbbackend->
                                                fetch_key(keyid, &key, false));
@@ -294,7 +295,8 @@ int sock_do(int fd)
                        }
                        if (ret == 0) {
                                logthing(LOGTHING_INFO,
-                                               "Deleting 0x%llX, result: %d",
+                                               "Deleting 0x%" PRIX64
+                                               ", result: %d",
                                                keyid,
                                                config.dbbackend->delete_key(
                                                        keyid, false));
diff --git a/keydb.c b/keydb.c
index 42eebfe3a34c8b1e0ee4bc0c6b1c9ed9bafa0914..4dc9332ad3690bbee67c1dfa6b7f39ada55f7910 100644 (file)
--- a/keydb.c
+++ b/keydb.c
@@ -185,7 +185,7 @@ int generic_update_keys(struct openpgp_publickey **keys, bool sendsync)
        for (curkey = *keys; curkey != NULL; curkey = curkey->next) {
                intrans = config.dbbackend->starttrans();
                logthing(LOGTHING_INFO,
-                       "Fetching key 0x%llX, result: %d",
+                       "Fetching key 0x%" PRIX64 ", result: %d",
                        get_keyid(curkey),
                        config.dbbackend->fetch_key(get_keyid(curkey), &oldkey,
                                        intrans));
index e22b00db30156e084505a3ec9a748a45c0c910e7..ba7792f20302a756d3bcd98c4d28107f87e0472e 100644 (file)
@@ -428,7 +428,7 @@ static int dynamic_update_keys(struct openpgp_publickey **keys, bool sendsync)
        for (curkey = *keys; curkey != NULL; curkey = curkey->next) {
                intrans = dynamic_starttrans();
                logthing(LOGTHING_INFO,
-                       "Fetching key 0x%llX, result: %d",
+                       "Fetching key 0x%" PRIX64 ", result: %d",
                        get_keyid(curkey),
                        dynamic_fetch_key(get_keyid(curkey), &oldkey, intrans));
 
index 88bb6803bad50907ceeee29b80d9dcb6d8afaacb..e99c26898af3385f2237fe7a86e613b850814846 100644 (file)
@@ -83,7 +83,7 @@ static int file_fetch_key(uint64_t keyid, struct openpgp_publickey **publickey,
        char keyfile[1024];
        int fd = -1;
 
-       snprintf(keyfile, 1023, "%s/0x%llX", config.db_dir,
+       snprintf(keyfile, 1023, "%s/0x%" PRIX64, config.db_dir,
                        keyid & 0xFFFFFFFF);
        fd = open(keyfile, O_RDONLY); // | O_SHLOCK);
 
@@ -118,7 +118,7 @@ static int file_store_key(struct openpgp_publickey *publickey, bool intrans,
        char keyfile[1024];
        int fd = -1;
 
-       snprintf(keyfile, 1023, "%s/0x%llX", config.db_dir,
+       snprintf(keyfile, 1023, "%s/0x%" PRIX64, config.db_dir,
                        get_keyid(publickey) & 0xFFFFFFFF);
        fd = open(keyfile, O_WRONLY | O_CREAT, 0664); // | O_EXLOCK);
 
@@ -149,7 +149,7 @@ static int file_delete_key(uint64_t keyid, bool intrans)
 {
        char keyfile[1024];
 
-       snprintf(keyfile, 1023, "%s/0x%llX", config.db_dir,
+       snprintf(keyfile, 1023, "%s/0x%" PRIX64, config.db_dir,
                        keyid & 0xFFFFFFFF);
 
        return unlink(keyfile);
index bc3c890e6ae75a318e07a1a44e7c6c33d7e5bd54..0dc9de5b2c819296d0ffc8f977ff79e8f018a011 100644 (file)
@@ -57,7 +57,7 @@ static uint32_t calchash(uint8_t * ptr)
 static void keypath(char *buffer, uint64_t _keyid)
 {
        uint64_t keyid = _keyid << 32;
-       snprintf(buffer, PATH_MAX, "%s/key/%02X/%02X/%08X/%016llX",
+       snprintf(buffer, PATH_MAX, "%s/key/%02X/%02X/%08X/%016" PRIX64,
                 config.db_dir, (uint8_t) ((keyid >> 56) & 0xFF),
                 (uint8_t) ((keyid >> 48) & 0xFF),
                 (uint32_t) (keyid >> 32), _keyid);
@@ -95,7 +95,7 @@ static void prove_path_to(uint64_t keyid, char *what)
 
 static void wordpath(char *buffer, char *word, uint32_t hash, uint64_t keyid)
 {
-       snprintf(buffer, PATH_MAX, "%s/words/%02X/%02X/%08X/%s/%016llX",
+       snprintf(buffer, PATH_MAX, "%s/words/%02X/%02X/%08X/%s/%016" PRIX64,
                 config.db_dir, (uint8_t) ((hash >> 24) & 0xFF),
                 (uint8_t) ((hash >> 16) & 0xFF), hash, word, keyid);
 }
@@ -109,7 +109,7 @@ static void worddir(char *buffer, char *word, uint32_t hash)
 
 static void subkeypath(char *buffer, uint64_t subkey, uint64_t keyid)
 {
-       snprintf(buffer, PATH_MAX, "%s/subkeys/%02X/%02X/%08X/%016llX",
+       snprintf(buffer, PATH_MAX, "%s/subkeys/%02X/%02X/%08X/%016" PRIX64,
                 config.db_dir,
                 (uint8_t) ((subkey >> 24) & 0xFF),
                 (uint8_t) ((subkey >> 16) & 0xFF),
@@ -346,11 +346,11 @@ static int fs_delete_key(uint64_t keyid, bool intrans)
        ret = fetch_key(keyid, &pk, true);
 
        if (ret) {
-               logthing(LOGTHING_DEBUG, "Wordlist for key %016llX",
+               logthing(LOGTHING_DEBUG, "Wordlist for key %016" PRIX64,
                         keyid);
                wl = wordlist = makewordlistfromkey(wordlist, pk);
                logthing(LOGTHING_DEBUG,
-                        "Wordlist for key %016llX done", keyid);
+                        "Wordlist for key %016" PRIX64 " done", keyid);
                while (wl) {
                        uint32_t hash = calchash((uint8_t *) (wl->object));
                        prove_path_to(hash, "words");
index 85ea50060b5b12a58cad35badabb066d9d9043a8..6b5d32055f82f426484164c86ce1fab846542062 100644 (file)
@@ -150,12 +150,13 @@ static int pg_fetch_key(uint64_t keyid, struct openpgp_publickey **publickey,
        
        if (keyid > 0xFFFFFFFF) {
                snprintf(statement, 1023,
-                       "SELECT keydata FROM onak_keys WHERE keyid = '%llX'",
+                       "SELECT keydata FROM onak_keys WHERE keyid = '%"
+                       PRIX64 "'",
                        keyid);
        } else {
                snprintf(statement, 1023,
                        "SELECT keydata FROM onak_keys WHERE keyid "
-                       "LIKE '%%%llX'",
+                       "LIKE '%%%" PRIX64 "'",
                        keyid);
        }
        result = PQexec(dbconn, statement);
@@ -282,7 +283,8 @@ static int pg_delete_key(uint64_t keyid, bool intrans)
        }
        
        snprintf(statement, 1023,
-                       "SELECT keydata FROM onak_keys WHERE keyid = '%llX'",
+                       "SELECT keydata FROM onak_keys WHERE keyid = '%"
+                       PRIX64 "'",
                        keyid);
        result = PQexec(dbconn, statement);
 
@@ -298,24 +300,25 @@ static int pg_delete_key(uint64_t keyid, bool intrans)
                PQclear(result);
 
                snprintf(statement, 1023,
-                       "DELETE FROM onak_keys WHERE keyid = '%llX'",
+                       "DELETE FROM onak_keys WHERE keyid = '%" PRIX64 "'",
                        keyid);
                result = PQexec(dbconn, statement);
                PQclear(result);
 
                snprintf(statement, 1023,
-                       "DELETE FROM onak_sigs WHERE signee = '%llX'",
+                       "DELETE FROM onak_sigs WHERE signee = '%" PRIX64 "'",
                        keyid);
                result = PQexec(dbconn, statement);
                PQclear(result);
 
                snprintf(statement, 1023,
-                       "DELETE FROM onak_uids WHERE keyid = '%llX'",
+                       "DELETE FROM onak_uids WHERE keyid = '%" PRIX64 "'",
                        keyid);
                result = PQexec(dbconn, statement);
        } else if (PQresultStatus(result) != PGRES_TUPLES_OK) {
                logthing(LOGTHING_ERROR,
-                               "Problem retrieving key (%llX) from DB.",
+                               "Problem retrieving key (%" PRIX64
+                               ") from DB.",
                                keyid);
        }
 
@@ -391,7 +394,7 @@ static int pg_store_key(struct openpgp_publickey *publickey, bool intrans,
 
        snprintf(statement, 1023, 
                        "INSERT INTO onak_keys (keyid, keydata) VALUES "
-                       "('%llX', '%d')", 
+                       "('%" PRIX64 "', '%d')", 
                        get_keyid(publickey),
                        key_oid);
        result = PQexec(dbconn, statement);
@@ -414,7 +417,7 @@ static int pg_store_key(struct openpgp_publickey *publickey, bool intrans,
                                snprintf(statement, 1023,
                                        "INSERT INTO onak_uids "
                                        "(keyid, uid, pri) "
-                                       "VALUES ('%llX', '%s', '%c')",
+                                       "VALUES ('%" PRIX64 "', '%s', '%c')",
                                        get_keyid(publickey),
                                        safeuid,
                                        (uids[i] == primary) ? 't' : 'f');
@@ -448,7 +451,7 @@ static int pg_store_key(struct openpgp_publickey *publickey, bool intrans,
                                packets = packets->next) {
                        snprintf(statement, 1023,
                                "INSERT INTO onak_sigs (signer, signee) "
-                               "VALUES ('%llX', '%llX')",
+                               "VALUES ('%" PRIX64 "', '%" PRIX64 "')",
                                sig_keyid(packets->packet),
                                get_keyid(publickey));
                        result = PQexec(dbconn, statement);
@@ -475,7 +478,8 @@ static char *pg_keyid2uid(uint64_t keyid)
        char *uid = NULL;
 
        snprintf(statement, 1023,
-               "SELECT uid FROM onak_uids WHERE keyid = '%llX' AND pri = 't'",
+               "SELECT uid FROM onak_uids WHERE keyid = '%" PRIX64
+               "' AND pri = 't'",
                keyid);
        result = PQexec(dbconn, statement);
 
@@ -491,7 +495,8 @@ static char *pg_keyid2uid(uint64_t keyid)
                uid = strdup(PQgetvalue(result, 0, 0));
        } else if (PQresultStatus(result) != PGRES_TUPLES_OK) {
                logthing(LOGTHING_ERROR,
-                               "Problem retrieving key (%llX) from DB.",
+                               "Problem retrieving key (%" PRIX64
+                               ") from DB.",
                                keyid);
        }
 
@@ -525,7 +530,8 @@ static struct ll *pg_getkeysigs(uint64_t keyid, bool *revoked)
        }
 
        snprintf(statement, 1023,
-               "SELECT DISTINCT signer FROM onak_sigs WHERE signee = '%llX'",
+               "SELECT DISTINCT signer FROM onak_sigs WHERE signee = '%"
+               PRIX64 "'",
                keyid);
        result = PQexec(dbconn, statement);
 
index e670d498f0a38189d9fb347254f3a6d1f5fa5023..fafef123e6b37566bcc86dad4946a71374857d7d 100644 (file)
--- a/lookup.c
+++ b/lookup.c
@@ -165,7 +165,7 @@ int main(int argc, char *argv[])
                case OP_GET:
                        if (ishex) {
                                logthing(LOGTHING_NOTICE, 
-                                       "Getting keyid 0x%llX",
+                                       "Getting keyid 0x%" PRIX64,
                                        keyid);
                                result = config.dbbackend->fetch_key(keyid,
                                        &publickey, false);