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

Unified Diff: core/fpdfapi/fpdf_parser/fpdf_parser_utility.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/fpdfapi/fpdf_font/fpdf_font.cpp ('k') | core/fxcrt/fx_basic_bstring.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
index 03975149b058b7f471da280b2ebbab94fe3540ff..1e9252fa826220f661dcf31080e7f9f7dfe21e4a 100644
--- a/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
+++ b/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
@@ -87,21 +87,20 @@ int32_t GetDirectInteger(CPDF_Dictionary* pDict, const CFX_ByteStringC& key) {
}
CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& bstr) {
- int size = bstr.GetLength();
- const FX_CHAR* pSrc = bstr.c_str();
if (bstr.Find('#') == -1)
return bstr;
+ int size = bstr.GetLength();
CFX_ByteString result;
FX_CHAR* pDestStart = result.GetBuffer(size);
FX_CHAR* pDest = pDestStart;
for (int i = 0; i < size; i++) {
- if (pSrc[i] == '#' && i < size - 2) {
+ if (bstr[i] == '#' && i < size - 2) {
*pDest++ =
- FXSYS_toHexDigit(pSrc[i + 1]) * 16 + FXSYS_toHexDigit(pSrc[i + 2]);
+ FXSYS_toHexDigit(bstr[i + 1]) * 16 + FXSYS_toHexDigit(bstr[i + 2]);
i += 2;
} else {
- *pDest++ = pSrc[i];
+ *pDest++ = bstr[i];
}
}
result.ReleaseBuffer((FX_STRSIZE)(pDest - pDestStart));
« no previous file with comments | « core/fpdfapi/fpdf_font/fpdf_font.cpp ('k') | core/fxcrt/fx_basic_bstring.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698