mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-19 09:30:44 +00:00
fixed recently introduced i18n bugs
This commit is contained in:
parent
a456660fc9
commit
98eae31a0b
@ -148,7 +148,7 @@ static void CheckCaseConversion()
|
||||
if(NULL == gCaseConv )
|
||||
StartUpCaseConversion();
|
||||
|
||||
NS_ASSERTION( gCaseConv != NULL , "cannot obtain UnicharUtil");
|
||||
// NS_ASSERTION( gCaseConv != NULL , "cannot obtain UnicharUtil");
|
||||
|
||||
}
|
||||
|
||||
@ -489,9 +489,11 @@ void nsString::ToLowerCase()
|
||||
{
|
||||
// I18N code begin
|
||||
CheckCaseConversion();
|
||||
nsresult err = gCaseConv->ToLower(mStr, mStr, mLength);
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
if(gCaseConv) {
|
||||
nsresult err = gCaseConv->ToLower(mStr, mStr, mLength);
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
}
|
||||
// I18N code end
|
||||
|
||||
// somehow UnicharUtil return failed, fallback to the old ascii only code
|
||||
@ -514,9 +516,11 @@ void nsString::ToUpperCase()
|
||||
{
|
||||
// I18N code begin
|
||||
CheckCaseConversion();
|
||||
nsresult err = gCaseConv->ToUpper(mStr, mStr, mLength);
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
if(gCaseConv) {
|
||||
nsresult err = gCaseConv->ToUpper(mStr, mStr, mLength);
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
}
|
||||
// I18N code end
|
||||
|
||||
// somehow UnicharUtil return failed, fallback to the old ascii only code
|
||||
@ -562,10 +566,12 @@ void nsString::ToLowerCase(nsString& aOut) const
|
||||
|
||||
// I18N code begin
|
||||
CheckCaseConversion();
|
||||
nsresult err = gCaseConv->ToLower(mStr, aOut.mStr, mLength);
|
||||
(*(aOut.mStr+mLength)) = 0;
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
if(gCaseConv) {
|
||||
nsresult err = gCaseConv->ToLower(mStr, aOut.mStr, mLength);
|
||||
(*(aOut.mStr+mLength)) = 0;
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
}
|
||||
// I18N code end
|
||||
|
||||
// somehow UnicharUtil return failed, fallback to the old ascii only code
|
||||
@ -596,10 +602,12 @@ void nsString::ToUpperCase(nsString& aOut) const
|
||||
|
||||
// I18N code begin
|
||||
CheckCaseConversion();
|
||||
nsresult err = gCaseConv->ToUpper(mStr, aOut.mStr, mLength);
|
||||
(*(aOut.mStr+mLength)) = 0;
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
if(gCaseConv) {
|
||||
nsresult err = gCaseConv->ToUpper(mStr, aOut.mStr, mLength);
|
||||
(*(aOut.mStr+mLength)) = 0;
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
}
|
||||
// I18N code end
|
||||
|
||||
// somehow UnicharUtil return failed, fallback to the old ascii only code
|
||||
|
@ -56,7 +56,7 @@ nsScanner::nsScanner(nsString& anHTMLString) :
|
||||
mMarkPos=-1;
|
||||
mFileStream=0;
|
||||
nsAutoString defaultCharset(DEFAULTCHARSET);
|
||||
mUnicodeDecoder = nsnull;
|
||||
mUnicodeDecoder = 0;
|
||||
SetDocumentCharset(defaultCharset);
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ nsScanner::nsScanner(nsString& aFilename,PRBool aCreateStream) :
|
||||
mFileStream=new fstream(buffer,ios::in);
|
||||
#endif
|
||||
} //if
|
||||
mUnicodeDecoder = nsnull;
|
||||
mUnicodeDecoder = 0;
|
||||
nsAutoString defaultCharset(DEFAULTCHARSET);
|
||||
SetDocumentCharset(defaultCharset);
|
||||
|
||||
@ -114,7 +114,7 @@ nsScanner::nsScanner(nsString& aFilename,fstream& aStream,PRBool assumeOwnership
|
||||
mTotalRead=0;
|
||||
mOwnsStream=assumeOwnership;
|
||||
mFileStream=&aStream;
|
||||
mUnicodeDecoder = nsnull;
|
||||
mUnicodeDecoder = 0;
|
||||
nsAutoString defaultCharset(DEFAULTCHARSET);
|
||||
SetDocumentCharset(defaultCharset);
|
||||
}
|
||||
@ -220,19 +220,21 @@ PRBool nsScanner::Append(nsString& aBuffer) {
|
||||
*/
|
||||
PRBool nsScanner::Append(const char* aBuffer, PRUint32 aLen){
|
||||
|
||||
PRInt32 unicharLength = 0;
|
||||
PRInt32 srcLength = aLen;
|
||||
mUnicodeDecoder->Length(aBuffer, 0, aLen, &unicharLength);
|
||||
PRUnichar *unichars = new PRUnichar [ unicharLength ];
|
||||
|
||||
nsresult res = mUnicodeDecoder->Convert(unichars, 0, &unicharLength,
|
||||
aBuffer, 0, &srcLength );
|
||||
mBuffer.Append(unichars, unicharLength);
|
||||
delete unichars;
|
||||
mTotalRead += unicharLength;
|
||||
|
||||
// mBuffer.Append(aBuffer,aLen);
|
||||
// mTotalRead+=aLen;
|
||||
if(mUnicodeDecoder) {
|
||||
PRInt32 unicharLength = 0;
|
||||
PRInt32 srcLength = aLen;
|
||||
mUnicodeDecoder->Length(aBuffer, 0, aLen, &unicharLength);
|
||||
PRUnichar *unichars = new PRUnichar [ unicharLength ];
|
||||
nsresult res = mUnicodeDecoder->Convert(unichars, 0, &unicharLength,aBuffer, 0, &srcLength );
|
||||
mBuffer.Append(unichars, unicharLength);
|
||||
delete unichars;
|
||||
mTotalRead += unicharLength;
|
||||
}
|
||||
else {
|
||||
|
||||
mBuffer.Append(aBuffer,aLen);
|
||||
mTotalRead+=aLen;
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ nsScanner::nsScanner(nsString& anHTMLString) :
|
||||
mMarkPos=-1;
|
||||
mFileStream=0;
|
||||
nsAutoString defaultCharset(DEFAULTCHARSET);
|
||||
mUnicodeDecoder = nsnull;
|
||||
mUnicodeDecoder = 0;
|
||||
SetDocumentCharset(defaultCharset);
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ nsScanner::nsScanner(nsString& aFilename,PRBool aCreateStream) :
|
||||
mFileStream=new fstream(buffer,ios::in);
|
||||
#endif
|
||||
} //if
|
||||
mUnicodeDecoder = nsnull;
|
||||
mUnicodeDecoder = 0;
|
||||
nsAutoString defaultCharset(DEFAULTCHARSET);
|
||||
SetDocumentCharset(defaultCharset);
|
||||
|
||||
@ -114,7 +114,7 @@ nsScanner::nsScanner(nsString& aFilename,fstream& aStream,PRBool assumeOwnership
|
||||
mTotalRead=0;
|
||||
mOwnsStream=assumeOwnership;
|
||||
mFileStream=&aStream;
|
||||
mUnicodeDecoder = nsnull;
|
||||
mUnicodeDecoder = 0;
|
||||
nsAutoString defaultCharset(DEFAULTCHARSET);
|
||||
SetDocumentCharset(defaultCharset);
|
||||
}
|
||||
@ -220,19 +220,21 @@ PRBool nsScanner::Append(nsString& aBuffer) {
|
||||
*/
|
||||
PRBool nsScanner::Append(const char* aBuffer, PRUint32 aLen){
|
||||
|
||||
PRInt32 unicharLength = 0;
|
||||
PRInt32 srcLength = aLen;
|
||||
mUnicodeDecoder->Length(aBuffer, 0, aLen, &unicharLength);
|
||||
PRUnichar *unichars = new PRUnichar [ unicharLength ];
|
||||
|
||||
nsresult res = mUnicodeDecoder->Convert(unichars, 0, &unicharLength,
|
||||
aBuffer, 0, &srcLength );
|
||||
mBuffer.Append(unichars, unicharLength);
|
||||
delete unichars;
|
||||
mTotalRead += unicharLength;
|
||||
|
||||
// mBuffer.Append(aBuffer,aLen);
|
||||
// mTotalRead+=aLen;
|
||||
if(mUnicodeDecoder) {
|
||||
PRInt32 unicharLength = 0;
|
||||
PRInt32 srcLength = aLen;
|
||||
mUnicodeDecoder->Length(aBuffer, 0, aLen, &unicharLength);
|
||||
PRUnichar *unichars = new PRUnichar [ unicharLength ];
|
||||
nsresult res = mUnicodeDecoder->Convert(unichars, 0, &unicharLength,aBuffer, 0, &srcLength );
|
||||
mBuffer.Append(unichars, unicharLength);
|
||||
delete unichars;
|
||||
mTotalRead += unicharLength;
|
||||
}
|
||||
else {
|
||||
|
||||
mBuffer.Append(aBuffer,aLen);
|
||||
mTotalRead+=aLen;
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ static void CheckCaseConversion()
|
||||
if(NULL == gCaseConv )
|
||||
StartUpCaseConversion();
|
||||
|
||||
NS_ASSERTION( gCaseConv != NULL , "cannot obtain UnicharUtil");
|
||||
// NS_ASSERTION( gCaseConv != NULL , "cannot obtain UnicharUtil");
|
||||
|
||||
}
|
||||
|
||||
@ -489,9 +489,11 @@ void nsString::ToLowerCase()
|
||||
{
|
||||
// I18N code begin
|
||||
CheckCaseConversion();
|
||||
nsresult err = gCaseConv->ToLower(mStr, mStr, mLength);
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
if(gCaseConv) {
|
||||
nsresult err = gCaseConv->ToLower(mStr, mStr, mLength);
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
}
|
||||
// I18N code end
|
||||
|
||||
// somehow UnicharUtil return failed, fallback to the old ascii only code
|
||||
@ -514,9 +516,11 @@ void nsString::ToUpperCase()
|
||||
{
|
||||
// I18N code begin
|
||||
CheckCaseConversion();
|
||||
nsresult err = gCaseConv->ToUpper(mStr, mStr, mLength);
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
if(gCaseConv) {
|
||||
nsresult err = gCaseConv->ToUpper(mStr, mStr, mLength);
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
}
|
||||
// I18N code end
|
||||
|
||||
// somehow UnicharUtil return failed, fallback to the old ascii only code
|
||||
@ -562,10 +566,12 @@ void nsString::ToLowerCase(nsString& aOut) const
|
||||
|
||||
// I18N code begin
|
||||
CheckCaseConversion();
|
||||
nsresult err = gCaseConv->ToLower(mStr, aOut.mStr, mLength);
|
||||
(*(aOut.mStr+mLength)) = 0;
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
if(gCaseConv) {
|
||||
nsresult err = gCaseConv->ToLower(mStr, aOut.mStr, mLength);
|
||||
(*(aOut.mStr+mLength)) = 0;
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
}
|
||||
// I18N code end
|
||||
|
||||
// somehow UnicharUtil return failed, fallback to the old ascii only code
|
||||
@ -596,10 +602,12 @@ void nsString::ToUpperCase(nsString& aOut) const
|
||||
|
||||
// I18N code begin
|
||||
CheckCaseConversion();
|
||||
nsresult err = gCaseConv->ToUpper(mStr, aOut.mStr, mLength);
|
||||
(*(aOut.mStr+mLength)) = 0;
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
if(gCaseConv) {
|
||||
nsresult err = gCaseConv->ToUpper(mStr, aOut.mStr, mLength);
|
||||
(*(aOut.mStr+mLength)) = 0;
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
}
|
||||
// I18N code end
|
||||
|
||||
// somehow UnicharUtil return failed, fallback to the old ascii only code
|
||||
|
@ -148,7 +148,7 @@ static void CheckCaseConversion()
|
||||
if(NULL == gCaseConv )
|
||||
StartUpCaseConversion();
|
||||
|
||||
NS_ASSERTION( gCaseConv != NULL , "cannot obtain UnicharUtil");
|
||||
// NS_ASSERTION( gCaseConv != NULL , "cannot obtain UnicharUtil");
|
||||
|
||||
}
|
||||
|
||||
@ -489,9 +489,11 @@ void nsString::ToLowerCase()
|
||||
{
|
||||
// I18N code begin
|
||||
CheckCaseConversion();
|
||||
nsresult err = gCaseConv->ToLower(mStr, mStr, mLength);
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
if(gCaseConv) {
|
||||
nsresult err = gCaseConv->ToLower(mStr, mStr, mLength);
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
}
|
||||
// I18N code end
|
||||
|
||||
// somehow UnicharUtil return failed, fallback to the old ascii only code
|
||||
@ -514,9 +516,11 @@ void nsString::ToUpperCase()
|
||||
{
|
||||
// I18N code begin
|
||||
CheckCaseConversion();
|
||||
nsresult err = gCaseConv->ToUpper(mStr, mStr, mLength);
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
if(gCaseConv) {
|
||||
nsresult err = gCaseConv->ToUpper(mStr, mStr, mLength);
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
}
|
||||
// I18N code end
|
||||
|
||||
// somehow UnicharUtil return failed, fallback to the old ascii only code
|
||||
@ -562,10 +566,12 @@ void nsString::ToLowerCase(nsString& aOut) const
|
||||
|
||||
// I18N code begin
|
||||
CheckCaseConversion();
|
||||
nsresult err = gCaseConv->ToLower(mStr, aOut.mStr, mLength);
|
||||
(*(aOut.mStr+mLength)) = 0;
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
if(gCaseConv) {
|
||||
nsresult err = gCaseConv->ToLower(mStr, aOut.mStr, mLength);
|
||||
(*(aOut.mStr+mLength)) = 0;
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
}
|
||||
// I18N code end
|
||||
|
||||
// somehow UnicharUtil return failed, fallback to the old ascii only code
|
||||
@ -596,10 +602,12 @@ void nsString::ToUpperCase(nsString& aOut) const
|
||||
|
||||
// I18N code begin
|
||||
CheckCaseConversion();
|
||||
nsresult err = gCaseConv->ToUpper(mStr, aOut.mStr, mLength);
|
||||
(*(aOut.mStr+mLength)) = 0;
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
if(gCaseConv) {
|
||||
nsresult err = gCaseConv->ToUpper(mStr, aOut.mStr, mLength);
|
||||
(*(aOut.mStr+mLength)) = 0;
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
}
|
||||
// I18N code end
|
||||
|
||||
// somehow UnicharUtil return failed, fallback to the old ascii only code
|
||||
|
@ -148,7 +148,7 @@ static void CheckCaseConversion()
|
||||
if(NULL == gCaseConv )
|
||||
StartUpCaseConversion();
|
||||
|
||||
NS_ASSERTION( gCaseConv != NULL , "cannot obtain UnicharUtil");
|
||||
// NS_ASSERTION( gCaseConv != NULL , "cannot obtain UnicharUtil");
|
||||
|
||||
}
|
||||
|
||||
@ -489,9 +489,11 @@ void nsString::ToLowerCase()
|
||||
{
|
||||
// I18N code begin
|
||||
CheckCaseConversion();
|
||||
nsresult err = gCaseConv->ToLower(mStr, mStr, mLength);
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
if(gCaseConv) {
|
||||
nsresult err = gCaseConv->ToLower(mStr, mStr, mLength);
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
}
|
||||
// I18N code end
|
||||
|
||||
// somehow UnicharUtil return failed, fallback to the old ascii only code
|
||||
@ -514,9 +516,11 @@ void nsString::ToUpperCase()
|
||||
{
|
||||
// I18N code begin
|
||||
CheckCaseConversion();
|
||||
nsresult err = gCaseConv->ToUpper(mStr, mStr, mLength);
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
if(gCaseConv) {
|
||||
nsresult err = gCaseConv->ToUpper(mStr, mStr, mLength);
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
}
|
||||
// I18N code end
|
||||
|
||||
// somehow UnicharUtil return failed, fallback to the old ascii only code
|
||||
@ -562,10 +566,12 @@ void nsString::ToLowerCase(nsString& aOut) const
|
||||
|
||||
// I18N code begin
|
||||
CheckCaseConversion();
|
||||
nsresult err = gCaseConv->ToLower(mStr, aOut.mStr, mLength);
|
||||
(*(aOut.mStr+mLength)) = 0;
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
if(gCaseConv) {
|
||||
nsresult err = gCaseConv->ToLower(mStr, aOut.mStr, mLength);
|
||||
(*(aOut.mStr+mLength)) = 0;
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
}
|
||||
// I18N code end
|
||||
|
||||
// somehow UnicharUtil return failed, fallback to the old ascii only code
|
||||
@ -596,10 +602,12 @@ void nsString::ToUpperCase(nsString& aOut) const
|
||||
|
||||
// I18N code begin
|
||||
CheckCaseConversion();
|
||||
nsresult err = gCaseConv->ToUpper(mStr, aOut.mStr, mLength);
|
||||
(*(aOut.mStr+mLength)) = 0;
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
if(gCaseConv) {
|
||||
nsresult err = gCaseConv->ToUpper(mStr, aOut.mStr, mLength);
|
||||
(*(aOut.mStr+mLength)) = 0;
|
||||
if( NS_SUCCEEDED(err))
|
||||
return;
|
||||
}
|
||||
// I18N code end
|
||||
|
||||
// somehow UnicharUtil return failed, fallback to the old ascii only code
|
||||
|
Loading…
x
Reference in New Issue
Block a user