From: Jonathan McDowell Date: Sat, 7 Jun 2008 11:48:56 +0000 (+0100) Subject: Change to using PRIx64 rather than llX for outputting keyids. X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/commitdiff_plain/1921fa44cfae203ae40e853ee9ecedb206fa9413?ds=inline Change to using PRIx64 rather than llX for outputting keyids. C99 defines PRIx64 which is set appropriate depending on 32/64 bit, so use that rather than llX, which is only ok for 32 bit. --- diff --git a/gpgwww.c b/gpgwww.c index 984aab4..10b3806 100644 --- a/gpgwww.c +++ b/gpgwww.c @@ -154,13 +154,15 @@ int main(int argc, char *argv[]) } if (op != OP_GET) { - printf("

Looking for path from 0x%llX to 0x%llX.\n", + printf("

Looking for path from 0x%" PRIx64" to 0x%" PRIx64 + ".\n", from, to); - printf("" - "Find reverse path\n", + printf("Find reverse path\n", to, from); - printf("" + printf("" "Get all keys listed

\n", from, to); @@ -171,7 +173,8 @@ int main(int argc, char *argv[]) catchsignals(); config.dbbackend->initdb(true); inithash(); - logthing(LOGTHING_NOTICE, "Looking for path from 0x%llX to 0x%llX.", + logthing(LOGTHING_NOTICE, "Looking for path from 0x%" PRIx64 " to 0x%" + PRIx64, from, to); if (op == OP_GET) { diff --git a/keyindex.c b/keyindex.c index a4cc90b..e4649ba 100644 --- a/keyindex.c +++ b/keyindex.c @@ -41,21 +41,22 @@ int list_sigs(struct openpgp_packet_list *sigs, bool html) } if (html && uid != NULL) { printf("%s %08llX " - "" - "%s\n", + "search=%016" PRIx64 "\">%08" PRIx64 + " " + "%s\n", sig, sigid, sigid & 0xFFFFFFFF, sigid, txt2html(uid)); } else if (html && uid == NULL) { - printf("%s %08llX " + printf("%s %08" PRIx64 " " "[User id not found]\n", sig, sigid & 0xFFFFFFFF); } else { - printf("%s %08llX" + printf("%s %08" PRIx64 " %s\n", sig, sigid & 0xFFFFFFFF, @@ -88,9 +89,11 @@ int list_uids(uint64_t keyid, struct openpgp_signedpacket_list *uids, } else if (uids->packet->tag == 17) { printf(" "); if (html) { - printf("\"[photo\n", - keyid, - imgindx); + printf("\"[photo" + "\n", + keyid, + imgindx); imgindx++; } else { printf("[photo id]\n"); @@ -236,7 +239,8 @@ int key_index(struct openpgp_publickey *keys, bool verbose, bool fingerprint, if (html) { printf("pub %5d%c/%08llX %04d/%02d/%02d ", + "search=%016" PRIx64 "\">%08" PRIx64 + " %04d/%02d/%02d ", length, (type == 1) ? 'R' : ((type == 16) ? 'g' : ((type == 17) ? 'D' : '?')), @@ -246,7 +250,7 @@ int key_index(struct openpgp_publickey *keys, bool verbose, bool fingerprint, created->tm_mon + 1, created->tm_mday); } else { - printf("pub %5d%c/%08llX %04d/%02d/%02d ", + printf("pub %5d%c/%08" PRIx64 " %04d/%02d/%02d ", length, (type == 1) ? 'R' : ((type == 16) ? 'g' : ((type == 17) ? 'D' : '?')), @@ -263,7 +267,7 @@ int key_index(struct openpgp_publickey *keys, bool verbose, bool fingerprint, curuid->packet->data); if (html) { printf("", + "search=0x%016" PRIx64 "\">", keyid); } printf("%s%s%s\n", @@ -328,7 +332,7 @@ int mrkey_index(struct openpgp_publickey *keys) switch (keys->publickey->data[0]) { case 2: case 3: - printf("%016llX", get_keyid(keys)); + printf("%016" PRIx64, get_keyid(keys)); type = keys->publickey->data[7]; length = (keys->publickey->data[8] << 8) + keys->publickey->data[9]; diff --git a/maxpath.c b/maxpath.c index b9ba53a..4d65588 100644 --- a/maxpath.c +++ b/maxpath.c @@ -52,8 +52,9 @@ void findmaxpath(unsigned long max) from = (struct stats_key *)curkey->object; to = tmp; distance = to->colour; - printf("Current max path (#%ld) is from %llX" - " to %llX (%ld steps)\n", + printf("Current max path (#%ld) is from %" + PRIx64 " to %" PRIx64 + " (%ld steps)\n", loop, from->keyid, to->keyid, @@ -62,7 +63,7 @@ void findmaxpath(unsigned long max) curkey=curkey->next; } } - printf("Max path is from %llX to %llX (%ld steps)\n", + printf("Max path is from %" PRIx64 " to %" PRIx64 " (%ld steps)\n", from->keyid, to->keyid, distance); diff --git a/parsekey.c b/parsekey.c index 6e080af..a0c0311 100644 --- a/parsekey.c +++ b/parsekey.c @@ -148,7 +148,7 @@ int parse_keys(struct openpgp_packet_list *packets, */ int debug_packet(struct openpgp_packet *packet) { - printf("\tNew format: %d, Tag: %u, Length: %d\n", + printf("\tNew format: %d, Tag: %u, Length: %zd\n", packet->newformat, packet->tag, packet->length); diff --git a/sixdegrees.c b/sixdegrees.c index d4e55c1..e346cf1 100644 --- a/sixdegrees.c +++ b/sixdegrees.c @@ -86,12 +86,12 @@ void sixdegrees(uint64_t keyid) config.dbbackend->cached_getkeysigs(keyid); if ((keyinfo = findinhash(keyid)) == NULL) { - printf("Couldn't find key 0x%llX.\n", keyid); + printf("Couldn't find key 0x%" PRIx64 ".\n", keyid); return; } uid = config.dbbackend->keyid2uid(keyinfo->keyid); - printf("Six degrees for 0x%llX (%s):\n", keyinfo->keyid, uid); + printf("Six degrees for 0x%" PRIx64 " (%s):\n", keyinfo->keyid, uid); free(uid); uid = NULL; diff --git a/stats.c b/stats.c index ca7c929..bf85da6 100644 --- a/stats.c +++ b/stats.c @@ -139,11 +139,11 @@ void dofindpath(uint64_t have, uint64_t want, bool html, int count) (void) config.dbbackend->cached_getkeysigs(fullwant); if ((keyinfoa = findinhash(fullhave)) == NULL) { - printf("Couldn't find key 0x%llX.\n", have); + printf("Couldn't find key 0x%" PRIx64 ".\n", have); return; } if ((keyinfob = findinhash(fullwant)) == NULL) { - printf("Couldn't find key 0x%llX.\n", want); + printf("Couldn't find key 0x%" PRIx64 ".\n", want); return; } @@ -164,8 +164,8 @@ void dofindpath(uint64_t have, uint64_t want, bool html, int count) html ? "
" : ""); if (keyinfoa->colour == 0) { if (pathnum == 0) { - printf("Can't find a link from 0x%08llX to " - "0x%08llX%s\n", + printf("Can't find a link from 0x%08" PRIx64 + " to 0x%08" PRIx64 "%s\n", have, want, html ? "
" : ""); @@ -175,7 +175,8 @@ void dofindpath(uint64_t have, uint64_t want, bool html, int count) } pathnum = count; } else { - printf("%d steps from 0x%08llX to 0x%08llX%s\n", + printf("%d steps from 0x%08" PRIx64 " to 0x%08" PRIx64 + "%s\n", keyinfoa->colour, have & 0xFFFFFFFF, want & 0xFFFFFFFF, html ? "
" : ""); @@ -185,7 +186,8 @@ void dofindpath(uint64_t have, uint64_t want, bool html, int count) curkey->keyid); if (html && uid == NULL) { printf("
0x%08llX ([" + "0x%08" PRIx64 "\">0x%08" PRIx64 + " ([" "User id not found])%s
\n", curkey->keyid & 0xFFFFFFFF, curkey->keyid & 0xFFFFFFFF, @@ -193,9 +195,11 @@ void dofindpath(uint64_t have, uint64_t want, bool html, int count) "" : " signs"); } else if (html && uid != NULL) { printf("0x%08llX" + "0x%08" PRIx64 "\">0x%08" + PRIx64 "" " (%s)%s" + "search=0x%08" PRIx64 + "\">%s)%s" "
\n", curkey->keyid & 0xFFFFFFFF, curkey->keyid & 0xFFFFFFFF, @@ -204,7 +208,7 @@ void dofindpath(uint64_t have, uint64_t want, bool html, int count) (curkey->keyid == fullwant) ? "" : " signs"); } else { - printf("0x%08llX (%s)%s\n", + printf("0x%08" PRIx64 " (%s)%s\n", curkey->keyid & 0xFFFFFFFF, (uid == NULL) ? "[User id not found]" : @@ -228,7 +232,8 @@ void dofindpath(uint64_t have, uint64_t want, bool html, int count) } curkey = keyinfoa; while (curkey != NULL && curkey->keyid != 0) { - printf("0x%08llX ", curkey->keyid & 0xFFFFFFFF); + printf("0x%08" PRIx64 " ", + curkey->keyid & 0xFFFFFFFF); curkey = findinhash(curkey->parent); } putchar('\n');