summaryrefslogtreecommitdiff
path: root/xfa/fde/css/fde_cssdeclaration.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fde/css/fde_cssdeclaration.cpp')
-rw-r--r--xfa/fde/css/fde_cssdeclaration.cpp23
1 files changed, 9 insertions, 14 deletions
diff --git a/xfa/fde/css/fde_cssdeclaration.cpp b/xfa/fde/css/fde_cssdeclaration.cpp
index f4f55fc0db..570b60c670 100644
--- a/xfa/fde/css/fde_cssdeclaration.cpp
+++ b/xfa/fde/css/fde_cssdeclaration.cpp
@@ -53,26 +53,21 @@ const FX_WCHAR* CFDE_CSSDeclaration::CopyToLocal(
const FX_WCHAR* pszValue,
int32_t iValueLen) {
ASSERT(iValueLen > 0);
- CFX_MapPtrToPtr* pCache = pArgs->pStringCache;
- void* pKey = NULL;
+ std::unordered_map<uint32_t, FX_WCHAR*>* pCache = pArgs->pStringCache;
+ uint32_t key = 0;
if (pCache) {
- void* pszCached = NULL;
- pKey = (void*)(uintptr_t)FX_HashCode_GetW(
- CFX_WideStringC(pszValue, iValueLen), false);
- if (pCache->Lookup(pKey, pszCached)) {
- return (const FX_WCHAR*)pszCached;
- }
+ key = FX_HashCode_GetW(CFX_WideStringC(pszValue, iValueLen), false);
+ auto it = pCache->find(key);
+ if (it != pCache->end())
+ return it->second;
}
FX_WCHAR* psz =
(FX_WCHAR*)pArgs->pStaticStore->Alloc((iValueLen + 1) * sizeof(FX_WCHAR));
- if (psz == NULL) {
- return NULL;
- }
FXSYS_wcsncpy(psz, pszValue, iValueLen);
psz[iValueLen] = '\0';
- if (pCache) {
- pCache->SetAt(pKey, psz);
- }
+ if (pCache)
+ (*pCache)[key] = psz;
+
return psz;
}
IFDE_CSSPrimitiveValue* CFDE_CSSDeclaration::NewNumberValue(