Bug 1102048 (Part 24, decoders) - Make image/src files comply with the Mozilla Coding Style Guide. r=seth

This commit is contained in:
Glenn Randers-Pehrson 2015-04-05 16:22:00 -07:00
parent 410816eea2
commit f2b4370c06
12 changed files with 53 additions and 45 deletions

View File

@ -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 <stdint.h>
#include "nsDebug.h"
@ -72,4 +72,4 @@ private:
} // namespace image
} // namespace mozilla
#endif // MOZILLA_IMAGELIB_EXIF_H
#endif // mozilla_image_decoders_EXIF_h

View File

@ -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

View File

@ -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)) {

View File

@ -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 <stdio.h> /* 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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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