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

Unified Diff: xfa/fee/fde_txtedtengine.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/include/fx_string.h ('k') | xfa/fxbarcode/datamatrix/BC_DataMatrixDecodedBitStreamParser.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fee/fde_txtedtengine.cpp
diff --git a/xfa/fee/fde_txtedtengine.cpp b/xfa/fee/fde_txtedtengine.cpp
index dfbf02e88180fdcda3a81655684beb9ad6ef4e66..71f510205be4b5cc21a5f0c6456850fb605fe2c9 100644
--- a/xfa/fee/fde_txtedtengine.cpp
+++ b/xfa/fee/fde_txtedtengine.cpp
@@ -1603,9 +1603,9 @@ void CFDE_TxtEdtEngine::DeleteSelect() {
IFDE_TxtEdtDoRecord* IFDE_TxtEdtDoRecord::Create(
const CFX_ByteStringC& bsDoRecord) {
- const FX_CHAR* lpBuf = bsDoRecord.c_str();
- int32_t nType = *((int32_t*)lpBuf);
- switch (nType) {
+ const uint32_t* lpBuf =
+ reinterpret_cast<const uint32_t*>(bsDoRecord.raw_str());
+ switch (*lpBuf) {
case FDE_TXTEDT_DORECORD_INS:
return new CFDE_TxtEdtDoRecord_Insert(bsDoRecord);
case FDE_TXTEDT_DORECORD_DEL:
@@ -1669,9 +1669,7 @@ void CFDE_TxtEdtDoRecord_Insert::Serialize(CFX_ByteString& bsDoRecord) const {
}
void CFDE_TxtEdtDoRecord_Insert::Deserialize(
const CFX_ByteStringC& bsDoRecord) {
- CFX_ArchiveLoader ArchiveLoader(
- reinterpret_cast<const uint8_t*>(bsDoRecord.c_str()),
- bsDoRecord.GetLength());
+ CFX_ArchiveLoader ArchiveLoader(bsDoRecord.raw_str(), bsDoRecord.GetLength());
int32_t nType = 0;
ArchiveLoader >> nType;
ASSERT(nType == FDE_TXTEDT_DORECORD_INS);
@@ -1746,9 +1744,7 @@ void CFDE_TxtEdtDoRecord_DeleteRange::Serialize(
}
void CFDE_TxtEdtDoRecord_DeleteRange::Deserialize(
const CFX_ByteStringC& bsDoRecord) {
- CFX_ArchiveLoader ArchiveLoader(
- reinterpret_cast<const uint8_t*>(bsDoRecord.c_str()),
- bsDoRecord.GetLength());
+ CFX_ArchiveLoader ArchiveLoader(bsDoRecord.raw_str(), bsDoRecord.GetLength());
int32_t nType = 0;
ArchiveLoader >> nType;
ASSERT(nType == FDE_TXTEDT_DORECORD_DEL);
« no previous file with comments | « core/fxcrt/include/fx_string.h ('k') | xfa/fxbarcode/datamatrix/BC_DataMatrixDecodedBitStreamParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698