This commit is contained in:
cata%netscape.com 1999-02-24 17:05:23 +00:00
Родитель 9f135c0eb4
Коммит 56140d598d
1 изменённых файлов: 13 добавлений и 2 удалений

Просмотреть файл

@ -30,6 +30,10 @@ nsEncoderSupport::nsEncoderSupport()
mBufferCapacity = 16;
mBuffer = new char[mBufferCapacity];
mErrBehavior = kOnError_Signal;
mErrChar = 0;
mErrEncoder = NULL;
Reset();
NS_INIT_REFCNT();
PR_AtomicIncrement(&g_InstanceCount);
@ -38,6 +42,7 @@ nsEncoderSupport::nsEncoderSupport()
nsEncoderSupport::~nsEncoderSupport()
{
delete [] mBuffer;
NS_IF_RELEASE(mErrEncoder);
PR_AtomicDecrement(&g_InstanceCount);
}
@ -210,7 +215,7 @@ NS_IMETHODIMP nsEncoderSupport::Finish(char * aDest, PRInt32 * aDestLength)
char * dest = aDest;
char * destEnd = aDest + *aDestLength;
PRInt32 bcr, bcw; // byte counts for read & write;
PRInt32 bcw; // byte count for write;
nsresult res;
res = FlushBuffer(&dest, destEnd);
@ -250,8 +255,14 @@ NS_IMETHODIMP nsEncoderSupport::SetOutputErrorBehavior(
nsIUnicharEncoder * aEncoder,
PRUnichar aChar)
{
mErrBehavior = aBehavior;
if ((aBehavior == kOnError_CallBack) && (aEncoder == NULL))
return NS_ERROR_NULL_POINTER;
NS_IF_RELEASE(aEncoder);
mErrEncoder = aEncoder;
NS_IF_ADDREF(aEncoder);
mErrBehavior = aBehavior;
mErrChar = aChar;
return NS_OK;
}