diff options
author | Rosen Penev <rosenp@gmail.com> | 2017-11-23 13:18:07 -0800 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2017-12-08 10:40:20 +0100 |
commit | d6e34b735201805ae9112a7997f15b80f5926942 (patch) | |
tree | 5ee9c544ae655c360efcef12c33b5f3f79b78981 /tools/sstrip | |
parent | 01c5cf0b24edae55a9df18296e2ed488d2b2ba0b (diff) | |
download | mtk-20170518-d6e34b735201805ae9112a7997f15b80f5926942.zip mtk-20170518-d6e34b735201805ae9112a7997f15b80f5926942.tar.gz mtk-20170518-d6e34b735201805ae9112a7997f15b80f5926942.tar.bz2 |
tools/sstrip: Fix compile under standard linux.
bswap32 undefined is the issue. Added the proper header. Also fixed a few format/conversion warnings that clang complained about without -Wall or -Wextra.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'tools/sstrip')
-rw-r--r-- | tools/sstrip/src/sstrip.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/sstrip/src/sstrip.c b/tools/sstrip/src/sstrip.c index 0508aaa..12cf12e 100644 --- a/tools/sstrip/src/sstrip.c +++ b/tools/sstrip/src/sstrip.c @@ -59,6 +59,7 @@ #include <unistd.h> #include <fcntl.h> #include <elf.h> +#include <byteswap.h> #ifndef TRUE #define TRUE 1 @@ -103,7 +104,7 @@ static int do_reverse_endian; } else if (sizeof(X) == 8) { \ __res = bswap_64((X)); \ } else { \ - fprintf(stderr, "%s: %s: EGET failed for size %d\n", \ + fprintf(stderr, "%s: %s: EGET failed for size %zu\n", \ progname, filename, sizeof(X)); \ exit(EXIT_FAILURE); \ } \ @@ -124,7 +125,7 @@ static int do_reverse_endian; } else if (sizeof(Y) == 8) { \ Y = bswap_64((uint64_t)(X)); \ } else { \ - fprintf(stderr, "%s: %s: ESET failed for size %d\n", \ + fprintf(stderr, "%s: %s: ESET failed for size %zu\n", \ progname, filename, sizeof(Y)); \ exit(EXIT_FAILURE); \ } while (0) @@ -197,7 +198,7 @@ static int getmemorysize ## CLASS (Elf ## CLASS ## _Ehdr const *ehdr, \ { \ Elf ## CLASS ## _Phdr const *phdr; \ unsigned long size, n; \ - int i; \ + size_t i; \ \ /* Start by setting the size to include the ELF header and the \ * complete program segment header table. \ @@ -230,7 +231,7 @@ static int modifyheaders ## CLASS (Elf ## CLASS ## _Ehdr *ehdr, \ unsigned long newsize) \ { \ Elf ## CLASS ## _Phdr *phdr; \ - int i; \ + size_t i; \ \ /* If the section header table is gone, then remove all references \ * to it in the ELF header. \ |