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

View File

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