You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by am...@apache.org on 2006/04/18 13:31:08 UTC
svn commit: r394919 - /xerces/c/trunk/src/xercesc/internal/XMLReader.cpp
Author: amassari
Date: Tue Apr 18 04:30:33 2006
New Revision: 394919
URL: http://svn.apache.org/viewcvs?rev=394919&view=rev
Log:
setEncoding was relying on XMLRecognizer::encodingForName to return OtherEncoding when presented with a endian-neutral UTF16/UTF32 encoding, but it doesn't do it anymore
Modified:
xerces/c/trunk/src/xercesc/internal/XMLReader.cpp
Modified: xerces/c/trunk/src/xercesc/internal/XMLReader.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/internal/XMLReader.cpp?rev=394919&r1=394918&r2=394919&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/XMLReader.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/XMLReader.cpp Tue Apr 18 04:30:33 2006
@@ -1233,87 +1233,85 @@
XMLCh* inputEncoding = XMLString::replicate(newEncoding, fMemoryManager);
XMLString::upperCaseASCII(inputEncoding);
+ XMLRecognizer::Encodings newBaseEncoding;
//
- // Try to map the string to one of our standard encodings. If its not
- // one of them, then it has to be one of the non-intrinsic encodings,
- // in which case we have to delete our intrinsic encoder and create a
- // new one.
+ // Check for non-endian specific UTF-16 or UCS-4. If so, and if we
+ // are already in one of the endian versions of those encodings,
+ // then just keep it and go on. Otherwise, its not valid.
//
- XMLRecognizer::Encodings newBaseEncoding = XMLRecognizer::encodingForName
- (
- inputEncoding
- );
-
- //
- // If it does not come back as one of the auto-sensed encodings, then we
- // have to possibly replace it and at least check a few things.
- //
- if (newBaseEncoding == XMLRecognizer::OtherEncoding)
+ if (!XMLString::compareString(inputEncoding, XMLUni::fgUTF16EncodingString)
+ || !XMLString::compareString(inputEncoding, XMLUni::fgUTF16EncodingString2)
+ || !XMLString::compareString(inputEncoding, XMLUni::fgUTF16EncodingString3)
+ || !XMLString::compareString(inputEncoding, XMLUni::fgUTF16EncodingString4)
+ || !XMLString::compareString(inputEncoding, XMLUni::fgUTF16EncodingString5)
+ || !XMLString::compareString(inputEncoding, XMLUni::fgUTF16EncodingString6)
+ || !XMLString::compareString(inputEncoding, XMLUni::fgUTF16EncodingString7))
{
- //
- // Check for non-endian specific UTF-16 or UCS-4. If so, and if we
- // are already in one of the endian versions of those encodings,
- // then just keep it and go on. Otherwise, its not valid.
- //
- if (!XMLString::compareString(inputEncoding, XMLUni::fgUTF16EncodingString)
- || !XMLString::compareString(inputEncoding, XMLUni::fgUTF16EncodingString2)
- || !XMLString::compareString(inputEncoding, XMLUni::fgUTF16EncodingString3)
- || !XMLString::compareString(inputEncoding, XMLUni::fgUTF16EncodingString4)
- || !XMLString::compareString(inputEncoding, XMLUni::fgUTF16EncodingString5)
- || !XMLString::compareString(inputEncoding, XMLUni::fgUTF16EncodingString6)
- || !XMLString::compareString(inputEncoding, XMLUni::fgUTF16EncodingString7))
- {
- fMemoryManager->deallocate(inputEncoding);
+ fMemoryManager->deallocate(inputEncoding);
- if ((fEncoding != XMLRecognizer::UTF_16L)
- && (fEncoding != XMLRecognizer::UTF_16B))
- {
- return false;
- }
-
- // Override with the original endian specific encoding
- newBaseEncoding = fEncoding;
-
- if (fEncoding == XMLRecognizer::UTF_16L) {
- fMemoryManager->deallocate(fEncodingStr);
- fEncodingStr = XMLString::replicate(XMLUni::fgUTF16LEncodingString, fMemoryManager);
- }
- else {
- fMemoryManager->deallocate(fEncodingStr);
- fEncodingStr = XMLString::replicate(XMLUni::fgUTF16BEncodingString, fMemoryManager);
- }
- }
- else if (!XMLString::compareString(inputEncoding, XMLUni::fgUCS4EncodingString)
- || !XMLString::compareString(inputEncoding, XMLUni::fgUCS4EncodingString2)
- || !XMLString::compareString(inputEncoding, XMLUni::fgUCS4EncodingString3))
+ if ((fEncoding != XMLRecognizer::UTF_16L)
+ && (fEncoding != XMLRecognizer::UTF_16B))
{
- fMemoryManager->deallocate(inputEncoding);
+ return false;
+ }
- if ((fEncoding != XMLRecognizer::UCS_4L)
- && (fEncoding != XMLRecognizer::UCS_4B))
- {
- return false;
- }
+ // Override with the original endian specific encoding
+ newBaseEncoding = fEncoding;
+
+ if (fEncoding == XMLRecognizer::UTF_16L) {
+ fMemoryManager->deallocate(fEncodingStr);
+ fEncodingStr = XMLString::replicate(XMLUni::fgUTF16LEncodingString, fMemoryManager);
+ }
+ else {
+ fMemoryManager->deallocate(fEncodingStr);
+ fEncodingStr = XMLString::replicate(XMLUni::fgUTF16BEncodingString, fMemoryManager);
+ }
+ }
+ else if (!XMLString::compareString(inputEncoding, XMLUni::fgUCS4EncodingString)
+ || !XMLString::compareString(inputEncoding, XMLUni::fgUCS4EncodingString2)
+ || !XMLString::compareString(inputEncoding, XMLUni::fgUCS4EncodingString3))
+ {
+ fMemoryManager->deallocate(inputEncoding);
- // Override with the original endian specific encoding
- newBaseEncoding = fEncoding;
+ if ((fEncoding != XMLRecognizer::UCS_4L)
+ && (fEncoding != XMLRecognizer::UCS_4B))
+ {
+ return false;
+ }
- if (fEncoding == XMLRecognizer::UCS_4L) {
+ // Override with the original endian specific encoding
+ newBaseEncoding = fEncoding;
- fMemoryManager->deallocate(fEncodingStr);
- fEncodingStr = XMLString::replicate(XMLUni::fgUCS4LEncodingString, fMemoryManager);
- }
- else {
+ if (fEncoding == XMLRecognizer::UCS_4L) {
- fMemoryManager->deallocate(fEncodingStr);
- fEncodingStr = XMLString::replicate(XMLUni::fgUCS4BEncodingString, fMemoryManager);
- }
+ fMemoryManager->deallocate(fEncodingStr);
+ fEncodingStr = XMLString::replicate(XMLUni::fgUCS4LEncodingString, fMemoryManager);
}
- else
+ else {
+
+ fMemoryManager->deallocate(fEncodingStr);
+ fEncodingStr = XMLString::replicate(XMLUni::fgUCS4BEncodingString, fMemoryManager);
+ }
+ }
+ else
+ {
+ //
+ // Try to map the string to one of our standard encodings. If its not
+ // one of them, then it has to be one of the non-intrinsic encodings,
+ // in which case we have to delete our intrinsic encoder and create a
+ // new one.
+ //
+ newBaseEncoding = XMLRecognizer::encodingForName(inputEncoding);
+
+ //
+ // If it does not come back as one of the auto-sensed encodings, then we
+ // have to possibly replace it and at least check a few things.
+ //
+ if (newBaseEncoding == XMLRecognizer::OtherEncoding)
{
//
- // None of those special cases, so just replicate the new name
- // and use it directly to create the transcoder
+ // We already know it's none of those non-endian special cases,
+ // so just replicate the new name and use it directly to create the transcoder
//
fMemoryManager->deallocate(fEncodingStr);
fEncodingStr = inputEncoding;
@@ -1327,12 +1325,12 @@
, fMemoryManager
);
}
- }
- else
- {
- // Store the new encoding string since it is just an intrinsic
- fMemoryManager->deallocate(fEncodingStr);
- fEncodingStr = inputEncoding;
+ else
+ {
+ // Store the new encoding string since it is just an intrinsic
+ fMemoryManager->deallocate(fEncodingStr);
+ fEncodingStr = inputEncoding;
+ }
}
if (!fTranscoder) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org