Finished up utilities testing

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4470 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Webster 1999-11-11 04:40:29 +00:00
parent f28538c5f6
commit 13a4ea8d83
2 changed files with 34 additions and 7 deletions

View File

@ -76,7 +76,7 @@ wxApp *wxTheApp = NULL;
// FIXME why not const? and not static? // FIXME why not const? and not static?
// NB: all "NoRedraw" classes must have the same names as the "normal" classes // NB: all "NoRedraw" classes must have the same names as the "normal" classes
// with NR suffix - wxWindow::MSWCreate() supposes this // with NR suffix - wxWindow::OS2Create() supposes this
wxChar wxFrameClassName[] = wxT("wxFrameClass"); wxChar wxFrameClassName[] = wxT("wxFrameClass");
wxChar wxFrameClassNameNoRedraw[] = wxT("wxFrameClassNR"); wxChar wxFrameClassNameNoRedraw[] = wxT("wxFrameClassNR");
wxChar wxMDIFrameClassName[] = wxT("wxMDIFrameClass"); wxChar wxMDIFrameClassName[] = wxT("wxMDIFrameClass");
@ -125,7 +125,7 @@ bool wxApp::Initialize()
// wxRedirectIOToConsole(); // wxRedirectIOToConsole();
#endif #endif
wxBuffer = new wxChar[1500]; // FIXME wxBuffer = new wxChar[1500]; // FIXME; why?
wxClassInfo::InitializeClasses(); wxClassInfo::InitializeClasses();

View File

@ -265,6 +265,7 @@ void wxError(
, const wxString& rTitle , const wxString& rTitle
) )
{ {
wxBuffer = new wxChar[256];
wxSprintf(wxBuffer, "%s\nContinue?", WXSTRINGCAST rMsg); wxSprintf(wxBuffer, "%s\nContinue?", WXSTRINGCAST rMsg);
if (::WinMessageBox( HWND_DESKTOP if (::WinMessageBox( HWND_DESKTOP
,NULL ,NULL
@ -273,6 +274,7 @@ void wxError(
,0 ,0
,MB_ICONEXCLAMATION | MB_YESNO ,MB_ICONEXCLAMATION | MB_YESNO
) == MBID_YES) ) == MBID_YES)
delete[] wxBuffer;
wxExit(); wxExit();
} }
@ -469,6 +471,8 @@ bool wxGetResource(
) )
{ {
wxChar* zStr = NULL; wxChar* zStr = NULL;
zStr = new wxChar[1000];
bool bSucc = wxGetResource( rSection bool bSucc = wxGetResource( rSection
,rEntry ,rEntry
,(wxChar **)&zStr ,(wxChar **)&zStr
@ -481,7 +485,11 @@ bool wxGetResource(
delete[] zStr; delete[] zStr;
return TRUE; return TRUE;
} }
else return FALSE; else
{
delete[] zStr;
return FALSE;
}
} }
bool wxGetResource( bool wxGetResource(
@ -492,6 +500,8 @@ bool wxGetResource(
) )
{ {
wxChar* zStr = NULL; wxChar* zStr = NULL;
zStr = new wxChar[1000];
bool bSucc = wxGetResource( rSection bool bSucc = wxGetResource( rSection
,rEntry ,rEntry
,(wxChar **)&zStr ,(wxChar **)&zStr
@ -504,7 +514,11 @@ bool wxGetResource(
delete[] zStr; delete[] zStr;
return TRUE; return TRUE;
} }
else return FALSE; else
{
delete[] zStr;
return FALSE;
}
} }
bool wxGetResource( bool wxGetResource(
@ -515,6 +529,8 @@ bool wxGetResource(
) )
{ {
wxChar* zStr = NULL; wxChar* zStr = NULL;
zStr = new wxChar[1000];
bool bSucc = wxGetResource( rSection bool bSucc = wxGetResource( rSection
,rEntry ,rEntry
,(wxChar **)&zStr ,(wxChar **)&zStr
@ -527,7 +543,11 @@ bool wxGetResource(
delete[] zStr; delete[] zStr;
return TRUE; return TRUE;
} }
else return FALSE; else
{
delete[] zStr;
return FALSE;
}
} }
#endif // wxUSE_RESOURCES #endif // wxUSE_RESOURCES
@ -603,6 +623,7 @@ wxChar* wxGetUserHome (
wxChar* zHome; wxChar* zHome;
wxString sUser1(rUser); wxString sUser1(rUser);
wxBuffer = new wxChar[256];
if (sUser1 != _T("")) if (sUser1 != _T(""))
{ {
wxChar zTmp[64]; wxChar zTmp[64];
@ -617,6 +638,7 @@ wxChar* wxGetUserHome (
if ((zHome = wxGetenv(_T("TMP"))) != NULL || if ((zHome = wxGetenv(_T("TMP"))) != NULL ||
(zHome = wxGetenv(_T("TMPDIR"))) != NULL || (zHome = wxGetenv(_T("TMPDIR"))) != NULL ||
(zHome = wxGetenv(_T("TEMP"))) != NULL) (zHome = wxGetenv(_T("TEMP"))) != NULL)
delete[] wxBuffer;
return *zHome ? zHome : (wxChar*)_T("\\"); return *zHome ? zHome : (wxChar*)_T("\\");
} }
if (wxStricmp(zTmp, WXSTRINGCAST sUser1) == 0) if (wxStricmp(zTmp, WXSTRINGCAST sUser1) == 0)
@ -624,13 +646,18 @@ wxChar* wxGetUserHome (
} }
} }
if (sUser1 == _T("")) if (sUser1 == _T(""))
{
if ((zHome = wxGetenv(_T("HOME"))) != NULL) if ((zHome = wxGetenv(_T("HOME"))) != NULL)
{ {
wxStrcpy(wxBuffer, zHome); wxStrcpy(wxBuffer, zHome);
Unix2DosFilename(wxBuffer); Unix2DosFilename(wxBuffer);
return wxBuffer; wxStrcpy(zHome, wxBuffer);
delete[] wxBuffer;
return zHome;
} }
return NULL; // No home known! }
delete[] wxBuffer;
return NULL; // No home known!
} }
// Check whether this window wants to process messages, e.g. Stop button // Check whether this window wants to process messages, e.g. Stop button