Replace FPF_GetHashCode_StringA() with FX_HashCode_GetA()
De-duplicate some code between fxcrt/ and fxge/ for android.
-- convert FPF_SKIANormalizeFontName() to unsigned for consistency
with FX_HashCode_GetA().
Change-Id: I11728b3b1780363ab43f63dddf383f484295bdb3
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/91250
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxge/android/cfpf_skiafontmgr.cpp b/core/fxge/android/cfpf_skiafontmgr.cpp
index 6cbb019..7722e64 100644
--- a/core/fxge/android/cfpf_skiafontmgr.cpp
+++ b/core/fxge/android/cfpf_skiafontmgr.cpp
@@ -123,16 +123,9 @@
return FPF_SKIACHARSET_Default;
}
-uint32_t FPF_GetHashCode_StringA(ByteStringView bsStr) {
- uint32_t uHashCode = 0;
- for (char ch : bsStr)
- uHashCode = 31 * uHashCode + tolower(ch);
- return uHashCode;
-}
-
uint32_t FPF_SKIANormalizeFontName(ByteStringView bsFamily) {
uint32_t uHashCode = 0;
- for (char ch : bsFamily) {
+ for (unsigned char ch : bsFamily) {
if (ch == ' ' || ch == '-' || ch == ',')
continue;
uHashCode = 31 * uHashCode + tolower(ch);
@@ -151,7 +144,7 @@
if (FontStyleIsSerif(dwStyle))
bsFont += "Serif";
bsFont += static_cast<uint8_t>(uCharset);
- return FPF_GetHashCode_StringA(bsFont.AsStringView());
+ return FX_HashCode_GetA(bsFont.AsStringView());
}
bool FPF_SkiaIsCJK(FX_Charset uCharset) {