Add a FinishNoBuff() method to the UnicodeToHZ encoder, to send the correct closing escape sequence

This commit is contained in:
smontagu%smontagu.org 2007-02-26 20:00:17 +00:00
Родитель 05222d6ea6
Коммит ae28a37971
2 изменённых файлов: 18 добавлений и 0 удалений

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

@ -133,6 +133,22 @@ NS_IMETHODIMP nsUnicodeToHZ::ConvertNoBuff(
*aSrcLength = i;
return NS_OK;
}
NS_IMETHODIMP nsUnicodeToHZ::FinishNoBuff(char * aDest, PRInt32 * aDestLength)
{
if ( mHZState == HZ_STATE_GB )
{
// if we are in HZ mode, end it by adding a '~}' ESC sequence
mHZState = HZ_STATE_ASCII;
aDest[0] = '~';
aDest[1] = '}';
*aDestLength = 2;
} else {
*aDestLength = 0;
}
return NS_OK;
}
NS_IMETHODIMP nsUnicodeToHZ::FillInfo(PRUint32 *aInfo)
{
mUtil.FillGB2312Info(aInfo);

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

@ -69,6 +69,8 @@ protected:
char * aDest,
PRInt32 * aDestLength);
NS_IMETHOD FinishNoBuff(char * aDest, PRInt32 * aDestLength);
NS_IMETHOD FillInfo(PRUint32 *aInfo);
NS_IMETHOD ConvertNoBuffNoErr(const PRUnichar * aSrc, PRInt32 * aSrcLength,