OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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/page/pageint.h" | 7 #include "core/fpdfapi/page/pageint.h" |
8 | 8 |
9 #include <limits.h> | 9 #include <limits.h> |
10 | 10 |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 break; | 226 break; |
227 } | 227 } |
228 dwStreamSize += m_Pos - dwPrevPos; | 228 dwStreamSize += m_Pos - dwPrevPos; |
229 } | 229 } |
230 m_Pos = dwSavePos; | 230 m_Pos = dwSavePos; |
231 pData = FX_Alloc(uint8_t, dwStreamSize); | 231 pData = FX_Alloc(uint8_t, dwStreamSize); |
232 FXSYS_memcpy(pData, m_pBuf + m_Pos, dwStreamSize); | 232 FXSYS_memcpy(pData, m_pBuf + m_Pos, dwStreamSize); |
233 m_Pos += dwStreamSize; | 233 m_Pos += dwStreamSize; |
234 } | 234 } |
235 pDict->SetNewFor<CPDF_Number>("Length", (int)dwStreamSize); | 235 pDict->SetNewFor<CPDF_Number>("Length", (int)dwStreamSize); |
236 return new CPDF_Stream(pData, dwStreamSize, pDict); | 236 return new CPDF_Stream(pData, dwStreamSize, pdfium::WrapUnique(pDict)); |
237 } | 237 } |
238 | 238 |
239 CPDF_StreamParser::SyntaxType CPDF_StreamParser::ParseNextElement() { | 239 CPDF_StreamParser::SyntaxType CPDF_StreamParser::ParseNextElement() { |
240 delete m_pLastObj; | 240 delete m_pLastObj; |
241 m_pLastObj = nullptr; | 241 m_pLastObj = nullptr; |
242 | 242 |
243 m_WordSize = 0; | 243 m_WordSize = 0; |
244 bool bIsNumber = true; | 244 bool bIsNumber = true; |
245 if (!PositionIsInBounds()) | 245 if (!PositionIsInBounds()) |
246 return EndOfData; | 246 return EndOfData; |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 | 616 |
617 if (buf.GetLength() > kMaxStringLength) | 617 if (buf.GetLength() > kMaxStringLength) |
618 return CFX_ByteString(buf.GetBuffer(), kMaxStringLength); | 618 return CFX_ByteString(buf.GetBuffer(), kMaxStringLength); |
619 | 619 |
620 return buf.MakeString(); | 620 return buf.MakeString(); |
621 } | 621 } |
622 | 622 |
623 bool CPDF_StreamParser::PositionIsInBounds() const { | 623 bool CPDF_StreamParser::PositionIsInBounds() const { |
624 return m_Pos < m_Size; | 624 return m_Pos < m_Size; |
625 } | 625 } |
OLD | NEW |