From e8fd750b53e1fa51298d8c17495cdac3363841f0 Mon Sep 17 00:00:00 2001 From: David Webster Date: Tue, 9 Nov 1999 05:57:19 +0000 Subject: [PATCH] OS/2 resource storage and retrieval git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4451 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/os2/utils.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/os2/utils.cpp b/src/os2/utils.cpp index 2bae71d97b..c82dfc9a5a 100644 --- a/src/os2/utils.cpp +++ b/src/os2/utils.cpp @@ -418,7 +418,8 @@ bool wxGetResource( { HAB hab; HINI hIni; - static const wxChar zDefunkt[] = _T("$$default"); + wxChar zDefunkt[] = _T("$$default"); + char zBuf[1000]; if (rFile != "") { @@ -429,11 +430,14 @@ bool wxGetResource( ,(PSZ)WXSTRINGCAST rSection ,(PSZ)WXSTRINGCAST rEntry ,(PSZ)zDefunkt - ,(void*)*ppValue + ,(PVOID)zBuf ,1000 ); - if (n != 0L || wxStrcmp(*ppValue, zDefunkt) == 0) + if (zBuf == NULL) return FALSE; + if (n == 0L || wxStrcmp(zBuf, zDefunkt) == 0) + return FALSE; + zBuf[n-1] = '\0'; } else return FALSE; @@ -444,12 +448,16 @@ bool wxGetResource( ,(PSZ)WXSTRINGCAST rSection ,(PSZ)WXSTRINGCAST rEntry ,(PSZ)zDefunkt - ,(void*)*ppValue + ,(PVOID)zBuf ,1000 ); - if (n != 0L || wxStrcmp(*ppValue, zDefunkt) == 0) + if (zBuf == NULL) return FALSE; + if (n == 0L || wxStrcmp(zBuf, zDefunkt) == 0) + return FALSE; + zBuf[n-1] = '\0'; } + strcpy((char*)*ppValue, zBuf); return TRUE; }