From 5e83276d6ea5a348cfc944d185c18401a6c615be Mon Sep 17 00:00:00 2001 From: "blythe%netscape.com" Date: Fri, 24 Jul 1998 22:56:50 +0000 Subject: [PATCH] Fix a few pref calls to check or assert for errors git-svn-id: svn://10.0.0.236/trunk@6442 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/cmd/winfe/animbar2.cpp | 9 +++------ mozilla/cmd/winfe/custom.cpp | 11 ++++++----- mozilla/cmd/winfe/display.cpp | 4 ++-- mozilla/cmd/winfe/fegui.cpp | 6 ++++-- mozilla/cmd/winfe/framinit.cpp | 5 +++-- mozilla/cmd/winfe/mainfrm.cpp | 4 ++-- mozilla/cmd/winfe/nsapp.cpp | 4 ++-- 7 files changed, 22 insertions(+), 21 deletions(-) diff --git a/mozilla/cmd/winfe/animbar2.cpp b/mozilla/cmd/winfe/animbar2.cpp index c29a37a8de3..b31a415468e 100644 --- a/mozilla/cmd/winfe/animbar2.cpp +++ b/mozilla/cmd/winfe/animbar2.cpp @@ -169,9 +169,6 @@ CAnimation2::CAnimation2( CWnd *pParent, LPUNKNOWN pUnk ): CWnd() m_ToolTip.Create(this); #endif - char *pURL; - PREF_CopyConfigString("toolbar.logo.url",&pURL); - if( !CUST_IsCustomAnimation( &m_iFrameCount ) ) { m_ToolTip.AddTool(this, szLoadString(IDS_NETSCAPE_TIP)); @@ -361,9 +358,9 @@ void CAnimation2::OnLButtonUp( UINT nFlags, CPoint point ) ASSERT(pCX != NULL); if (pCX != NULL) { - char *pURL; - PREF_CopyConfigString("toolbar.logo.url",&pURL); - if (pURL && *pURL) { + char *pURL = NULL; + int iError = PREF_CopyConfigString("toolbar.logo.url",&pURL); + if (PREF_ERROR != iError && pURL && *pURL) { pCX->NormalGetUrl(pURL); XP_FREE(pURL); } diff --git a/mozilla/cmd/winfe/custom.cpp b/mozilla/cmd/winfe/custom.cpp index d25b0d11cec..050fd76c77b 100644 --- a/mozilla/cmd/winfe/custom.cpp +++ b/mozilla/cmd/winfe/custom.cpp @@ -30,19 +30,20 @@ BOOL CUST_IsCustomAnimation(int * iFrames) { - char *pFile; + char *pFile = NULL; BOOL bRet = FALSE; // set iFrames to default - PREF_CopyConfigString("toolbar.logo.win_small_file",&pFile); - if (pFile) { + int iError = PREF_CopyConfigString("toolbar.logo.win_small_file",&pFile); + if (PREF_ERROR != iError && pFile) { if (*pFile) bRet = TRUE; XP_FREE(pFile); pFile = NULL; } - PREF_CopyConfigString("toolbar.logo.win_large_file",&pFile); - if (pFile) { + pFile = NULL; + iError = PREF_CopyConfigString("toolbar.logo.win_large_file",&pFile); + if (PREF_ERROR != iError && pFile) { if (*pFile) bRet = TRUE; XP_FREE(pFile); pFile = NULL; diff --git a/mozilla/cmd/winfe/display.cpp b/mozilla/cmd/winfe/display.cpp index 53c269d70ab..ae723e87984 100755 --- a/mozilla/cmd/winfe/display.cpp +++ b/mozilla/cmd/winfe/display.cpp @@ -660,8 +660,8 @@ NET_StreamClass *external_viewer_disk_stream(int iFormatOut, void *pDataObj, URL } if(bMoreInfo == TRUE) { char * url = NULL; - PREF_CopyConfigString("internal_url.more_info_plugin.url",&url); - if (url) { + int iError = PREF_CopyConfigString("internal_url.more_info_plugin.url",&url); + if (PREF_ERROR != iError && url) { CString csUrlAddress = url; csUrlAddress += "?"; csUrlAddress += pUrl->content_type; diff --git a/mozilla/cmd/winfe/fegui.cpp b/mozilla/cmd/winfe/fegui.cpp index 2f90f36c8d8..d2752315ee1 100755 --- a/mozilla/cmd/winfe/fegui.cpp +++ b/mozilla/cmd/winfe/fegui.cpp @@ -2976,7 +2976,8 @@ HBITMAP wfe_LoadBitmap(HINSTANCE hInst, HDC hDC, LPCSTR pszBmName ) HBITMAP hCust = NULL; CString csProfileFile; - PREF_CopyConfigString("toolbar.logo.win_large_file",&pFile); + int iError = PREF_CopyConfigString("toolbar.logo.win_large_file",&pFile); + ASSERT(iError != PREF_ERROR); // we need to first check the profile for the file (for PE) and then resort to the default of the EXE dir csProfileFile = theApp.m_UserDirectory; @@ -2995,7 +2996,8 @@ HBITMAP wfe_LoadBitmap(HINSTANCE hInst, HDC hDC, LPCSTR pszBmName ) HBITMAP hCust = NULL; CString csProfileFile; - PREF_CopyConfigString("toolbar.logo.win_small_file",&pFile); + int iError = PREF_CopyConfigString("toolbar.logo.win_small_file",&pFile); + ASSERT(iError != PREF_ERROR); // we need to first check the profile for the file (for PE) and then resort to the default of the EXE dir csProfileFile = theApp.m_UserDirectory; diff --git a/mozilla/cmd/winfe/framinit.cpp b/mozilla/cmd/winfe/framinit.cpp index 96897c9459a..912ce4fadc1 100755 --- a/mozilla/cmd/winfe/framinit.cpp +++ b/mozilla/cmd/winfe/framinit.cpp @@ -601,8 +601,9 @@ void CMainFrame::OnLoadHomePage() if (bOverride) { // if the over-ride preference is set, use that instead - PREF_CopyConfigString("startup.homepage_override_url",&tmpBuf); - if (tmpBuf && tmpBuf[0]) { + tmpBuf = NULL; + int iError = PREF_CopyConfigString("startup.homepage_override_url",&tmpBuf); + if (PREF_ERROR != iError && tmpBuf && tmpBuf[0]) { csTmp = tmpBuf; lpszHomePage = csTmp; XP_FREE(tmpBuf); diff --git a/mozilla/cmd/winfe/mainfrm.cpp b/mozilla/cmd/winfe/mainfrm.cpp index d829cb5b0c8..758b55a11ed 100644 --- a/mozilla/cmd/winfe/mainfrm.cpp +++ b/mozilla/cmd/winfe/mainfrm.cpp @@ -391,9 +391,9 @@ void CMainFrame::OnUpdateToggleImageLoad(CCmdUI* pCmdUI) void CMainFrame::OnNetSearch() { char * url = NULL; - PREF_CopyConfigString("internal_url.net_search.url",&url); + int iError = PREF_CopyConfigString("internal_url.net_search.url",&url); - if(GetMainContext() && url) + if(PREF_ERROR != iError && GetMainContext() && url) { GetMainContext()->NormalGetUrl(url); XP_FREE(url); diff --git a/mozilla/cmd/winfe/nsapp.cpp b/mozilla/cmd/winfe/nsapp.cpp index d24c9088ca9..3bbe0723462 100644 --- a/mozilla/cmd/winfe/nsapp.cpp +++ b/mozilla/cmd/winfe/nsapp.cpp @@ -918,8 +918,8 @@ CString CNetscapeApp::ResolveAppVersion() { csReturn += csVersion; char *pCustAgent = NULL; - PREF_CopyConfigString("user_agent",&pCustAgent); - if (pCustAgent) { + int iError = PREF_CopyConfigString("user_agent",&pCustAgent); + if (PREF_ERROR != iError && pCustAgent) { if (*pCustAgent) { csReturn += "C-"; csReturn += pCustAgent;