GetCharPref() is going away for nsIPref scriptability - use CopyCharPref instead

This commit is contained in:
alecf%netscape.com 1999-05-28 00:56:53 +00:00
parent b133ab936f
commit ff3c5ccf00
2 changed files with 7 additions and 8 deletions

View File

@ -79,6 +79,8 @@
#include "nsIServiceManager.h"
#include "nsIEventQueueService.h"
#include "nsRDFCID.h"
#include "nsMsgBaseCID.h"
#include "nsMsgLocalCID.h"
#ifdef XP_PC
#define NETLIB_DLL "netlib.dll"
@ -307,19 +309,18 @@ void nsMailboxTestDriver::InitializeTestDriver()
// propogating bienvenu's preferences hack.....
#define ROOT_PATH_LENGTH 128
char rootPath[ROOT_PATH_LENGTH];
int rootLen = ROOT_PATH_LENGTH;
char* rootPath;
nsIPref* prefs;
nsresult rv;
rv = nsServiceManager::GetService(kPrefCID, kIPrefIID, (nsISupports**)&prefs);
if (prefs && NS_SUCCEEDED(rv))
{
prefs->Startup("prefs50.js");
rv = prefs->GetCharPref(kMsgRootFolderPref, rootPath, &rootLen);
rv = prefs->GetCharPref(kMsgRootFolderPref, &rootPath);
nsServiceManager::ReleaseService(kPrefCID, prefs);
}
if (rootLen > 0) // how many bytes did they write into our buffer?
if (NS_SUCCEEDED(rv)))
{
m_folderSpec = rootPath;
}

View File

@ -766,11 +766,9 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::GoHome(void)
// Find the home page stored in prefs
if (m_pIPref)
{
char szBuffer[512];
char *szBuffer;
nsresult rv;
int nBufLen = sizeof(szBuffer) / sizeof(szBuffer[0]);
memset(szBuffer, 0, sizeof(szBuffer));
rv = m_pIPref->GetCharPref(c_szPrefsHomePage, szBuffer, &nBufLen);
rv = m_pIPref->CopyCharPref(c_szPrefsHomePage, &szBuffer);
if (rv == NS_OK)
{
sUrl = A2T(szBuffer);