summaryrefslogtreecommitdiffstats
path: root/util/cbfstool/common.c
diff options
context:
space:
mode:
authorSol Boucher <solb@chromium.org>2015-03-05 15:38:03 -0800
committerPatrick Georgi <pgeorgi@google.com>2015-04-25 12:14:25 +0200
commit0e53931fee0178c4f4ac4e2e6b355b103b5e8c42 (patch)
treef38674ea0f24986093c5852115966fa27db2130a /util/cbfstool/common.c
parentc13ad6c6df709fda1d70743a860a406643620b9e (diff)
downloadcoreboot-0e53931fee0178c4f4ac4e2e6b355b103b5e8c42.tar.gz
coreboot-0e53931fee0178c4f4ac4e2e6b355b103b5e8c42.tar.bz2
coreboot-0e53931fee0178c4f4ac4e2e6b355b103b5e8c42.zip
cbfstool: Clean up in preparation for adding new files
This enables more warnings on the cbfstool codebase and fixes the issues that surface as a result. A memory leak that used to occur when compressing files with lzma is also found and fixed. Finally, there are several fixes for the Makefile: - Its autodependencies used to be broken because the target for the .dependencies file was misnamed; this meant that Make didn't know how to rebuild the file, and so would silently skip the step of updating it before including it. - The ability to build to a custom output directory by defining the obj variable had bitrotted. - The default value of the obj variable was causing implicit rules not to apply when specifying a file as a target without providing a custom value for obj. - Add a distclean target for removing the .dependencies file. BUG=chromium:461875 TEST=Build an image with cbfstool both before and after. BRANCH=None Change-Id: I951919d63443f2b053c2e67c1ac9872abc0a43ca Signed-off-by: Sol Boucher <solb@chromium.org> Original-Commit-Id: 49293443b4e565ca48d284e9a66f80c9c213975d Original-Change-Id: Ia7350c2c3306905984cfa711d5fc4631f0b43d5b Original-Signed-off-by: Sol Boucher <solb@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/257340 Original-Reviewed-by: Julius Werner <jwerner@chromium.org> Original-Reviewed-by: Stefan Reinauer <reinauer@chromium.org> Reviewed-on: http://review.coreboot.org/9937 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'util/cbfstool/common.c')
-rw-r--r--util/cbfstool/common.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/util/cbfstool/common.c b/util/cbfstool/common.c
index 9923ca344e9c..e8c2ccc45663 100644
--- a/util/cbfstool/common.c
+++ b/util/cbfstool/common.c
@@ -22,6 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <strings.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -36,7 +37,7 @@ int verbose = 0;
int is_big_endian(void)
{
static const uint32_t inttest = 0x12345678;
- uint8_t inttest_lsb = *(uint8_t *)&inttest;
+ const uint8_t inttest_lsb = *(const uint8_t *)&inttest;
if (inttest_lsb == 0x12) {
return 1;
}
@@ -73,7 +74,7 @@ int buffer_from_file(struct buffer *buffer, const char *filename)
return -1;
}
buffer->size = get_file_size(fp);
- if (buffer->size == -1) {
+ if (buffer->size == -1u) {
fprintf(stderr, "could not determine size of %s\n", filename);
fclose(fp);
return -1;