]> git.saurik.com Git - wxWidgets.git/blame - src/common/archive.cpp
fixing overrelease and out-of-bounds write, fixes #13725
[wxWidgets.git] / src / common / archive.cpp
CommitLineData
00375592 1/////////////////////////////////////////////////////////////////////////////
8898456d 2// Name: src/common/archive.cpp
00375592
VZ
3// Purpose: Streams for archive formats
4// Author: Mike Wetherell
5// RCS-ID: $Id$
6// Copyright: (c) Mike Wetherell
7// Licence: wxWindows licence
8/////////////////////////////////////////////////////////////////////////////
9
00375592
VZ
10// For compilers that support precompilation, includes "wx.h".
11#include "wx/wxprec.h"
12
13#ifdef __BORLANDC__
8898456d 14 #pragma hdrstop
00375592
VZ
15#endif
16
8898456d
WS
17#if wxUSE_STREAMS && wxUSE_ARCHIVE_STREAMS
18
00375592 19#include "wx/archive.h"
00375592
VZ
20
21IMPLEMENT_ABSTRACT_CLASS(wxArchiveEntry, wxObject)
1b79dad4 22IMPLEMENT_ABSTRACT_CLASS(wxArchiveClassFactory, wxFilterClassFactoryBase)
00375592
VZ
23
24
25/////////////////////////////////////////////////////////////////////////////
26// wxArchiveInputStream
27
28wxArchiveInputStream::wxArchiveInputStream(wxInputStream& stream,
29 wxMBConv& conv)
30 : wxFilterInputStream(stream),
31 m_conv(conv)
32{
33}
34
1b79dad4
MW
35wxArchiveInputStream::wxArchiveInputStream(wxInputStream *stream,
36 wxMBConv& conv)
37 : wxFilterInputStream(stream),
38 m_conv(conv)
39{
40}
41
00375592
VZ
42
43/////////////////////////////////////////////////////////////////////////////
44// wxArchiveOutputStream
45
46wxArchiveOutputStream::wxArchiveOutputStream(wxOutputStream& stream,
47 wxMBConv& conv)
48 : wxFilterOutputStream(stream),
49 m_conv(conv)
50{
51}
52
1b79dad4
MW
53wxArchiveOutputStream::wxArchiveOutputStream(wxOutputStream *stream,
54 wxMBConv& conv)
55 : wxFilterOutputStream(stream),
56 m_conv(conv)
57{
58}
59
00375592
VZ
60
61/////////////////////////////////////////////////////////////////////////////
62// wxArchiveEntry
63
64void wxArchiveEntry::SetNotifier(wxArchiveNotifier& notifier)
65{
66 UnsetNotifier();
67 m_notifier = &notifier;
68 m_notifier->OnEntryUpdated(*this);
69}
70
f44eaed6 71wxArchiveEntry& wxArchiveEntry::operator=(const wxArchiveEntry& WXUNUSED(e))
00375592 72{
f44eaed6 73 m_notifier = NULL;
00375592
VZ
74 return *this;
75}
76
1b79dad4
MW
77
78/////////////////////////////////////////////////////////////////////////////
79// wxArchiveClassFactory
80
81wxArchiveClassFactory *wxArchiveClassFactory::sm_first = NULL;
82
83void wxArchiveClassFactory::Remove()
84{
85 if (m_next != this)
86 {
87 wxArchiveClassFactory **pp = &sm_first;
88
89 while (*pp != this)
90 pp = &(*pp)->m_next;
91
92 *pp = m_next;
93
94 m_next = this;
95 }
96}
97
9e8e867f 98#endif // wxUSE_STREAMS && wxUSE_ARCHIVE_STREAMS