From: Michael Vrable Date: Wed, 23 Sep 2009 01:38:30 +0000 (-0700) Subject: Make printf format specifiers 32/64-bit clean. X-Git-Url: https://git.vrable.net/?a=commitdiff_plain;h=92a6fa8cd45e12f70f65f9d9fc6d1cdd6592878a;p=bluesky.git Make printf format specifiers 32/64-bit clean. --- diff --git a/bluesky/bluesky.h b/bluesky/bluesky.h index 7419cd4..5524c44 100644 --- a/bluesky/bluesky.h +++ b/bluesky/bluesky.h @@ -10,6 +10,7 @@ #define _BLUESKY_H #include +#include #include #ifdef __cplusplus diff --git a/bluesky/dir.c b/bluesky/dir.c index 8520689..14eb6eb 100644 --- a/bluesky/dir.c +++ b/bluesky/dir.c @@ -7,6 +7,7 @@ */ #include +#include #include #include "bluesky.h" @@ -137,7 +138,8 @@ void bluesky_directory_dump(BlueSkyInode *dir) while (!g_sequence_iter_is_end(i)) { BlueSkyDirent *d = g_sequence_get(i); - g_print(" 0x%08x [inum=%lld] %s\n", d->cookie, d->inum, d->name); + g_print(" 0x%08x [inum=%"PRIu64"] %s\n", + d->cookie, d->inum, d->name); i = g_sequence_iter_next(i); } } diff --git a/bluesky/inode.c b/bluesky/inode.c index 59b915a..f3f3198 100644 --- a/bluesky/inode.c +++ b/bluesky/inode.c @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -81,7 +82,7 @@ void bluesky_inode_ref(BlueSkyInode *inode) void bluesky_inode_unref(BlueSkyInode *inode) { if (g_atomic_int_dec_and_test(&inode->refcount)) { - g_error("Reference count for inode %lld dropped to zero!\n", + g_error("Reference count for inode %"PRIu64" dropped to zero!\n", inode->inum); } } @@ -169,7 +170,7 @@ void bluesky_inode_flush(BlueSkyFS *fs, BlueSkyInode *inode) BlueSkyRCStr *data = bluesky_string_new(g_string_free(buf, FALSE), len); char key[64]; - sprintf(key, "inode-%016llx", inode->inum); + sprintf(key, "inode-%016"PRIx64, inode->inum); bluesky_store_put(fs->store, key, data); } @@ -178,7 +179,7 @@ void bluesky_inode_flush(BlueSkyFS *fs, BlueSkyInode *inode) void bluesky_inode_fetch(BlueSkyFS *fs, uint64_t inum) { char key[64]; - sprintf(key, "inode-%016llx", inum); + sprintf(key, "inode-%016"PRIx64, inum); BlueSkyRCStr *data = bluesky_store_get(fs->store, key); if (data == NULL) return; @@ -186,6 +187,6 @@ void bluesky_inode_fetch(BlueSkyFS *fs, uint64_t inum) BlueSkyInode *inode = bluesky_deserialize_inode(fs, data->data); if (inode != NULL) { bluesky_insert_inode(fs, inode); - g_print("Loaded inode %lld\n", (long long)inum); + g_print("Loaded inode %"PRIu64"\n", inum); } } diff --git a/bluesky/main.c b/bluesky/main.c index c02bc22..29ef60b 100644 --- a/bluesky/main.c +++ b/bluesky/main.c @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -21,7 +22,7 @@ int main(int argc, char *argv[]) printf("BlueSkyFS starting...\n"); - printf(" time = %lld\n", bluesky_get_current_time()); + printf(" time = %"PRIi64"\n", bluesky_get_current_time()); BlueSkyFS *fs = bluesky_new_fs("export"); diff --git a/bluesky/serialize.c b/bluesky/serialize.c index eaa9258..c806d88 100644 --- a/bluesky/serialize.c +++ b/bluesky/serialize.c @@ -7,6 +7,7 @@ */ #include +#include #include #include @@ -156,7 +157,7 @@ BlueSkyInode *bluesky_deserialize_inode(BlueSkyFS *fs, const gchar *buf) bluesky_dirent_compare, NULL); g_hash_table_insert(inode->dirhash, dirent->name, dirent); - g_print(" dirent[%08x]: %s -> %lld\n", + g_print(" dirent[%08x]: %s -> %"PRIu64"\n", dirent->cookie, dirent->name, dirent->inum); buf = strchr(d->name, '\0') + 1; diff --git a/nfs3/nfs3.c b/nfs3/nfs3.c index 004aed8..593d660 100644 --- a/nfs3/nfs3.c +++ b/nfs3/nfs3.c @@ -376,7 +376,7 @@ nfsproc3_create_3_svc(create3args *argp, struct svc_req *rqstp) file->nlink = 1; file->mode = 0755; int64_t time = bluesky_get_current_time(); - printf("time: %lld\n", time); + printf("time: %"PRIi64"\n", time); file->mtime = time; file->ctime = time; file->atime = time;