projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added back 2 extra pixels for the best size under XP
[wxWidgets.git]
/
src
/
common
/
stream.cpp
diff --git
a/src/common/stream.cpp
b/src/common/stream.cpp
index 435b60f266a6c6814cce08149b66d037e933a3b4..f13da0d3d8af6a7e542f04eacde4bedfe4e82e8d 100644
(file)
--- a/
src/common/stream.cpp
+++ b/
src/common/stream.cpp
@@
-22,20
+22,20
@@
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#include "wx/wxprec.h"
#ifdef __BORLANDC__
- #pragma hdrstop
+
#pragma hdrstop
#endif
#endif
+#if wxUSE_STREAMS
+
+#include "wx/stream.h"
+
#ifndef WX_PRECOMP
#ifndef WX_PRECOMP
-
#include "wx/defs
.h"
+
#include "wx/log
.h"
#endif
#endif
-#if wxUSE_STREAMS
-
#include <ctype.h>
#include <ctype.h>
-#include "wx/stream.h"
#include "wx/datstrm.h"
#include "wx/textfile.h"
#include "wx/datstrm.h"
#include "wx/textfile.h"
-#include "wx/log.h"
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// constants
@@
-117,7
+117,10
@@
wxStreamBuffer::wxStreamBuffer(const wxStreamBuffer& buffer)
void wxStreamBuffer::FreeBuffer()
{
if ( m_destroybuf )
void wxStreamBuffer::FreeBuffer()
{
if ( m_destroybuf )
+ {
free(m_buffer_start);
free(m_buffer_start);
+ m_buffer_start = NULL;
+ }
}
wxStreamBuffer::~wxStreamBuffer()
}
wxStreamBuffer::~wxStreamBuffer()
@@
-163,15
+166,15
@@
void wxStreamBuffer::SetBufferIO(void *start,
void wxStreamBuffer::SetBufferIO(size_t bufsize)
{
void wxStreamBuffer::SetBufferIO(size_t bufsize)
{
- // start by freeing the old buffer
- FreeBuffer();
-
if ( bufsize )
{
if ( bufsize )
{
+ // this will free the old buffer and allocate the new one
SetBufferIO(malloc(bufsize), bufsize, true /* take ownership */);
}
else // no buffer size => no buffer
{
SetBufferIO(malloc(bufsize), bufsize, true /* take ownership */);
}
else // no buffer size => no buffer
{
+ // still free the old one
+ FreeBuffer();
InitBuffer();
}
}
InitBuffer();
}
}