summaryrefslogtreecommitdiff
path: root/manifest.c
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2014-05-14 21:33:33 +0200
committerJoel Rosdahl <joel@rosdahl.net>2014-05-14 21:33:33 +0200
commit44e4acb8b89a3d56d97bf4d6715dd2882bb414a7 (patch)
treecb30c6032ccc38787072074e90f8524234ba286b /manifest.c
parent20b782fb194a23341f835bac6870f5d815c5e43b (diff)
downloadccache-44e4acb8b89a3d56d97bf4d6715dd2882bb414a7.tar.gz
Fix clang build warning "shift count >= width of type"
Diffstat (limited to 'manifest.c')
-rw-r--r--manifest.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/manifest.c b/manifest.c
index 4a456f50..7977418b 100644
--- a/manifest.c
+++ b/manifest.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2010, 2012 Joel Rosdahl
+ * Copyright (C) 2009-2014 Joel Rosdahl
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -138,6 +138,16 @@ free_manifest(struct manifest *mf)
free(mf);
}
+#define READ_BYTE(var) \
+ do { \
+ int ch_; \
+ ch_ = gzgetc(f); \
+ if (ch_ == EOF) { \
+ goto error; \
+ } \
+ (var) = ch_ & 0xFF; \
+ } while (0)
+
#define READ_INT(size, var) \
do { \
int ch_; \
@@ -221,14 +231,14 @@ read_manifest(gzFile f)
free_manifest(mf);
return NULL;
}
- READ_INT(1, version);
+ READ_BYTE(version);
if (version != VERSION) {
cc_log("Manifest file has unknown version %u", version);
free_manifest(mf);
return NULL;
}
- READ_INT(1, mf->hash_size);
+ READ_BYTE(mf->hash_size);
if (mf->hash_size != 16) {
/* Temporary measure until we support different hash algorithms. */
cc_log("Manifest file has unsupported hash size %u", mf->hash_size);