From 14e22779625de673569c7b950ecc2753fb915b31 Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Tue, 27 Apr 2010 06:56:47 +0000 Subject: Since some people disapprove of white space cleanups mixed in regular commits while others dislike them being extra commits, let's clean them up once and for all for the existing code. If it's ugly, let it only be ugly once :-) Signed-off-by: Stefan Reinauer Acked-by: Stefan Reinauer git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5507 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- payloads/bayou/bayou.xml.example | 4 +- payloads/bayou/lzmadecode.c | 40 +++++++-------- payloads/bayou/lzmadecode.h | 12 ++--- payloads/bayou/nrv2b.c | 4 +- .../pbuilder/lzma/C/7zip/Decompress/LzmaDecode.c | 46 ++++++++--------- .../pbuilder/lzma/C/7zip/Decompress/LzmaDecode.h | 14 +++--- payloads/bayou/util/pbuilder/lzma/minilzma.cc | 58 +++++++++++----------- 7 files changed, 89 insertions(+), 89 deletions(-) (limited to 'payloads/bayou') diff --git a/payloads/bayou/bayou.xml.example b/payloads/bayou/bayou.xml.example index 471ac35ce922..60fa78301040 100644 --- a/payloads/bayou/bayou.xml.example +++ b/payloads/bayou/bayou.xml.example @@ -29,11 +29,11 @@ payloads/passwd.elf passwd - + payloads/coreinfo.elf - + payloads/coreinfo.elf diff --git a/payloads/bayou/lzmadecode.c b/payloads/bayou/lzmadecode.c index 1c96283fbbbb..b03415f35e7a 100644 --- a/payloads/bayou/lzmadecode.c +++ b/payloads/bayou/lzmadecode.c @@ -1,21 +1,21 @@ /* LzmaDecode.c LZMA Decoder (optimized for Speed version) - + LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01) http://www.7-zip.org/ LZMA SDK is licensed under two licenses: 1) GNU Lesser General Public License (GNU LGPL) 2) Common Public License (CPL) - It means that you can select one of these two licenses and + It means that you can select one of these two licenses and follow rules of that license. SPECIAL EXCEPTION: - Igor Pavlov, as the author of this Code, expressly permits you to - statically or dynamically link your Code (or bind by name) to the - interfaces of this file without subjecting your linked Code to the - terms of the CPL or GNU LGPL. Any modifications or additions + Igor Pavlov, as the author of this Code, expressly permits you to + statically or dynamically link your Code (or bind by name) to the + interfaces of this file without subjecting your linked Code to the + terms of the CPL or GNU LGPL. Any modifications or additions to this file, however, are subject to the LGPL or CPL terms. */ @@ -37,7 +37,7 @@ #define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; } #define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2 - + #define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; } @@ -47,9 +47,9 @@ #define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \ { UpdateBit0(p); mi <<= 1; A0; } else \ - { UpdateBit1(p); mi = (mi + mi) + 1; A1; } - -#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;) + { UpdateBit1(p); mi = (mi + mi) + 1; A1; } + +#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;) #define RangeDecoderBitTreeDecode(probs, numLevels, res) \ { int i = numLevels; res = 1; \ @@ -72,7 +72,7 @@ #define LenLow (LenChoice2 + 1) #define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) #define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) -#define kNumLenProbs (LenHigh + kLenNumHighSymbols) +#define kNumLenProbs (LenHigh + kLenNumHighSymbols) #define kNumStates 12 @@ -161,7 +161,7 @@ int LzmaDecode(CLzmaDecoderState *vs, for (i = 0; i < numProbs; i++) p[i] = kBitModelTotal >> 1; } - + RC_INIT(inStream, inSize); @@ -170,7 +170,7 @@ int LzmaDecode(CLzmaDecoderState *vs, CProb *prob; UInt32 bound; int posState = (int)( - (nowPos + (nowPos ) & posStateMask); @@ -179,9 +179,9 @@ int LzmaDecode(CLzmaDecoderState *vs, { int symbol = 1; UpdateBit0(prob) - prob = p + Literal + (LZMA_LIT_SIZE * + prob = p + Literal + (LZMA_LIT_SIZE * ((( - (nowPos + (nowPos ) & literalPosMask) << lc) + (previousByte >> (8 - lc)))); @@ -212,7 +212,7 @@ int LzmaDecode(CLzmaDecoderState *vs, else if (state < 10) state -= 3; else state -= 6; } - else + else { UpdateBit1(prob); prob = p + IsRep + state; @@ -236,10 +236,10 @@ int LzmaDecode(CLzmaDecoderState *vs, IfBit0(prob) { UpdateBit0(prob); - + if (nowPos == 0) return LZMA_RESULT_DATA_ERROR; - + state = state < kNumLitStates ? 9 : 11; previousByte = outStream[nowPos - rep0]; outStream[nowPos++] = previousByte; @@ -261,7 +261,7 @@ int LzmaDecode(CLzmaDecoderState *vs, UpdateBit0(prob); distance = rep1; } - else + else { UpdateBit1(prob); prob = p + IsRepG2 + state; @@ -322,7 +322,7 @@ int LzmaDecode(CLzmaDecoderState *vs, int posSlot; state += kNumLitStates; prob = p + PosSlot + - ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << + ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits); RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot); if (posSlot >= kStartPosModelIndex) diff --git a/payloads/bayou/lzmadecode.h b/payloads/bayou/lzmadecode.h index f885446ced14..37712455e96a 100644 --- a/payloads/bayou/lzmadecode.h +++ b/payloads/bayou/lzmadecode.h @@ -1,4 +1,4 @@ -/* +/* LzmaDecode.h LZMA Decoder interface @@ -8,14 +8,14 @@ LZMA SDK is licensed under two licenses: 1) GNU Lesser General Public License (GNU LGPL) 2) Common Public License (CPL) - It means that you can select one of these two licenses and + It means that you can select one of these two licenses and follow rules of that license. SPECIAL EXCEPTION: - Igor Pavlov, as the author of this code, expressly permits you to - statically or dynamically link your code (or bind by name) to the - interfaces of this file without subjecting your linked code to the - terms of the CPL or GNU LGPL. Any modifications or additions + Igor Pavlov, as the author of this code, expressly permits you to + statically or dynamically link your code (or bind by name) to the + interfaces of this file without subjecting your linked code to the + terms of the CPL or GNU LGPL. Any modifications or additions to this file, however, are subject to the LGPL or CPL terms. */ diff --git a/payloads/bayou/nrv2b.c b/payloads/bayou/nrv2b.c index 11f977e7e416..dbfb91a9537a 100644 --- a/payloads/bayou/nrv2b.c +++ b/payloads/bayou/nrv2b.c @@ -1,6 +1,6 @@ #include -// This GETBIT is supposed to work on little endian +// This GETBIT is supposed to work on little endian // 32bit systems. The algorithm will definitely need // some fixing on other systems, but it might not be // a problem since the nrv2b binary behaves the same.. @@ -40,7 +40,7 @@ unsigned long unrv2b(u8 *src, u8 *dst, unsigned long *ilen_p) // skip length src += 4; - /* FIXME: check olen with the length stored in first 4 bytes */ + /* FIXME: check olen with the length stored in first 4 bytes */ for (;;) { unsigned int m_off, m_len; diff --git a/payloads/bayou/util/pbuilder/lzma/C/7zip/Decompress/LzmaDecode.c b/payloads/bayou/util/pbuilder/lzma/C/7zip/Decompress/LzmaDecode.c index 21bf40bde065..83508436df17 100644 --- a/payloads/bayou/util/pbuilder/lzma/C/7zip/Decompress/LzmaDecode.c +++ b/payloads/bayou/util/pbuilder/lzma/C/7zip/Decompress/LzmaDecode.c @@ -1,21 +1,21 @@ /* LzmaDecode.c LZMA Decoder (optimized for Speed version) - + LZMA SDK 4.22 Copyright (c) 1999-2005 Igor Pavlov (2005-06-10) http://www.7-zip.org/ LZMA SDK is licensed under two licenses: 1) GNU Lesser General Public License (GNU LGPL) 2) Common Public License (CPL) - It means that you can select one of these two licenses and + It means that you can select one of these two licenses and follow rules of that license. SPECIAL EXCEPTION: - Igor Pavlov, as the author of this Code, expressly permits you to - statically or dynamically link your Code (or bind by name) to the - interfaces of this file without subjecting your linked Code to the - terms of the CPL or GNU LGPL. Any modifications or additions + Igor Pavlov, as the author of this Code, expressly permits you to + statically or dynamically link your Code (or bind by name) to the + interfaces of this file without subjecting your linked Code to the + terms of the CPL or GNU LGPL. Any modifications or additions to this file, however, are subject to the LGPL or CPL terms. */ @@ -50,7 +50,7 @@ #define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; } #define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2 - + #endif #define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; } @@ -61,9 +61,9 @@ #define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \ { UpdateBit0(p); mi <<= 1; A0; } else \ - { UpdateBit1(p); mi = (mi + mi) + 1; A1; } - -#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;) + { UpdateBit1(p); mi = (mi + mi) + 1; A1; } + +#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;) #define RangeDecoderBitTreeDecode(probs, numLevels, res) \ { int i = numLevels; res = 1; \ @@ -86,7 +86,7 @@ #define LenLow (LenChoice2 + 1) #define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) #define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) -#define kNumLenProbs (LenHigh + kLenNumHighSymbols) +#define kNumLenProbs (LenHigh + kLenNumHighSymbols) #define kNumStates 12 @@ -172,7 +172,7 @@ int LzmaDecode(CLzmaDecoderState *vs, int lc = vs->Properties.lc; #ifdef _LZMA_OUT_READ - + UInt32 Range = vs->Range; UInt32 Code = vs->Code; #ifdef _LZMA_IN_CB @@ -214,7 +214,7 @@ int LzmaDecode(CLzmaDecoderState *vs, UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp)); UInt32 i; for (i = 0; i < numProbs; i++) - p[i] = kBitModelTotal >> 1; + p[i] = kBitModelTotal >> 1; rep0 = rep1 = rep2 = rep3 = 1; state = 0; globalPos = 0; @@ -265,7 +265,7 @@ int LzmaDecode(CLzmaDecoderState *vs, for (i = 0; i < numProbs; i++) p[i] = kBitModelTotal >> 1; } - + #ifdef _LZMA_IN_CB RC_INIT; #else @@ -279,7 +279,7 @@ int LzmaDecode(CLzmaDecoderState *vs, CProb *prob; UInt32 bound; int posState = (int)( - (nowPos + (nowPos #ifdef _LZMA_OUT_READ + globalPos #endif @@ -291,9 +291,9 @@ int LzmaDecode(CLzmaDecoderState *vs, { int symbol = 1; UpdateBit0(prob) - prob = p + Literal + (LZMA_LIT_SIZE * + prob = p + Literal + (LZMA_LIT_SIZE * ((( - (nowPos + (nowPos #ifdef _LZMA_OUT_READ + globalPos #endif @@ -342,7 +342,7 @@ int LzmaDecode(CLzmaDecoderState *vs, else if (state < 10) state -= 3; else state -= 6; } - else + else { UpdateBit1(prob); prob = p + IsRep + state; @@ -369,14 +369,14 @@ int LzmaDecode(CLzmaDecoderState *vs, UInt32 pos; #endif UpdateBit0(prob); - + #ifdef _LZMA_OUT_READ if (distanceLimit == 0) #else if (nowPos == 0) #endif return LZMA_RESULT_DATA_ERROR; - + state = state < kNumLitStates ? 9 : 11; #ifdef _LZMA_OUT_READ pos = dictionaryPos - rep0; @@ -412,7 +412,7 @@ int LzmaDecode(CLzmaDecoderState *vs, UpdateBit0(prob); distance = rep1; } - else + else { UpdateBit1(prob); prob = p + IsRepG2 + state; @@ -473,7 +473,7 @@ int LzmaDecode(CLzmaDecoderState *vs, int posSlot; state += kNumLitStates; prob = p + PosSlot + - ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << + ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits); RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot); if (posSlot >= kStartPosModelIndex) @@ -528,7 +528,7 @@ int LzmaDecode(CLzmaDecoderState *vs, len += kMatchMinLen; #ifdef _LZMA_OUT_READ - if (rep0 > distanceLimit) + if (rep0 > distanceLimit) #else if (rep0 > nowPos) #endif diff --git a/payloads/bayou/util/pbuilder/lzma/C/7zip/Decompress/LzmaDecode.h b/payloads/bayou/util/pbuilder/lzma/C/7zip/Decompress/LzmaDecode.h index 213062af12c3..abc02d7edf36 100644 --- a/payloads/bayou/util/pbuilder/lzma/C/7zip/Decompress/LzmaDecode.h +++ b/payloads/bayou/util/pbuilder/lzma/C/7zip/Decompress/LzmaDecode.h @@ -1,4 +1,4 @@ -/* +/* LzmaDecode.h LZMA Decoder interface @@ -8,14 +8,14 @@ LZMA SDK is licensed under two licenses: 1) GNU Lesser General Public License (GNU LGPL) 2) Common Public License (CPL) - It means that you can select one of these two licenses and + It means that you can select one of these two licenses and follow rules of that license. SPECIAL EXCEPTION: - Igor Pavlov, as the author of this code, expressly permits you to - statically or dynamically link your code (or bind by name) to the - interfaces of this file without subjecting your linked code to the - terms of the CPL or GNU LGPL. Any modifications or additions + Igor Pavlov, as the author of this code, expressly permits you to + statically or dynamically link your code (or bind by name) to the + interfaces of this file without subjecting your linked code to the + terms of the CPL or GNU LGPL. Any modifications or additions to this file, however, are subject to the LGPL or CPL terms. */ @@ -29,7 +29,7 @@ /* Use read function for output data */ /* #define _LZMA_PROB32 */ -/* It can increase speed on some 32-bit CPUs, +/* It can increase speed on some 32-bit CPUs, but memory usage will be doubled in that case */ /* #define _LZMA_LOC_OPT */ diff --git a/payloads/bayou/util/pbuilder/lzma/minilzma.cc b/payloads/bayou/util/pbuilder/lzma/minilzma.cc index 7610910a19d1..441c28835f9c 100644 --- a/payloads/bayou/util/pbuilder/lzma/minilzma.cc +++ b/payloads/bayou/util/pbuilder/lzma/minilzma.cc @@ -89,7 +89,7 @@ static UInt32 SelectDictionarySizeFor(unsigned datasize) if(datasize <= 512) return 512; if(datasize <= 1024) return 1024; if(datasize <= 4096) return 4096; - if(datasize <= 16384) return 32768; + if(datasize <= 16384) return 32768; if(datasize <= 65536) return 528288; if(datasize <= 528288) return 1048576*4; if(datasize <= 786432) reutrn 1048576*16; @@ -105,12 +105,12 @@ class CInStreamRam: public ISequentialInStream, public CMyUnknownImp size_t Pos; public: MY_UNKNOWN_IMP - + CInStreamRam(const std::vector& buf) : input(buf), Pos(0) { } virtual ~CInStreamRam() {} - + STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); }; @@ -118,12 +118,12 @@ STDMETHODIMP CInStreamRam::Read(void *data, UInt32 size, UInt32 *processedSize) { UInt32 remain = input.size() - Pos; if (size > remain) size = remain; - + std::memcpy(data, &input[Pos], size); Pos += size; - + if(processedSize != NULL) *processedSize = size; - + return S_OK; } @@ -133,27 +133,27 @@ class COutStreamRam: public ISequentialOutStream, public CMyUnknownImp size_t Pos; public: MY_UNKNOWN_IMP - + COutStreamRam(): result(), Pos(0) { } virtual ~COutStreamRam() { } - + void Reserve(unsigned n) { result.reserve(n); } const std::vector& Get() const { return result; } - + HRESULT WriteByte(Byte b) { if(Pos >= result.size()) result.resize(Pos+1); result[Pos++] = b; return S_OK; } - + STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); }; STDMETHODIMP COutStreamRam::Write(const void *data, UInt32 size, UInt32 *processedSize) { if(Pos+size > result.size()) result.resize(Pos+size); - + std::memcpy(&result[Pos], data, size); if(processedSize != NULL) *processedSize = size; Pos += size; @@ -163,15 +163,15 @@ STDMETHODIMP COutStreamRam::Write(const void *data, UInt32 size, UInt32 *process const std::vector LZMACompress(const std::vector& buf) { if(buf.empty()) return buf; - + const UInt32 dictionarysize = SelectDictionarySizeFor(buf.size()); - + NCompress::NLZMA::CEncoder *encoderSpec = new NCompress::NLZMA::CEncoder; CMyComPtr encoder = encoderSpec; - const PROPID propIDs[] = + const PROPID propIDs[] = { NCoderPropID::kAlgorithm, - NCoderPropID::kDictionarySize, + NCoderPropID::kDictionarySize, NCoderPropID::kNumFastBytes, }; const unsigned kNumProps = sizeof(propIDs) / sizeof(propIDs[0]); @@ -185,16 +185,16 @@ const std::vector LZMACompress(const std::vector& Error: return std::vector (); } - + COutStreamRam *const outStreamSpec = new COutStreamRam; CMyComPtr outStream = outStreamSpec; CInStreamRam *const inStreamSpec = new CInStreamRam(buf); CMyComPtr inStream = inStreamSpec; - + outStreamSpec->Reserve(buf.size()); if (encoderSpec->WriteCoderProperties(outStream) != S_OK) goto Error; - + for (unsigned i = 0; i < 8; i++) { UInt64 t = (UInt64)buf.size(); @@ -203,7 +203,7 @@ const std::vector LZMACompress(const std::vector& HRESULT lzmaResult = encoder->Code(inStream, outStream, 0, 0, 0); if (lzmaResult != S_OK) goto Error; - + return outStreamSpec->Get(); } @@ -216,22 +216,22 @@ const std::vector LZMADeCompress (const std::vector& buf) { if(buf.size() <= 5+8) return std::vector (); - + uint_least64_t out_sizemax = R64(&buf[5]); - + std::vector result(out_sizemax); - + CLzmaDecoderState state; LzmaDecodeProperties(&state.Properties, &buf[0], LZMA_PROPERTIES_SIZE); state.Probs = new CProb[LzmaGetNumProbs(&state.Properties)]; - + SizeT in_done; SizeT out_done; LzmaDecode(&state, &buf[13], buf.size()-13, &in_done, &result[0], result.size(), &out_done); - + delete[] state.Probs; - + result.resize(out_done); return result; } @@ -242,7 +242,7 @@ int main(int argc, char *argv[]) char *s; FILE *f, *infile, *outfile; int c; - + if (argc != 4) { std::fprintf(stderr, "'lzma e file1 file2' encodes file1 into file2.\n" "'lzma d file2 file1' decodes file2 into file1.\n"); @@ -270,9 +270,9 @@ int main(int argc, char *argv[]) fread(Buf,si, 1, infile); std::vector result; - if (toupper(*argv[1]) == 'E') + if (toupper(*argv[1]) == 'E') result = LZMACompress(std::vector(Buf,Buf+si)); - else + else result = LZMADeCompress(std::vector(Buf,Buf+si)); fwrite(&result[0], result.size(), 1, outfile); @@ -289,7 +289,7 @@ extern "C" { * @param in a pointer to the buffer * @param in_len the length in bytes * @param out a pointer to a buffer of at least size in_len - * @param out_len a pointer to the compressed length of in + * @param out_len a pointer to the compressed length of in */ void do_lzma_compress(char *in, int in_len, char *out, int *out_len) { -- cgit v1.2.3