diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-05-21 14:54:17 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-05-21 14:54:17 -0700 |
commit | e6406b39d09f765f5f1a1530a3a737f17a0666c1 (patch) | |
tree | 79b2b130b121750deff93feb206695614552f4f3 | |
parent | bc4b82ea7a9c6603c6a1c89e00f4e6381c1b6804 (diff) | |
download | pdfium-e6406b39d09f765f5f1a1530a3a737f17a0666c1.tar.xz |
Fix four annoying warnings:
Two "set but unused", one of which is surely an artifact from
copying code around, and the other which ought to be used for
the sake of clarity.
Two are unknown "optimize" pragmas, remove them since the code
has been shipped for years on other platforms under full optimization.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1148353002
-rw-r--r-- | core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp | 33 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp | 2 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp | 2 |
3 files changed, 15 insertions, 22 deletions
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp index a5a91ebc53..9096bf938e 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp @@ -190,8 +190,10 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F } } const CFX_DIBitmap* pMaskBitmap = NULL; + FX_BOOL bDeleteMask = FALSE; if (pBitmap->HasAlpha()) { pMaskBitmap = pBitmap->GetAlphaMask(); + bDeleteMask = TRUE; } if (!pMaskBitmap && pMask) { FXDIB_Format maskFormat = pMask->GetFormat(); @@ -204,7 +206,6 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F FX_INT32 maskHeight = pMaskBitmap->GetHeight(); FX_LPBYTE mask_buf = NULL; FX_STRSIZE mask_size; - FX_BOOL bDeleteMask = TRUE; CPDF_Dictionary* pMaskDict = new CPDF_Dictionary; pMaskDict->SetAtName(FX_BSTRC("Type"), FX_BSTRC("XObject")); pMaskDict->SetAtName(FX_BSTRC("Subtype"), FX_BSTRC("Image")); @@ -223,24 +224,20 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F FXSYS_memcpy32(mask_buf + a * maskWidth, pMaskBitmap->GetScanline(a), maskWidth); } } - if (pMaskDict) { - pMaskDict->SetAtInteger(FX_BSTRC("Length"), mask_size); - CPDF_Stream* pMaskStream = NULL; - if (bUseMatte) { - int a, r, g, b; - ArgbDecode(*(pParam->pMatteColor), a, r, g, b); - CPDF_Array* pMatte = new CPDF_Array; - pMatte->AddInteger(r); - pMatte->AddInteger(g); - pMatte->AddInteger(b); - pMaskDict->SetAt(FX_BSTRC("Matte"), pMatte); - } - pMaskStream = new CPDF_Stream(mask_buf, mask_size, pMaskDict); - m_pDocument->AddIndirectObject(pMaskStream); - bDeleteMask = FALSE; - pDict->SetAtReference(FX_BSTRC("SMask"), m_pDocument, pMaskStream); + pMaskDict->SetAtInteger(FX_BSTRC("Length"), mask_size); + if (bUseMatte) { + int a, r, g, b; + ArgbDecode(*(pParam->pMatteColor), a, r, g, b); + CPDF_Array* pMatte = new CPDF_Array; + pMatte->AddInteger(r); + pMatte->AddInteger(g); + pMatte->AddInteger(b); + pMaskDict->SetAt(FX_BSTRC("Matte"), pMatte); } - if (pBitmap->HasAlpha()) { + CPDF_Stream* pMaskStream = new CPDF_Stream(mask_buf, mask_size, pMaskDict); + m_pDocument->AddIndirectObject(pMaskStream); + pDict->SetAtReference(FX_BSTRC("SMask"), m_pDocument, pMaskStream); + if (bDeleteMask) { delete pMaskBitmap; } } diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp index 8ec490a9e8..924c88e421 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp @@ -73,7 +73,6 @@ CPDF_PSProc::~CPDF_PSProc() } } } -#pragma optimize( "", off ) FX_BOOL CPDF_PSProc::Execute(CPDF_PSEngine* pEngine) { int size = m_Operators.GetSize(); @@ -107,7 +106,6 @@ FX_BOOL CPDF_PSProc::Execute(CPDF_PSEngine* pEngine) } return TRUE; } -#pragma optimize( "", on ) CPDF_PSEngine::CPDF_PSEngine() { m_StackCount = 0; diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp index 691981cb10..d18caab217 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp @@ -232,11 +232,9 @@ ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(FX_LPCBYTE src_buf, FX_DWORD int nComps, int bpc, const CPDF_Dictionary* pParams) { int predictor = 0; - FX_BOOL bEarlyChange = TRUE; int Colors = 0, BitsPerComponent = 0, Columns = 0; if (pParams) { predictor = ((CPDF_Dictionary*)pParams)->GetInteger(FX_BSTRC("Predictor")); - bEarlyChange = ((CPDF_Dictionary*)pParams)->GetInteger(FX_BSTRC("EarlyChange"), 1); Colors = pParams->GetInteger(FX_BSTRC("Colors"), 1); BitsPerComponent = pParams->GetInteger(FX_BSTRC("BitsPerComponent"), 8); Columns = pParams->GetInteger(FX_BSTRC("Columns"), 1); |