Author: stepan
Date: 2009-05-26 14:22:10 +0200 (Tue, 26 May 2009)
New Revision: 4299

Modified:
   trunk/coreboot-v2/util/cbfstool/Makefile
   trunk/coreboot-v2/util/cbfstool/resize.c
   trunk/coreboot-v2/util/cbfstool/tools/Makefile
   trunk/coreboot-v2/util/cbfstool/tools/cbfs-mkstage.c
   trunk/coreboot-v2/util/cbfstool/tools/lzma/C/7zip/Compress/LZ/IMatchFinder.h
   trunk/coreboot-v2/util/cbfstool/tools/lzma/C/Common/MyWindows.h
   trunk/coreboot-v2/util/cbfstool/tools/lzma/minilzma.cc
Log:
Cosmetic cbfstool update (trivial)
* 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 <[email protected]>
Acked-by: Stefan Reinauer <[email protected]>



Modified: trunk/coreboot-v2/util/cbfstool/Makefile
===================================================================
--- trunk/coreboot-v2/util/cbfstool/Makefile    2009-05-23 22:02:31 UTC (rev 
4298)
+++ trunk/coreboot-v2/util/cbfstool/Makefile    2009-05-26 12:22:10 UTC (rev 
4299)
@@ -8,7 +8,9 @@
 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 @@
 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 @@
 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)

Modified: trunk/coreboot-v2/util/cbfstool/resize.c
===================================================================
--- trunk/coreboot-v2/util/cbfstool/resize.c    2009-05-23 22:02:31 UTC (rev 
4298)
+++ trunk/coreboot-v2/util/cbfstool/resize.c    2009-05-26 12:22:10 UTC (rev 
4299)
@@ -95,7 +95,6 @@
                /* 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 @@
                                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 @@
 
                        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))

Modified: trunk/coreboot-v2/util/cbfstool/tools/Makefile
===================================================================
--- trunk/coreboot-v2/util/cbfstool/tools/Makefile      2009-05-23 22:02:31 UTC 
(rev 4298)
+++ trunk/coreboot-v2/util/cbfstool/tools/Makefile      2009-05-26 12:22:10 UTC 
(rev 4299)
@@ -12,13 +12,13 @@
 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))

Modified: trunk/coreboot-v2/util/cbfstool/tools/cbfs-mkstage.c
===================================================================
--- trunk/coreboot-v2/util/cbfstool/tools/cbfs-mkstage.c        2009-05-23 
22:02:31 UTC (rev 4298)
+++ trunk/coreboot-v2/util/cbfstool/tools/cbfs-mkstage.c        2009-05-26 
12:22:10 UTC (rev 4299)
@@ -34,7 +34,6 @@
 {
        Elf32_Phdr *phdr;
        Elf32_Ehdr *ehdr = (Elf32_Ehdr *) input;
-       Elf32_Shdr *shdr;
        char *header, *buffer;
        unsigned char *out;
 
@@ -47,7 +46,6 @@
        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

Modified: 
trunk/coreboot-v2/util/cbfstool/tools/lzma/C/7zip/Compress/LZ/IMatchFinder.h
===================================================================
--- 
trunk/coreboot-v2/util/cbfstool/tools/lzma/C/7zip/Compress/LZ/IMatchFinder.h    
    2009-05-23 22:02:31 UTC (rev 4298)
+++ 
trunk/coreboot-v2/util/cbfstool/tools/lzma/C/7zip/Compress/LZ/IMatchFinder.h    
    2009-05-26 12:22:10 UTC (rev 4299)
@@ -26,7 +26,7 @@
 
 struct IMatchFinderSetNumPasses
 {
-  //virtual ~IMatchFinderSetNumPasses(){}
+  virtual ~IMatchFinderSetNumPasses(){}
   virtual void SetNumPasses(UInt32 numPasses) PURE;
 };
 

Modified: trunk/coreboot-v2/util/cbfstool/tools/lzma/C/Common/MyWindows.h
===================================================================
--- trunk/coreboot-v2/util/cbfstool/tools/lzma/C/Common/MyWindows.h     
2009-05-23 22:02:31 UTC (rev 4298)
+++ trunk/coreboot-v2/util/cbfstool/tools/lzma/C/Common/MyWindows.h     
2009-05-26 12:22:10 UTC (rev 4299)
@@ -101,7 +101,7 @@
 
 struct IUnknown
 {
-  //virtual ~IUnknown() {}
+  virtual ~IUnknown() {}
   STDMETHOD(QueryInterface) (REFIID iid, void **outObject) PURE;
   STDMETHOD_(ULONG, AddRef)() PURE;
   STDMETHOD_(ULONG, Release)() PURE;

Modified: trunk/coreboot-v2/util/cbfstool/tools/lzma/minilzma.cc
===================================================================
--- trunk/coreboot-v2/util/cbfstool/tools/lzma/minilzma.cc      2009-05-23 
22:02:31 UTC (rev 4298)
+++ trunk/coreboot-v2/util/cbfstool/tools/lzma/minilzma.cc      2009-05-26 
12:22:10 UTC (rev 4299)
@@ -303,12 +303,12 @@
 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);
        }
 }


-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to