Cosmetic cbfstool update (trivial)
authorStefan Reinauer <stepan@coresystems.de>
Tue, 26 May 2009 12:22:10 +0000 (12:22 +0000)
committerStefan Reinauer <stepan@openbios.org>
Tue, 26 May 2009 12:22:10 +0000 (12:22 +0000)
* remove some dead code
* fix indentation
* comment in some destructors and fix some other warnings
* use HOSTCC instead of CC (not all the way cosmetic, but very simple)

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4299 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

util/cbfstool/Makefile
util/cbfstool/resize.c
util/cbfstool/tools/Makefile
util/cbfstool/tools/cbfs-mkstage.c
util/cbfstool/tools/lzma/C/7zip/Compress/LZ/IMatchFinder.h
util/cbfstool/tools/lzma/C/Common/MyWindows.h
util/cbfstool/tools/lzma/minilzma.cc

index a779eab1265ba79bc53d8f2f301051d4d7a8b3c0..50f97961bcf8d513d0f5e95472d13c4a0ce4cd3e 100644 (file)
@@ -8,7 +8,9 @@ COMMANDS=create.o bootblock.o delete.o extract.o add.o print.o resize.o
 OBJ=$(COMMANDS) cbfstool.o util.o fs.o
 INC=cbfstool.h cbfs.h
 
-CC=gcc
+HOSTCC ?= gcc
+HOSTCXX ?= g++
+
 CFLAGS=-g -Wall -W -Werror
 
 DESTDIR ?= /usr/local/bin
@@ -16,7 +18,7 @@ DESTDIR ?= /usr/local/bin
 all: $(obj)/cbfstool $(obj)/tools/cbfs-mkpayload $(obj)/tools/cbfs-mkstage
 
 $(obj)/cbfstool: $(patsubst %,$(obj)/%,$(OBJ))
-       $(CC) -o $@ $(patsubst %,$(obj)/%,$(OBJ))
+       $(HOSTCC) -o $@ $(patsubst %,$(obj)/%,$(OBJ))
 
 tobj = $(obj)/tools
 tsrc = $(shell pwd)/tools
@@ -24,7 +26,7 @@ tsrc = $(shell pwd)/tools
 include $(tsrc)/Makefile
 
 $(obj)/%.o: %.c $(INC)
-       $(CC) $(CFLAGS) -c -o $@ $<
+       $(HOSTCC) $(CFLAGS) -c -o $@ $<
 
 install: $(obj)/cbfstool $(obj)/tools/cbfs-mkpayload $(obj)/tools/cbfs-mkstage
        @ install -d $(DESTDIR)
index d70c6d04efab2021d577c944db8d30513628ee65..ef3267f392d9578a03f7fc444c4eaea0e827ee89 100644 (file)
@@ -95,7 +95,6 @@ int resize_handler(struct rom *rom, int argc, char **argv)
                /* The first entry doesn't have to move */
 
                c = rom_find(rom, rom->header->offset);
-               offset = rom->header->offset;
 
                while (c) {
                        struct cbfs_file *n = rom_find_next(rom, c);
@@ -105,10 +104,8 @@ int resize_handler(struct rom *rom, int argc, char **argv)
                                break;
 
                        /* Calculate a new location for the entry */
-                       next =
-                           ROM_OFFSET(rom,
-                                      c) + ALIGN(ntohl(c->offset) +
-                                                 ntohl(c->len), align);
+                       next = ROM_OFFSET(rom, c) + 
+                               ALIGN(ntohl(c->offset) + ntohl(c->len), align);
 
                        /* Copy the next entry there */
                        memmove(ROM_PTR(rom, next), n,
@@ -116,8 +113,10 @@ int resize_handler(struct rom *rom, int argc, char **argv)
 
                        c = (struct cbfs_file *)ROM_PTR(rom, next);
 
-                       /* If the previous header wasn't overwritten by the change,
-                          corrupt the header so we don't accidently find it */
+                       /* If the previous header wasn't overwritten by 
+                        * the change, corrupt the header so we don't 
+                        * accidently find it
+                        */
 
                        if (ROM_OFFSET(rom, n) >
                            next + ntohl(c->len) + ntohl(c->offset))
index 65ba375fc3703e9a5b59b9fc7542e19fdfad07c1..e750c21bd78bc5305b3835103c04f1ebe72bc46e 100644 (file)
@@ -12,13 +12,13 @@ include $(tsrc)/lzma/Makefile
 COMMON = common.o compress.o $(LZMA_OBJ)
 
 $(tobj)/cbfs-mkstage: $(tobj)/cbfs-mkstage.o $(patsubst %,$(tobj)/%,$(COMMON))
-       $(CXX) $(CFLAGS) -o $@ $^
+       $(HOSTCXX) $(CFLAGS) -o $@ $^
 
 $(tobj)/cbfs-mkpayload: $(tobj)/cbfs-mkpayload.o $(patsubst %,$(tobj)/%,$(COMMON))
-       $(CXX) $(CFLAGS) -o $@ $^
+       $(HOSTCXX) $(CFLAGS) -o $@ $^
 
 $(tobj)/%.o: %.c
-       $(CC) $(CFLAGS) -c -o $@ $<
+       $(HOSTCC) $(CFLAGS) -c -o $@ $<
 
 tools-clean:
        rm -f $(tobj)/cbfs-mkpayload.o $(tobj)/cbfs-mkstage.o $(patsubst %,$(tobj)/%,$(COMMON))
index 0c472da517da94e6b40e4af2add5138c0be05484..b758851f2c2c5d0b7dc492cc305cffd847d2f777 100644 (file)
@@ -34,7 +34,6 @@ int parse_elf(unsigned char *input, unsigned char **output,
 {
        Elf32_Phdr *phdr;
        Elf32_Ehdr *ehdr = (Elf32_Ehdr *) input;
-       Elf32_Shdr *shdr;
        char *header, *buffer;
        unsigned char *out;
 
@@ -47,7 +46,6 @@ int parse_elf(unsigned char *input, unsigned char **output,
        header = (char *)ehdr;
 
        phdr = (Elf32_Phdr *) & (header[ehdr->e_phoff]);
-       shdr = (Elf32_Shdr *) & (header[ehdr->e_shoff]);
 
        /* Now, regular headers - we only care about PT_LOAD headers,
         * because thats what we're actually going to load
index 9459f210d8ee065d8460b2d3e2d563e3cfa04621..8b8480b2d2dde3db396f04844c6817042d9a1558 100644 (file)
@@ -26,7 +26,7 @@ struct IMatchFinder: public IInWindowStream
 
 struct IMatchFinderSetNumPasses
 {
-  //virtual ~IMatchFinderSetNumPasses(){}
+  virtual ~IMatchFinderSetNumPasses(){}
   virtual void SetNumPasses(UInt32 numPasses) PURE;
 };
 
index 4ac3dfc5c275a1b1d11362585e57f4652c0d3430..0212fa77a30d294608966b299ab932f1c771a763 100644 (file)
@@ -101,7 +101,7 @@ typedef LONG SCODE;
 
 struct IUnknown
 {
-  //virtual ~IUnknown() {}
+  virtual ~IUnknown() {}
   STDMETHOD(QueryInterface) (REFIID iid, void **outObject) PURE;
   STDMETHOD_(ULONG, AddRef)() PURE;
   STDMETHOD_(ULONG, Release)() PURE;
index 7610910a19d172ca2630e4e8a689414d3529297a..5437b59946fb14457f20482f618ce08fba6b615b 100644 (file)
@@ -303,12 +303,12 @@ void do_lzma_compress(char *in, int in_len, char *out, int *out_len) {
 void do_lzma_uncompress(char *dst, int dst_len, char *src, int src_len) {
        std::vector<unsigned char> result;
        result = LZMADeCompress(std::vector<unsigned char>(src, src + src_len));
-       if (result.size() <= dst_len)
+       if (result.size() <= (SizeT)dst_len)
                std::memcpy(dst, &result[0], result.size());
        else
        {
                fprintf(stderr, "Not copying %d bytes to %d-byte buffer!\n",
-                       result.size(), dst_len);
+                       (unsigned int)result.size(), dst_len);
                exit(1);
        }
 }