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

Unified Diff: core/fxcrt/fx_extension.cpp

Issue 1972053003: Add CFX_ByteStringC::CharAt() to avoid c_str() and casts (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 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 | « core/fxcrt/fx_basic_util.cpp ('k') | core/fxcrt/fx_xml_composer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxcrt/fx_extension.cpp
diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp
index 0b55fc91dd228a5363226dd8ba4ea6334d4f9b41..315e33fd7e817d28fe528afefaeac4bbe122b9d3 100644
--- a/core/fxcrt/fx_extension.cpp
+++ b/core/fxcrt/fx_extension.cpp
@@ -219,17 +219,13 @@ int32_t FXSYS_strnicmp(const FX_CHAR* s1, const FX_CHAR* s2, size_t count) {
}
uint32_t FX_HashCode_GetA(const CFX_ByteStringC& str, bool bIgnoreCase) {
- const FX_CHAR* pStr = str.c_str();
- const FX_CHAR* pStrEnd = pStr + str.GetLength();
uint32_t dwHashCode = 0;
if (bIgnoreCase) {
- while (pStr < pStrEnd) {
- dwHashCode = 31 * dwHashCode + FXSYS_tolower(*pStr++);
- }
+ for (FX_STRSIZE i = 0; i < str.GetLength(); ++i)
+ dwHashCode = 31 * dwHashCode + FXSYS_tolower(str.CharAt(i));
} else {
- while (pStr < pStrEnd) {
- dwHashCode = 31 * dwHashCode + *pStr++;
- }
+ for (FX_STRSIZE i = 0; i < str.GetLength(); ++i)
+ dwHashCode = 31 * dwHashCode + str.CharAt(i);
}
return dwHashCode;
}
« no previous file with comments | « core/fxcrt/fx_basic_util.cpp ('k') | core/fxcrt/fx_xml_composer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698