From 6c55495fcaf634e7f788f4dfe77fa1a106c9cd55 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Tue, 29 Jul 2014 10:13:17 -0700 Subject: 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 --- core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp | 2 +- core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp | 4 +- core/src/fpdfapi/fpdf_font/fpdf_font.cpp | 2 +- core/src/fpdfapi/fpdf_font/fpdf_font_utility.cpp | 7 ++- core/src/fpdfapi/fpdf_font/ttgsubtable.h | 6 +-- core/src/fpdfapi/fpdf_page/fpdf_page.cpp | 4 -- core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp | 3 -- core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp | 1 - core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp | 2 - .../fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp | 1 - .../src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp | 2 +- core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp | 12 ++--- .../fpdfapi/fpdf_render/fpdf_render_loadimage.cpp | 3 -- .../fpdfapi/fpdf_render/fpdf_render_pattern.cpp | 5 -- core/src/fpdfdoc/doc_form.cpp | 8 ++-- core/src/fpdfdoc/doc_vt.cpp | 1 - core/src/fpdfdoc/pdf_vt.h | 3 -- core/src/fpdftext/fpdf_text_search.cpp | 4 -- core/src/fxcodec/codec/fx_codec_jpeg.cpp | 53 ---------------------- core/src/fxge/ge/fx_ge_fontmap.cpp | 10 ++-- fpdfsdk/include/fsdk_annothandler.h | 2 +- fpdfsdk/include/javascript/JS_GlobalData.h | 1 - fpdfsdk/src/javascript/JS_GlobalData.cpp | 2 +- fpdfsdk/src/javascript/PublicMethods.cpp | 27 +++++------ fpdfsdk/src/javascript/util.cpp | 34 +++++++------- fpdfsdk/src/pdfwindow/PWL_Wnd.cpp | 2 +- 26 files changed, 60 insertions(+), 141 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(); diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp index c1e41526d4..821b9981b8 100644 --- a/core/src/fpdfdoc/doc_form.cpp +++ b/core/src/fpdfdoc/doc_form.cpp @@ -1492,10 +1492,10 @@ const struct _SupportFieldEncoding { FX_LPCSTR m_name; FX_INT32 m_codePage; } g_fieldEncoding[] = { - "BigFive", 950, - "GBK", 936, - "Shift-JIS", 932, - "UHC", 949, + { "BigFive", 950 }, + { "GBK", 936 }, + { "Shift-JIS", 932 }, + { "UHC", 949 }, }; static void FPDFDOC_FDF_GetFieldValue(CPDF_Dictionary *pFieldDict, CFX_WideString &csValue, CFX_ByteString &bsEncoding) { diff --git a/core/src/fpdfdoc/doc_vt.cpp b/core/src/fpdfdoc/doc_vt.cpp index 9de9ffd426..09fa2bf416 100644 --- a/core/src/fpdfdoc/doc_vt.cpp +++ b/core/src/fpdfdoc/doc_vt.cpp @@ -815,7 +815,6 @@ CPDF_VariableText::CPDF_VariableText() : m_nCharArray(0), m_nAlignment(0), m_fCharSpace(0.0f), - m_fWordSpace(0.0f), m_fFontSize(0.0f), m_nHorzScale(100), m_wSubWord(0), diff --git a/core/src/fpdfdoc/pdf_vt.h b/core/src/fpdfdoc/pdf_vt.h index 0f74cef5bd..09ed0b0317 100644 --- a/core/src/fpdfdoc/pdf_vt.h +++ b/core/src/fpdfdoc/pdf_vt.h @@ -603,14 +603,11 @@ private: FX_FLOAT m_fCharSpace; FX_INT32 m_nHorzScale; FX_WORD m_wSubWord; - FX_FLOAT m_fWordSpace; FX_FLOAT m_fFontSize; private: FX_BOOL m_bInitial; FX_BOOL m_bRichText; - FX_FLOAT m_fCaretOriginX; - FX_INT32 m_nCurFontIndex; IPDF_VariableText_Provider * m_pVTProvider; CPDF_VariableText_Iterator * m_pVTIterator; }; diff --git a/core/src/fpdftext/fpdf_text_search.cpp b/core/src/fpdftext/fpdf_text_search.cpp index 8c81ad9f66..3bd6450303 100644 --- a/core/src/fpdftext/fpdf_text_search.cpp +++ b/core/src/fpdftext/fpdf_text_search.cpp @@ -136,13 +136,9 @@ int FPDFText_ProcessInterObj(const CPDF_TextObject* pPrevObj, const CPDF_TextObj } FX_BOOL CPDF_TextStream::ProcessObject(const CPDF_TextObject* pObj, FX_BOOL bFirstLine) { - if(pObj->m_Bottom > 380 && pObj->m_Left < 45 && pObj->m_Top < 402) { - int i = 0; - } CPDF_Font* pFont = pObj->GetFont(); CFX_AffineMatrix matrix; pObj->GetTextMatrix(&matrix); - FX_FLOAT fs = pObj->GetFontSize(); int item_index = 0; if (m_pLastObj) { int result = FPDFText_ProcessInterObj(m_pLastObj, pObj); diff --git a/core/src/fxcodec/codec/fx_codec_jpeg.cpp b/core/src/fxcodec/codec/fx_codec_jpeg.cpp index 37399f8eb8..ac4be23e2c 100644 --- a/core/src/fxcodec/codec/fx_codec_jpeg.cpp +++ b/core/src/fxcodec/codec/fx_codec_jpeg.cpp @@ -82,59 +82,6 @@ static FX_BOOL _JpegIsIccMarker(jpeg_saved_marker_ptr marker) } return FALSE; } -static FX_BOOL _JpegLoadIccProfile(j_decompress_ptr cinfo, FX_LPBYTE* icc_buf_ptr, FX_DWORD* icc_length) -{ - if(icc_buf_ptr == NULL || icc_length == NULL) { - return FALSE; - } - *icc_buf_ptr = NULL; - *icc_length = 0; - FX_LPBYTE icc_data_ptr = NULL; - FX_DWORD icc_data_len = 0; - FX_BYTE count_icc_marker = 0; - FX_BYTE num_icc_marker = 0; - jpeg_saved_marker_ptr marker_list[256] = {NULL}; - for (jpeg_saved_marker_ptr cur_marker = cinfo->marker_list; - cur_marker != NULL; - cur_marker = cur_marker->next) { - if(_JpegIsIccMarker(cur_marker)) { - if(count_icc_marker == 0) { - num_icc_marker = cur_marker->data[13]; - } else if(num_icc_marker != cur_marker->data[13]) { - return FALSE; - } - int sn = cur_marker->data[12] - 1; - if(sn < 0 || sn >= num_icc_marker) { - return FALSE; - } - if(marker_list[sn] == NULL) { - marker_list[sn] = cur_marker; - } else { - return FALSE; - } - count_icc_marker ++; - icc_data_len += (cur_marker->data_length - JPEG_OVERHEAD_LEN); - } - } - if(count_icc_marker != num_icc_marker) { - return FALSE; - } - if(num_icc_marker == 0) { - return TRUE; - } - icc_data_ptr = FX_Alloc(FX_BYTE, icc_data_len); - if(icc_buf_ptr == NULL) { - return FALSE; - } - *icc_buf_ptr = icc_data_ptr; - *icc_length = icc_data_len; - for (int idx = 0; idx < num_icc_marker; idx++) { - icc_data_len = marker_list[idx]->data_length - JPEG_OVERHEAD_LEN; - FXSYS_memcpy32(icc_data_ptr, marker_list[idx]->data + JPEG_OVERHEAD_LEN, icc_data_len); - icc_data_ptr += icc_data_len; - } - return TRUE; -} static FX_BOOL _JpegEmbedIccProfile(j_compress_ptr cinfo, FX_LPCBYTE icc_buf_ptr, FX_DWORD icc_length) { if(icc_buf_ptr == NULL || icc_length == 0) { diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp index f5d378d55b..4c99765e7d 100644 --- a/core/src/fxge/ge/fx_ge_fontmap.cpp +++ b/core/src/fxge/ge/fx_ge_fontmap.cpp @@ -859,11 +859,11 @@ typedef struct _FX_FontStyle { FX_INT32 len; } FX_FontStyle; const FX_FontStyle g_FontStyles[] = { - "Bold", 4, - "Italic", 6, - "BoldItalic", 10, - "Reg", 3, - "Regular", 7, + { "Bold", 4 }, + { "Italic", 6 }, + { "BoldItalic", 10 }, + { "Reg", 3 }, + { "Regular", 7 }, }; CFX_ByteString ParseStyle(FX_LPCSTR pStyle, int iLen, int iIndex) { diff --git a/fpdfsdk/include/fsdk_annothandler.h b/fpdfsdk/include/fsdk_annothandler.h index fec3d927d9..9f97c52596 100644 --- a/fpdfsdk/include/fsdk_annothandler.h +++ b/fpdfsdk/include/fsdk_annothandler.h @@ -85,7 +85,7 @@ public: class CPDFSDK_BFAnnotHandler:public IPDFSDK_AnnotHandler { public: - CPDFSDK_BFAnnotHandler(CPDFDoc_Environment* pApp):m_pFormFiller(NULL),m_pApp(pApp) {} + CPDFSDK_BFAnnotHandler(CPDFDoc_Environment* pApp) : m_pApp(pApp), m_pFormFiller(NULL) {} virtual ~CPDFSDK_BFAnnotHandler() {} public: diff --git a/fpdfsdk/include/javascript/JS_GlobalData.h b/fpdfsdk/include/javascript/JS_GlobalData.h index 1001ff6320..8eee158a00 100644 --- a/fpdfsdk/include/javascript/JS_GlobalData.h +++ b/fpdfsdk/include/javascript/JS_GlobalData.h @@ -91,7 +91,6 @@ private: private: CFX_ArrayTemplate m_arrayGlobalData; CFX_WideString m_sFilePath; - CPDFDoc_Environment* m_pApp; }; #endif //_JS_GLOBALDATA_H_ diff --git a/fpdfsdk/src/javascript/JS_GlobalData.cpp b/fpdfsdk/src/javascript/JS_GlobalData.cpp index 2207726890..83771dfe57 100644 --- a/fpdfsdk/src/javascript/JS_GlobalData.cpp +++ b/fpdfsdk/src/javascript/JS_GlobalData.cpp @@ -117,7 +117,7 @@ static const FX_BYTE JS_RC4KEY[] = {0x19,0xa8,0xe8,0x01,0xf6,0xa8,0xb6,0x4d,0x82 0x55,0x8b,0x6e,0x6b,0x19,0xa0,0xf8,0x77,0xd5,0xa3 }; -CJS_GlobalData::CJS_GlobalData(CPDFDoc_Environment* pApp) : m_pApp(pApp) +CJS_GlobalData::CJS_GlobalData(CPDFDoc_Environment* pApp) { // IBaseAnnot* pBaseAnnot = IBaseAnnot::GetBaseAnnot(m_pApp); // ASSERT(pBaseAnnot != NULL); diff --git a/fpdfsdk/src/javascript/PublicMethods.cpp b/fpdfsdk/src/javascript/PublicMethods.cpp index c030d6cad2..e307f432d3 100644 --- a/fpdfsdk/src/javascript/PublicMethods.cpp +++ b/fpdfsdk/src/javascript/PublicMethods.cpp @@ -68,25 +68,26 @@ struct stru_TbConvert FX_LPCSTR lpszCppMark; }; -static const stru_TbConvert fcTable[] = {"mmmm","%B", - "mmm", "%b", - "mm", "%m", +static const stru_TbConvert fcTable[] = { + { "mmmm","%B" }, + { "mmm", "%b" }, + { "mm", "%m" }, //"m" - "dddd","%A", - "ddd", "%a", - "dd", "%d", + { "dddd","%A" }, + { "ddd", "%a" }, + { "dd", "%d" }, //"d", "%w", - "yyyy","%Y", - "yy", "%y", - "HH", "%H", + { "yyyy","%Y" }, + { "yy", "%y" }, + { "HH", "%H" }, //"H" - "hh", "%I", + { "hh", "%I" }, //"h" - "MM", "%M", + { "MM", "%M" }, //"M" - "ss", "%S", + { "ss", "%S" }, //"s - "tt", "%p" + { "tt", "%p" }, //"t" }; diff --git a/fpdfsdk/src/javascript/util.cpp b/fpdfsdk/src/javascript/util.cpp index bafdb22da9..6563a10f97 100644 --- a/fpdfsdk/src/javascript/util.cpp +++ b/fpdfsdk/src/javascript/util.cpp @@ -63,32 +63,32 @@ struct stru_TbConvert }; const stru_TbConvert fcTable[] = { - (FX_LPCWSTR)L"mmmm", (FX_LPCWSTR)L"%B", - (FX_LPCWSTR)L"mmm", (FX_LPCWSTR)L"%b", - (FX_LPCWSTR)L"mm", (FX_LPCWSTR)L"%m", + { (FX_LPCWSTR)L"mmmm", (FX_LPCWSTR)L"%B" }, + { (FX_LPCWSTR)L"mmm", (FX_LPCWSTR)L"%b" }, + { (FX_LPCWSTR)L"mm", (FX_LPCWSTR)L"%m" }, //"m" - (FX_LPCWSTR)L"dddd", (FX_LPCWSTR)L"%A", - (FX_LPCWSTR)L"ddd", (FX_LPCWSTR)L"%a", - (FX_LPCWSTR)L"dd", (FX_LPCWSTR)L"%d", + { (FX_LPCWSTR)L"dddd", (FX_LPCWSTR)L"%A" }, + { (FX_LPCWSTR)L"ddd", (FX_LPCWSTR)L"%a" }, + { (FX_LPCWSTR)L"dd", (FX_LPCWSTR)L"%d" }, //"d", "%w", - (FX_LPCWSTR)L"yyyy", (FX_LPCWSTR)L"%Y", - (FX_LPCWSTR)L"yy", (FX_LPCWSTR)L"%y", - (FX_LPCWSTR)L"HH", (FX_LPCWSTR)L"%H", + { (FX_LPCWSTR)L"yyyy", (FX_LPCWSTR)L"%Y" }, + { (FX_LPCWSTR)L"yy", (FX_LPCWSTR)L"%y" }, + { (FX_LPCWSTR)L"HH", (FX_LPCWSTR)L"%H" }, //"H" - (FX_LPCWSTR)L"hh", (FX_LPCWSTR)L"%I", + { (FX_LPCWSTR)L"hh", (FX_LPCWSTR)L"%I" }, //"h" - (FX_LPCWSTR)L"MM", (FX_LPCWSTR)L"%M", + { (FX_LPCWSTR)L"MM", (FX_LPCWSTR)L"%M" }, //"M" - (FX_LPCWSTR)L"ss", (FX_LPCWSTR)L"%S", + { (FX_LPCWSTR)L"ss", (FX_LPCWSTR)L"%S" }, //"s - (FX_LPCWSTR)L"TT", (FX_LPCWSTR)L"%p", + { (FX_LPCWSTR)L"TT", (FX_LPCWSTR)L"%p" }, //"t" #if defined(_WIN32) - (FX_LPCWSTR)L"tt", (FX_LPCWSTR)L"%p", - (FX_LPCWSTR)L"h", (FX_LPCWSTR)L"%#I", + { (FX_LPCWSTR)L"tt", (FX_LPCWSTR)L"%p" }, + { (FX_LPCWSTR)L"h", (FX_LPCWSTR)L"%#I" }, #else - (FX_LPCWSTR)L"tt", (FX_LPCWSTR)L"%P", - (FX_LPCWSTR)L"h", (FX_LPCWSTR)L"%l", + { (FX_LPCWSTR)L"tt", (FX_LPCWSTR)L"%P" }, + { (FX_LPCWSTR)L"h", (FX_LPCWSTR)L"%l" }, #endif }; diff --git a/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp index 9bb784c8a6..bc3348736b 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp @@ -14,8 +14,8 @@ static CFX_MapPtrTemplate g_TimeMap; CPWL_Timer::CPWL_Timer(CPWL_TimerHandler* pAttached, IFX_SystemHandler* pSystemHandler) : - m_pAttached(pAttached), m_nTimerID(0), + m_pAttached(pAttached), m_pSystemHandler(pSystemHandler) { ASSERT(m_pAttached != NULL); -- cgit v1.2.3