Changed pointer to refs for name params

This commit is contained in:
rods%netscape.com 1999-05-18 21:43:22 +00:00
parent 0142cb7a14
commit 7e5e29032f
3 changed files with 18 additions and 8 deletions

View File

@ -37,9 +37,9 @@ class nsIFontRetrieverService : public nsISupports
NS_IMETHOD CreateFontNameIterator( nsIFontNameIterator** aIterator ) = 0;
NS_IMETHOD CreateFontSizeIterator( const nsString * aFontName, nsIFontSizeIterator** aIterator ) = 0;
NS_IMETHOD CreateFontSizeIterator( const nsString &aFontName, nsIFontSizeIterator** aIterator ) = 0;
NS_IMETHOD IsFontScalable( const nsString * aFontName, PRBool* aResult ) = 0;
NS_IMETHOD IsFontScalable( const nsString &aFontName, PRBool* aResult ) = 0;
};

View File

@ -103,15 +103,18 @@ NS_IMETHODIMP nsFontRetrieverService::CreateFontNameIterator( nsIFontNameIterato
}
//----------------------------------------------------------
NS_IMETHODIMP nsFontRetrieverService::CreateFontSizeIterator( const nsString * aFontName,
NS_IMETHODIMP nsFontRetrieverService::CreateFontSizeIterator( const nsString &aFontName,
nsIFontSizeIterator** aIterator )
{
// cache current value in case someone else externally is using it
PRInt32 saveIterInx = mNameIterInx;
PRBool found = PR_FALSE;
Reset();
do {
nsAutoString name;
Get(&name);
if (name.Equals(*aFontName)) {
if (name.Equals(aFontName)) {
found = PR_TRUE;
break;
}
@ -128,8 +131,10 @@ NS_IMETHODIMP nsFontRetrieverService::CreateFontSizeIterator( const nsString * a
FontInfo * fontInfo = (FontInfo *)mFontList->ElementAt(mNameIterInx);
mSizeIter->SetFontInfo(fontInfo);
mNameIterInx = saveIterInx;
return NS_OK;
}
mNameIterInx = saveIterInx;
return NS_ERROR_FAILURE;
}
@ -323,14 +328,17 @@ NS_IMETHODIMP nsFontRetrieverService::LoadFontList()
}
//----------------------------------------------------------
NS_IMETHODIMP nsFontRetrieverService::IsFontScalable( const nsString * aFontName, PRBool* aResult )
NS_IMETHODIMP nsFontRetrieverService::IsFontScalable( const nsString &aFontName, PRBool* aResult )
{
// cache current value in case someone else externally is using it
PRInt32 saveIterInx = mNameIterInx;
PRBool found = PR_FALSE;
Reset();
do {
nsAutoString name;
Get(&name);
if (name.Equals(*aFontName)) {
if (name.Equals(aFontName)) {
found = PR_TRUE;
break;
}
@ -339,8 +347,10 @@ NS_IMETHODIMP nsFontRetrieverService::IsFontScalable( const nsString * aFontName
if (found) {
FontInfo * fontInfo = (FontInfo *)mFontList->ElementAt(mNameIterInx);
*aResult = fontInfo->mIsScalable;
mNameIterInx = saveIterInx;
return NS_OK;
}
mNameIterInx = saveIterInx;
return NS_ERROR_FAILURE;
}

View File

@ -36,9 +36,9 @@ public:
// nsIFontRetrieverService
NS_IMETHOD CreateFontNameIterator( nsIFontNameIterator** aIterator );
NS_IMETHOD CreateFontSizeIterator( const nsString * aFontName, nsIFontSizeIterator** aIterator );
NS_IMETHOD CreateFontSizeIterator( const nsString &aFontName, nsIFontSizeIterator** aIterator );
NS_IMETHOD IsFontScalable( const nsString * aFontName, PRBool* aResult );
NS_IMETHOD IsFontScalable( const nsString &aFontName, PRBool* aResult );
// nsIFontNameIterator