diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-02-26 21:51:32 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-02-26 21:51:32 +0000 |
commit | e24d5a885ecde400936796b104f1950f756d90d2 (patch) | |
tree | aaed0fe0a5ac137107ef9c29a53e107c39dddccd | |
parent | 0bc02c152bd0c178a5946196e2054a5cdc7650f4 (diff) | |
download | pdfium-e24d5a885ecde400936796b104f1950f756d90d2.tar.xz |
Get rid of some static variables.
These are generally cheap enough to compute as needed, rather than
keeping around in memory all the time (plus the memory for the static
flag the compiler generates to check if initialized).
Change-Id: If3a5365521f6a7781e66fb11f04883a5c673ee11
Reviewed-on: https://pdfium-review.googlesource.com/27150
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
-rw-r--r-- | core/fpdftext/cpdf_linkextract.cpp | 5 | ||||
-rw-r--r-- | fpdfsdk/pwl/cpwl_edit_impl.cpp | 4 | ||||
-rw-r--r-- | fxjs/cfxjse_engine.cpp | 2 | ||||
-rw-r--r-- | fxjs/cjs_util.cpp | 2 | ||||
-rw-r--r-- | xfa/fwl/cfwl_widgetmgr.cpp | 4 |
5 files changed, 9 insertions, 8 deletions
diff --git a/core/fpdftext/cpdf_linkextract.cpp b/core/fpdftext/cpdf_linkextract.cpp index 05cbdfb3a7..c3cf4fc1ef 100644 --- a/core/fpdftext/cpdf_linkextract.cpp +++ b/core/fpdftext/cpdf_linkextract.cpp @@ -189,9 +189,10 @@ bool CPDF_LinkExtract::CheckWebLink(WideString* strBeCheck, int32_t* nStart, int32_t* nCount) { static const wchar_t kHttpScheme[] = L"http"; - static const size_t kHttpSchemeLen = FXSYS_len(kHttpScheme); static const wchar_t kWWWAddrStart[] = L"www."; - static const size_t kWWWAddrStartLen = FXSYS_len(kWWWAddrStart); + + const size_t kHttpSchemeLen = FXSYS_len(kHttpScheme); + const size_t kWWWAddrStartLen = FXSYS_len(kWWWAddrStart); WideString str = *strBeCheck; str.MakeLower(); diff --git a/fpdfsdk/pwl/cpwl_edit_impl.cpp b/fpdfsdk/pwl/cpwl_edit_impl.cpp index 6fad6414d0..cb774e5ef9 100644 --- a/fpdfsdk/pwl/cpwl_edit_impl.cpp +++ b/fpdfsdk/pwl/cpwl_edit_impl.cpp @@ -444,8 +444,8 @@ void CPWL_EditImpl::DrawEdit(CFX_RenderDevice* pDevice, FX_COLORREF crOldFill = crCurFill; bool bSelect = false; - static const FX_COLORREF crWhite = ArgbEncode(255, 255, 255, 255); - static const FX_COLORREF crSelBK = ArgbEncode(255, 0, 51, 113); + const FX_COLORREF crWhite = ArgbEncode(255, 255, 255, 255); + const FX_COLORREF crSelBK = ArgbEncode(255, 0, 51, 113); std::ostringstream sTextBuf; int32_t nFontIndex = -1; diff --git a/fxjs/cfxjse_engine.cpp b/fxjs/cfxjse_engine.cpp index 47911f8a2d..da117f5272 100644 --- a/fxjs/cfxjse_engine.cpp +++ b/fxjs/cfxjse_engine.cpp @@ -521,7 +521,7 @@ bool CFXJSE_Engine::QueryVariableValue(CXFA_Node* pScriptNode, } void CFXJSE_Engine::RemoveBuiltInObjs(CFXJSE_Context* pContext) const { - static const ByteStringView OBJ_NAME[2] = {"Number", "Date"}; + const ByteStringView OBJ_NAME[2] = {"Number", "Date"}; std::unique_ptr<CFXJSE_Value> pObject = pContext->GetGlobalObject(); auto hProp = pdfium::MakeUnique<CFXJSE_Value>(GetIsolate()); for (int i = 0; i < 2; ++i) { diff --git a/fxjs/cjs_util.cpp b/fxjs/cjs_util.cpp index fd064b33a6..56bf4133d3 100644 --- a/fxjs/cjs_util.cpp +++ b/fxjs/cjs_util.cpp @@ -211,7 +211,7 @@ CJS_Return CJS_Util::printd(CJS_Runtime* pRuntime, if (year < 0) return CJS_Return(JSGetStringFromID(JSMessage::kValueError)); - static const TbConvertAdditional cTableAd[] = { + const TbConvertAdditional cTableAd[] = { {L"m", month}, {L"d", day}, {L"H", hour}, {L"h", hour > 12 ? hour - 12 : hour}, {L"M", min}, {L"s", sec}, diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp index 3082b182ad..0860556665 100644 --- a/xfa/fwl/cfwl_widgetmgr.cpp +++ b/xfa/fwl/cfwl_widgetmgr.cpp @@ -525,10 +525,10 @@ bool CFWL_WidgetMgr::IsNeedRepaint(CFWL_Widget* pWidget, bool bChildIntersectWithDirty = false; bool bOrginPtIntersectWidthChild = false; bool bOrginPtIntersectWidthDirty = rtDirty.Contains(rtWidget.TopLeft()); - static FWL_NEEDREPAINTHITDATA hitPoint[kNeedRepaintHitPoints]; - memset(hitPoint, 0, sizeof(hitPoint)); float fxPiece = rtWidget.width / kNeedRepaintHitPiece; float fyPiece = rtWidget.height / kNeedRepaintHitPiece; + FWL_NEEDREPAINTHITDATA hitPoint[kNeedRepaintHitPoints]; + memset(hitPoint, 0, sizeof(hitPoint)); hitPoint[2].hitPoint.x = hitPoint[6].hitPoint.x = rtWidget.left; hitPoint[0].hitPoint.x = hitPoint[3].hitPoint.x = hitPoint[7].hitPoint.x = hitPoint[10].hitPoint.x = fxPiece + rtWidget.left; |