From: Vadim Zeitlin Date: Tue, 12 Jan 1999 23:44:03 +0000 (+0000) Subject: some really minor changes (the most important one: small memory hole in X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/09914df7b85fe17845223b291ab65925dceba6f2 some really minor changes (the most important one: small memory hole in wxList plugged) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1384 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/latex/wx/tlog.tex b/docs/latex/wx/tlog.tex index 0cb7fccfcf..0cdc287607 100644 --- a/docs/latex/wx/tlog.tex +++ b/docs/latex/wx/tlog.tex @@ -1,11 +1,10 @@ \section{Log classes overview}\label{wxlogoverview} -Classes: \helpref{wxLog}{wxlog} - -%\helpref{wxLogStderr}{wxlogstderr},% -%\helpref{wxLogOstream}{wxlogostream}, \helpref{wxLogTextCtrl}{wxlogtextctrl},% -%\helpref{wxLogWindow}{wxlogwindow}, \helpref{wxLogGui}{wxloggui},% -%\helpref{wxLogNull}{wxlognull}% +Classes: \helpref{wxLog}{wxlog}\\ +\helpref{wxLogStderr}{wxlogstderr},\\ +\helpref{wxLogOstream}{wxlogostream}, \helpref{wxLogTextCtrl}{wxlogtextctrl},\\ +\helpref{wxLogWindow}{wxlogwindow}, \helpref{wxLogGui}{wxloggui},\\ +\helpref{wxLogNull}{wxlognull} This is a general overview of logging classes provided by wxWindows. The word logging here has a broad sense, including all of the program output, not only @@ -126,8 +125,8 @@ clear the log, close it completely or save all messages to file. \item{\bf wxLogNull} The last log class is quite particular: it doesn't do anything. The objects of this class may be instantiated to (temporarily) suppress output of {\it wxLogXXX()} functions. As an example, trying to open a -non-existing file will usually provoke an error message, but if you for some -reason it's unwanted, just use this construction: +non-existing file will usually provoke an error message, but if for some +reasons it's unwanted, just use this construction: {\small \begin{verbatim} diff --git a/src/common/file.cpp b/src/common/file.cpp index 9a8684002b..016c199ca1 100644 --- a/src/common/file.cpp +++ b/src/common/file.cpp @@ -301,12 +301,15 @@ size_t wxFile::Write(const void *pBuf, size_t nCount) bool wxFile::Flush() { if ( IsOpened() ) { - // @@@ fsync() is not ANSI (BSDish) -// if ( fsync(m_fd) == -1 ) { // TODO - if (wxTrue) { - wxLogSysError(_("can't flush file descriptor %d"), m_fd); - return FALSE; - } + #if defined(_MSC_VER) || wxHAVE_FSYNC + if ( fsync(m_fd) == -1 ) + { + wxLogSysError(_("can't flush file descriptor %d"), m_fd); + return FALSE; + } + #else // no fsync + // just do nothing + #endif // fsync } return TRUE; diff --git a/src/common/list.cpp b/src/common/list.cpp index 4cb8cf8f75..4eeacc5bb3 100644 --- a/src/common/list.cpp +++ b/src/common/list.cpp @@ -120,6 +120,11 @@ wxNodeBase::~wxNodeBase() // compatibility with old code if ( m_list != NULL ) { + if ( m_list->m_keyType == wxKEY_STRING ) + { + free(m_key.string); + } + m_list->DetachNode(this); } } @@ -348,6 +353,8 @@ void wxListBase::DoDeleteNode(wxNodeBase *node) node->DeleteData(); } + // so that the node knows that it's being deleted by the list + node->m_list = NULL; delete node; } diff --git a/src/common/resource.cpp b/src/common/resource.cpp index 436565d0ed..031a211c74 100644 --- a/src/common/resource.cpp +++ b/src/common/resource.cpp @@ -559,17 +559,33 @@ bool wxResourceInterpretResources(wxResourceTable& table, wxExprDatabase& db) return TRUE; } -static char *g_ValidControlClasses[] = { "wxButton", "wxBitmapButton", "wxMessage", - "wxStaticText", "wxStaticBitmap", "wxText", "wxTextCtrl", "wxMultiText", - "wxListBox", "wxRadioBox", "wxRadioButton", "wxCheckBox", "wxBitmapCheckBox", - "wxGroupBox", "wxStaticBox", "wxSlider", "wxGauge", "wxScrollBar", - "wxChoice", "wxComboBox" } ; -static int g_ValidControlClassesCount = sizeof(g_ValidControlClasses) / sizeof(char *) ; +static const char *g_ValidControlClasses[] = +{ + "wxButton", + "wxBitmapButton", + "wxMessage", + "wxStaticText", + "wxStaticBitmap", + "wxText", + "wxTextCtrl", + "wxMultiText", + "wxListBox", + "wxRadioBox", + "wxRadioButton", + "wxCheckBox", + "wxBitmapCheckBox", + "wxGroupBox", + "wxStaticBox", + "wxSlider", + "wxGauge", + "wxScrollBar", + "wxChoice", + "wxComboBox" +}; static bool wxIsValidControlClass(const wxString& c) { - int i; - for ( i = 0; i < g_ValidControlClassesCount; i++) + for ( size_t i = 0; i < WXSIZEOF(g_ValidControlClasses); i++ ) { if ( c == g_ValidControlClasses[i] ) return TRUE; diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 2d3212aaed..f8b44aa487 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -17,7 +17,7 @@ #include "wx/wxprec.h" #ifdef __BORLANDC__ -#pragma hdrstop + #pragma hdrstop #endif #ifndef WX_PRECOMP @@ -39,11 +39,11 @@ #endif #if wxUSE_OWNER_DRAWN -#include "wx/ownerdrw.h" + #include "wx/ownerdrw.h" #endif #if wxUSE_DRAG_AND_DROP -#include "wx/msw/ole/droptgt.h" + #include "wx/msw/ole/droptgt.h" #endif #include "wx/menuitem.h" @@ -82,7 +82,7 @@ #endif #ifdef __WXDEBUG__ -const char *wxGetMessageName(int message); + const char *wxGetMessageName(int message); #endif //__WXDEBUG__ #define WINDOW_MARGIN 3 // This defines sensitivity of Leave events @@ -841,7 +841,6 @@ LRESULT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA wxWndHook = NULL; wnd->m_hWnd = (WXHWND) hWnd; } - // wxDebugMsg("hWnd = %d, m_hWnd = %d, msg = %d\n", hWnd, m_hWnd, message); // Stop right here if we don't have a valid handle // in our wxWnd object. @@ -866,17 +865,16 @@ LRESULT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA // Should probably have a test for 'genuine' NT #if defined(__WIN32__) -#define DIMENSION_TYPE short + #define DIMENSION_TYPE short #else -#define DIMENSION_TYPE int + #define DIMENSION_TYPE int #endif // Main Windows 3 window proc long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) { wxASSERT( m_lastMsg == message && - m_lastWParam == wParam && - m_lastLParam == lParam ); + m_lastWParam == wParam && m_lastLParam == lParam ); #ifdef __WXDEBUG__ wxLogTrace(wxTraceMessages, "Processing %s(%lx, %lx)",