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

Side by Side Diff: core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp

Issue 1884363002: Explicity use CFX_ByteStrings in a couple of places (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | core/fpdfapi/fpdf_font/fpdf_font.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/fpdfapi/fpdf_edit/editint.h" 7 #include "core/fpdfapi/fpdf_edit/editint.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after
1979 CPDF_Array* pOldIDArray = m_pParser ? m_pParser->GetIDArray() : NULL; 1979 CPDF_Array* pOldIDArray = m_pParser ? m_pParser->GetIDArray() : NULL;
1980 FX_BOOL bNewId = !m_pIDArray; 1980 FX_BOOL bNewId = !m_pIDArray;
1981 if (!m_pIDArray) { 1981 if (!m_pIDArray) {
1982 m_pIDArray = new CPDF_Array; 1982 m_pIDArray = new CPDF_Array;
1983 CPDF_Object* pID1 = pOldIDArray ? pOldIDArray->GetObjectAt(0) : NULL; 1983 CPDF_Object* pID1 = pOldIDArray ? pOldIDArray->GetObjectAt(0) : NULL;
1984 if (pID1) { 1984 if (pID1) {
1985 m_pIDArray->Add(pID1->Clone()); 1985 m_pIDArray->Add(pID1->Clone());
1986 } else { 1986 } else {
1987 std::vector<uint8_t> buffer = 1987 std::vector<uint8_t> buffer =
1988 PDF_GenerateFileID((uint32_t)(uintptr_t) this, m_dwLastObjNum); 1988 PDF_GenerateFileID((uint32_t)(uintptr_t) this, m_dwLastObjNum);
1989 CFX_ByteStringC bsBuffer(buffer.data(), buffer.size()); 1989 CFX_ByteString bsBuffer(buffer.data(), buffer.size());
1990 m_pIDArray->Add(new CPDF_String(bsBuffer, TRUE), m_pDocument); 1990 m_pIDArray->Add(new CPDF_String(bsBuffer, TRUE), m_pDocument);
1991 } 1991 }
1992 } 1992 }
1993 if (!bDefault) { 1993 if (!bDefault) {
1994 return; 1994 return;
1995 } 1995 }
1996 if (pOldIDArray) { 1996 if (pOldIDArray) {
1997 CPDF_Object* pID2 = pOldIDArray->GetObjectAt(1); 1997 CPDF_Object* pID2 = pOldIDArray->GetObjectAt(1);
1998 if ((m_dwFlags & FPDFCREATE_INCREMENTAL) && m_pEncryptDict && pID2) { 1998 if ((m_dwFlags & FPDFCREATE_INCREMENTAL) && m_pEncryptDict && pID2) {
1999 m_pIDArray->Add(pID2->Clone()); 1999 m_pIDArray->Add(pID2->Clone());
2000 return; 2000 return;
2001 } 2001 }
2002 std::vector<uint8_t> buffer = 2002 std::vector<uint8_t> buffer =
2003 PDF_GenerateFileID((uint32_t)(uintptr_t) this, m_dwLastObjNum); 2003 PDF_GenerateFileID((uint32_t)(uintptr_t) this, m_dwLastObjNum);
2004 CFX_ByteStringC bsBuffer(buffer.data(), buffer.size()); 2004 CFX_ByteString bsBuffer(buffer.data(), buffer.size());
2005 m_pIDArray->Add(new CPDF_String(bsBuffer, TRUE), m_pDocument); 2005 m_pIDArray->Add(new CPDF_String(bsBuffer, TRUE), m_pDocument);
2006 return; 2006 return;
2007 } 2007 }
2008 m_pIDArray->Add(m_pIDArray->GetObjectAt(0)->Clone()); 2008 m_pIDArray->Add(m_pIDArray->GetObjectAt(0)->Clone());
2009 if (m_pEncryptDict && !pOldIDArray && m_pParser && bNewId) { 2009 if (m_pEncryptDict && !pOldIDArray && m_pParser && bNewId) {
2010 if (m_pEncryptDict->GetStringBy("Filter") == "Standard") { 2010 if (m_pEncryptDict->GetStringBy("Filter") == "Standard") {
2011 CPDF_StandardSecurityHandler handler; 2011 CPDF_StandardSecurityHandler handler;
2012 CFX_ByteString user_pass = m_pParser->GetPassword(); 2012 CFX_ByteString user_pass = m_pParser->GetPassword();
2013 uint32_t flag = PDF_ENCRYPT_CONTENT; 2013 uint32_t flag = PDF_ENCRYPT_CONTENT;
2014 handler.OnCreate(m_pEncryptDict, m_pIDArray, user_pass.raw_str(), 2014 handler.OnCreate(m_pEncryptDict, m_pIDArray, user_pass.raw_str(),
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
2070 m_bNewCrypto = FALSE; 2070 m_bNewCrypto = FALSE;
2071 if (!m_bStandardSecurity) { 2071 if (!m_bStandardSecurity) {
2072 return; 2072 return;
2073 } 2073 }
2074 if (m_pEncryptDict) { 2074 if (m_pEncryptDict) {
2075 m_pEncryptDict->Release(); 2075 m_pEncryptDict->Release();
2076 m_pEncryptDict = NULL; 2076 m_pEncryptDict = NULL;
2077 } 2077 }
2078 m_bStandardSecurity = FALSE; 2078 m_bStandardSecurity = FALSE;
2079 } 2079 }
OLDNEW
« no previous file with comments | « no previous file | core/fpdfapi/fpdf_font/fpdf_font.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698