summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-12-22 14:57:45 -0800
committerLei Zhang <thestig@chromium.org>2015-12-22 14:57:45 -0800
commit9ba6a147311eacb933c175168de6d11c439985d3 (patch)
treea1a75ac52168294f73b6eda5c65c26e4444b4c47 /core/src/fpdfapi
parentcd2bb30aba89a05c0bbd4d6973fa070205e3a1e8 (diff)
downloadpdfium-9ba6a147311eacb933c175168de6d11c439985d3.tar.xz
Merge to XFA: Start using allowed C++11 features.
TBR=dml@google.com, thakis@chromium.org Review URL: https://codereview.chromium.org/1544923002 . Review URL: https://codereview.chromium.org/1545823002 . (cherry picked from commit ba2586d2c0a50df14aa2549a0a841e1d4b9af4b6) (cherry picked from commit 87f7d29531dabfd66e547a6be31a08272ff631d5) Review URL: https://codereview.chromium.org/1542213002 .
Diffstat (limited to 'core/src/fpdfapi')
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp19
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp5
2 files changed, 13 insertions, 11 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index d5a2780980..2a271f1179 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -327,7 +327,7 @@ FX_DWORD CPDF_Parser::SetEncryptHandler() {
if (!pSecurityHandler->OnInit(this, m_pEncryptDict)) {
return err;
}
- m_pSecurityHandler = nonstd::move(pSecurityHandler);
+ m_pSecurityHandler = std::move(pSecurityHandler);
nonstd::unique_ptr<CPDF_CryptoHandler> pCryptoHandler(
m_pSecurityHandler->CreateCryptoHandler());
if (!pCryptoHandler->Init(m_pEncryptDict, m_pSecurityHandler.get())) {
@@ -456,8 +456,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos,
FX_FILESIZE SavedPos = m_Syntax.SavePos();
const int32_t recordsize = 20;
std::vector<char> buf(1024 * recordsize + 1);
- char* pBuf = pdfium::vector_as_array(&buf);
- pBuf[1024 * recordsize] = '\0';
+ buf[1024 * recordsize] = '\0';
int32_t nBlocks = count / 1024 + 1;
for (int32_t block = 0; block < nBlocks; block++) {
int32_t block_size = block == nBlocks - 1 ? count % 1024 : 1024;
@@ -465,12 +464,13 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos,
if ((FX_FILESIZE)(dwStartPos + dwReadSize) > m_Syntax.m_FileLen) {
return FALSE;
}
- if (!m_Syntax.ReadBlock(reinterpret_cast<uint8_t*>(pBuf), dwReadSize)) {
+ if (!m_Syntax.ReadBlock(reinterpret_cast<uint8_t*>(buf.data()),
+ dwReadSize)) {
return FALSE;
}
for (int32_t i = 0; i < block_size; i++) {
FX_DWORD objnum = start_objnum + block * 1024 + i;
- char* pEntry = pBuf + i * recordsize;
+ char* pEntry = &buf[i * recordsize];
if (pEntry[17] == 'f') {
m_ObjectInfo[objnum].pos = 0;
m_V5Type.SetAtGrow(objnum, 0);
@@ -544,16 +544,15 @@ bool CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos,
m_dwXrefStartObjNum = start_objnum;
if (!bSkip) {
std::vector<char> buf(1024 * recordsize + 1);
- char* pBuf = pdfium::vector_as_array(&buf);
- pBuf[1024 * recordsize] = '\0';
+ buf[1024 * recordsize] = '\0';
int32_t nBlocks = count / 1024 + 1;
for (int32_t block = 0; block < nBlocks; block++) {
int32_t block_size = block == nBlocks - 1 ? count % 1024 : 1024;
- m_Syntax.ReadBlock(reinterpret_cast<uint8_t*>(pBuf),
+ m_Syntax.ReadBlock(reinterpret_cast<uint8_t*>(buf.data()),
block_size * recordsize);
for (int32_t i = 0; i < block_size; i++) {
FX_DWORD objnum = start_objnum + block * 1024 + i;
- char* pEntry = pBuf + i * recordsize;
+ char* pEntry = &buf[i * recordsize];
if (pEntry[17] == 'f') {
m_ObjectInfo[objnum].pos = 0;
m_V5Type.SetAtGrow(objnum, 0);
@@ -3606,7 +3605,7 @@ FX_BOOL CPDF_DataAvail::CheckHintTables(IFX_DownloadHints* pHints) {
ParseIndirectObjectAt(szHSStart, 0));
CPDF_Stream* pStream = ToStream(pHintStream.get());
if (pStream && pHintTables->LoadHintStream(pStream))
- m_pHintTables = nonstd::move(pHintTables);
+ m_pHintTables = std::move(pHintTables);
m_docStatus = PDF_DATAAVAIL_DONE;
return TRUE;
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
index ea6195dc8e..d39d30f2a3 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
@@ -6,6 +6,9 @@
#include "render_int.h"
+#include <utility>
+#include <vector>
+
#include "core/include/fpdfapi/fpdf_module.h"
#include "core/include/fpdfapi/fpdf_pageobj.h"
#include "core/include/fpdfapi/fpdf_render.h"
@@ -126,7 +129,7 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
pBackdrop1->Clear((FX_DWORD)-1);
pBackdrop1->CompositeBitmap(0, 0, pBackdrop->GetWidth(),
pBackdrop->GetHeight(), pBackdrop.get(), 0, 0);
- pBackdrop = nonstd::move(pBackdrop1);
+ pBackdrop = std::move(pBackdrop1);
m_pDevice->SetDIBits(pBackdrop.get(), back_left, back_top);
}