зеркало из https://github.com/mozilla/gecko-dev.git
Remove UEscape decoder/encoder. Bug 350830, r=jshin, sr=dveditz
This commit is contained in:
Родитель
9f65ed567b
Коммит
a86de95bfc
|
@ -53,7 +53,6 @@
|
|||
|
||||
t.61-8bit.notForBrowser = true
|
||||
x-imap4-modified-utf7.notForBrowser = true
|
||||
x-u-escaped.notForBrowser = true
|
||||
windows-936.notForBrowser = true
|
||||
us-ascii.notForBrowser = true
|
||||
x-obsoleted-euc-jp.notForBrowser = true
|
||||
|
@ -69,7 +68,6 @@ iso-8859-8-e.notForBrowser = true
|
|||
t.61-8bit.notForOutgoing = true
|
||||
utf-7.notForOutgoing = true
|
||||
x-imap4-modified-utf7.notForOutgoing = true
|
||||
x-u-escaped.notForOutgoing = true
|
||||
windows-936.notForOutgoing = true
|
||||
us-ascii.notForOutgoing = true
|
||||
x-obsoleted-euc-jp.notForOutgoing = true
|
||||
|
|
|
@ -154,7 +154,6 @@ iso-10646-ucs-4=UTF-32BE
|
|||
x-iso-10646-ucs-4-be=UTF-32BE
|
||||
x-iso-10646-ucs-4-le=UTF-32LE
|
||||
x-user-defined=x-user-defined
|
||||
x-u-escaped=x-u-escaped
|
||||
x-johab=x-johab
|
||||
x-windows-949=x-windows-949
|
||||
#
|
||||
|
|
|
@ -82,8 +82,6 @@
|
|||
// ucvlatin
|
||||
#include "nsUCvLatinCID.h"
|
||||
#include "nsUCvLatinDll.h"
|
||||
#include "nsUEscapeToUnicode.h"
|
||||
#include "nsUnicodeToUEscape.h"
|
||||
#include "nsAsciiToUnicode.h"
|
||||
#include "nsISO88592ToUnicode.h"
|
||||
#include "nsISO88593ToUnicode.h"
|
||||
|
@ -329,7 +327,6 @@ NS_UCONV_REG_UNREG("UTF-8", NS_UTF8TOUNICODE_CID, NS_UNICODETOUTF8_CID)
|
|||
|
||||
// ucvlatin
|
||||
NS_UCONV_REG_UNREG("us-ascii", NS_ASCIITOUNICODE_CID, NS_UNICODETOASCII_CID)
|
||||
NS_UCONV_REG_UNREG("x-u-escaped", NS_UESCAPETOUNICODE_CID, NS_UNICODETOUESCAPE_CID)
|
||||
NS_UCONV_REG_UNREG("ISO-8859-2", NS_ISO88592TOUNICODE_CID, NS_UNICODETOISO88592_CID)
|
||||
NS_UCONV_REG_UNREG("ISO-8859-3", NS_ISO88593TOUNICODE_CID, NS_UNICODETOISO88593_CID)
|
||||
NS_UCONV_REG_UNREG("ISO-8859-4", NS_ISO88594TOUNICODE_CID, NS_UNICODETOISO88594_CID)
|
||||
|
@ -493,8 +490,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsUTF16BEToUnicode)
|
|||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUTF16LEToUnicode)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUTF32BEToUnicode)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUTF32LEToUnicode)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToUEscape)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUEscapeToUnicode)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToUTF7)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToMUTF7)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToUTF16BE)
|
||||
|
@ -812,11 +807,6 @@ static const nsModuleComponentInfo components[] =
|
|||
NS_UNICODEDECODER_CONTRACTID_BASE "us-ascii",
|
||||
nsAsciiToUnicodeConstructor ,
|
||||
},
|
||||
{
|
||||
DECODER_NAME_BASE "x-u-escaped" , NS_UESCAPETOUNICODE_CID,
|
||||
NS_UNICODEDECODER_CONTRACTID_BASE "x-u-escaped",
|
||||
nsUEscapeToUnicodeConstructor ,
|
||||
},
|
||||
{
|
||||
DECODER_NAME_BASE "ISO-8859-2" , NS_ISO88592TOUNICODE_CID,
|
||||
NS_UNICODEDECODER_CONTRACTID_BASE "ISO-8859-2",
|
||||
|
@ -1122,11 +1112,6 @@ static const nsModuleComponentInfo components[] =
|
|||
NS_UNICODEENCODER_CONTRACTID_BASE "us-ascii",
|
||||
nsUnicodeToAsciiConstructor,
|
||||
},
|
||||
{
|
||||
ENCODER_NAME_BASE "x-u-escaped" , NS_UNICODETOUESCAPE_CID,
|
||||
NS_UNICODEENCODER_CONTRACTID_BASE "x-u-escaped",
|
||||
nsUnicodeToUEscapeConstructor,
|
||||
},
|
||||
{
|
||||
ENCODER_NAME_BASE "ISO-8859-2" , NS_UNICODETOISO88592_CID,
|
||||
NS_UNICODEENCODER_CONTRACTID_BASE "ISO-8859-2",
|
||||
|
|
|
@ -53,7 +53,6 @@ REQUIRES = xpcom \
|
|||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
nsUEscapeToUnicode.cpp \
|
||||
nsAsciiToUnicode.cpp \
|
||||
nsISO88592ToUnicode.cpp \
|
||||
nsISO88593ToUnicode.cpp \
|
||||
|
@ -114,7 +113,6 @@ CPPSRCS = \
|
|||
nsUTF32ToUnicode.cpp \
|
||||
nsT61ToUnicode.cpp \
|
||||
nsUserDefinedToUnicode.cpp \
|
||||
nsUnicodeToUEscape.cpp \
|
||||
nsUnicodeToAscii.cpp \
|
||||
nsUnicodeToISO88592.cpp \
|
||||
nsUnicodeToISO88593.cpp \
|
||||
|
|
|
@ -617,14 +617,6 @@
|
|||
#define NS_UNICODETOTIS620WIN_CID \
|
||||
{ 0x4f26b731, 0x46cb, 0x11d3, {0xb3, 0xc3, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70}}
|
||||
|
||||
// {319FF9C2-51D2-11d3-B3C3-00805F8A6670}
|
||||
#define NS_UESCAPETOUNICODE_CID \
|
||||
{ 0x319ff9c2, 0x51d2, 0x11d3, {0xb3, 0xc3, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70}}
|
||||
|
||||
// {319FF9C3-51D2-11d3-B3C3-00805F8A6670}
|
||||
#define NS_UNICODETOUESCAPE_CID \
|
||||
{ 0x319ff9c3, 0x51d2, 0x11d3, {0xb3, 0xc3, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70}}
|
||||
|
||||
#ifdef MOZ_EXTRA_X11CONVERTERS
|
||||
// {49B38F11-6193-11d3-B3C5-00805F8A6670}
|
||||
#define NS_UNICODETOLANGBOXARABIC8_CID \
|
||||
|
|
|
@ -1,152 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsUEscapeToUnicode.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Subclassing of nsTableDecoderSupport class [implementation]
|
||||
|
||||
NS_IMETHODIMP nsUEscapeToUnicode::GetMaxLength(const char * aSrc,
|
||||
PRInt32 aSrcLength,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
*aDestLength = (aSrcLength + mBufferLen);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsUEscapeToUnicode::Convert(
|
||||
const char * aSrc, PRInt32 * aSrcLength,
|
||||
PRUnichar * aDest, PRInt32 * aDestLength)
|
||||
{
|
||||
const char* srcPtr = aSrc;
|
||||
const char* srcEnd = aSrc + *aSrcLength;
|
||||
PRUnichar* destPtr = aDest;
|
||||
PRUnichar* destEnd = aDest + *aDestLength;
|
||||
while((mBufferLen >0) && (destPtr < destEnd))
|
||||
*destPtr++ = mBuffer[--mBufferLen];
|
||||
|
||||
for(;(srcPtr < srcEnd) && (destPtr < destEnd); srcPtr++)
|
||||
{
|
||||
switch(mState)
|
||||
{
|
||||
case 0:
|
||||
if('\\' == *srcPtr) {
|
||||
mState++;
|
||||
} else {
|
||||
if(0x80 == (0x80 & *srcPtr))
|
||||
{
|
||||
*destPtr++ = (PRUnichar)0xFFFD;
|
||||
} else {
|
||||
*destPtr++ = (PRUnichar)*srcPtr;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1: // got a '\'
|
||||
if(('u' == *srcPtr) || ('U' == *srcPtr)) {
|
||||
mState++;
|
||||
mData=0;
|
||||
} else if(('n' == *srcPtr) || ('r' == *srcPtr) || ('t' == *srcPtr)) {
|
||||
mState =0;
|
||||
if((destPtr+2) >= destEnd) {
|
||||
// notice the data in mBuffer is stored in reversed order
|
||||
mBufferLen = 2;
|
||||
mBuffer[1] = PRUnichar('\\') ;
|
||||
mBuffer[0] = (PRUnichar)*srcPtr;
|
||||
goto error;
|
||||
}
|
||||
*destPtr++ = PRUnichar('\\');
|
||||
*destPtr++ = (PRUnichar)*srcPtr;
|
||||
} else {
|
||||
mState =0;
|
||||
*destPtr++ = (PRUnichar)*srcPtr;
|
||||
}
|
||||
break;
|
||||
case 2: // got \u
|
||||
case 3: // got \u1
|
||||
case 4: // got \u12
|
||||
case 5: // got \u123
|
||||
if(('0' <= *srcPtr) && (*srcPtr <='9')) {
|
||||
mData = (mData << 4) | (*srcPtr - '0');
|
||||
mState++;
|
||||
} else if(('a' <= *srcPtr) && (*srcPtr <='f')) {
|
||||
mData = (mData << 4) | ((*srcPtr - 'a') + 0x0a);
|
||||
mState++;
|
||||
} else if(('A' <= *srcPtr) && (*srcPtr <='F')) {
|
||||
mData = (mData << 4) | ((*srcPtr - 'A') + 0x0a);
|
||||
mState++;
|
||||
} else {
|
||||
// if we got \u , \u2 , \u34
|
||||
if((destPtr+2) >= destEnd) {
|
||||
// notice the data in mBuffer is stored in reversed order
|
||||
mBufferLen = 2;
|
||||
mBuffer[1] = (PRUnichar) mData;
|
||||
mBuffer[0] = (PRUnichar)*srcPtr;
|
||||
mState=0;
|
||||
goto error;
|
||||
}
|
||||
*destPtr++ = (PRUnichar) mData;
|
||||
*destPtr++ = (PRUnichar)*srcPtr;
|
||||
mState=0;
|
||||
}
|
||||
if(6==mState) // got \u1234
|
||||
{
|
||||
*destPtr++ = (PRUnichar) mData;
|
||||
mState = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
*aDestLength = destPtr - aDest;
|
||||
*aSrcLength = srcPtr - aSrc;
|
||||
return NS_OK;
|
||||
|
||||
error:
|
||||
*aDestLength = destPtr - aDest;
|
||||
*aSrcLength = srcPtr - aSrc;
|
||||
return NS_OK_UDEC_MOREOUTPUT;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsUEscapeToUnicode::Reset()
|
||||
{
|
||||
mState =0;
|
||||
mData=0;
|
||||
mBufferLen =0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsUEscapeToUnicode_h___
|
||||
#define nsUEscapeToUnicode_h___
|
||||
#include "nsISupports.h"
|
||||
|
||||
#include "nsUEscapeToUnicode.h"
|
||||
#include "nsUCSupport.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsUEscapeToUnicode [declaration]
|
||||
|
||||
class nsUEscapeToUnicode : public nsBasicDecoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsUEscapeToUnicode() : nsBasicDecoderSupport() { Reset();};
|
||||
|
||||
NS_IMETHOD Convert(const char * aSrc, PRInt32 * aSrcLength,
|
||||
PRUnichar * aDest, PRInt32 * aDestLength);
|
||||
NS_IMETHOD Reset();
|
||||
|
||||
protected:
|
||||
//--------------------------------------------------------------------
|
||||
// Subclassing of nsDecoderSupport class [declaration]
|
||||
|
||||
NS_IMETHOD GetMaxLength(const char * aSrc, PRInt32 aSrcLength,
|
||||
PRInt32 * aDestLength);
|
||||
private:
|
||||
PRUint8 mState;
|
||||
PRUint16 mData;
|
||||
PRUnichar mBuffer[2];
|
||||
PRUint32 mBufferLen;
|
||||
};
|
||||
|
||||
#endif /* nsUEscapeToUnicode_h___ */
|
|
@ -1,97 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
#include "nsUnicodeToUEscape.h"
|
||||
#include "nsUCSupport.h"
|
||||
#include <string.h>
|
||||
|
||||
char hexarray[]="0123456789ABCDEF";
|
||||
NS_IMETHODIMP nsUnicodeToUEscape::Convert(const PRUnichar * aSrc, PRInt32 * aSrcLength,
|
||||
char * aDest, PRInt32 * aDestLength)
|
||||
{
|
||||
const PRUnichar *src = aSrc;
|
||||
const PRUnichar *srcEnd = aSrc + *aSrcLength;
|
||||
char * dest = aDest;
|
||||
const char * destEnd = aDest + *aDestLength;
|
||||
|
||||
while(( src < srcEnd) && (dest<destEnd))
|
||||
{
|
||||
if(0x0000 == ( 0xFF80 & (*src)) )
|
||||
{
|
||||
if( PRUnichar('\\') == *src)
|
||||
{
|
||||
if(( PRUnichar('n') == *(1+src))||
|
||||
( PRUnichar('r') == *(1+src))||
|
||||
( PRUnichar('t') == *(1+src)))
|
||||
{
|
||||
*dest++ = (char) *src;
|
||||
} else {
|
||||
if((dest +2 ) >= destEnd)
|
||||
goto error;
|
||||
*dest++ = (char) '\\';
|
||||
*dest++ = (char) '\\';
|
||||
}
|
||||
} else {
|
||||
*dest++ = (char) *src;
|
||||
}
|
||||
} else {
|
||||
if((dest +6 ) >= destEnd)
|
||||
goto error;
|
||||
*dest++ = (char) '\\';
|
||||
*dest++ = (char) 'u';
|
||||
*dest++ = (char) hexarray[0x0f & (*src >> 12)];
|
||||
*dest++ = (char) hexarray[0x0f & (*src >> 8)];
|
||||
*dest++ = (char) hexarray[0x0f & (*src >> 4)];
|
||||
*dest++ = (char) hexarray[0x0f & (*src)];
|
||||
}
|
||||
src++;
|
||||
}
|
||||
|
||||
*aSrcLength = src - aSrc;
|
||||
*aDestLength = dest - aDest;
|
||||
return NS_OK;
|
||||
error:
|
||||
*aSrcLength = src - aSrc;
|
||||
*aDestLength = dest - aDest;
|
||||
return NS_OK_UDEC_MOREOUTPUT;
|
||||
}
|
||||
nsresult NEW_UnicodeToUEscape(nsISupports **aResult)
|
||||
{
|
||||
*aResult = (nsIUnicodeEncoder*)new nsUnicodeToUEscape();
|
||||
return (NULL == *aResult) ? NS_ERROR_OUT_OF_MEMORY : NS_OK;
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsUnicodeToUEscape_h___
|
||||
#define nsUnicodeToUEscape_h___
|
||||
|
||||
#include "nsUCSupport.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
// XXX should we inherited from nsEncoderSupprt ? We don't want the buffer stuff there
|
||||
class nsUnicodeToUEscape : public nsEncoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsUnicodeToUEscape() : nsEncoderSupport(6) {};
|
||||
|
||||
NS_IMETHOD FillInfo(PRUint32* aInfo)
|
||||
{
|
||||
memset(aInfo, 0xFF, (0x10000L >> 3));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD Convert(const PRUnichar * aSrc, PRInt32 * aSrcLength,
|
||||
char * aDest, PRInt32 * aDestLength);
|
||||
NS_IMETHOD Finish(char * aDest, PRInt32 * aDestLength)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD Reset()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Subclassing of nsEncoderSupport class [declaration]
|
||||
|
||||
NS_IMETHOD ConvertNoBuffNoErr(const PRUnichar * aSrc, PRInt32 * aSrcLength,
|
||||
char * aDest, PRInt32 * aDestLength)
|
||||
{
|
||||
NS_ASSERTION(PR_FALSE, "should never call this");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
};
|
||||
|
||||
};
|
||||
nsresult NEW_UnicodeToUEscape(nsISupports **aResult);
|
||||
|
||||
#endif /* nsUnicodeToUEscape_h___ */
|
Загрузка…
Ссылка в новой задаче