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

Side by Side Diff: core/src/fxcrt/xml_int.h

Issue 1297713003: Don't bother checking pointers before delete[] and FX_Free(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 5 years, 4 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 | « core/src/fxcrt/fx_basic_maps.cpp ('k') | core/src/fxge/android/fpf_skiafontmgr.h » ('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 #ifndef CORE_SRC_FXCRT_XML_INT_H_ 7 #ifndef CORE_SRC_FXCRT_XML_INT_H_
8 #define CORE_SRC_FXCRT_XML_INT_H_ 8 #define CORE_SRC_FXCRT_XML_INT_H_
9 9
10 #include "../../include/fxcrt/fx_stream.h" 10 #include "../../include/fxcrt/fx_stream.h"
(...skipping 29 matching lines...) Expand all
40 size_t m_dwCurPos; 40 size_t m_dwCurPos;
41 }; 41 };
42 42
43 #define FX_XMLDATASTREAM_BufferSize (32 * 1024) 43 #define FX_XMLDATASTREAM_BufferSize (32 * 1024)
44 class CXML_DataStmAcc : public IFX_BufferRead { 44 class CXML_DataStmAcc : public IFX_BufferRead {
45 public: 45 public:
46 CXML_DataStmAcc(IFX_FileRead* pFileRead) 46 CXML_DataStmAcc(IFX_FileRead* pFileRead)
47 : m_pFileRead(pFileRead), m_pBuffer(NULL), m_nStart(0), m_dwSize(0) { 47 : m_pFileRead(pFileRead), m_pBuffer(NULL), m_nStart(0), m_dwSize(0) {
48 FXSYS_assert(m_pFileRead != NULL); 48 FXSYS_assert(m_pFileRead != NULL);
49 } 49 }
50 ~CXML_DataStmAcc() override { 50 ~CXML_DataStmAcc() override { FX_Free(m_pBuffer); }
51 if (m_pBuffer) {
52 FX_Free(m_pBuffer);
53 }
54 }
55 51
56 void Release() override { delete this; } 52 void Release() override { delete this; }
57 FX_BOOL IsEOF() override { 53 FX_BOOL IsEOF() override {
58 return m_nStart + (FX_FILESIZE)m_dwSize >= m_pFileRead->GetSize(); 54 return m_nStart + (FX_FILESIZE)m_dwSize >= m_pFileRead->GetSize();
59 } 55 }
60 FX_FILESIZE GetPosition() override { 56 FX_FILESIZE GetPosition() override {
61 return m_nStart + (FX_FILESIZE)m_dwSize; 57 return m_nStart + (FX_FILESIZE)m_dwSize;
62 } 58 }
63 size_t ReadBlock(void* buffer, size_t size) override { return 0; } 59 size_t ReadBlock(void* buffer, size_t size) override { return 0; }
64 FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE) override { 60 FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE) override {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 const CFX_WideStringC& content, 115 const CFX_WideStringC& content,
120 CXML_Element* pElement); 116 CXML_Element* pElement);
121 void InsertCDATASegment(CFX_UTF8Decoder& decoder, CXML_Element* pElement); 117 void InsertCDATASegment(CFX_UTF8Decoder& decoder, CXML_Element* pElement);
122 }; 118 };
123 119
124 void FX_XML_SplitQualifiedName(const CFX_ByteStringC& bsFullName, 120 void FX_XML_SplitQualifiedName(const CFX_ByteStringC& bsFullName,
125 CFX_ByteStringC& bsSpace, 121 CFX_ByteStringC& bsSpace,
126 CFX_ByteStringC& bsName); 122 CFX_ByteStringC& bsName);
127 123
128 #endif // CORE_SRC_FXCRT_XML_INT_H_ 124 #endif // CORE_SRC_FXCRT_XML_INT_H_
OLDNEW
« no previous file with comments | « core/src/fxcrt/fx_basic_maps.cpp ('k') | core/src/fxge/android/fpf_skiafontmgr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698