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

Unified Diff: core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp

Issue 1853233002: Make down-conversion explicit from CFX_ByteString to CFX_ByteStringC. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix CPDF_Name::GetConstString() 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 | « core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp ('k') | core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
index 21934d35c48424f7e522c8ba760c9bfb341ab2f5..323602b0e10aa5e44b85d55b5674c3c422a3bd4c 100644
--- a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
+++ b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
@@ -54,7 +54,7 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
if (pFile->AppendString(" ") < 0) {
return -1;
}
- if ((len = pFile->AppendString(pObj->GetString())) < 0) {
+ if ((len = pFile->AppendString(pObj->GetString().AsByteStringC())) < 0) {
return -1;
}
offset += len + 1;
@@ -62,7 +62,8 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
case CPDF_Object::STRING: {
CFX_ByteString str = pObj->GetString();
FX_BOOL bHex = pObj->AsString()->IsHex();
- if ((len = pFile->AppendString(PDF_EncodeString(str, bHex))) < 0) {
+ if ((len = pFile->AppendString(
+ PDF_EncodeString(str, bHex).AsByteStringC())) < 0) {
return -1;
}
offset += len;
@@ -73,7 +74,8 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
return -1;
}
CFX_ByteString str = pObj->GetString();
- if ((len = pFile->AppendString(PDF_NameEncode(str))) < 0) {
+ if ((len = pFile->AppendString(PDF_NameEncode(str).AsByteStringC())) <
+ 0) {
return -1;
}
offset += len + 1;
@@ -132,7 +134,8 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
if (pFile->AppendString("/") < 0) {
return -1;
}
- if ((len = pFile->AppendString(PDF_NameEncode(key))) < 0) {
+ if ((len = pFile->AppendString(PDF_NameEncode(key).AsByteStringC())) <
+ 0) {
return -1;
}
offset += len + 1;
@@ -211,7 +214,8 @@ int32_t PDF_CreatorWriteTrailer(CPDF_Document* pDocument,
if (pFile->AppendString(("/")) < 0) {
return -1;
}
- if ((len = pFile->AppendString(PDF_NameEncode(key))) < 0) {
+ if ((len = pFile->AppendString(PDF_NameEncode(key).AsByteStringC())) <
+ 0) {
return -1;
}
offset += len + 1;
@@ -1114,7 +1118,7 @@ int32_t CPDF_Creator::WriteDirectObj(uint32_t objnum,
if (m_File.AppendString(" ") < 0) {
return -1;
}
- if ((len = m_File.AppendString(pObj->GetString())) < 0) {
+ if ((len = m_File.AppendString(pObj->GetString().AsByteStringC())) < 0) {
return -1;
}
m_Offset += len + 1;
@@ -1124,7 +1128,7 @@ int32_t CPDF_Creator::WriteDirectObj(uint32_t objnum,
FX_BOOL bHex = pObj->AsString()->IsHex();
if (!m_pCryptoHandler || !bEncrypt) {
CFX_ByteString content = PDF_EncodeString(str, bHex);
- if ((len = m_File.AppendString(content)) < 0) {
+ if ((len = m_File.AppendString(content.AsByteStringC())) < 0) {
return -1;
}
m_Offset += len;
@@ -1136,7 +1140,7 @@ int32_t CPDF_Creator::WriteDirectObj(uint32_t objnum,
CFX_ByteString content = PDF_EncodeString(
CFX_ByteString((const FX_CHAR*)encryptor.m_pData, encryptor.m_dwSize),
bHex);
- if ((len = m_File.AppendString(content)) < 0) {
+ if ((len = m_File.AppendString(content.AsByteStringC())) < 0) {
return -1;
}
m_Offset += len;
@@ -1176,7 +1180,8 @@ int32_t CPDF_Creator::WriteDirectObj(uint32_t objnum,
return -1;
}
CFX_ByteString str = pObj->GetString();
- if ((len = m_File.AppendString(PDF_NameEncode(str))) < 0) {
+ if ((len = m_File.AppendString(PDF_NameEncode(str).AsByteStringC())) <
+ 0) {
return -1;
}
m_Offset += len + 1;
@@ -1240,7 +1245,8 @@ int32_t CPDF_Creator::WriteDirectObj(uint32_t objnum,
if (m_File.AppendString("/") < 0) {
return -1;
}
- if ((len = m_File.AppendString(PDF_NameEncode(key))) < 0) {
+ if ((len = m_File.AppendString(PDF_NameEncode(key).AsByteStringC())) <
+ 0) {
return -1;
}
m_Offset += len + 1;
@@ -1642,7 +1648,7 @@ int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause* pPause) {
str = m_ObjectOffset.GetPtrAt(1)
? "xref\r\n"
: "xref\r\n0 1\r\n0000000000 65535 f\r\n";
- if (m_File.AppendString(str) < 0) {
+ if (m_File.AppendString(str.AsByteStringC()) < 0) {
return -1;
}
m_Pos = (void*)(uintptr_t)1;
@@ -1771,7 +1777,7 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) {
if (m_File.AppendString(("/")) < 0) {
return -1;
}
- if (m_File.AppendString(PDF_NameEncode(key)) < 0) {
+ if (m_File.AppendString(PDF_NameEncode(key).AsByteStringC()) < 0) {
return -1;
}
if (pValue->GetObjNum()) {
« no previous file with comments | « core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp ('k') | core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698