Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(557)

Unified Diff: xfa/fde/css/fde_cssdatatable.cpp

Issue 1919563002: Pass CFX_*StringCs to FX_HashCode_GETA and _GETW hash functions. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: fix issue from c4 Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/fde/css/fde_cssdatatable.h ('k') | xfa/fde/css/fde_cssdeclaration.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fde/css/fde_cssdatatable.cpp
diff --git a/xfa/fde/css/fde_cssdatatable.cpp b/xfa/fde/css/fde_cssdatatable.cpp
index 6abe5a7a26be3e54d541d5ac9ce00a1387ec67c5..f37f77b86c856fa0b0defa70b1fc8ce1b5ab5c85 100644
--- a/xfa/fde/css/fde_cssdatatable.cpp
+++ b/xfa/fde/css/fde_cssdatatable.cpp
@@ -557,10 +557,10 @@ FDE_LPCCSSPERSUDOTABLE FDE_GetCSSPersudoByEnum(FDE_CSSPERSUDO ePersudo) {
return (ePersudo < FDE_CSSPERSUDO_NONE) ? (g_FDE_CSSPersudoType + ePersudo)
: NULL;
}
-FDE_LPCCSSPROPERTYTABLE FDE_GetCSSPropertyByName(const FX_WCHAR* pszName,
- int32_t iLength) {
- FXSYS_assert(pszName != NULL && iLength > 0);
- uint32_t dwHash = FX_HashCode_String_GetW(pszName, iLength, TRUE);
+FDE_LPCCSSPROPERTYTABLE FDE_GetCSSPropertyByName(
+ const CFX_WideStringC& wsName) {
+ FXSYS_assert(!wsName.IsEmpty());
+ uint32_t dwHash = FX_HashCode_GetW(wsName, true);
int32_t iEnd = FDE_CSSPROPERTY_MAX - 1;
int32_t iMid, iStart = 0;
uint32_t dwMid;
@@ -581,10 +581,9 @@ FDE_LPCCSSPROPERTYTABLE FDE_GetCSSPropertyByEnum(FDE_CSSPROPERTY eName) {
return (eName < FDE_CSSPROPERTY_MAX) ? (g_FDE_CSSProperties + eName) : NULL;
}
FDE_LPCCSSPROPERTYVALUETABLE FDE_GetCSSPropertyValueByName(
- const FX_WCHAR* pszName,
- int32_t iLength) {
- FXSYS_assert(pszName != NULL && iLength > 0);
- uint32_t dwHash = FX_HashCode_String_GetW(pszName, iLength, TRUE);
+ const CFX_WideStringC& wsName) {
+ FXSYS_assert(!wsName.IsEmpty());
+ uint32_t dwHash = FX_HashCode_GetW(wsName, true);
int32_t iEnd = FDE_CSSPROPERTYVALUE_MAX - 1;
int32_t iMid, iStart = 0;
uint32_t dwMid;
@@ -606,10 +605,10 @@ FDE_LPCCSSPROPERTYVALUETABLE FDE_GetCSSPropertyValueByEnum(
return (eName < FDE_CSSPROPERTYVALUE_MAX) ? (g_FDE_CSSPropertyValues + eName)
: NULL;
}
-FDE_LPCCSSMEDIATYPETABLE FDE_GetCSSMediaTypeByName(const FX_WCHAR* pszName,
- int32_t iLength) {
- FXSYS_assert(pszName != NULL && iLength > 0);
- uint16_t wHash = (uint16_t)FX_HashCode_String_GetW(pszName, iLength, TRUE);
+FDE_LPCCSSMEDIATYPETABLE FDE_GetCSSMediaTypeByName(
+ const CFX_WideStringC& wsName) {
+ FXSYS_assert(!wsName.IsEmpty());
+ uint16_t wHash = FX_HashCode_GetW(wsName, true);
int32_t iEnd =
sizeof(g_FDE_CSSMediaTypes) / sizeof(FDE_CSSMEDIATYPETABLE) - 1;
int32_t iMid, iStart = 0;
@@ -627,10 +626,10 @@ FDE_LPCCSSMEDIATYPETABLE FDE_GetCSSMediaTypeByName(const FX_WCHAR* pszName,
} while (iStart <= iEnd);
return NULL;
}
-FDE_LPCCSSLENGTHUNITTABLE FDE_GetCSSLengthUnitByName(const FX_WCHAR* pszName,
- int32_t iLength) {
- FXSYS_assert(pszName != NULL && iLength > 0);
- uint16_t wHash = (uint16_t)FX_HashCode_String_GetW(pszName, iLength, TRUE);
+FDE_LPCCSSLENGTHUNITTABLE FDE_GetCSSLengthUnitByName(
+ const CFX_WideStringC& wsName) {
+ FXSYS_assert(!wsName.IsEmpty());
+ uint16_t wHash = FX_HashCode_GetW(wsName, true);
int32_t iEnd =
sizeof(g_FDE_CSSLengthUnits) / sizeof(FDE_CSSLENGTHUNITTABLE) - 1;
int32_t iMid, iStart = 0;
@@ -648,10 +647,9 @@ FDE_LPCCSSLENGTHUNITTABLE FDE_GetCSSLengthUnitByName(const FX_WCHAR* pszName,
} while (iStart <= iEnd);
return NULL;
}
-FDE_LPCCSSCOLORTABLE FDE_GetCSSColorByName(const FX_WCHAR* pszName,
- int32_t iLength) {
- FXSYS_assert(pszName != NULL && iLength > 0);
- uint32_t dwHash = FX_HashCode_String_GetW(pszName, iLength, TRUE);
+FDE_LPCCSSCOLORTABLE FDE_GetCSSColorByName(const CFX_WideStringC& wsName) {
+ FXSYS_assert(!wsName.IsEmpty());
+ uint32_t dwHash = FX_HashCode_GetW(wsName, true);
int32_t iEnd = sizeof(g_FDE_CSSColors) / sizeof(FDE_CSSCOLORTABLE) - 1;
int32_t iMid, iStart = 0;
uint32_t dwMid;
@@ -684,7 +682,8 @@ FX_BOOL FDE_ParseCSSNumber(const FX_WCHAR* pszValue,
if (iValueLen >= 1 && *pszValue == '%') {
eUnit = FDE_CSSPRIMITIVETYPE_Percent;
} else if (iValueLen == 2) {
- FDE_LPCCSSLENGTHUNITTABLE pUnit = FDE_GetCSSLengthUnitByName(pszValue, 2);
+ FDE_LPCCSSLENGTHUNITTABLE pUnit =
+ FDE_GetCSSLengthUnitByName(CFX_WideStringC(pszValue, 2));
if (pUnit != NULL) {
eUnit = (FDE_CSSPRIMITIVETYPE)pUnit->wValue;
}
@@ -770,7 +769,8 @@ FX_BOOL FDE_ParseCSSColor(const FX_WCHAR* pszValue,
dwColor = ArgbEncode(255, rgb[0], rgb[1], rgb[2]);
return TRUE;
} else {
- FDE_LPCCSSCOLORTABLE pColor = FDE_GetCSSColorByName(pszValue, iValueLen);
+ FDE_LPCCSSCOLORTABLE pColor =
+ FDE_GetCSSColorByName(CFX_WideStringC(pszValue, iValueLen));
if (pColor != NULL) {
dwColor = pColor->dwValue;
return TRUE;
« no previous file with comments | « xfa/fde/css/fde_cssdatatable.h ('k') | xfa/fde/css/fde_cssdeclaration.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698