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

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: 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
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 27 matching lines...) Expand all
38 size_t m_dwCurPos; 38 size_t m_dwCurPos;
39 }; 39 };
40 #define FX_XMLDATASTREAM_BufferSize (32 * 1024) 40 #define FX_XMLDATASTREAM_BufferSize (32 * 1024)
41 class CXML_DataStmAcc : public IFX_BufferRead { 41 class CXML_DataStmAcc : public IFX_BufferRead {
42 public: 42 public:
43 CXML_DataStmAcc(IFX_FileRead* pFileRead) 43 CXML_DataStmAcc(IFX_FileRead* pFileRead)
44 : m_pFileRead(pFileRead), m_pBuffer(NULL), m_nStart(0), m_dwSize(0) { 44 : m_pFileRead(pFileRead), m_pBuffer(NULL), m_nStart(0), m_dwSize(0) {
45 FXSYS_assert(m_pFileRead != NULL); 45 FXSYS_assert(m_pFileRead != NULL);
46 } 46 }
47 virtual ~CXML_DataStmAcc() { 47 virtual ~CXML_DataStmAcc() {
48 if (m_pBuffer) {
49 FX_Free(m_pBuffer); 48 FX_Free(m_pBuffer);
50 }
51 } 49 }
52 virtual void Release() { delete this; } 50 virtual void Release() { delete this; }
53 virtual FX_BOOL IsEOF() { 51 virtual FX_BOOL IsEOF() {
54 return m_nStart + (FX_FILESIZE)m_dwSize >= m_pFileRead->GetSize(); 52 return m_nStart + (FX_FILESIZE)m_dwSize >= m_pFileRead->GetSize();
55 } 53 }
56 virtual FX_FILESIZE GetPosition() { return m_nStart + (FX_FILESIZE)m_dwSize; } 54 virtual FX_FILESIZE GetPosition() { return m_nStart + (FX_FILESIZE)m_dwSize; }
57 virtual size_t ReadBlock(void* buffer, size_t size) { return 0; } 55 virtual size_t ReadBlock(void* buffer, size_t size) { return 0; }
58 virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE) { 56 virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE) {
59 if (bRestart) { 57 if (bRestart) {
60 m_nStart = 0; 58 m_nStart = 0;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 void InsertContentSegment(FX_BOOL bCDATA, 109 void InsertContentSegment(FX_BOOL bCDATA,
112 const CFX_WideStringC& content, 110 const CFX_WideStringC& content,
113 CXML_Element* pElement); 111 CXML_Element* pElement);
114 void InsertCDATASegment(CFX_UTF8Decoder& decoder, CXML_Element* pElement); 112 void InsertCDATASegment(CFX_UTF8Decoder& decoder, CXML_Element* pElement);
115 }; 113 };
116 void FX_XML_SplitQualifiedName(const CFX_ByteStringC& bsFullName, 114 void FX_XML_SplitQualifiedName(const CFX_ByteStringC& bsFullName,
117 CFX_ByteStringC& bsSpace, 115 CFX_ByteStringC& bsSpace,
118 CFX_ByteStringC& bsName); 116 CFX_ByteStringC& bsName);
119 117
120 #endif // CORE_SRC_FXCRT_XML_INT_H_ 118 #endif // CORE_SRC_FXCRT_XML_INT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698