got rid of wxBuffer (finally!!!)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21571 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -486,8 +486,6 @@ private:
|
|||||||
// global data
|
// global data
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
WXDLLIMPEXP_DATA_BASE(extern wxChar*) wxBuffer;
|
|
||||||
|
|
||||||
WXDLLIMPEXP_DATA_BASE(extern HINSTANCE) wxhInstance;
|
WXDLLIMPEXP_DATA_BASE(extern HINSTANCE) wxhInstance;
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
@@ -56,12 +56,6 @@ class WXDLLIMPEXP_BASE wxPoint;
|
|||||||
// String functions (deprecated, use wxString)
|
// String functions (deprecated, use wxString)
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Useful buffer (FIXME VZ: To be removed!!!)
|
|
||||||
// Now only needed in MSW port
|
|
||||||
#if !defined(__WXMOTIF__) && !defined(__WXGTK__) && !defined(__WXX11__) && !defined(__WXMGL__) && !defined(__WXMAC__)
|
|
||||||
WXDLLIMPEXP_DATA_BASE(extern wxChar*) wxBuffer;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Make a copy of this string using 'new'
|
// Make a copy of this string using 'new'
|
||||||
WXDLLIMPEXP_BASE wxChar* copystring(const wxChar *s);
|
WXDLLIMPEXP_BASE wxChar* copystring(const wxChar *s);
|
||||||
|
|
||||||
|
@@ -119,7 +119,6 @@
|
|||||||
// global variables
|
// global variables
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
extern wxChar *wxBuffer;
|
|
||||||
extern wxList WXDLLEXPORT wxPendingDelete;
|
extern wxList WXDLLEXPORT wxPendingDelete;
|
||||||
#ifndef __WXMICROWIN__
|
#ifndef __WXMICROWIN__
|
||||||
extern void wxSetKeyboardHook(bool doIt);
|
extern void wxSetKeyboardHook(bool doIt);
|
||||||
@@ -287,8 +286,6 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
|
|||||||
}
|
}
|
||||||
#endif // wxUSE_UNICODE && !wxUSE_UNICODE_MSLU
|
#endif // wxUSE_UNICODE && !wxUSE_UNICODE_MSLU
|
||||||
|
|
||||||
wxBuffer = new wxChar[1500]; // FIXME
|
|
||||||
|
|
||||||
#if defined(__WIN95__) && !defined(__WXMICROWIN__)
|
#if defined(__WIN95__) && !defined(__WXMICROWIN__)
|
||||||
InitCommonControls();
|
InitCommonControls();
|
||||||
#endif // __WIN95__
|
#endif // __WIN95__
|
||||||
@@ -500,9 +497,6 @@ bool wxApp::UnregisterWindowClasses()
|
|||||||
|
|
||||||
void wxApp::CleanUp()
|
void wxApp::CleanUp()
|
||||||
{
|
{
|
||||||
delete[] wxBuffer;
|
|
||||||
wxBuffer = NULL;
|
|
||||||
|
|
||||||
#ifndef __WXMICROWIN__
|
#ifndef __WXMICROWIN__
|
||||||
wxSetKeyboardHook(FALSE);
|
wxSetKeyboardHook(FALSE);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -583,13 +583,15 @@ void wxListBox::SetHorizontalExtent(const wxString& s)
|
|||||||
oldFont = (HFONT) ::SelectObject(dc, (HFONT) GetFont().GetResourceHandle());
|
oldFont = (HFONT) ::SelectObject(dc, (HFONT) GetFont().GetResourceHandle());
|
||||||
|
|
||||||
GetTextMetrics(dc, &lpTextMetric);
|
GetTextMetrics(dc, &lpTextMetric);
|
||||||
int i;
|
|
||||||
for (i = 0; i < m_noItems; i++)
|
// FIXME: buffer overflow!!
|
||||||
|
wxChar buf[1024];
|
||||||
|
for (int i = 0; i < m_noItems; i++)
|
||||||
{
|
{
|
||||||
int len = (int)SendMessage(GetHwnd(), LB_GETTEXT, i, (LONG)wxBuffer);
|
int len = (int)SendMessage(GetHwnd(), LB_GETTEXT, i, (LPARAM)buf);
|
||||||
wxBuffer[len] = 0;
|
buf[len] = 0;
|
||||||
SIZE extentXY;
|
SIZE extentXY;
|
||||||
::GetTextExtentPoint(dc, (LPTSTR)wxBuffer, len, &extentXY);
|
::GetTextExtentPoint(dc, buf, len, &extentXY);
|
||||||
int extentX = (int)(extentXY.cx + lpTextMetric.tmAveCharWidth);
|
int extentX = (int)(extentXY.cx + lpTextMetric.tmAveCharWidth);
|
||||||
if (extentX > largestExtent)
|
if (extentX > largestExtent)
|
||||||
largestExtent = extentX;
|
largestExtent = extentX;
|
||||||
|
@@ -240,18 +240,6 @@ bool wxGetUserId(wxChar *buf, int maxSize)
|
|||||||
// Get user name e.g. Julian Smart
|
// Get user name e.g. Julian Smart
|
||||||
bool wxGetUserName(wxChar *buf, int maxSize)
|
bool wxGetUserName(wxChar *buf, int maxSize)
|
||||||
{
|
{
|
||||||
#if wxUSE_PENWINDOWS && !defined(__WATCOMC__) && !defined(__GNUWIN32__)
|
|
||||||
extern HANDLE g_hPenWin; // PenWindows Running?
|
|
||||||
if (g_hPenWin)
|
|
||||||
{
|
|
||||||
// PenWindows Does have a user concept!
|
|
||||||
// Get the current owner of the recognizer
|
|
||||||
GetPrivateProfileString("Current", "User", default_name, wxBuffer, maxSize - 1, "PENWIN.INI");
|
|
||||||
strncpy(buf, wxBuffer, maxSize - 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
#ifdef USE_NET_API
|
#ifdef USE_NET_API
|
||||||
CHAR szUserName[256];
|
CHAR szUserName[256];
|
||||||
if ( !wxGetUserId(szUserName, WXSIZEOF(szUserName)) )
|
if ( !wxGetUserId(szUserName, WXSIZEOF(szUserName)) )
|
||||||
@@ -332,7 +320,6 @@ error:
|
|||||||
wxStrncpy(buf, wxT("Unknown User"), maxSize);
|
wxStrncpy(buf, wxT("Unknown User"), maxSize);
|
||||||
}
|
}
|
||||||
#endif // Win32/16
|
#endif // Win32/16
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@@ -83,22 +83,23 @@ bool wxWriteResource(const wxString& section, const wxString& entry, int value,
|
|||||||
bool wxGetResource(const wxString& section, const wxString& entry, wxChar **value, const wxString& file)
|
bool wxGetResource(const wxString& section, const wxString& entry, wxChar **value, const wxString& file)
|
||||||
{
|
{
|
||||||
static const wxChar defunkt[] = wxT("$$default");
|
static const wxChar defunkt[] = wxT("$$default");
|
||||||
|
|
||||||
|
wxChar buf[1024];
|
||||||
if (file != wxT(""))
|
if (file != wxT(""))
|
||||||
{
|
{
|
||||||
int n = GetPrivateProfileString((LPCTSTR)WXSTRINGCAST section, (LPCTSTR)WXSTRINGCAST entry, (LPCTSTR)defunkt,
|
int n = GetPrivateProfileString(section, entry, defunkt,
|
||||||
(LPTSTR)wxBuffer, 1000, (LPCTSTR)WXSTRINGCAST file);
|
buf, WXSIZEOF(buf), file);
|
||||||
if (n == 0 || wxStrcmp(wxBuffer, defunkt) == 0)
|
if (n == 0 || wxStrcmp(buf, defunkt) == 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int n = GetProfileString((LPCTSTR)WXSTRINGCAST section, (LPCTSTR)WXSTRINGCAST entry, (LPCTSTR)defunkt,
|
int n = GetProfileString(section, entry, defunkt, buf, WXSIZEOF(buf));
|
||||||
(LPTSTR)wxBuffer, 1000);
|
if (n == 0 || wxStrcmp(buf, defunkt) == 0)
|
||||||
if (n == 0 || wxStrcmp(wxBuffer, defunkt) == 0)
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (*value) delete[] (*value);
|
if (*value) delete[] (*value);
|
||||||
*value = copystring(wxBuffer);
|
*value = copystring(buf);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user