Make mErrorEncoder nsCOMPtr. Bug 306493, r=jshin, sr=dbaron

This commit is contained in:
smontagu%smontagu.org 2005-09-06 07:10:26 +00:00
parent 085ece7010
commit 5ac082b0a6
10 changed files with 9 additions and 24 deletions

View File

@ -53,10 +53,7 @@ nsUnicodeToSunIndic::SetOutputErrorBehavior(PRInt32 aBehavior,
{
if (aBehavior == kOnError_CallBack && aEncoder == nsnull)
return NS_ERROR_NULL_POINTER;
NS_IF_RELEASE(mErrEncoder);
mErrEncoder = aEncoder;
NS_IF_ADDREF(mErrEncoder);
mErrBehavior = aBehavior;
mErrChar = aChar;
return NS_OK;

View File

@ -87,6 +87,6 @@ private:
PRInt32 mErrBehavior;
PRUnichar mErrChar;
nsIUnicharEncoder* mErrEncoder;
nsCOMPtr<nsIUnicharEncoder> mErrEncoder;
};
#endif /* !nsUnicodeToSunIndic_h___ */

View File

@ -148,10 +148,7 @@ nsUnicodeToThaiTTF::SetOutputErrorBehavior(PRInt32 aBehavior,
{
if (aBehavior == kOnError_CallBack && aEncoder == nsnull)
return NS_ERROR_NULL_POINTER;
NS_IF_RELEASE(mErrEncoder);
mErrEncoder = aEncoder;
NS_IF_ADDREF(mErrEncoder);
mErrBehavior = aBehavior;
mErrChar = aChar;
return NS_OK;

View File

@ -71,7 +71,7 @@ private:
PRInt32 mErrBehavior;
PRUnichar mErrChar;
nsIUnicharEncoder* mErrEncoder;
nsCOMPtr<nsIUnicharEncoder> mErrEncoder;
};
#endif /* nsUnicodeToThaiTTF_h___ */

View File

@ -168,10 +168,7 @@ nsUnicodeToJamoTTF::SetOutputErrorBehavior(PRInt32 aBehavior,
{
if (aBehavior == kOnError_CallBack && aEncoder == nsnull)
return NS_ERROR_NULL_POINTER;
NS_IF_RELEASE(mErrEncoder);
mErrEncoder = aEncoder;
NS_IF_ADDREF(mErrEncoder);
mErrBehavior = aBehavior;
mErrChar = aChar;
return NS_OK;

View File

@ -87,7 +87,7 @@ protected:
PRInt32 mErrBehavior;
PRUnichar mErrChar;
nsIUnicharEncoder* mErrEncoder;
nsCOMPtr<nsIUnicharEncoder> mErrEncoder;
private:
NS_IMETHOD composeHangul(char* output);

View File

@ -274,7 +274,7 @@ nsUnicodeToTSCII::Convert(const PRUnichar * aSrc, PRInt32 * aSrcLength,
}
if (ch < 0x80) // Plain ASCII character.
*dest++ = ch;
*dest++ = (char)ch;
else if (IS_UNI_TAMIL(ch)) {
PRUint8 t = UnicharToTSCII[ch - UNI_TAMIL_START];
@ -298,7 +298,7 @@ nsUnicodeToTSCII::Convert(const PRUnichar * aSrc, PRInt32 * aSrcLength,
}
}
else if (ch == 0x00A9)
*dest++ = ch;
*dest++ = (char)ch;
else if (IS_UNI_SINGLE_QUOTE(ch))
*dest++ = ch - UNI_LEFT_SINGLE_QUOTE + TSC_LEFT_SINGLE_QUOTE;
else if (IS_UNI_DOUBLE_QUOTE(ch))
@ -524,10 +524,7 @@ nsUnicodeToTamilTTF::SetOutputErrorBehavior(PRInt32 aBehavior,
{
if (aBehavior == kOnError_CallBack && aEncoder == nsnull)
return NS_ERROR_NULL_POINTER;
NS_IF_RELEASE(mErrEncoder);
mErrEncoder = aEncoder;
NS_IF_ADDREF(mErrEncoder);
mErrBehavior = aBehavior;
mErrChar = aChar;
return NS_OK;

View File

@ -41,6 +41,7 @@
#ifndef nsUnicodeToTSCII_h___
#define nsUnicodeToTSCII_h___
#include "nsCOMPtr.h"
#include "nsISupports.h"
#include "nsIUnicodeEncoder.h"
#include "nsICharRepresentable.h"
@ -105,7 +106,7 @@ private:
char mStaticBuffer[CHAR_BUFFER_SIZE];
PRInt32 mErrBehavior;
PRUnichar mErrChar;
nsIUnicharEncoder* mErrEncoder;
nsCOMPtr<nsIUnicharEncoder> mErrEncoder;
};
#endif /* nsUnicodeToTSCII_h___ */

View File

@ -382,7 +382,6 @@ nsEncoderSupport::nsEncoderSupport(PRUint32 aMaxLengthFactor) :
mErrBehavior = kOnError_Signal;
mErrChar = 0;
mErrEncoder = NULL;
Reset();
}
@ -390,7 +389,6 @@ nsEncoderSupport::nsEncoderSupport(PRUint32 aMaxLengthFactor) :
nsEncoderSupport::~nsEncoderSupport()
{
delete [] mBuffer;
NS_IF_RELEASE(mErrEncoder);
}
NS_IMETHODIMP nsEncoderSupport::ConvertNoBuff(const PRUnichar * aSrc,
@ -574,10 +572,7 @@ NS_IMETHODIMP nsEncoderSupport::SetOutputErrorBehavior(
if (aBehavior == kOnError_CallBack && aEncoder == nsnull)
return NS_ERROR_NULL_POINTER;
NS_IF_RELEASE(mErrEncoder);
mErrEncoder = aEncoder;
NS_IF_ADDREF(mErrEncoder);
mErrBehavior = aBehavior;
mErrChar = aChar;
return NS_OK;

View File

@ -38,6 +38,7 @@
#ifndef nsUCvJaSupport_h___
#define nsUCvJaSupport_h___
#include "nsCOMPtr.h"
#include "nsIUnicodeEncoder.h"
#include "nsIUnicodeDecoder.h"
#include "nsIUnicodeEncodeHelper.h"
@ -337,7 +338,7 @@ protected:
* Error handling stuff
*/
PRInt32 mErrBehavior;
nsIUnicharEncoder * mErrEncoder;
nsCOMPtr<nsIUnicharEncoder> mErrEncoder;
PRUnichar mErrChar;
PRUint32 mMaxLengthFactor;