diff options
author | tsepez <tsepez@chromium.org> | 2016-04-25 11:23:43 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-25 11:23:43 -0700 |
commit | b6853cfe4fd1ee089dfdd0cb09bbc4063532ef82 (patch) | |
tree | 1404031e845c8b4b09d5a68fd81f09a7d2865d59 /xfa/fde/css/fde_cssdeclaration.cpp | |
parent | 2a8a20cde4c8e2294f6868bb097fe450960a709f (diff) | |
download | pdfium-b6853cfe4fd1ee089dfdd0cb09bbc4063532ef82.tar.xz |
Pass CFX_*StringCs to FX_HashCode_GETA and _GETW hash functions.
Too many calls were of the form fn(x.c_str(), x.GetLength())
which is an anti-pattern given the StringC classes which tie
these together.
There are a few places where explicit CFX_*StringCs are
constructed, but this can be avoided by changing the args
to these functions in the same manner.
Removed String_ from name of functions since it added
little value. Also removed default argument.
Review URL: https://codereview.chromium.org/1919563002
Diffstat (limited to 'xfa/fde/css/fde_cssdeclaration.cpp')
-rw-r--r-- | xfa/fde/css/fde_cssdeclaration.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/xfa/fde/css/fde_cssdeclaration.cpp b/xfa/fde/css/fde_cssdeclaration.cpp index 5517d85cb2..e48372c2ed 100644 --- a/xfa/fde/css/fde_cssdeclaration.cpp +++ b/xfa/fde/css/fde_cssdeclaration.cpp @@ -57,8 +57,8 @@ const FX_WCHAR* CFDE_CSSDeclaration::CopyToLocal( void* pKey = NULL; if (pCache) { void* pszCached = NULL; - pKey = - (void*)(uintptr_t)FX_HashCode_String_GetW(pszValue, iValueLen, FALSE); + pKey = (void*)(uintptr_t)FX_HashCode_GetW( + CFX_WideStringC(pszValue, iValueLen), false); if (pCache->Lookup(pKey, pszCached)) { return (const FX_WCHAR*)pszCached; } @@ -298,7 +298,7 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseEnum(const FDE_CSSPROPERTYARGS* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen) { const FDE_CSSPROPERTYVALUETABLE* pValue = - FDE_GetCSSPropertyValueByName(pszValue, iValueLen); + FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); return pValue ? NewEnumValue(pArgs->pStaticStore, pValue->eName) : NULL; } IFDE_CSSValue* CFDE_CSSDeclaration::ParseColor(const FDE_CSSPROPERTYARGS* pArgs, @@ -371,7 +371,7 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseFunction( switch (ePrimitiveType) { case FDE_CSSPRIMITIVETYPE_String: { const FDE_CSSPROPERTYVALUETABLE* pPropertyValue = - FDE_GetCSSPropertyValueByName(pszValue, iValueLen); + FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (pPropertyValue != NULL) { argumentArr.Add( NewEnumValue(pArgs->pStaticStore, pPropertyValue->eName)); @@ -429,7 +429,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseContentProperty( return FALSE; case FDE_CSSPRIMITIVETYPE_String: { const FDE_CSSPROPERTYVALUETABLE* pValue = - FDE_GetCSSPropertyValueByName(pszValue, iValueLen); + FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (pValue != NULL) { switch (pValue->eName) { case FDE_CSSPROPERTYVALUE_Normal: @@ -563,7 +563,8 @@ FX_BOOL CFDE_CSSDeclaration::ParseValueListProperty( } if (dwType & FDE_CSSVALUETYPE_MaybeEnum) { const FDE_CSSPROPERTYVALUETABLE* pValue = - FDE_GetCSSPropertyValueByName(pszValue, iValueLen); + FDE_GetCSSPropertyValueByName( + CFX_WideStringC(pszValue, iValueLen)); if (pValue != NULL) { list.Add(NewEnumValue(pStaticStore, pValue->eName)); continue; @@ -695,7 +696,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseBorderPropoerty( break; case FDE_CSSPRIMITIVETYPE_String: { const FDE_CSSCOLORTABLE* pColorItem = - FDE_GetCSSColorByName(pszValue, iValueLen); + FDE_GetCSSColorByName(CFX_WideStringC(pszValue, iValueLen)); if (pColorItem != NULL) { if (pColor == NULL) { pColor = FXTARGET_NewWith(pStaticStore) @@ -704,7 +705,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseBorderPropoerty( continue; } const FDE_CSSPROPERTYVALUETABLE* pValue = - FDE_GetCSSPropertyValueByName(pszValue, iValueLen); + FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (pValue == NULL) { continue; } @@ -786,7 +787,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseListStyleProperty( break; case FDE_CSSPRIMITIVETYPE_String: { const FDE_CSSPROPERTYVALUETABLE* pValue = - FDE_GetCSSPropertyValueByName(pszValue, iValueLen); + FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (pValue == NULL) { break; } @@ -878,7 +879,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseBackgroundProperty( } break; case FDE_CSSPRIMITIVETYPE_String: { const FDE_CSSPROPERTYVALUETABLE* pValue = - FDE_GetCSSPropertyValueByName(pszValue, iValueLen); + FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (pValue != NULL) { switch (pValue->eName) { case FDE_CSSPROPERTYVALUE_None: @@ -931,7 +932,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseBackgroundProperty( break; } const FDE_CSSCOLORTABLE* pColorItem = - FDE_GetCSSColorByName(pszValue, iValueLen); + FDE_GetCSSColorByName(CFX_WideStringC(pszValue, iValueLen)); if (pColorItem != NULL) { if (pColor == NULL) { pColor = FXTARGET_NewWith(pStaticStore) @@ -1001,7 +1002,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, switch (eType) { case FDE_CSSPRIMITIVETYPE_String: { const FDE_CSSPROPERTYVALUETABLE* pValue = - FDE_GetCSSPropertyValueByName(pszValue, iValueLen); + FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (pValue != NULL) { switch (pValue->eName) { case FDE_CSSPROPERTYVALUE_XxSmall: @@ -1139,7 +1140,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseColumnRuleProperty( switch (eType) { case FDE_CSSPRIMITIVETYPE_String: { const FDE_CSSPROPERTYVALUETABLE* pValue = - FDE_GetCSSPropertyValueByName(pszValue, iValueLen); + FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (pValue != NULL) { switch (pValue->eName) { case FDE_CSSPROPERTYVALUE_None: @@ -1236,7 +1237,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseTextEmphasisProperty( switch (eType) { case FDE_CSSPRIMITIVETYPE_String: { const FDE_CSSPROPERTYVALUETABLE* pValue = - FDE_GetCSSPropertyValueByName(pszValue, iValueLen); + FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (pValue != NULL) { arrEmphasisStyle.Add(NewEnumValue(pStaticStore, pValue->eName)); continue; @@ -1289,7 +1290,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseColumnsProperty( switch (eType) { case FDE_CSSPRIMITIVETYPE_String: { const FDE_CSSPROPERTYVALUETABLE* pValue = - FDE_GetCSSPropertyValueByName(pszValue, iValueLen); + FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (pValue == NULL && pValue->eName == FDE_CSSPROPERTYVALUE_Auto) { pColumnWidth = NewEnumValue(pStaticStore, pValue->eName); } @@ -1341,7 +1342,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseOverflowProperty( while (parser.NextValue(eType, pszValue, iValueLen)) { if (eType == FDE_CSSPRIMITIVETYPE_String) { const FDE_CSSPROPERTYVALUETABLE* pValue = - FDE_GetCSSPropertyValueByName(pszValue, iValueLen); + FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (pValue != NULL) { switch (pValue->eName) { case FDE_CSSOVERFLOW_Visible: |