diff options
author | Nico Weber <thakis@chromium.org> | 2014-07-29 10:13:17 -0700 |
---|---|---|
committer | Nico Weber <thakis@chromium.org> | 2014-07-29 10:13:17 -0700 |
commit | 6c55495fcaf634e7f788f4dfe77fa1a106c9cd55 (patch) | |
tree | 3fe8612d47f51ff551e480a2088a48349cd9bdf7 /core/src/fpdfapi | |
parent | c77e8f73397613f278eaeef2cae44debc6a684c8 (diff) | |
download | pdfium-6c55495fcaf634e7f788f4dfe77fa1a106c9cd55.tar.xz |
Fix a few more warnings in chromium_code mode.
No intended behavior change.
- Remove more unused variables, functions, member variables.
- Put a few constructor initializers in the order they execute in.
- Add braces for subobject initializers.
- Fix a handful of signed / unsigned comparisons.
BUG=pdfium:29
R=bo_xu@foxitsoftware.com
Review URL: https://codereview.chromium.org/429593005
Diffstat (limited to 'core/src/fpdfapi')
-rw-r--r-- | core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp | 2 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp | 4 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_font/fpdf_font.cpp | 2 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_font/fpdf_font_utility.cpp | 7 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_font/ttgsubtable.h | 6 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page.cpp | 4 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp | 3 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp | 1 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp | 2 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp | 1 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp | 2 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp | 12 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp | 3 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp | 5 |
14 files changed, 17 insertions, 37 deletions
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp index 9eec7aa4a8..fd94b88983 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp @@ -544,8 +544,8 @@ FX_FILESIZE CPDF_ObjectStream::End(CPDF_Creator* pCreator) } CPDF_XRefStream::CPDF_XRefStream() : m_PrevOffset(0) - , m_iSeg(0) , m_dwTempObjNum(0) + , m_iSeg(0) { } FX_BOOL CPDF_XRefStream::Start() diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp index 9985f06dc6..2dd2911e93 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp @@ -685,7 +685,7 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, FX_BOOL bVert, FX_BOOL bTr pBaseDict->SetAtName(FX_BSTRC("Encoding"), "WinAnsiEncoding"); } else { flags |= PDFFONT_NONSYMBOLIC; - int i; + size_t i; for (i = 0; i < sizeof g_FX_CharsetUnicodes / sizeof(FX_CharsetUnicodes); i ++) { charSets.RemoveAll(); charSets.Add(g_FX_CharsetUnicodes[i].m_Charset); @@ -913,7 +913,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) } } else { flags |= PDFFONT_NONSYMBOLIC; - int i; + size_t i; for (i = 0; i < sizeof g_FX_CharsetUnicodes / sizeof(FX_CharsetUnicodes); i ++) if (g_FX_CharsetUnicodes[i].m_Charset == charset) { break; diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp index b7ca5b1b7d..36b6ce2b5b 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp @@ -995,7 +995,7 @@ FX_BOOL CPDF_SimpleFont::LoadCommon() } if (m_Flags & PDFFONT_ALLCAP) { unsigned char lowercases[] = {'a', 'z', 0xe0, 0xf6, 0xf8, 0xfd}; - for (int range = 0; range < sizeof lowercases / 2; range ++) { + for (size_t range = 0; range < sizeof lowercases / 2; range ++) { for (int i = lowercases[range * 2]; i <= lowercases[range * 2 + 1]; i ++) { if (m_GlyphIndex[i] != 0xffff && m_pFontFile != NULL) { continue; diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_utility.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_utility.cpp index b10bff7ebe..d7c725cc2f 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font_utility.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font_utility.cpp @@ -22,7 +22,7 @@ FX_LPVOID FXFC_LoadPackage(FX_LPCSTR name) return NULL; } FX_BYTE buf[256]; - size_t read = FXSYS_fread(buf, 1, 20, file); + FXSYS_fread(buf, 1, 20, file); if (*(FX_DWORD*)buf != 0x43465846) { FXSYS_fclose(file); return NULL; @@ -45,15 +45,14 @@ FX_BOOL FXFC_LoadFile(FX_LPVOID p, FX_LPCSTR name, FX_LPBYTE& pBuffer, FX_DWORD& FXFC_PACKAGE* pPackage = (FXFC_PACKAGE*)p; FXSYS_fseek(pPackage->m_pFile, pPackage->m_IndexOffset, FXSYS_SEEK_SET); FX_BYTE buf[128]; - size_t read = 0; for (int i = 0; i < pPackage->m_nFiles; i ++) { - read = FXSYS_fread(buf, pPackage->m_IndexSize, 1, pPackage->m_pFile); + FXSYS_fread(buf, pPackage->m_IndexSize, 1, pPackage->m_pFile); if (FXSYS_stricmp((FX_LPCSTR)buf, name) == 0) { FX_DWORD offset = *(FX_DWORD*)&buf[64]; size = *(FX_DWORD*)&buf[68]; pBuffer = FX_Alloc(FX_BYTE, size); FXSYS_fseek(pPackage->m_pFile, offset, FXSYS_SEEK_SET); - read = FXSYS_fread(pBuffer, size, 1, pPackage->m_pFile); + FXSYS_fread(pBuffer, size, 1, pPackage->m_pFile); if (buf[72]) { FX_DWORD orig_size; FX_LPBYTE comp_buf = pBuffer; diff --git a/core/src/fpdfapi/fpdf_font/ttgsubtable.h b/core/src/fpdfapi/fpdf_font/ttgsubtable.h index 26f67fbd18..cc7f8c8752 100644 --- a/core/src/fpdfapi/fpdf_font/ttgsubtable.h +++ b/core/src/fpdfapi/fpdf_font/ttgsubtable.h @@ -22,8 +22,8 @@ protected: class CFX_CTTGSUBTable : public CFX_Object { public: - CFX_CTTGSUBTable(void): loaded(false), m_bFeautureMapLoad(FALSE) {}; - CFX_CTTGSUBTable(FT_Bytes gsub): loaded(false), m_bFeautureMapLoad(FALSE) + CFX_CTTGSUBTable(void): m_bFeautureMapLoad(FALSE), loaded(false) {}; + CFX_CTTGSUBTable(FT_Bytes gsub): m_bFeautureMapLoad(FALSE), loaded(false) { LoadGSUBTable(gsub); } @@ -274,7 +274,7 @@ private: struct TSingleSubstFormat1: public TSubTableBase { TCoverageFormatBase *Coverage; TT_int16_t DeltaGlyphID; - TSingleSubstFormat1(): DeltaGlyphID(0), Coverage(NULL) + TSingleSubstFormat1(): Coverage(NULL), DeltaGlyphID(0) { SubstFormat = 1; } diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp index 500fe4a57f..6d3cf29785 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp @@ -313,7 +313,6 @@ void CPDF_TextObject::SetText(int nChars, FX_DWORD* pCharCodes, FX_FLOAT* pKerni } } } else { - int offset = 0; m_pCharCodes = (FX_DWORD*)(FX_UINTPTR)pCharCodes[0]; } RecalcPositionData(); @@ -354,7 +353,6 @@ FX_FLOAT CPDF_TextObject::GetSpaceCharWidth() const } void CPDF_TextObject::GetCharRect(int index, CFX_FloatRect& rect) const { - FX_FLOAT curpos = 0; CPDF_Font* pFont = m_TextState.GetFont(); FX_BOOL bVertWriting = FALSE; CPDF_CIDFont* pCIDFont = pFont->GetCIDFont(); @@ -526,8 +524,6 @@ void CPDF_TextObject::CalcPositionData(FX_FLOAT* pTextAdvanceX, FX_FLOAT* pTextA } void CPDF_TextObject::CalcCharPos(FX_FLOAT* pPosArray) const { - FX_FLOAT curpos = 0; - int count = 0; CPDF_Font* pFont = m_TextState.GetFont(); FX_BOOL bVertWriting = FALSE; CPDF_CIDFont* pCIDFont = pFont->GetCIDFont(); diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp index 467fb63f47..1b7cb03ee2 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp @@ -785,9 +785,6 @@ FX_BOOL CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) if (pTableObj == NULL) { return FALSE; } - FX_LPCBYTE pTable = NULL; - FX_DWORD size = 0; - CPDF_StreamAcc* pStreamAcc = NULL; if (pTableObj->GetType() == PDFOBJ_STRING) { m_Table = ((CPDF_String*)pTableObj)->GetString(); } else if (pTableObj->GetType() == PDFOBJ_STREAM) { diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp index c152b223c9..097bd61e6c 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp @@ -146,7 +146,6 @@ CPDF_DocPageData::~CPDF_DocPageData() { Clear(FALSE); Clear(TRUE); - FX_POSITION pos = NULL; } void CPDF_DocPageData::Clear(FX_BOOL bRelease) { diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp index 5e8c1b5ec3..7d8bd4842a 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -619,11 +619,9 @@ void CPDF_StreamContentParser::Handle_ConcatMatrix() { FX_FLOAT a2 = GetNumber16(5), b2 = GetNumber16(4), c2 = GetNumber16(3), d2 = GetNumber16(2); FX_FLOAT e2 = GetNumber(1), f2 = GetNumber(0); - FX_FLOAT old_width_scale = m_pCurStates->m_CTM.GetXUnit(); CFX_AffineMatrix new_matrix(a2, b2, c2, d2, e2, f2); new_matrix.Concat(m_pCurStates->m_CTM); m_pCurStates->m_CTM = new_matrix; - FX_FLOAT new_width_scale = m_pCurStates->m_CTM.GetXUnit(); OnChangeTextMatrix(); } void CPDF_StreamContentParser::Handle_SetColorSpace_Fill() diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp index 9dddd86c1a..3dc0e551b4 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp @@ -106,7 +106,6 @@ FX_DWORD CPDF_StandardSecurityHandler::GetPermissions() static FX_BOOL _LoadCryptInfo(CPDF_Dictionary* pEncryptDict, FX_BSTR name, int& cipher, int& keylen) { int Version = pEncryptDict->GetInteger(FX_BSTRC("V")); - int Revision = pEncryptDict->GetInteger(FX_BSTRC("R")); cipher = FXCIPHER_RC4; keylen = 0; if (Version >= 4) { diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp index 26877ec418..11370075d6 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp @@ -1269,7 +1269,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, FX_LPBYTE& pBuffer, FX_DWOR if (n == 1) { size = totalsize - (thisoff + offset); } else { - FX_DWORD nextnum = syntax.GetDirectNum(); + syntax.GetDirectNum(); // Skip nextnum. FX_DWORD nextoff = syntax.GetDirectNum(); size = nextoff - thisoff; } diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp index eb08bca8a7..45b6970e2a 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp @@ -171,16 +171,16 @@ void CPDF_PageRenderCache::ResetBitmap(CPDF_Stream* pStream, const CFX_DIBitmap* m_nCacheSize = pImageCache->EstimateSize() - oldsize; } CPDF_ImageCache::CPDF_ImageCache(CPDF_Document* pDoc, CPDF_Stream* pStream) - : m_pDocument(pDoc) - , m_pStream(pStream) - , m_pCachedBitmap(NULL) - , m_pCachedMask(NULL) - , m_dwCacheSize(0) - , m_dwTimeCount(0) + : m_dwTimeCount(0) , m_pCurBitmap(NULL) , m_pCurMask(NULL) , m_MatteColor(0) , m_pRenderStatus(NULL) + , m_pDocument(pDoc) + , m_pStream(pStream) + , m_pCachedBitmap(NULL) + , m_pCachedMask(NULL) + , m_dwCacheSize(0) { } CPDF_ImageCache::~CPDF_ImageCache() diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp index 81cff01f50..7f442eb15c 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp @@ -945,7 +945,6 @@ void CPDF_DIBSource::TranslateScanline24bpp(FX_LPBYTE dest_scan, FX_LPCBYTE src_ if (m_bDefaultDecode) { if (m_Family == PDFCS_DEVICERGB || m_Family == PDFCS_CALRGB) { if (m_bpc == 16) { - FX_LPBYTE dest_pos = dest_scan; FX_LPCBYTE src_pos = src_scan; for (int col = 0; col < m_Width; col ++) { *dest_scan++ = src_pos[4]; @@ -954,7 +953,6 @@ void CPDF_DIBSource::TranslateScanline24bpp(FX_LPBYTE dest_scan, FX_LPCBYTE src_ src_pos += 6; } } else if (m_bpc == 8) { - FX_LPBYTE dest_pos = dest_scan; FX_LPCBYTE src_pos = src_scan; for (int column = 0; column < m_Width; column ++) { *dest_scan++ = src_pos[2]; @@ -1360,7 +1358,6 @@ void CPDF_DIBSource::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_ if (src_x % 2) { src_bit_pos = 4; } - int value = (1 << bpc) - 1; for (FX_DWORD i = 0; i < m_nComponents; i ++) { temp[i] = (FX_BYTE)(_GetBits8(pSrcPixel, src_bit_pos, bpc) * unit_To8Bpc); src_bit_pos += bpc; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp index ba0ca84ec4..7ffd186f72 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp @@ -71,7 +71,6 @@ static void _DrawAxialShading(CFX_DIBitmap* pBitmap, CFX_AffineMatrix* pObject2B rgb_array[i] = FXARGB_TODIB(FXARGB_MAKE(alpha, FXSYS_round(R * 255), FXSYS_round(G * 255), FXSYS_round(B * 255))); } int pitch = pBitmap->GetPitch(); - int Bpp = pBitmap->GetBPP() / 8; for (int row = 0; row < height; row ++) { FX_DWORD* dib_buf = (FX_DWORD*)(pBitmap->GetBuffer() + row * pitch); for (int column = 0; column < width; column ++) { @@ -156,7 +155,6 @@ static void _DrawRadialShading(CFX_DIBitmap* pBitmap, CFX_AffineMatrix* pObject2 int width = pBitmap->GetWidth(); int height = pBitmap->GetHeight(); int pitch = pBitmap->GetPitch(); - int Bpp = pBitmap->GetBPP() / 8; FX_BOOL bDecreasing = FALSE; if (start_r > end_r) { int length = (int)FXSYS_sqrt((FXSYS_Mul(start_x - end_x, start_x - end_x) + FXSYS_Mul(start_y - end_y, start_y - end_y))); @@ -245,7 +243,6 @@ static void _DrawFuncShading(CFX_DIBitmap* pBitmap, CFX_AffineMatrix* pObject2Bi int width = pBitmap->GetWidth(); int height = pBitmap->GetHeight(); int pitch = pBitmap->GetPitch(); - int Bpp = pBitmap->GetBPP() / 8; int total_results = 0; for (int j = 0; j < nFuncs; j ++) { if (pFuncs[j]) { @@ -743,8 +740,6 @@ static void _DrawCoonPatchMeshes(FX_BOOL bTensor, CFX_DIBitmap* pBitmap, CFX_Aff void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern, CFX_AffineMatrix* pMatrix, FX_RECT& clip_rect, int alpha, FX_BOOL bAlphaMode) { - int width = clip_rect.Width(); - int height = clip_rect.Height(); CPDF_Function** pFuncs = pPattern->m_pFunctions; int nFuncs = pPattern->m_nFuncs; CPDF_Dictionary* pDict = pPattern->m_pShadingObj->GetDict(); |