diff options
author | Henrique Nakashima <hnakashima@chromium.org> | 2017-06-27 17:04:16 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-06-28 13:37:57 +0000 |
commit | d8df8d4cd419258b50413c4eb730d144824844f0 (patch) | |
tree | d943188375fbfb2d4dc619e275c496815534350b /core/fpdfapi/edit | |
parent | 0646275cd9c19e9fb97eaa023494bb771e47e095 (diff) | |
download | pdfium-d8df8d4cd419258b50413c4eb730d144824844f0.tar.xz |
Use new overloads to make usages of ostringstream more readable.
Bug: pdfium:731
Change-Id: I92077971aec6bada061ed101cb48abe1611050d7
Reviewed-on: https://pdfium-review.googlesource.com/7042
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/edit')
-rw-r--r-- | core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp index 508581f551..eeb6f81721 100644 --- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp +++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp @@ -72,8 +72,7 @@ void CPDF_PageContentGenerator::GenerateContent() { CPDF_Object* pContent = pPageDict ? pPageDict->GetObjectFor("Contents") : nullptr; CPDF_Stream* pStream = pDoc->NewIndirect<CPDF_Stream>(); - pStream->SetData(reinterpret_cast<const uint8_t*>(buf.str().c_str()), - buf.tellp()); + pStream->SetData(&buf); if (pContent) { CPDF_Array* pArray = ToArray(pContent); if (pArray) { @@ -180,7 +179,7 @@ void CPDF_PageContentGenerator::ProcessImage(std::ostringstream* buf, if (bWasInline) pImageObj->SetImage(m_pDocument->GetPageData()->GetImage(dwObjNum)); - *buf << "/" << PDF_NameEncode(name).c_str() << " Do Q\n"; + *buf << "/" << PDF_NameEncode(name) << " Do Q\n"; } // Processing path with operators from Tables 4.9 and 4.10 of PDF spec 1.7: @@ -302,7 +301,7 @@ void CPDF_PageContentGenerator::ProcessGraphics(std::ostringstream* buf, name = RealizeResource(dwObjNum, "ExtGState"); m_pObjHolder->m_GraphicsMap[graphD] = name; } - *buf << "/" << PDF_NameEncode(name).c_str() << " gs "; + *buf << "/" << PDF_NameEncode(name) << " gs "; } // This method adds text to the buffer, BT begins the text object, ET ends it. @@ -343,14 +342,14 @@ void CPDF_PageContentGenerator::ProcessText(std::ostringstream* buf, dictName = RealizeResource(dwObjNum, "Font"); m_pObjHolder->m_FontsMap[fontD] = dictName; } - *buf << "/" << PDF_NameEncode(dictName).c_str() << " " - << pTextObj->GetFontSize() << " Tf "; + *buf << "/" << PDF_NameEncode(dictName) << " " << pTextObj->GetFontSize() + << " Tf "; CFX_ByteString text; for (uint32_t charcode : pTextObj->m_CharCodes) { if (charcode != CPDF_Font::kInvalidCharCode) pFont->AppendChar(&text, charcode); } ProcessGraphics(buf, pTextObj); - *buf << PDF_EncodeString(text, true).c_str() << " Tj ET"; + *buf << PDF_EncodeString(text, true) << " Tj ET"; *buf << " Q\n"; } |