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

Unified Diff: xfa/fgas/font/fgas_stdfontmgr.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/fgas/font/fgas_fontutils.cpp ('k') | xfa/fgas/localization/fgas_locale.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fgas/font/fgas_stdfontmgr.cpp
diff --git a/xfa/fgas/font/fgas_stdfontmgr.cpp b/xfa/fgas/font/fgas_stdfontmgr.cpp
index 9e8c824118ee825955ed4feef75953c78af45cdc..4b2a1422d2d7c30248616f6be535dd2539c01ecd 100644
--- a/xfa/fgas/font/fgas_stdfontmgr.cpp
+++ b/xfa/fgas/font/fgas_stdfontmgr.cpp
@@ -176,7 +176,7 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(const uint8_t* pBuffer, int32_t iLength) {
}
IFX_Font* CFX_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFileName) {
FXSYS_assert(pszFileName != NULL);
- uint32_t dwHash = FX_HashCode_String_GetW(pszFileName, -1);
+ uint32_t dwHash = FX_HashCode_GetW(pszFileName, false);
IFX_Font* pFont = NULL;
if (m_FileFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont)) {
if (pFont != NULL) {
@@ -230,8 +230,8 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(IFX_Font* pSrcFont,
}
void* buffer[3] = {pSrcFont, (void*)(uintptr_t)dwFontStyles,
(void*)(uintptr_t)wCodePage};
- uint32_t dwHash =
- FX_HashCode_String_GetA((const FX_CHAR*)buffer, 3 * sizeof(void*));
+ uint32_t dwHash = FX_HashCode_GetA(
+ CFX_ByteStringC((uint8_t*)buffer, sizeof(buffer)), false);
IFX_Font* pFont = NULL;
if (m_DeriveFonts.GetCount() > 0) {
m_DeriveFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont);
@@ -702,8 +702,7 @@ IFX_Font* CFX_FontMgrImp::GetFontByCodePage(uint16_t wCodePage,
CFX_ByteString bsHash;
bsHash.Format("%d, %d", wCodePage, dwFontStyles);
bsHash += CFX_WideString(pszFontFamily).UTF8Encode();
- uint32_t dwHash = FX_HashCode_String_GetA(bsHash.c_str(), bsHash.GetLength());
-
+ uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringC(), false);
CFX_ArrayTemplate<IFX_Font*>* pFonts = nullptr;
if (m_Hash2Fonts.Lookup(dwHash, pFonts)) {
if (!pFonts)
@@ -759,7 +758,7 @@ IFX_Font* CFX_FontMgrImp::GetFontByUnicode(FX_WCHAR wUnicode,
else
bsHash.Format("%d, %d", wCodePage, dwFontStyles);
bsHash += CFX_WideString(pszFontFamily).UTF8Encode();
- uint32_t dwHash = FX_HashCode_String_GetA(bsHash.c_str(), bsHash.GetLength());
+ uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringC(), false);
CFX_ArrayTemplate<IFX_Font*>* pFonts = nullptr;
if (m_Hash2Fonts.Lookup(dwHash, pFonts)) {
if (!pFonts)
@@ -847,7 +846,7 @@ IFX_Font* CFX_FontMgrImp::LoadFont(const uint8_t* pBuffer,
int32_t* pFaceCount) {
void* Hash[2] = {(void*)(uintptr_t)pBuffer, (void*)(uintptr_t)iLength};
uint32_t dwHash =
- FX_HashCode_String_GetA((const FX_CHAR*)Hash, 2 * sizeof(void*));
+ FX_HashCode_GetA(CFX_ByteStringC((uint8_t*)Hash, sizeof(Hash)), false);
IFX_FileAccess* pFontAccess = nullptr;
m_Hash2FileAccess.Lookup(dwHash, pFontAccess);
return pFontAccess ? LoadFont(pFontAccess, iFaceIndex, pFaceCount, TRUE)
@@ -860,7 +859,7 @@ IFX_Font* CFX_FontMgrImp::LoadFont(const FX_WCHAR* pszFileName,
CFX_ByteString bsHash;
bsHash += CFX_WideString(pszFileName).UTF8Encode();
- uint32_t dwHash = FX_HashCode_String_GetA(bsHash.c_str(), bsHash.GetLength());
+ uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringC(), false);
IFX_FileAccess* pFontAccess = nullptr;
if (!m_Hash2FileAccess.Lookup(dwHash, pFontAccess)) {
pFontAccess = FX_CreateDefaultFileAccess(pszFileName);
@@ -877,7 +876,7 @@ IFX_Font* CFX_FontMgrImp::LoadFont(IFX_Stream* pFontStream,
FX_BOOL bSaveStream) {
void* Hash[1] = {(void*)(uintptr_t)pFontStream};
uint32_t dwHash =
- FX_HashCode_String_GetA((const FX_CHAR*)Hash, 1 * sizeof(void*));
+ FX_HashCode_GetA(CFX_ByteStringC((uint8_t*)Hash, sizeof(Hash)), false);
IFX_FileAccess* pFontAccess = nullptr;
m_Hash2FileAccess.Lookup(dwHash, pFontAccess);
@@ -894,7 +893,7 @@ IFX_Font* CFX_FontMgrImp::LoadFont(IFX_FileAccess* pFontAccess,
if (bWantCache) {
CFX_ByteString bsHash;
bsHash.Format("%d, %d", (uintptr_t)pFontAccess, iFaceIndex);
- dwHash = FX_HashCode_String_GetA(bsHash.c_str(), bsHash.GetLength());
+ dwHash = FX_HashCode_GetA(bsHash.AsStringC(), false);
if (m_FileAccess2IFXFont.Lookup(dwHash, pFont)) {
if (pFont) {
if (pFaceCount)
« no previous file with comments | « xfa/fgas/font/fgas_fontutils.cpp ('k') | xfa/fgas/localization/fgas_locale.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698