From b6853cfe4fd1ee089dfdd0cb09bbc4063532ef82 Mon Sep 17 00:00:00 2001 From: tsepez Date: Mon, 25 Apr 2016 11:23:43 -0700 Subject: 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 --- xfa/fgas/localization/fgas_locale.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'xfa/fgas/localization') diff --git a/xfa/fgas/localization/fgas_locale.cpp b/xfa/fgas/localization/fgas_locale.cpp index 6e0add1fa5..9a8e05cbc7 100644 --- a/xfa/fgas/localization/fgas_locale.cpp +++ b/xfa/fgas/localization/fgas_locale.cpp @@ -595,8 +595,7 @@ FX_LOCALECATEGORY CFX_FormatString::GetCategory( wsCategory += pStr[ccf]; ccf++; } - uint32_t dwHash = - FX_HashCode_String_GetW(wsCategory.c_str(), wsCategory.GetLength()); + uint32_t dwHash = FX_HashCode_GetW(wsCategory.AsStringC(), false); if (dwHash == FX_LOCALECATEGORY_DateHash) { if (eCategory == FX_LOCALECATEGORY_Time) { return FX_LOCALECATEGORY_DateTime; @@ -755,8 +754,8 @@ IFX_Locale* CFX_FormatString::GetNumericFormat(const CFX_WideString& wsPattern, while (ccf < iLenf && pStr[ccf] != '(' && pStr[ccf] != '{') { wsSubCategory += pStr[ccf++]; } - uint32_t dwSubHash = FX_HashCode_String_GetW( - wsSubCategory.c_str(), wsSubCategory.GetLength()); + uint32_t dwSubHash = + FX_HashCode_GetW(wsSubCategory.AsStringC(), false); FX_LOCALENUMSUBCATEGORY eSubCategory = FX_LOCALENUMPATTERN_Decimal; for (int32_t i = 0; i < g_iFXLocaleNumSubCatCount; i++) { if (g_FXLocaleNumSubCatData[i].uHash == dwSubHash) { @@ -2209,8 +2208,8 @@ FX_DATETIMETYPE CFX_FormatString::GetDateTimeFormat( while (ccf < iLenf && pStr[ccf] != '(' && pStr[ccf] != '{') { wsSubCategory += pStr[ccf++]; } - uint32_t dwSubHash = FX_HashCode_String_GetW( - wsSubCategory.c_str(), wsSubCategory.GetLength()); + uint32_t dwSubHash = + FX_HashCode_GetW(wsSubCategory.AsStringC(), false); FX_LOCALEDATETIMESUBCATEGORY eSubCategory = FX_LOCALEDATETIMESUBCATEGORY_Medium; for (int32_t i = 0; i < g_iFXLocaleDateTimeSubCatCount; i++) { -- cgit v1.2.3