[coreboot-gerrit] New patch to review for coreboot: 292e356 util/cbfstool: Use `%zu` instead of `%ld` for size_t arguments

Paul Menzel (paulepanter@users.sourceforge.net) gerrit at coreboot.org
Sun Mar 16 00:54:05 CET 2014


Paul Menzel (paulepanter at users.sourceforge.net) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5388

-gerrit

commit 292e356dc139615fbd6b9fad7050abc5cb18f6ae
Author: Paul Menzel <paulepanter at users.sourceforge.net>
Date:   Sun Mar 16 00:15:57 2014 +0100

    util/cbfstool: Use `%zu` instead of `%ld` for size_t arguments
    
    Since commit aa2f739a (cbfs: fix issues with word size and endianness.) [1]
    cbfstool cannot be built anymore under 32-bit platforms.
    
    	error: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘size_t’
    
    For arguments of size_t the conversion specifier `%zu` should to be used
    instead of `%ld` as sizes are non-negative.
    
    [1] http://review.coreboot.org/4817
    
    Change-Id: Id84a20fbf237376a31f7e4816bd139463800c977
    Signed-off-by: Paul Menzel <paulepanter at users.sourceforge.net>
---
 util/cbfstool/cbfs-mkstage.c | 2 +-
 util/cbfstool/elfheaders.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/util/cbfstool/cbfs-mkstage.c b/util/cbfstool/cbfs-mkstage.c
index 6aa3746..eadc775 100644
--- a/util/cbfstool/cbfs-mkstage.c
+++ b/util/cbfstool/cbfs-mkstage.c
@@ -132,7 +132,7 @@ int parse_elf_to_stage(const struct buffer *input, struct buffer *output,
 			continue;
 		if (input->size < (phdr[i].p_offset + phdr[i].p_filesz)){
 			ERROR("Underflow copying out the segment."
-			      "File has %ld bytes left, segment end is %ld\n",
+			      "File has %zd bytes left, segment end is %zd\n",
 			      input->size, phdr[i].p_offset + phdr[i].p_filesz);
 			return -1;
 		}
diff --git a/util/cbfstool/elfheaders.c b/util/cbfstool/elfheaders.c
index f3ed05c..816278f 100644
--- a/util/cbfstool/elfheaders.c
+++ b/util/cbfstool/elfheaders.c
@@ -147,7 +147,7 @@ check_size(const struct buffer *b, size_t offset, size_t size, const char *desc)
 
 	if (offset >= buffer_size(b) || (offset + size) > buffer_size(b)) {
 		ERROR("The file is not large enough for the '%s'. "
-		      "%ld bytes @ offset %zu, input %zu bytes.\n",
+		      "%zu bytes @ offset %zu, input %zu bytes.\n",
 		      desc, size, offset, buffer_size(b));
 		return -1;
 	}



More information about the coreboot-gerrit mailing list