Fix a few pref calls to check or assert for errors

This commit is contained in:
blythe%netscape.com 1998-07-24 22:56:50 +00:00
Родитель fd97cbd817
Коммит b2fd4c6cf1
7 изменённых файлов: 22 добавлений и 21 удалений

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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);

Просмотреть файл

@ -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);

Просмотреть файл

@ -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;