From f2b4370c06a5a920a2f345667ef7973bdd26f57b Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Sun, 5 Apr 2015 16:22:00 -0700 Subject: [PATCH] Bug 1102048 (Part 24, decoders) - Make image/src files comply with the Mozilla Coding Style Guide. r=seth --- image/decoders/EXIF.h | 6 +++--- image/decoders/GIF2.h | 6 +++--- image/decoders/iccjpeg.c | 3 ++- image/decoders/iccjpeg.h | 6 +++--- image/decoders/nsBMPDecoder.h | 20 +++++++++++--------- image/decoders/nsGIFDecoder2.cpp | 14 +++++++++----- image/decoders/nsGIFDecoder2.h | 6 +++--- image/decoders/nsICODecoder.h | 16 ++++++++-------- image/decoders/nsIconDecoder.h | 6 +++--- image/decoders/nsJPEGDecoder.cpp | 3 ++- image/decoders/nsJPEGDecoder.h | 6 +++--- image/decoders/nsPNGDecoder.h | 6 +++--- 12 files changed, 53 insertions(+), 45 deletions(-) diff --git a/image/decoders/EXIF.h b/image/decoders/EXIF.h index d93afa8f816..9028f2cf832 100644 --- a/image/decoders/EXIF.h +++ b/image/decoders/EXIF.h @@ -3,8 +3,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef MOZILLA_IMAGELIB_EXIF_H -#define MOZILLA_IMAGELIB_EXIF_H +#ifndef mozilla_image_decoders_EXIF_h +#define mozilla_image_decoders_EXIF_h #include #include "nsDebug.h" @@ -72,4 +72,4 @@ private: } // namespace image } // namespace mozilla -#endif // MOZILLA_IMAGELIB_EXIF_H +#endif // mozilla_image_decoders_EXIF_h diff --git a/image/decoders/GIF2.h b/image/decoders/GIF2.h index b74be14ce9c..49cc39a4cdd 100644 --- a/image/decoders/GIF2.h +++ b/image/decoders/GIF2.h @@ -3,8 +3,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef GIF2_H -#define GIF2_H +#ifndef mozilla_image_decoders_GIF2_H +#define mozilla_image_decoders_GIF2_H #define MAX_LZW_BITS 12 #define MAX_BITS 4097 // 2^MAX_LZW_BITS+1 @@ -106,5 +106,5 @@ typedef struct gif_struct { } gif_struct; -#endif // GIF2_H +#endif // mozilla_image_decoders_GIF2_H diff --git a/image/decoders/iccjpeg.c b/image/decoders/iccjpeg.c index 15b40fecee7..af014cf6bea 100644 --- a/image/decoders/iccjpeg.c +++ b/image/decoders/iccjpeg.c @@ -122,8 +122,9 @@ read_icc_profile (j_decompress_ptr cinfo, * any ICC markers and verifies the consistency of the marker numbering. */ - for (seq_no = 1; seq_no <= MAX_SEQ_NO; seq_no++) + for (seq_no = 1; seq_no <= MAX_SEQ_NO; seq_no++) { marker_present[seq_no] = 0; + } for (marker = cinfo->marker_list; marker != NULL; marker = marker->next) { if (marker_is_icc(marker)) { diff --git a/image/decoders/iccjpeg.h b/image/decoders/iccjpeg.h index a968f11ed4b..474df719cfa 100644 --- a/image/decoders/iccjpeg.h +++ b/image/decoders/iccjpeg.h @@ -20,8 +20,8 @@ * for details. */ -#ifndef ICCJPEG_H -#define ICCJPEG_H +#ifndef mozilla_image_decoders_iccjpeg_h +#define mozilla_image_decoders_iccjpeg_h #include /* needed to define "FILE", "NULL" */ #include "jpeglib.h" @@ -64,4 +64,4 @@ extern void setup_read_icc_profile JPP((j_decompress_ptr cinfo)); extern boolean read_icc_profile JPP((j_decompress_ptr cinfo, JOCTET** icc_data_ptr, unsigned int* icc_data_len)); -#endif // ICCJPEG_H +#endif // mozilla_image_decoders_iccjpeg_h diff --git a/image/decoders/nsBMPDecoder.h b/image/decoders/nsBMPDecoder.h index c90c0214ddf..46ce442788e 100644 --- a/image/decoders/nsBMPDecoder.h +++ b/image/decoders/nsBMPDecoder.h @@ -4,8 +4,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef nsBMPDecoder_h -#define nsBMPDecoder_h +#ifndef mozilla_image_decoders_nsBMPDecoder_h +#define mozilla_image_decoders_nsBMPDecoder_h #include "BMPFileHeaders.h" #include "Decoder.h" @@ -114,14 +114,15 @@ private: /// Sets the pixel data in aDecoded to the given values. /// @param aDecoded pointer to pixel to be set, will be incremented to point to /// the next pixel. -static inline void SetPixel(uint32_t*& aDecoded, uint8_t aRed, uint8_t aGreen, - uint8_t aBlue, uint8_t aAlpha = 0xFF) +static inline void +SetPixel(uint32_t*& aDecoded, uint8_t aRed, uint8_t aGreen, + uint8_t aBlue, uint8_t aAlpha = 0xFF) { *aDecoded++ = gfxPackedPixel(aAlpha, aRed, aGreen, aBlue); } -static inline void SetPixel(uint32_t*& aDecoded, uint8_t idx, colorTable* - aColors) +static inline void +SetPixel(uint32_t*& aDecoded, uint8_t idx, colorTable* aColors) { SetPixel(aDecoded, aColors[idx].red, aColors[idx].green, aColors[idx].blue); } @@ -131,8 +132,9 @@ static inline void SetPixel(uint32_t*& aDecoded, uint8_t idx, colorTable* /// depending on whether one or two pixels are written. /// @param aData The values for the two pixels /// @param aCount Current count. Is decremented by one or two. -inline void Set4BitPixel(uint32_t*& aDecoded, uint8_t aData, - uint32_t& aCount, colorTable* aColors) +inline void +Set4BitPixel(uint32_t*& aDecoded, uint8_t aData, uint32_t& aCount, + colorTable* aColors) { uint8_t idx = aData >> 4; SetPixel(aDecoded, idx, aColors); @@ -146,4 +148,4 @@ inline void Set4BitPixel(uint32_t*& aDecoded, uint8_t aData, } // namespace image } // namespace mozilla -#endif // nsBMPDecoder_h +#endif // mozilla_image_decoders_nsBMPDecoder_h diff --git a/image/decoders/nsGIFDecoder2.cpp b/image/decoders/nsGIFDecoder2.cpp index aee5085f0ea..7a95713440b 100644 --- a/image/decoders/nsGIFDecoder2.cpp +++ b/image/decoders/nsGIFDecoder2.cpp @@ -541,7 +541,9 @@ ConvertColormap(uint32_t* aColormap, uint32_t aColors) // Convert color entries to Cairo format // set up for loops below - if (!aColors) return; + if (!aColors) { + return; + } uint32_t c = aColors; // copy as bytes until source pointer is 32-bit-aligned @@ -657,8 +659,9 @@ nsGIFDecoder2::WriteInternal(const char* aBuffer, uint32_t aCount) mGIFStruct.datum = mGIFStruct.bits = 0; // init the tables - for (int i = 0; i < clear_code; i++) + for (int i = 0; i < clear_code; i++) { mGIFStruct.suffix[i] = i; + } mGIFStruct.stackp = mGIFStruct.stack; @@ -702,7 +705,7 @@ nsGIFDecoder2::WriteInternal(const char* aBuffer, uint32_t aCount) // Not used // float aspect = (float)((q[6] + 15) / 64.0); - if (q[4] & 0x80) { // global map + if (q[4] & 0x80) { // Get the global colormap const uint32_t size = (3 << mGIFStruct.global_colormap_depth); if (len < size) { @@ -857,10 +860,11 @@ nsGIFDecoder2::WriteInternal(const char* aBuffer, uint32_t aCount) // Check for netscape application extension if (mGIFStruct.bytes_to_consume == 11 && (!strncmp((char*)q, "NETSCAPE2.0", 11) || - !strncmp((char*)q, "ANIMEXTS1.0", 11))) + !strncmp((char*)q, "ANIMEXTS1.0", 11))) { GETN(1, gif_netscape_extension_block); - else + } else { GETN(1, gif_consume_block); + } break; // Netscape-specific GIF extension: animation looping diff --git a/image/decoders/nsGIFDecoder2.h b/image/decoders/nsGIFDecoder2.h index 5ba0f8f3ee4..1d2e55301fd 100644 --- a/image/decoders/nsGIFDecoder2.h +++ b/image/decoders/nsGIFDecoder2.h @@ -4,8 +4,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef nsGIFDecoder2_h -#define nsGIFDecoder2_h +#ifndef mozilla_image_decoders_nsGIFDecoder2_h +#define mozilla_image_decoders_nsGIFDecoder2_h #include "Decoder.h" @@ -69,4 +69,4 @@ private: } // namespace image } // namespace mozilla -#endif // nsGIFDecoder2_h +#endif // mozilla_image_decoders_nsGIFDecoder2_h diff --git a/image/decoders/nsICODecoder.h b/image/decoders/nsICODecoder.h index 6e449b93a70..787d699025d 100644 --- a/image/decoders/nsICODecoder.h +++ b/image/decoders/nsICODecoder.h @@ -4,8 +4,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef nsICODecoder_h -#define nsICODecoder_h +#ifndef mozilla_image_decoders_nsICODecoder_h +#define mozilla_image_decoders_nsICODecoder_h #include "nsAutoPtr.h" #include "Decoder.h" @@ -56,19 +56,19 @@ private: // Sets the hotspot property of if we have a cursor void SetHotSpotIfCursor(); // Creates a bitmap file header buffer, returns true if successful - bool FillBitmapFileHeaderBuffer(int8_t *bfh); + bool FillBitmapFileHeaderBuffer(int8_t* bfh); // Fixes the ICO height to match that of the BIH. // and also fixes the BIH height to be /2 of what it was. // See definition for explanation. // Returns false if invalid information is contained within. - bool FixBitmapHeight(int8_t *bih); + bool FixBitmapHeight(int8_t* bih); // Fixes the ICO width to match that of the BIH. // Returns false if invalid information is contained within. - bool FixBitmapWidth(int8_t *bih); + bool FixBitmapWidth(int8_t* bih); // Extract bitmap info header size count from BMP information header - int32_t ExtractBIHSizeFromBitmap(int8_t *bih); + int32_t ExtractBIHSizeFromBitmap(int8_t* bih); // Extract bit count from BMP information header - int32_t ExtractBPPFromBitmap(int8_t *bih); + int32_t ExtractBPPFromBitmap(int8_t* bih); // Calculates the row size in bytes for the AND mask table uint32_t CalcAlphaRowSize(); // Obtains the number of colors from the BPP, mBPP must be filled in @@ -101,4 +101,4 @@ private: } // namespace image } // namespace mozilla -#endif // nsICODecoder_h +#endif // mozilla_image_decoders_nsICODecoder_h diff --git a/image/decoders/nsIconDecoder.h b/image/decoders/nsIconDecoder.h index 24069f01053..42ae2591b31 100644 --- a/image/decoders/nsIconDecoder.h +++ b/image/decoders/nsIconDecoder.h @@ -4,8 +4,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef nsIconDecoder_h -#define nsIconDecoder_h +#ifndef mozilla_image_decoders_nsIconDecoder_h +#define mozilla_image_decoders_nsIconDecoder_h #include "Decoder.h" @@ -59,4 +59,4 @@ enum { } // namespace image } // namespace mozilla -#endif // nsIconDecoder_h +#endif // mozilla_image_decoders_nsIconDecoder_h diff --git a/image/decoders/nsJPEGDecoder.cpp b/image/decoders/nsJPEGDecoder.cpp index f8c3c10446d..684bdaf7b81 100644 --- a/image/decoders/nsJPEGDecoder.cpp +++ b/image/decoders/nsJPEGDecoder.cpp @@ -190,8 +190,9 @@ nsJPEGDecoder::InitInternal() mSourceMgr.term_source = term_source; // Record app markers for ICC data - for (uint32_t m = 0; m < 16; m++) + for (uint32_t m = 0; m < 16; m++) { jpeg_save_markers(&mInfo, JPEG_APP0 + m, 0xFFFF); + } } void diff --git a/image/decoders/nsJPEGDecoder.h b/image/decoders/nsJPEGDecoder.h index 915394e8ee3..7904f2570f7 100644 --- a/image/decoders/nsJPEGDecoder.h +++ b/image/decoders/nsJPEGDecoder.h @@ -4,8 +4,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef nsJPEGDecoder_h -#define nsJPEGDecoder_h +#ifndef mozilla_image_decoders_nsJPEGDecoder_h +#define mozilla_image_decoders_nsJPEGDecoder_h #include "RasterImage.h" // On Windows systems, RasterImage.h brings in 'windows.h', which defines INT32. @@ -103,4 +103,4 @@ public: } // namespace image } // namespace mozilla -#endif // nsJPEGDecoder_h +#endif // mozilla_image_decoders_nsJPEGDecoder_h diff --git a/image/decoders/nsPNGDecoder.h b/image/decoders/nsPNGDecoder.h index e27c4c7fd68..2c976dac9d8 100644 --- a/image/decoders/nsPNGDecoder.h +++ b/image/decoders/nsPNGDecoder.h @@ -4,8 +4,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef nsPNGDecoder_h -#define nsPNGDecoder_h +#ifndef mozilla_image_decoders_nsPNGDecoder_h +#define mozilla_image_decoders_nsPNGDecoder_h #include "Decoder.h" @@ -129,4 +129,4 @@ public: } // namespace image } // namespace mozilla -#endif // nsPNGDecoder_h +#endif // mozilla_image_decoders_nsPNGDecoder_h