mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
fix bug 71358. Use xpcom pointer and do right thing for ref count
r/sr=hyatt
This commit is contained in:
parent
80fdeac6f8
commit
fdfd99773b
@ -60,9 +60,8 @@ nsBidiPresUtils::nsBidiPresUtils() : mSuccess(NS_ERROR_FAILURE),
|
||||
mIndexMap(nsnull),
|
||||
mLevels(nsnull)
|
||||
{
|
||||
nsCOMPtr<nsIBidi> bidiEngine = do_GetService("@mozilla.org/intl/bidi;1");
|
||||
if (bidiEngine) {
|
||||
mBidiEngine = bidiEngine;
|
||||
mBidiEngine = do_GetService("@mozilla.org/intl/bidi;1");
|
||||
if (mBidiEngine) {
|
||||
mSuccess = NS_OK;
|
||||
}
|
||||
}
|
||||
@ -841,11 +840,10 @@ nsBidiPresUtils::FormatUnicodeText(nsIPresContext* aPresContext,
|
||||
{
|
||||
nsresult rv;
|
||||
if (!mUnicodeUtils) {
|
||||
nsCOMPtr<nsIUBidiUtils> bidiUtils = do_GetService("@mozilla.org/intl/unicharbidiutil;1");
|
||||
if (!bidiUtils) {
|
||||
mUnicodeUtils = do_GetService("@mozilla.org/intl/unicharbidiutil;1");
|
||||
if (!mUnicodeUtils) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mUnicodeUtils = bidiUtils;
|
||||
}
|
||||
// ahmed
|
||||
//adjusted for correct numeral shaping
|
||||
@ -1023,6 +1021,7 @@ nsresult nsBidiPresUtils::GetBidiEngine(nsIBidi** aBidiEngine)
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
if (mBidiEngine) {
|
||||
*aBidiEngine = mBidiEngine;
|
||||
NS_ADDREF(*aBidiEngine);
|
||||
rv = NS_OK;
|
||||
}
|
||||
return rv;
|
||||
|
@ -29,8 +29,8 @@
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIBidi.h"
|
||||
|
||||
class nsIUBidiUtils;
|
||||
#include "nsIUBidiUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsBidiPresUtils {
|
||||
public:
|
||||
@ -146,8 +146,8 @@ private:
|
||||
PRUint8* mLevels;
|
||||
nsresult mSuccess;
|
||||
|
||||
nsIBidi* mBidiEngine;
|
||||
nsIUBidiUtils* mUnicodeUtils;
|
||||
nsCOMPtr<nsIBidi> mBidiEngine;
|
||||
nsCOMPtr<nsIUBidiUtils> mUnicodeUtils;
|
||||
};
|
||||
|
||||
#endif /* nsBidiPresUtils_h___ */
|
||||
|
@ -29,8 +29,8 @@
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIBidi.h"
|
||||
|
||||
class nsIUBidiUtils;
|
||||
#include "nsIUBidiUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsBidiPresUtils {
|
||||
public:
|
||||
@ -146,8 +146,8 @@ private:
|
||||
PRUint8* mLevels;
|
||||
nsresult mSuccess;
|
||||
|
||||
nsIBidi* mBidiEngine;
|
||||
nsIUBidiUtils* mUnicodeUtils;
|
||||
nsCOMPtr<nsIBidi> mBidiEngine;
|
||||
nsCOMPtr<nsIUBidiUtils> mUnicodeUtils;
|
||||
};
|
||||
|
||||
#endif /* nsBidiPresUtils_h___ */
|
||||
|
@ -60,9 +60,8 @@ nsBidiPresUtils::nsBidiPresUtils() : mSuccess(NS_ERROR_FAILURE),
|
||||
mIndexMap(nsnull),
|
||||
mLevels(nsnull)
|
||||
{
|
||||
nsCOMPtr<nsIBidi> bidiEngine = do_GetService("@mozilla.org/intl/bidi;1");
|
||||
if (bidiEngine) {
|
||||
mBidiEngine = bidiEngine;
|
||||
mBidiEngine = do_GetService("@mozilla.org/intl/bidi;1");
|
||||
if (mBidiEngine) {
|
||||
mSuccess = NS_OK;
|
||||
}
|
||||
}
|
||||
@ -841,11 +840,10 @@ nsBidiPresUtils::FormatUnicodeText(nsIPresContext* aPresContext,
|
||||
{
|
||||
nsresult rv;
|
||||
if (!mUnicodeUtils) {
|
||||
nsCOMPtr<nsIUBidiUtils> bidiUtils = do_GetService("@mozilla.org/intl/unicharbidiutil;1");
|
||||
if (!bidiUtils) {
|
||||
mUnicodeUtils = do_GetService("@mozilla.org/intl/unicharbidiutil;1");
|
||||
if (!mUnicodeUtils) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mUnicodeUtils = bidiUtils;
|
||||
}
|
||||
// ahmed
|
||||
//adjusted for correct numeral shaping
|
||||
@ -1023,6 +1021,7 @@ nsresult nsBidiPresUtils::GetBidiEngine(nsIBidi** aBidiEngine)
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
if (mBidiEngine) {
|
||||
*aBidiEngine = mBidiEngine;
|
||||
NS_ADDREF(*aBidiEngine);
|
||||
rv = NS_OK;
|
||||
}
|
||||
return rv;
|
||||
|
Loading…
Reference in New Issue
Block a user