making string conversions explict
git-svn-id: svn://10.0.0.236/trunk@65023 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
4cebb949ef
commit
dd2b4f8ffb
@ -510,15 +510,15 @@ nsLoggingSink::QuoteText(const nsString& aValue, nsString& aResult)
|
||||
while (cp < end) {
|
||||
PRUnichar ch = *cp++;
|
||||
if (ch == '"') {
|
||||
aResult.Append(""");
|
||||
aResult.AppendWithConversion(""");
|
||||
}
|
||||
else if (ch == '&') {
|
||||
aResult.Append("&");
|
||||
aResult.AppendWithConversion("&");
|
||||
}
|
||||
else if ((ch < 32) || (ch >= 127)) {
|
||||
aResult.Append("&#");
|
||||
aResult.Append(PRInt32(ch), 10);
|
||||
aResult.Append(';');
|
||||
aResult.AppendWithConversion("&#");
|
||||
aResult.AppendWithConversion(PRInt32(ch), 10);
|
||||
aResult.AppendWithConversion(';');
|
||||
}
|
||||
else {
|
||||
aResult.Append(ch);
|
||||
|
||||
@ -194,8 +194,9 @@ void nsParser::FreeSharedObjects(void) {
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
nsParser::nsParser(nsITokenObserver* anObserver) : mUnusedInput("") , mCharset("ISO-8859-1") {
|
||||
nsParser::nsParser(nsITokenObserver* anObserver) {
|
||||
NS_INIT_REFCNT();
|
||||
mCharset.AssignWithConversion("ISO-8859-1");
|
||||
mParserFilter = 0;
|
||||
mObserver = 0;
|
||||
mProgressEventSink = nsnull;
|
||||
@ -311,7 +312,7 @@ nsIParserFilter * nsParser::SetParserFilter(nsIParserFilter * aFilter)
|
||||
* @return ptr to previously set contentsink (usually null)
|
||||
*/
|
||||
void nsParser::SetCommand(const char* aCommand){
|
||||
nsAutoString theCommand(aCommand);
|
||||
nsCAutoString theCommand(aCommand);
|
||||
if(theCommand.Equals(kViewSourceCommand))
|
||||
mCommand=eViewSource;
|
||||
else mCommand=eViewNormal;
|
||||
@ -872,7 +873,7 @@ nsresult nsParser::Parse(nsIURI* aURL,nsIStreamObserver* aListener,PRBool aVerif
|
||||
if (rv != NS_OK) {
|
||||
return rv;
|
||||
}
|
||||
nsAutoString theName(spec);
|
||||
nsAutoString theName; theName.AssignWithConversion(spec);
|
||||
nsCRT::free(spec);
|
||||
|
||||
nsScanner* theScanner=new nsScanner(theName,PR_FALSE,mCharset,mCharsetSource);
|
||||
@ -903,7 +904,7 @@ nsresult nsParser::Parse(nsIInputStream& aStream,const nsString& aMimeType,PRBoo
|
||||
nsresult result=NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
//ok, time to create our tokenizer and begin the process
|
||||
nsAutoString theUnknownFilename("unknown");
|
||||
nsAutoString theUnknownFilename; theUnknownFilename.AssignWithConversion("unknown");
|
||||
|
||||
nsInputStream input(&aStream);
|
||||
|
||||
@ -1035,11 +1036,11 @@ PRBool nsParser::IsValidFragment(const nsString& aSourceBuffer,nsITagStack& aSta
|
||||
PRUint32 theCount=aStack.GetSize();
|
||||
PRUint32 theIndex=0;
|
||||
while(theIndex++<theCount){
|
||||
theContext.Append("<");
|
||||
theContext.AppendWithConversion("<");
|
||||
theContext.Append(aStack.TagAt(theCount-theIndex));
|
||||
theContext.Append(">");
|
||||
theContext.AppendWithConversion(">");
|
||||
}
|
||||
theContext.Append("<endnote>"); //XXXHack! I'll make this better later.
|
||||
theContext.AppendWithConversion("<endnote>"); //XXXHack! I'll make this better later.
|
||||
nsAutoString theBuffer(theContext);
|
||||
theBuffer.Append(aSourceBuffer);
|
||||
|
||||
@ -1047,7 +1048,7 @@ PRBool nsParser::IsValidFragment(const nsString& aSourceBuffer,nsITagStack& aSta
|
||||
if(theBuffer.Length()){
|
||||
//now it's time to try to build the model from this fragment
|
||||
|
||||
nsString theOutput("");
|
||||
nsString theOutput;
|
||||
nsIHTMLContentSink* theSink=0;
|
||||
nsresult theResult=NS_New_HTML_ContentSinkStream(&theSink,&theOutput,0);
|
||||
SetContentSink(theSink);
|
||||
@ -1078,11 +1079,11 @@ nsresult nsParser::ParseFragment(const nsString& aSourceBuffer,void* aKey,nsITag
|
||||
PRUint32 theCount=aStack.GetSize();
|
||||
PRUint32 theIndex=0;
|
||||
while(theIndex++<theCount){
|
||||
theContext.Append("<");
|
||||
theContext.AppendWithConversion("<");
|
||||
theContext.Append(aStack.TagAt(theCount-theIndex));
|
||||
theContext.Append(">");
|
||||
theContext.AppendWithConversion(">");
|
||||
}
|
||||
theContext.Append("<endnote>"); //XXXHack! I'll make this better later.
|
||||
theContext.AppendWithConversion("<endnote>"); //XXXHack! I'll make this better later.
|
||||
nsAutoString theBuffer(theContext);
|
||||
|
||||
#if 0
|
||||
@ -1386,7 +1387,7 @@ nsresult nsParser::OnStartRequest(nsIChannel* channel, nsISupports* aContext)
|
||||
rv = channel->GetContentType(&contentType);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
mParserContext->SetMimeType(contentType);
|
||||
mParserContext->SetMimeType( NS_ConvertToString(contentType) );
|
||||
nsCRT::free(contentType);
|
||||
}
|
||||
else
|
||||
@ -1409,7 +1410,7 @@ nsresult nsParser::OnStartRequest(nsIChannel* channel, nsISupports* aContext)
|
||||
|
||||
static PRBool detectByteOrderMark(const unsigned char* aBytes, PRInt32 aLen, nsString& oCharset, nsCharsetSource& oCharsetSource) {
|
||||
oCharsetSource= kCharsetFromAutoDetection;
|
||||
oCharset = "";
|
||||
oCharset.SetLength(0);
|
||||
// see http://www.w3.org/TR/1998/REC-xml-19980210#sec-oCharseting
|
||||
// for details
|
||||
switch(aBytes[0])
|
||||
@ -1419,19 +1420,19 @@ static PRBool detectByteOrderMark(const unsigned char* aBytes, PRInt32 aLen, nsS
|
||||
// 00 00
|
||||
if((0x00==aBytes[2]) && (0x3C==aBytes[3])) {
|
||||
// 00 00 00 3C UCS-4, big-endian machine (1234 order)
|
||||
oCharset = UCS4_BE;
|
||||
oCharset.AssignWithConversion(UCS4_BE);
|
||||
} else if((0x3C==aBytes[2]) && (0x00==aBytes[3])) {
|
||||
// 00 00 3C 00 UCS-4, unusual octet order (2143)
|
||||
oCharset = UCS4_2143;
|
||||
oCharset.AssignWithConversion(UCS4_2143);
|
||||
}
|
||||
} else if(0x3C==aBytes[1]) {
|
||||
// 00 3C
|
||||
if((0x00==aBytes[2]) && (0x00==aBytes[3])) {
|
||||
// 00 3C 00 00 UCS-4, unusual octet order (3412)
|
||||
oCharset = UCS4_3412;
|
||||
oCharset.AssignWithConversion(UCS4_3412);
|
||||
} else if((0x3C==aBytes[2]) && (0x3F==aBytes[3])) {
|
||||
// 00 3C 00 3F UTF-16, big-endian, no Byte Order Mark
|
||||
oCharset = UCS2_BE; // should change to UTF-16BE
|
||||
oCharset.AssignWithConversion(UCS2_BE); // should change to UTF-16BE
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1440,17 +1441,17 @@ static PRBool detectByteOrderMark(const unsigned char* aBytes, PRInt32 aLen, nsS
|
||||
// 3C 00
|
||||
if((0x00==aBytes[2]) && (0x00==aBytes[3])) {
|
||||
// 3C 00 00 00 UCS-4, little-endian machine (4321 order)
|
||||
oCharset = UCS4_LE;
|
||||
oCharset.AssignWithConversion(UCS4_LE);
|
||||
} else if((0x3F==aBytes[2]) && (0x00==aBytes[3])) {
|
||||
// 3C 00 3F 00 UTF-16, little-endian, no Byte Order Mark
|
||||
oCharset = UCS2_LE; // should change to UTF-16LE
|
||||
oCharset.AssignWithConversion(UCS2_LE); // should change to UTF-16LE
|
||||
}
|
||||
} else if((0x3C==aBytes[0]) && (0x3F==aBytes[1]) &&
|
||||
(0x78==aBytes[2]) && (0x6D==aBytes[3]) &&
|
||||
(0 == PL_strncmp("<?xml version", (char*)aBytes, 13 ))) {
|
||||
// 3C 3F 78 6D
|
||||
nsAutoString firstXbytes("");
|
||||
firstXbytes.Append((const char*)aBytes, (PRInt32)
|
||||
nsAutoString firstXbytes;
|
||||
firstXbytes.AppendWithConversion((const char*)aBytes, (PRInt32)
|
||||
((aLen > XMLENCODING_PEEKBYTES)?
|
||||
XMLENCODING_PEEKBYTES:
|
||||
aLen));
|
||||
@ -1481,7 +1482,7 @@ static PRBool detectByteOrderMark(const unsigned char* aBytes, PRInt32 aLen, nsS
|
||||
if(0xFF==aBytes[1]) {
|
||||
// FE FF
|
||||
// UTF-16, big-endian
|
||||
oCharset = UCS2_BE; // should change to UTF-16BE
|
||||
oCharset.AssignWithConversion(UCS2_BE); // should change to UTF-16BE
|
||||
oCharsetSource= kCharsetFromByteOrderMark;
|
||||
}
|
||||
break;
|
||||
@ -1489,7 +1490,7 @@ static PRBool detectByteOrderMark(const unsigned char* aBytes, PRInt32 aLen, nsS
|
||||
if(0xFE==aBytes[1]) {
|
||||
// FF FE
|
||||
// UTF-16, little-endian
|
||||
oCharset = UCS2_LE; // should change to UTF-16LE
|
||||
oCharset.AssignWithConversion(UCS2_LE); // should change to UTF-16LE
|
||||
oCharsetSource= kCharsetFromByteOrderMark;
|
||||
}
|
||||
break;
|
||||
@ -1565,7 +1566,7 @@ theContext->mTransferBufferSize;
|
||||
if(NS_SUCCEEDED(result) && (theNumRead>0)) {
|
||||
if(needCheckFirst4Bytes && (theNumRead >= 4)) {
|
||||
nsCharsetSource guessSource;
|
||||
nsAutoString guess("");
|
||||
nsAutoString guess;
|
||||
|
||||
needCheckFirst4Bytes = PR_FALSE;
|
||||
if(detectByteOrderMark((const unsigned char*)theContext->mTransferBuffer,
|
||||
@ -1639,7 +1640,7 @@ nsresult nsParser::OnStopRequest(nsIChannel* channel, nsISupports* aContext,
|
||||
//If you're here, then OnDataAvailable() never got called.
|
||||
//Prior to necko, we never dealt with this case, but the problem may have existed.
|
||||
//What we'll do (for now at least) is construct a blank HTML document.
|
||||
nsAutoString temp("<html><body></body></html>");
|
||||
nsAutoString temp; temp.AssignWithConversion("<html><body></body></html>");
|
||||
mParserContext->mScanner->Append(temp);
|
||||
result=ResumeParse(PR_TRUE,PR_TRUE);
|
||||
}
|
||||
|
||||
@ -78,7 +78,7 @@ nsParserService::HTMLStringTagToId(const nsString &aTag, PRInt32* aId) const
|
||||
NS_IMETHODIMP
|
||||
nsParserService::HTMLIdToStringTag(PRInt32 aId, nsString& aTag) const
|
||||
{
|
||||
aTag = nsHTMLTags::GetStringValue((nsHTMLTag)aId);
|
||||
aTag.AssignWithConversion( nsHTMLTags::GetStringValue((nsHTMLTag)aId) );
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ static NS_DEFINE_IID(kIParserNodeIID, NS_IPARSER_NODE_IID);
|
||||
nsString& GetEmptyString() {
|
||||
static nsString* gEmptyStr=0;
|
||||
if(!gEmptyStr)
|
||||
gEmptyStr=new nsString("");
|
||||
gEmptyStr=new nsString;
|
||||
return *gEmptyStr;
|
||||
}
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ MOZ_DECL_CTOR_COUNTER(nsScanner);
|
||||
* @return
|
||||
*/
|
||||
nsScanner::nsScanner(nsString& anHTMLString, const nsString& aCharset, nsCharsetSource aSource) :
|
||||
mBuffer(anHTMLString), mFilename(""), mUnicodeXferBuf("")
|
||||
mBuffer(anHTMLString)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsScanner);
|
||||
|
||||
@ -64,7 +64,6 @@ nsScanner::nsScanner(nsString& anHTMLString, const nsString& aCharset, nsCharset
|
||||
mMarkPos=0;
|
||||
mInputStream=0;
|
||||
mUnicodeDecoder = 0;
|
||||
mCharset = "";
|
||||
mCharsetSource = kCharsetUninitialized;
|
||||
SetDocumentCharset(aCharset, aSource);
|
||||
mNewlinesSkipped=0;
|
||||
@ -80,7 +79,7 @@ nsScanner::nsScanner(nsString& anHTMLString, const nsString& aCharset, nsCharset
|
||||
* @return
|
||||
*/
|
||||
nsScanner::nsScanner(nsString& aFilename,PRBool aCreateStream, const nsString& aCharset, nsCharsetSource aSource) :
|
||||
mBuffer(""), mFilename(aFilename), mUnicodeXferBuf("")
|
||||
mFilename(aFilename)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsScanner);
|
||||
|
||||
@ -94,7 +93,6 @@ nsScanner::nsScanner(nsString& aFilename,PRBool aCreateStream, const nsString& a
|
||||
mInputStream = new nsInputFileStream(nsFileSpec(aFilename));
|
||||
} //if
|
||||
mUnicodeDecoder = 0;
|
||||
mCharset = "";
|
||||
mCharsetSource = kCharsetUninitialized;
|
||||
SetDocumentCharset(aCharset, aSource);
|
||||
mNewlinesSkipped=0;
|
||||
@ -110,7 +108,7 @@ nsScanner::nsScanner(nsString& aFilename,PRBool aCreateStream, const nsString& a
|
||||
* @return
|
||||
*/
|
||||
nsScanner::nsScanner(nsString& aFilename,nsInputStream& aStream,const nsString& aCharset, nsCharsetSource aSource) :
|
||||
mBuffer(""), mFilename(aFilename) , mUnicodeXferBuf("")
|
||||
mFilename(aFilename)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsScanner);
|
||||
|
||||
@ -121,7 +119,6 @@ nsScanner::nsScanner(nsString& aFilename,nsInputStream& aStream,const nsString&
|
||||
mOwnsStream=PR_FALSE;
|
||||
mInputStream=&aStream;
|
||||
mUnicodeDecoder = 0;
|
||||
mCharset = "";
|
||||
mCharsetSource = kCharsetUninitialized;
|
||||
SetDocumentCharset(aCharset, aSource);
|
||||
mNewlinesSkipped=0;
|
||||
@ -152,7 +149,7 @@ nsresult nsScanner::SetDocumentCharset(const nsString& aCharset , nsCharsetSourc
|
||||
if(NS_FAILED(res) && (kCharsetUninitialized == mCharsetSource) )
|
||||
{
|
||||
// failed - unknown alias , fallback to ISO-8859-1
|
||||
charsetName = "ISO-8859-1";
|
||||
charsetName.AssignWithConversion("ISO-8859-1");
|
||||
}
|
||||
mCharset = charsetName;
|
||||
mCharsetSource = aSource;
|
||||
@ -241,10 +238,8 @@ PRUint32 nsScanner::Mark(PRInt32 anIndex){
|
||||
*/
|
||||
PRBool nsScanner::Insert(const nsString& aBuffer) {
|
||||
|
||||
PRInt32 theLen=aBuffer.Length();
|
||||
|
||||
mBuffer.Insert(aBuffer,mOffset,theLen);
|
||||
mTotalRead+=theLen;
|
||||
mBuffer.Insert(aBuffer,mOffset);
|
||||
mTotalRead+=aBuffer.Length();
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
@ -317,7 +312,7 @@ PRBool nsScanner::Append(const char* aBuffer, PRUint32 aLen){
|
||||
// delete[] unichars;
|
||||
}
|
||||
else {
|
||||
mBuffer.Append(aBuffer,aLen);
|
||||
mBuffer.AppendWithConversion(aBuffer,aLen);
|
||||
mTotalRead+=aLen;
|
||||
|
||||
}
|
||||
@ -394,7 +389,7 @@ nsresult nsScanner::FillBuffer(void) {
|
||||
}
|
||||
mOffset=mBuffer.Length();
|
||||
if((0<numread) && (0==result)) {
|
||||
mBuffer.Append((const char*)buf,numread);
|
||||
mBuffer.AppendWithConversion((const char*)buf,numread);
|
||||
mBuffer.StripChar(0); //yank the nulls that come in from the net.
|
||||
}
|
||||
mTotalRead+=mBuffer.Length();
|
||||
|
||||
@ -63,7 +63,7 @@ public:
|
||||
* @param aTheString -- The string (tag) associated with this handler
|
||||
* @return VOID
|
||||
*/
|
||||
void SetString(const nsString &aTheString) {mTheTagName = aTheString;}
|
||||
void SetString(const nsString &aTheString) {mTheTagName.Assign(aTheString);}
|
||||
|
||||
/**
|
||||
* Returns the string (tag) handled by this nsTagHandler
|
||||
|
||||
@ -72,8 +72,9 @@ CToken::CToken(const nsString& aName) : mTextValue(aName) {
|
||||
* @update gess 3/25/98
|
||||
* @param aName--char* containing name of token
|
||||
*/
|
||||
CToken::CToken(const char* aName) : mTextValue(aName) {
|
||||
CToken::CToken(const char* aName) {
|
||||
MOZ_COUNT_CTOR(CToken);
|
||||
mTextValue.AssignWithConversion(aName);
|
||||
mTypeID=0;
|
||||
mAttrCount=0;
|
||||
TokenCount++;
|
||||
@ -164,7 +165,7 @@ void CToken::DebugDumpSource(nsOutputStream& anOutputStream) {
|
||||
* @param name is a char* value containing new string value
|
||||
*/
|
||||
void CToken::SetStringValue(const char* name){
|
||||
mTextValue=name;
|
||||
mTextValue.AssignWithConversion(name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -202,12 +202,21 @@ public:
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
CViewSourceHTML::CViewSourceHTML() : nsIDTD(),
|
||||
mStartTag("start"), mEndTag("end"), mCommentTag("comment"),
|
||||
mCDATATag("cdata"), mDocTypeTag("doctype"), mPITag("pi"),
|
||||
mEntityTag("entity"), mText("txt"), mKey("key"), mValue("val")
|
||||
CViewSourceHTML::CViewSourceHTML()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
mStartTag.AssignWithConversion("start");
|
||||
mEndTag.AssignWithConversion("end");
|
||||
mCommentTag.AssignWithConversion("comment");
|
||||
mCDATATag.AssignWithConversion("cdata");
|
||||
mDocTypeTag.AssignWithConversion("doctype");
|
||||
mPITag.AssignWithConversion("pi");
|
||||
mEntityTag.AssignWithConversion("entity");
|
||||
mText.AssignWithConversion("txt");
|
||||
mKey.AssignWithConversion("key");
|
||||
mValue.AssignWithConversion("val");
|
||||
|
||||
mParser=0;
|
||||
mSink=0;
|
||||
mLineNumber=0;
|
||||
@ -269,15 +278,15 @@ nsresult CViewSourceHTML::CreateNewInstance(nsIDTD** aInstancePtrResult){
|
||||
eAutoDetectResult CViewSourceHTML::CanParse(CParserContext& aParserContext,nsString& aBuffer, PRInt32 aVersion) {
|
||||
eAutoDetectResult result=eUnknownDetect;
|
||||
|
||||
if(aParserContext.mMimeType.Equals(kPlainTextContentType) ||
|
||||
aParserContext.mMimeType.Equals(kTextCSSContentType)) {
|
||||
if(aParserContext.mMimeType.EqualsWithConversion(kPlainTextContentType) ||
|
||||
aParserContext.mMimeType.EqualsWithConversion(kTextCSSContentType)) {
|
||||
result=eValidDetect;
|
||||
}
|
||||
else if(eViewSource==aParserContext.mParserCommand) {
|
||||
if(aParserContext.mMimeType.Equals(kXMLTextContentType) ||
|
||||
aParserContext.mMimeType.Equals(kRDFTextContentType) ||
|
||||
aParserContext.mMimeType.Equals(kHTMLTextContentType) ||
|
||||
aParserContext.mMimeType.Equals(kXULTextContentType)) {
|
||||
if(aParserContext.mMimeType.EqualsWithConversion(kXMLTextContentType) ||
|
||||
aParserContext.mMimeType.EqualsWithConversion(kRDFTextContentType) ||
|
||||
aParserContext.mMimeType.EqualsWithConversion(kHTMLTextContentType) ||
|
||||
aParserContext.mMimeType.EqualsWithConversion(kXULTextContentType)) {
|
||||
result=ePrimaryDetect;
|
||||
}
|
||||
}
|
||||
@ -327,7 +336,7 @@ nsresult CViewSourceHTML::WillBuildModel( const CParserContext& aParserContext,
|
||||
CToken theToken("viewsource");
|
||||
nsCParserNode theNode(&theToken,0);
|
||||
|
||||
CAttributeToken *theAttr=new CAttributeToken("xmlns","http://www.mozilla.org/viewsource");
|
||||
CAttributeToken *theAttr=new CAttributeToken(NS_ConvertToString("xmlns"), NS_ConvertToString("http://www.mozilla.org/viewsource"));
|
||||
if(theAttr)
|
||||
theNode.AddAttribute(theAttr);
|
||||
mSink->OpenContainer(theNode);
|
||||
@ -664,7 +673,7 @@ nsresult WriteText(const nsString& aTextString,nsIContentSink& aSink,PRBool aPre
|
||||
}
|
||||
if(0<theSpaces){
|
||||
|
||||
CEntityToken theToken("nbsp");
|
||||
CEntityToken theToken( NS_ConvertToString("nbsp") );
|
||||
aContext.mStartNode.Init(&theToken);
|
||||
int theIndex;
|
||||
for(theIndex=0;theIndex<theSpaces;theIndex++)
|
||||
@ -748,7 +757,7 @@ nsresult CViewSourceHTML::WriteAttributes(PRInt32 attrCount) {
|
||||
* @return result status
|
||||
*/
|
||||
nsresult CViewSourceHTML::WriteTag(nsString &theXMLTagName,CToken* aToken,PRInt32 attrCount,PRBool aNewlineRequired) {
|
||||
static nsString theString("");
|
||||
static nsString theString;
|
||||
|
||||
nsresult result=NS_OK;
|
||||
|
||||
@ -811,7 +820,7 @@ nsresult CViewSourceHTML::WriteTag(nsString &theXMLTagName,CToken* aToken,PRInt3
|
||||
* @return result status
|
||||
*/
|
||||
nsresult CViewSourceHTML::WriteTag(nsString &theXMLTagName,nsString & aText,PRInt32 attrCount,PRBool aNewlineRequired) {
|
||||
static nsString theString("");
|
||||
static nsString theString;
|
||||
|
||||
nsresult result=NS_OK;
|
||||
|
||||
@ -893,7 +902,7 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) {
|
||||
void* theDocID=(pc)? pc->mKey:0;
|
||||
eHTMLTags theTag=(eHTMLTags)theToken->GetTypeID();
|
||||
|
||||
result=theService->Notify(theTag,theContext.mTokenNode,(PRUint32)theDocID,kViewSourceCommand,mParser);
|
||||
result=theService->Notify(theTag,theContext.mTokenNode,(PRUint32)theDocID, NS_ConvertToString(kViewSourceCommand), mParser);
|
||||
}
|
||||
}
|
||||
theContext.mTokenNode.Init(0,0,gTokenRecycler); //now recycle.
|
||||
@ -906,8 +915,8 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) {
|
||||
case eToken_cdatasection:
|
||||
{
|
||||
nsString& theStr=aToken->GetStringValueXXX();
|
||||
theStr.Insert("<!",0);
|
||||
theStr.Append("]]>");
|
||||
theStr.InsertWithConversion("<!",0);
|
||||
theStr.AppendWithConversion("]]>");
|
||||
result=WriteTag(mCDATATag,aToken,0,PR_TRUE);
|
||||
}
|
||||
break;
|
||||
@ -933,10 +942,10 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) {
|
||||
{
|
||||
nsAutoString theStr;
|
||||
nsString& theEntity=aToken->GetStringValueXXX();
|
||||
if(!theEntity.Equals("XI",IGNORE_CASE)) {
|
||||
if(!theEntity.EqualsWithConversion("XI",IGNORE_CASE)) {
|
||||
PRUnichar theChar=theEntity.CharAt(0);
|
||||
if((nsCRT::IsAsciiDigit(theChar)) || ('X'==theChar) || ('x'==theChar)){
|
||||
theStr.Append("#");
|
||||
theStr.AppendWithConversion("#");
|
||||
}
|
||||
theStr.Append(theEntity);
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ NS_IMPL_RELEASE(CWellFormedDTD)
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
CWellFormedDTD::CWellFormedDTD() : nsIDTD(), mFilename("") {
|
||||
CWellFormedDTD::CWellFormedDTD() : nsIDTD() {
|
||||
NS_INIT_REFCNT();
|
||||
mParser=0;
|
||||
mSink=0;
|
||||
@ -177,15 +177,15 @@ eAutoDetectResult CWellFormedDTD::CanParse(CParserContext& aParserContext,nsStri
|
||||
eAutoDetectResult result=eUnknownDetect;
|
||||
|
||||
if(eViewSource!=aParserContext.mParserCommand) {
|
||||
if(aParserContext.mMimeType.Equals(kXMLTextContentType) ||
|
||||
aParserContext.mMimeType.Equals(kRDFTextContentType) ||
|
||||
aParserContext.mMimeType.Equals(kXULTextContentType)) {
|
||||
if(aParserContext.mMimeType.EqualsWithConversion(kXMLTextContentType) ||
|
||||
aParserContext.mMimeType.EqualsWithConversion(kRDFTextContentType) ||
|
||||
aParserContext.mMimeType.EqualsWithConversion(kXULTextContentType)) {
|
||||
result=ePrimaryDetect;
|
||||
}
|
||||
else {
|
||||
if(-1<aBuffer.Find("<?xml ")) {
|
||||
if(0==aParserContext.mMimeType.Length()) {
|
||||
aParserContext.SetMimeType(kXMLTextContentType);
|
||||
aParserContext.SetMimeType( NS_ConvertToString(kXMLTextContentType) );
|
||||
}
|
||||
result=eValidDetect;
|
||||
}
|
||||
|
||||
@ -174,7 +174,7 @@ eXIFTags DetermineXIFTagType(const nsString& aString)
|
||||
|
||||
while(low<=high){
|
||||
middle=(PRInt32)(low+high)/2;
|
||||
result=aString.Compare(gXIFTagTable[middle].mName, PR_TRUE);
|
||||
result=aString.CompareWithConversion(gXIFTagTable[middle].mName, PR_TRUE);
|
||||
if (result==0)
|
||||
return gXIFTagTable[middle].fTagID;
|
||||
if (result<0)
|
||||
@ -251,7 +251,7 @@ nsXIFDTD::nsXIFDTD() : nsIDTD(){
|
||||
mInContent=PR_FALSE;
|
||||
mLowerCaseAttributes=PR_TRUE;
|
||||
mLowerCaseTags=PR_TRUE;
|
||||
mCharset = "";
|
||||
mCharset.SetLength(0);
|
||||
mSink=0;
|
||||
}
|
||||
|
||||
@ -303,18 +303,18 @@ nsresult nsXIFDTD::CreateNewInstance(nsIDTD** aInstancePtrResult){
|
||||
eAutoDetectResult nsXIFDTD::CanParse(CParserContext& aParserContext,nsString& aBuffer, PRInt32 aVersion) {
|
||||
eAutoDetectResult result=eUnknownDetect;
|
||||
|
||||
if(aParserContext.mMimeType.Equals(kXIFTextContentType)){
|
||||
if(aParserContext.mMimeType.EqualsWithConversion(kXIFTextContentType)){
|
||||
result=ePrimaryDetect;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(kNotFound!=aBuffer.Find(kXIFDocHeader)) {
|
||||
aParserContext.SetMimeType(kXIFTextContentType);
|
||||
aParserContext.SetMimeType( NS_ConvertToString(kXIFTextContentType) );
|
||||
result=ePrimaryDetect;
|
||||
}
|
||||
}
|
||||
|
||||
nsString charset("ISO-8859-1");
|
||||
nsString charset; charset.AssignWithConversion("ISO-8859-1");
|
||||
PRInt32 offset;
|
||||
offset = aBuffer.Find(kXIFDocInfo);
|
||||
|
||||
@ -534,7 +534,7 @@ nsresult nsXIFDTD::HandleTextToken(CToken* aToken) {
|
||||
{
|
||||
nsString& temp = aToken->GetStringValueXXX();
|
||||
|
||||
if (!temp.Equals("<xml version=\"1.0\"?>"))
|
||||
if (!temp.EqualsWithConversion("<xml version=\"1.0\"?>"))
|
||||
{
|
||||
result= AddLeaf(node);
|
||||
}
|
||||
@ -872,9 +872,9 @@ PRBool nsXIFDTD::GetAttributePair(nsIParserNode& aNode, nsString& aKey, nsString
|
||||
key.StripChars(quote);
|
||||
value.StripChars(quote);
|
||||
|
||||
if (key.Equals("name"))
|
||||
if (key.EqualsWithConversion("name"))
|
||||
aKey = value;
|
||||
if (key.Equals("value"))
|
||||
if (key.EqualsWithConversion("value"))
|
||||
{
|
||||
aValue = value;
|
||||
hasValue = PR_TRUE;
|
||||
@ -901,12 +901,12 @@ eHTMLTags nsXIFDTD::GetStartTag(const nsIParserNode& aNode, nsString& aName)
|
||||
{
|
||||
case eXIFTag_container:
|
||||
case eXIFTag_leaf:
|
||||
if (GetAttribute(aNode,nsString("isa"),aName))
|
||||
if (GetAttribute(aNode,NS_ConvertToString("isa"),aName))
|
||||
tag = tag = nsHTMLTags::LookupTag(aName);
|
||||
break;
|
||||
|
||||
case eXIFTag_css_stylesheet:
|
||||
aName = "style";
|
||||
aName.AssignWithConversion("style");
|
||||
tag = nsHTMLTags::LookupTag(aName);
|
||||
break;
|
||||
|
||||
@ -1299,7 +1299,7 @@ nsresult nsXIFDTD::CollectContentComment(CToken* aToken, nsCParserNode& aNode) {
|
||||
PRBool done=PR_FALSE;
|
||||
PRBool inContent=PR_FALSE;
|
||||
nsString& comment=aToken->GetStringValueXXX();
|
||||
comment="<!--"; // overwrite comment with "<!--"
|
||||
comment.AssignWithConversion("<!--"); // overwrite comment with "<!--"
|
||||
while (!done && NS_SUCCEEDED(result))
|
||||
{
|
||||
token=mTokenizer->PopToken();
|
||||
@ -1307,14 +1307,14 @@ nsresult nsXIFDTD::CollectContentComment(CToken* aToken, nsCParserNode& aNode) {
|
||||
if(!token) return result;
|
||||
|
||||
type=(eHTMLTokenTypes)token->GetTokenType();
|
||||
fragment=token->GetStringValueXXX();
|
||||
if(fragment.Equals("content")) {
|
||||
fragment.Assign(token->GetStringValueXXX());
|
||||
if(fragment.EqualsWithConversion("content")) {
|
||||
if(type==eToken_start)
|
||||
inContent=PR_TRUE;
|
||||
else inContent=PR_FALSE;
|
||||
}
|
||||
else if(fragment.Equals("comment")) {
|
||||
comment.Append("-->");
|
||||
else if(fragment.EqualsWithConversion("comment")) {
|
||||
comment.AppendWithConversion("-->");
|
||||
result=(mSink)? mSink->AddComment(aNode):NS_OK;
|
||||
done=PR_TRUE;
|
||||
}
|
||||
@ -1414,7 +1414,7 @@ void nsXIFDTD::ProcessEncodeTag(const nsIParserNode& aNode)
|
||||
nsString value;
|
||||
PRInt32 error;
|
||||
|
||||
if (GetAttribute(aNode,nsString("selection"),value))
|
||||
if (GetAttribute(aNode,NS_ConvertToString("selection"),value))
|
||||
{
|
||||
PRInt32 temp = value.ToInteger(&error);
|
||||
if (temp == 1)
|
||||
@ -1431,7 +1431,7 @@ void nsXIFDTD::ProcessEntityTag(const nsIParserNode& aNode)
|
||||
{
|
||||
nsAutoString value;
|
||||
|
||||
if (GetAttribute(aNode,nsString("value"),value)) {
|
||||
if (GetAttribute(aNode,NS_ConvertToString("value"),value)) {
|
||||
value+=';';
|
||||
CEntityToken* entity = new CEntityToken(value);
|
||||
nsCParserNode node((CToken*)entity);
|
||||
@ -1448,7 +1448,7 @@ void nsXIFDTD::BeginCSSStyleSheet(const nsIParserNode& aNode)
|
||||
|
||||
mBuffer.Truncate(0);
|
||||
mMaxCSSSelectorWidth = 10;
|
||||
if (GetAttribute(aNode,nsString("max_css_selector_width"),value))
|
||||
if (GetAttribute(aNode,NS_ConvertToString("max_css_selector_width"),value))
|
||||
{
|
||||
PRInt32 temp = value.ToInteger(&error);
|
||||
if (error == NS_OK)
|
||||
@ -1470,9 +1470,9 @@ void nsXIFDTD::EndCSSStyleSheet(const nsIParserNode& aNode)
|
||||
CStartToken startToken(tagName);
|
||||
nsCParserNode startNode((CToken*)&startToken);
|
||||
|
||||
mBuffer.Append("</");
|
||||
mBuffer.AppendWithConversion("</");
|
||||
mBuffer.Append(tagName);
|
||||
mBuffer.Append(">");
|
||||
mBuffer.AppendWithConversion(">");
|
||||
startNode.SetSkippedContent(mBuffer);
|
||||
mSink->AddLeaf(startNode);
|
||||
|
||||
@ -1494,7 +1494,7 @@ void nsXIFDTD::AddCSSSelector(const nsIParserNode& aNode)
|
||||
{
|
||||
nsString value;
|
||||
|
||||
if (GetAttribute(aNode, nsString("selectors"), value))
|
||||
if (GetAttribute(aNode, NS_ConvertToString("selectors"), value))
|
||||
{
|
||||
if (mLowerCaseAttributes == PR_TRUE)
|
||||
value.ToLowerCase();
|
||||
@ -1517,16 +1517,16 @@ void nsXIFDTD::BeginCSSDeclarationList(const nsIParserNode& aNode)
|
||||
count = 0;
|
||||
|
||||
for (PRInt32 i = 0; i < count; i++)
|
||||
mBuffer.Append(" ");
|
||||
mBuffer.AppendWithConversion(" ");
|
||||
|
||||
mBuffer.Append(" {");
|
||||
mBuffer.AppendWithConversion(" {");
|
||||
mCSSDeclarationCount = 0;
|
||||
|
||||
}
|
||||
|
||||
void nsXIFDTD::EndCSSDeclarationList(const nsIParserNode& aNode)
|
||||
{
|
||||
mBuffer.Append("}\n");
|
||||
mBuffer.AppendWithConversion("}\n");
|
||||
}
|
||||
|
||||
|
||||
@ -1536,14 +1536,14 @@ void nsXIFDTD::AddCSSDeclaration(const nsIParserNode& aNode)
|
||||
nsString value;
|
||||
|
||||
|
||||
if (PR_TRUE == GetAttribute(aNode, nsString("property"), property))
|
||||
if (PR_TRUE == GetAttribute(aNode, nsString("value"), value))
|
||||
if (PR_TRUE == GetAttribute(aNode, NS_ConvertToString("property"), property))
|
||||
if (PR_TRUE == GetAttribute(aNode, NS_ConvertToString("value"), value))
|
||||
{
|
||||
if (mCSSDeclarationCount != 0)
|
||||
mBuffer.Append(";");
|
||||
mBuffer.Append(" ");
|
||||
mBuffer.AppendWithConversion(";");
|
||||
mBuffer.AppendWithConversion(" ");
|
||||
mBuffer.Append(property);
|
||||
mBuffer.Append(": ");
|
||||
mBuffer.AppendWithConversion(": ");
|
||||
mBuffer.Append(value);
|
||||
mCSSDeclarationCount++;
|
||||
}
|
||||
|
||||
@ -237,7 +237,7 @@ nsresult nsXMLTokenizer::ConsumeSpecialMarkup(PRUnichar aChar,CToken*& aToken,ns
|
||||
PRBool isComment=PR_TRUE;
|
||||
nsAutoString theEmpty;
|
||||
if(theChar==kLeftSquareBracket) {
|
||||
nsAutoString CDATAString("[CDATA[");
|
||||
nsAutoString CDATAString; CDATAString.AssignWithConversion("[CDATA[");
|
||||
PRBool isCDATA = PR_FALSE;
|
||||
result = ConsumeConditional(aScanner, CDATAString, isCDATA);
|
||||
if (NS_OK == result) {
|
||||
|
||||
@ -510,15 +510,15 @@ nsLoggingSink::QuoteText(const nsString& aValue, nsString& aResult)
|
||||
while (cp < end) {
|
||||
PRUnichar ch = *cp++;
|
||||
if (ch == '"') {
|
||||
aResult.Append(""");
|
||||
aResult.AppendWithConversion(""");
|
||||
}
|
||||
else if (ch == '&') {
|
||||
aResult.Append("&");
|
||||
aResult.AppendWithConversion("&");
|
||||
}
|
||||
else if ((ch < 32) || (ch >= 127)) {
|
||||
aResult.Append("&#");
|
||||
aResult.Append(PRInt32(ch), 10);
|
||||
aResult.Append(';');
|
||||
aResult.AppendWithConversion("&#");
|
||||
aResult.AppendWithConversion(PRInt32(ch), 10);
|
||||
aResult.AppendWithConversion(';');
|
||||
}
|
||||
else {
|
||||
aResult.Append(ch);
|
||||
|
||||
@ -194,8 +194,9 @@ void nsParser::FreeSharedObjects(void) {
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
nsParser::nsParser(nsITokenObserver* anObserver) : mUnusedInput("") , mCharset("ISO-8859-1") {
|
||||
nsParser::nsParser(nsITokenObserver* anObserver) {
|
||||
NS_INIT_REFCNT();
|
||||
mCharset.AssignWithConversion("ISO-8859-1");
|
||||
mParserFilter = 0;
|
||||
mObserver = 0;
|
||||
mProgressEventSink = nsnull;
|
||||
@ -311,7 +312,7 @@ nsIParserFilter * nsParser::SetParserFilter(nsIParserFilter * aFilter)
|
||||
* @return ptr to previously set contentsink (usually null)
|
||||
*/
|
||||
void nsParser::SetCommand(const char* aCommand){
|
||||
nsAutoString theCommand(aCommand);
|
||||
nsCAutoString theCommand(aCommand);
|
||||
if(theCommand.Equals(kViewSourceCommand))
|
||||
mCommand=eViewSource;
|
||||
else mCommand=eViewNormal;
|
||||
@ -872,7 +873,7 @@ nsresult nsParser::Parse(nsIURI* aURL,nsIStreamObserver* aListener,PRBool aVerif
|
||||
if (rv != NS_OK) {
|
||||
return rv;
|
||||
}
|
||||
nsAutoString theName(spec);
|
||||
nsAutoString theName; theName.AssignWithConversion(spec);
|
||||
nsCRT::free(spec);
|
||||
|
||||
nsScanner* theScanner=new nsScanner(theName,PR_FALSE,mCharset,mCharsetSource);
|
||||
@ -903,7 +904,7 @@ nsresult nsParser::Parse(nsIInputStream& aStream,const nsString& aMimeType,PRBoo
|
||||
nsresult result=NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
//ok, time to create our tokenizer and begin the process
|
||||
nsAutoString theUnknownFilename("unknown");
|
||||
nsAutoString theUnknownFilename; theUnknownFilename.AssignWithConversion("unknown");
|
||||
|
||||
nsInputStream input(&aStream);
|
||||
|
||||
@ -1035,11 +1036,11 @@ PRBool nsParser::IsValidFragment(const nsString& aSourceBuffer,nsITagStack& aSta
|
||||
PRUint32 theCount=aStack.GetSize();
|
||||
PRUint32 theIndex=0;
|
||||
while(theIndex++<theCount){
|
||||
theContext.Append("<");
|
||||
theContext.AppendWithConversion("<");
|
||||
theContext.Append(aStack.TagAt(theCount-theIndex));
|
||||
theContext.Append(">");
|
||||
theContext.AppendWithConversion(">");
|
||||
}
|
||||
theContext.Append("<endnote>"); //XXXHack! I'll make this better later.
|
||||
theContext.AppendWithConversion("<endnote>"); //XXXHack! I'll make this better later.
|
||||
nsAutoString theBuffer(theContext);
|
||||
theBuffer.Append(aSourceBuffer);
|
||||
|
||||
@ -1047,7 +1048,7 @@ PRBool nsParser::IsValidFragment(const nsString& aSourceBuffer,nsITagStack& aSta
|
||||
if(theBuffer.Length()){
|
||||
//now it's time to try to build the model from this fragment
|
||||
|
||||
nsString theOutput("");
|
||||
nsString theOutput;
|
||||
nsIHTMLContentSink* theSink=0;
|
||||
nsresult theResult=NS_New_HTML_ContentSinkStream(&theSink,&theOutput,0);
|
||||
SetContentSink(theSink);
|
||||
@ -1078,11 +1079,11 @@ nsresult nsParser::ParseFragment(const nsString& aSourceBuffer,void* aKey,nsITag
|
||||
PRUint32 theCount=aStack.GetSize();
|
||||
PRUint32 theIndex=0;
|
||||
while(theIndex++<theCount){
|
||||
theContext.Append("<");
|
||||
theContext.AppendWithConversion("<");
|
||||
theContext.Append(aStack.TagAt(theCount-theIndex));
|
||||
theContext.Append(">");
|
||||
theContext.AppendWithConversion(">");
|
||||
}
|
||||
theContext.Append("<endnote>"); //XXXHack! I'll make this better later.
|
||||
theContext.AppendWithConversion("<endnote>"); //XXXHack! I'll make this better later.
|
||||
nsAutoString theBuffer(theContext);
|
||||
|
||||
#if 0
|
||||
@ -1386,7 +1387,7 @@ nsresult nsParser::OnStartRequest(nsIChannel* channel, nsISupports* aContext)
|
||||
rv = channel->GetContentType(&contentType);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
mParserContext->SetMimeType(contentType);
|
||||
mParserContext->SetMimeType( NS_ConvertToString(contentType) );
|
||||
nsCRT::free(contentType);
|
||||
}
|
||||
else
|
||||
@ -1409,7 +1410,7 @@ nsresult nsParser::OnStartRequest(nsIChannel* channel, nsISupports* aContext)
|
||||
|
||||
static PRBool detectByteOrderMark(const unsigned char* aBytes, PRInt32 aLen, nsString& oCharset, nsCharsetSource& oCharsetSource) {
|
||||
oCharsetSource= kCharsetFromAutoDetection;
|
||||
oCharset = "";
|
||||
oCharset.SetLength(0);
|
||||
// see http://www.w3.org/TR/1998/REC-xml-19980210#sec-oCharseting
|
||||
// for details
|
||||
switch(aBytes[0])
|
||||
@ -1419,19 +1420,19 @@ static PRBool detectByteOrderMark(const unsigned char* aBytes, PRInt32 aLen, nsS
|
||||
// 00 00
|
||||
if((0x00==aBytes[2]) && (0x3C==aBytes[3])) {
|
||||
// 00 00 00 3C UCS-4, big-endian machine (1234 order)
|
||||
oCharset = UCS4_BE;
|
||||
oCharset.AssignWithConversion(UCS4_BE);
|
||||
} else if((0x3C==aBytes[2]) && (0x00==aBytes[3])) {
|
||||
// 00 00 3C 00 UCS-4, unusual octet order (2143)
|
||||
oCharset = UCS4_2143;
|
||||
oCharset.AssignWithConversion(UCS4_2143);
|
||||
}
|
||||
} else if(0x3C==aBytes[1]) {
|
||||
// 00 3C
|
||||
if((0x00==aBytes[2]) && (0x00==aBytes[3])) {
|
||||
// 00 3C 00 00 UCS-4, unusual octet order (3412)
|
||||
oCharset = UCS4_3412;
|
||||
oCharset.AssignWithConversion(UCS4_3412);
|
||||
} else if((0x3C==aBytes[2]) && (0x3F==aBytes[3])) {
|
||||
// 00 3C 00 3F UTF-16, big-endian, no Byte Order Mark
|
||||
oCharset = UCS2_BE; // should change to UTF-16BE
|
||||
oCharset.AssignWithConversion(UCS2_BE); // should change to UTF-16BE
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1440,17 +1441,17 @@ static PRBool detectByteOrderMark(const unsigned char* aBytes, PRInt32 aLen, nsS
|
||||
// 3C 00
|
||||
if((0x00==aBytes[2]) && (0x00==aBytes[3])) {
|
||||
// 3C 00 00 00 UCS-4, little-endian machine (4321 order)
|
||||
oCharset = UCS4_LE;
|
||||
oCharset.AssignWithConversion(UCS4_LE);
|
||||
} else if((0x3F==aBytes[2]) && (0x00==aBytes[3])) {
|
||||
// 3C 00 3F 00 UTF-16, little-endian, no Byte Order Mark
|
||||
oCharset = UCS2_LE; // should change to UTF-16LE
|
||||
oCharset.AssignWithConversion(UCS2_LE); // should change to UTF-16LE
|
||||
}
|
||||
} else if((0x3C==aBytes[0]) && (0x3F==aBytes[1]) &&
|
||||
(0x78==aBytes[2]) && (0x6D==aBytes[3]) &&
|
||||
(0 == PL_strncmp("<?xml version", (char*)aBytes, 13 ))) {
|
||||
// 3C 3F 78 6D
|
||||
nsAutoString firstXbytes("");
|
||||
firstXbytes.Append((const char*)aBytes, (PRInt32)
|
||||
nsAutoString firstXbytes;
|
||||
firstXbytes.AppendWithConversion((const char*)aBytes, (PRInt32)
|
||||
((aLen > XMLENCODING_PEEKBYTES)?
|
||||
XMLENCODING_PEEKBYTES:
|
||||
aLen));
|
||||
@ -1481,7 +1482,7 @@ static PRBool detectByteOrderMark(const unsigned char* aBytes, PRInt32 aLen, nsS
|
||||
if(0xFF==aBytes[1]) {
|
||||
// FE FF
|
||||
// UTF-16, big-endian
|
||||
oCharset = UCS2_BE; // should change to UTF-16BE
|
||||
oCharset.AssignWithConversion(UCS2_BE); // should change to UTF-16BE
|
||||
oCharsetSource= kCharsetFromByteOrderMark;
|
||||
}
|
||||
break;
|
||||
@ -1489,7 +1490,7 @@ static PRBool detectByteOrderMark(const unsigned char* aBytes, PRInt32 aLen, nsS
|
||||
if(0xFE==aBytes[1]) {
|
||||
// FF FE
|
||||
// UTF-16, little-endian
|
||||
oCharset = UCS2_LE; // should change to UTF-16LE
|
||||
oCharset.AssignWithConversion(UCS2_LE); // should change to UTF-16LE
|
||||
oCharsetSource= kCharsetFromByteOrderMark;
|
||||
}
|
||||
break;
|
||||
@ -1565,7 +1566,7 @@ theContext->mTransferBufferSize;
|
||||
if(NS_SUCCEEDED(result) && (theNumRead>0)) {
|
||||
if(needCheckFirst4Bytes && (theNumRead >= 4)) {
|
||||
nsCharsetSource guessSource;
|
||||
nsAutoString guess("");
|
||||
nsAutoString guess;
|
||||
|
||||
needCheckFirst4Bytes = PR_FALSE;
|
||||
if(detectByteOrderMark((const unsigned char*)theContext->mTransferBuffer,
|
||||
@ -1639,7 +1640,7 @@ nsresult nsParser::OnStopRequest(nsIChannel* channel, nsISupports* aContext,
|
||||
//If you're here, then OnDataAvailable() never got called.
|
||||
//Prior to necko, we never dealt with this case, but the problem may have existed.
|
||||
//What we'll do (for now at least) is construct a blank HTML document.
|
||||
nsAutoString temp("<html><body></body></html>");
|
||||
nsAutoString temp; temp.AssignWithConversion("<html><body></body></html>");
|
||||
mParserContext->mScanner->Append(temp);
|
||||
result=ResumeParse(PR_TRUE,PR_TRUE);
|
||||
}
|
||||
|
||||
@ -78,7 +78,7 @@ nsParserService::HTMLStringTagToId(const nsString &aTag, PRInt32* aId) const
|
||||
NS_IMETHODIMP
|
||||
nsParserService::HTMLIdToStringTag(PRInt32 aId, nsString& aTag) const
|
||||
{
|
||||
aTag = nsHTMLTags::GetStringValue((nsHTMLTag)aId);
|
||||
aTag.AssignWithConversion( nsHTMLTags::GetStringValue((nsHTMLTag)aId) );
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ static NS_DEFINE_IID(kIParserNodeIID, NS_IPARSER_NODE_IID);
|
||||
nsString& GetEmptyString() {
|
||||
static nsString* gEmptyStr=0;
|
||||
if(!gEmptyStr)
|
||||
gEmptyStr=new nsString("");
|
||||
gEmptyStr=new nsString;
|
||||
return *gEmptyStr;
|
||||
}
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ MOZ_DECL_CTOR_COUNTER(nsScanner);
|
||||
* @return
|
||||
*/
|
||||
nsScanner::nsScanner(nsString& anHTMLString, const nsString& aCharset, nsCharsetSource aSource) :
|
||||
mBuffer(anHTMLString), mFilename(""), mUnicodeXferBuf("")
|
||||
mBuffer(anHTMLString)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsScanner);
|
||||
|
||||
@ -64,7 +64,6 @@ nsScanner::nsScanner(nsString& anHTMLString, const nsString& aCharset, nsCharset
|
||||
mMarkPos=0;
|
||||
mInputStream=0;
|
||||
mUnicodeDecoder = 0;
|
||||
mCharset = "";
|
||||
mCharsetSource = kCharsetUninitialized;
|
||||
SetDocumentCharset(aCharset, aSource);
|
||||
mNewlinesSkipped=0;
|
||||
@ -80,7 +79,7 @@ nsScanner::nsScanner(nsString& anHTMLString, const nsString& aCharset, nsCharset
|
||||
* @return
|
||||
*/
|
||||
nsScanner::nsScanner(nsString& aFilename,PRBool aCreateStream, const nsString& aCharset, nsCharsetSource aSource) :
|
||||
mBuffer(""), mFilename(aFilename), mUnicodeXferBuf("")
|
||||
mFilename(aFilename)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsScanner);
|
||||
|
||||
@ -94,7 +93,6 @@ nsScanner::nsScanner(nsString& aFilename,PRBool aCreateStream, const nsString& a
|
||||
mInputStream = new nsInputFileStream(nsFileSpec(aFilename));
|
||||
} //if
|
||||
mUnicodeDecoder = 0;
|
||||
mCharset = "";
|
||||
mCharsetSource = kCharsetUninitialized;
|
||||
SetDocumentCharset(aCharset, aSource);
|
||||
mNewlinesSkipped=0;
|
||||
@ -110,7 +108,7 @@ nsScanner::nsScanner(nsString& aFilename,PRBool aCreateStream, const nsString& a
|
||||
* @return
|
||||
*/
|
||||
nsScanner::nsScanner(nsString& aFilename,nsInputStream& aStream,const nsString& aCharset, nsCharsetSource aSource) :
|
||||
mBuffer(""), mFilename(aFilename) , mUnicodeXferBuf("")
|
||||
mFilename(aFilename)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsScanner);
|
||||
|
||||
@ -121,7 +119,6 @@ nsScanner::nsScanner(nsString& aFilename,nsInputStream& aStream,const nsString&
|
||||
mOwnsStream=PR_FALSE;
|
||||
mInputStream=&aStream;
|
||||
mUnicodeDecoder = 0;
|
||||
mCharset = "";
|
||||
mCharsetSource = kCharsetUninitialized;
|
||||
SetDocumentCharset(aCharset, aSource);
|
||||
mNewlinesSkipped=0;
|
||||
@ -152,7 +149,7 @@ nsresult nsScanner::SetDocumentCharset(const nsString& aCharset , nsCharsetSourc
|
||||
if(NS_FAILED(res) && (kCharsetUninitialized == mCharsetSource) )
|
||||
{
|
||||
// failed - unknown alias , fallback to ISO-8859-1
|
||||
charsetName = "ISO-8859-1";
|
||||
charsetName.AssignWithConversion("ISO-8859-1");
|
||||
}
|
||||
mCharset = charsetName;
|
||||
mCharsetSource = aSource;
|
||||
@ -241,10 +238,8 @@ PRUint32 nsScanner::Mark(PRInt32 anIndex){
|
||||
*/
|
||||
PRBool nsScanner::Insert(const nsString& aBuffer) {
|
||||
|
||||
PRInt32 theLen=aBuffer.Length();
|
||||
|
||||
mBuffer.Insert(aBuffer,mOffset,theLen);
|
||||
mTotalRead+=theLen;
|
||||
mBuffer.Insert(aBuffer,mOffset);
|
||||
mTotalRead+=aBuffer.Length();
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
@ -317,7 +312,7 @@ PRBool nsScanner::Append(const char* aBuffer, PRUint32 aLen){
|
||||
// delete[] unichars;
|
||||
}
|
||||
else {
|
||||
mBuffer.Append(aBuffer,aLen);
|
||||
mBuffer.AppendWithConversion(aBuffer,aLen);
|
||||
mTotalRead+=aLen;
|
||||
|
||||
}
|
||||
@ -394,7 +389,7 @@ nsresult nsScanner::FillBuffer(void) {
|
||||
}
|
||||
mOffset=mBuffer.Length();
|
||||
if((0<numread) && (0==result)) {
|
||||
mBuffer.Append((const char*)buf,numread);
|
||||
mBuffer.AppendWithConversion((const char*)buf,numread);
|
||||
mBuffer.StripChar(0); //yank the nulls that come in from the net.
|
||||
}
|
||||
mTotalRead+=mBuffer.Length();
|
||||
|
||||
@ -63,7 +63,7 @@ public:
|
||||
* @param aTheString -- The string (tag) associated with this handler
|
||||
* @return VOID
|
||||
*/
|
||||
void SetString(const nsString &aTheString) {mTheTagName = aTheString;}
|
||||
void SetString(const nsString &aTheString) {mTheTagName.Assign(aTheString);}
|
||||
|
||||
/**
|
||||
* Returns the string (tag) handled by this nsTagHandler
|
||||
|
||||
@ -72,8 +72,9 @@ CToken::CToken(const nsString& aName) : mTextValue(aName) {
|
||||
* @update gess 3/25/98
|
||||
* @param aName--char* containing name of token
|
||||
*/
|
||||
CToken::CToken(const char* aName) : mTextValue(aName) {
|
||||
CToken::CToken(const char* aName) {
|
||||
MOZ_COUNT_CTOR(CToken);
|
||||
mTextValue.AssignWithConversion(aName);
|
||||
mTypeID=0;
|
||||
mAttrCount=0;
|
||||
TokenCount++;
|
||||
@ -164,7 +165,7 @@ void CToken::DebugDumpSource(nsOutputStream& anOutputStream) {
|
||||
* @param name is a char* value containing new string value
|
||||
*/
|
||||
void CToken::SetStringValue(const char* name){
|
||||
mTextValue=name;
|
||||
mTextValue.AssignWithConversion(name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -202,12 +202,21 @@ public:
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
CViewSourceHTML::CViewSourceHTML() : nsIDTD(),
|
||||
mStartTag("start"), mEndTag("end"), mCommentTag("comment"),
|
||||
mCDATATag("cdata"), mDocTypeTag("doctype"), mPITag("pi"),
|
||||
mEntityTag("entity"), mText("txt"), mKey("key"), mValue("val")
|
||||
CViewSourceHTML::CViewSourceHTML()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
mStartTag.AssignWithConversion("start");
|
||||
mEndTag.AssignWithConversion("end");
|
||||
mCommentTag.AssignWithConversion("comment");
|
||||
mCDATATag.AssignWithConversion("cdata");
|
||||
mDocTypeTag.AssignWithConversion("doctype");
|
||||
mPITag.AssignWithConversion("pi");
|
||||
mEntityTag.AssignWithConversion("entity");
|
||||
mText.AssignWithConversion("txt");
|
||||
mKey.AssignWithConversion("key");
|
||||
mValue.AssignWithConversion("val");
|
||||
|
||||
mParser=0;
|
||||
mSink=0;
|
||||
mLineNumber=0;
|
||||
@ -269,15 +278,15 @@ nsresult CViewSourceHTML::CreateNewInstance(nsIDTD** aInstancePtrResult){
|
||||
eAutoDetectResult CViewSourceHTML::CanParse(CParserContext& aParserContext,nsString& aBuffer, PRInt32 aVersion) {
|
||||
eAutoDetectResult result=eUnknownDetect;
|
||||
|
||||
if(aParserContext.mMimeType.Equals(kPlainTextContentType) ||
|
||||
aParserContext.mMimeType.Equals(kTextCSSContentType)) {
|
||||
if(aParserContext.mMimeType.EqualsWithConversion(kPlainTextContentType) ||
|
||||
aParserContext.mMimeType.EqualsWithConversion(kTextCSSContentType)) {
|
||||
result=eValidDetect;
|
||||
}
|
||||
else if(eViewSource==aParserContext.mParserCommand) {
|
||||
if(aParserContext.mMimeType.Equals(kXMLTextContentType) ||
|
||||
aParserContext.mMimeType.Equals(kRDFTextContentType) ||
|
||||
aParserContext.mMimeType.Equals(kHTMLTextContentType) ||
|
||||
aParserContext.mMimeType.Equals(kXULTextContentType)) {
|
||||
if(aParserContext.mMimeType.EqualsWithConversion(kXMLTextContentType) ||
|
||||
aParserContext.mMimeType.EqualsWithConversion(kRDFTextContentType) ||
|
||||
aParserContext.mMimeType.EqualsWithConversion(kHTMLTextContentType) ||
|
||||
aParserContext.mMimeType.EqualsWithConversion(kXULTextContentType)) {
|
||||
result=ePrimaryDetect;
|
||||
}
|
||||
}
|
||||
@ -327,7 +336,7 @@ nsresult CViewSourceHTML::WillBuildModel( const CParserContext& aParserContext,
|
||||
CToken theToken("viewsource");
|
||||
nsCParserNode theNode(&theToken,0);
|
||||
|
||||
CAttributeToken *theAttr=new CAttributeToken("xmlns","http://www.mozilla.org/viewsource");
|
||||
CAttributeToken *theAttr=new CAttributeToken(NS_ConvertToString("xmlns"), NS_ConvertToString("http://www.mozilla.org/viewsource"));
|
||||
if(theAttr)
|
||||
theNode.AddAttribute(theAttr);
|
||||
mSink->OpenContainer(theNode);
|
||||
@ -664,7 +673,7 @@ nsresult WriteText(const nsString& aTextString,nsIContentSink& aSink,PRBool aPre
|
||||
}
|
||||
if(0<theSpaces){
|
||||
|
||||
CEntityToken theToken("nbsp");
|
||||
CEntityToken theToken( NS_ConvertToString("nbsp") );
|
||||
aContext.mStartNode.Init(&theToken);
|
||||
int theIndex;
|
||||
for(theIndex=0;theIndex<theSpaces;theIndex++)
|
||||
@ -748,7 +757,7 @@ nsresult CViewSourceHTML::WriteAttributes(PRInt32 attrCount) {
|
||||
* @return result status
|
||||
*/
|
||||
nsresult CViewSourceHTML::WriteTag(nsString &theXMLTagName,CToken* aToken,PRInt32 attrCount,PRBool aNewlineRequired) {
|
||||
static nsString theString("");
|
||||
static nsString theString;
|
||||
|
||||
nsresult result=NS_OK;
|
||||
|
||||
@ -811,7 +820,7 @@ nsresult CViewSourceHTML::WriteTag(nsString &theXMLTagName,CToken* aToken,PRInt3
|
||||
* @return result status
|
||||
*/
|
||||
nsresult CViewSourceHTML::WriteTag(nsString &theXMLTagName,nsString & aText,PRInt32 attrCount,PRBool aNewlineRequired) {
|
||||
static nsString theString("");
|
||||
static nsString theString;
|
||||
|
||||
nsresult result=NS_OK;
|
||||
|
||||
@ -893,7 +902,7 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) {
|
||||
void* theDocID=(pc)? pc->mKey:0;
|
||||
eHTMLTags theTag=(eHTMLTags)theToken->GetTypeID();
|
||||
|
||||
result=theService->Notify(theTag,theContext.mTokenNode,(PRUint32)theDocID,kViewSourceCommand,mParser);
|
||||
result=theService->Notify(theTag,theContext.mTokenNode,(PRUint32)theDocID, NS_ConvertToString(kViewSourceCommand), mParser);
|
||||
}
|
||||
}
|
||||
theContext.mTokenNode.Init(0,0,gTokenRecycler); //now recycle.
|
||||
@ -906,8 +915,8 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) {
|
||||
case eToken_cdatasection:
|
||||
{
|
||||
nsString& theStr=aToken->GetStringValueXXX();
|
||||
theStr.Insert("<!",0);
|
||||
theStr.Append("]]>");
|
||||
theStr.InsertWithConversion("<!",0);
|
||||
theStr.AppendWithConversion("]]>");
|
||||
result=WriteTag(mCDATATag,aToken,0,PR_TRUE);
|
||||
}
|
||||
break;
|
||||
@ -933,10 +942,10 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) {
|
||||
{
|
||||
nsAutoString theStr;
|
||||
nsString& theEntity=aToken->GetStringValueXXX();
|
||||
if(!theEntity.Equals("XI",IGNORE_CASE)) {
|
||||
if(!theEntity.EqualsWithConversion("XI",IGNORE_CASE)) {
|
||||
PRUnichar theChar=theEntity.CharAt(0);
|
||||
if((nsCRT::IsAsciiDigit(theChar)) || ('X'==theChar) || ('x'==theChar)){
|
||||
theStr.Append("#");
|
||||
theStr.AppendWithConversion("#");
|
||||
}
|
||||
theStr.Append(theEntity);
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ NS_IMPL_RELEASE(CWellFormedDTD)
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
CWellFormedDTD::CWellFormedDTD() : nsIDTD(), mFilename("") {
|
||||
CWellFormedDTD::CWellFormedDTD() : nsIDTD() {
|
||||
NS_INIT_REFCNT();
|
||||
mParser=0;
|
||||
mSink=0;
|
||||
@ -177,15 +177,15 @@ eAutoDetectResult CWellFormedDTD::CanParse(CParserContext& aParserContext,nsStri
|
||||
eAutoDetectResult result=eUnknownDetect;
|
||||
|
||||
if(eViewSource!=aParserContext.mParserCommand) {
|
||||
if(aParserContext.mMimeType.Equals(kXMLTextContentType) ||
|
||||
aParserContext.mMimeType.Equals(kRDFTextContentType) ||
|
||||
aParserContext.mMimeType.Equals(kXULTextContentType)) {
|
||||
if(aParserContext.mMimeType.EqualsWithConversion(kXMLTextContentType) ||
|
||||
aParserContext.mMimeType.EqualsWithConversion(kRDFTextContentType) ||
|
||||
aParserContext.mMimeType.EqualsWithConversion(kXULTextContentType)) {
|
||||
result=ePrimaryDetect;
|
||||
}
|
||||
else {
|
||||
if(-1<aBuffer.Find("<?xml ")) {
|
||||
if(0==aParserContext.mMimeType.Length()) {
|
||||
aParserContext.SetMimeType(kXMLTextContentType);
|
||||
aParserContext.SetMimeType( NS_ConvertToString(kXMLTextContentType) );
|
||||
}
|
||||
result=eValidDetect;
|
||||
}
|
||||
|
||||
@ -174,7 +174,7 @@ eXIFTags DetermineXIFTagType(const nsString& aString)
|
||||
|
||||
while(low<=high){
|
||||
middle=(PRInt32)(low+high)/2;
|
||||
result=aString.Compare(gXIFTagTable[middle].mName, PR_TRUE);
|
||||
result=aString.CompareWithConversion(gXIFTagTable[middle].mName, PR_TRUE);
|
||||
if (result==0)
|
||||
return gXIFTagTable[middle].fTagID;
|
||||
if (result<0)
|
||||
@ -251,7 +251,7 @@ nsXIFDTD::nsXIFDTD() : nsIDTD(){
|
||||
mInContent=PR_FALSE;
|
||||
mLowerCaseAttributes=PR_TRUE;
|
||||
mLowerCaseTags=PR_TRUE;
|
||||
mCharset = "";
|
||||
mCharset.SetLength(0);
|
||||
mSink=0;
|
||||
}
|
||||
|
||||
@ -303,18 +303,18 @@ nsresult nsXIFDTD::CreateNewInstance(nsIDTD** aInstancePtrResult){
|
||||
eAutoDetectResult nsXIFDTD::CanParse(CParserContext& aParserContext,nsString& aBuffer, PRInt32 aVersion) {
|
||||
eAutoDetectResult result=eUnknownDetect;
|
||||
|
||||
if(aParserContext.mMimeType.Equals(kXIFTextContentType)){
|
||||
if(aParserContext.mMimeType.EqualsWithConversion(kXIFTextContentType)){
|
||||
result=ePrimaryDetect;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(kNotFound!=aBuffer.Find(kXIFDocHeader)) {
|
||||
aParserContext.SetMimeType(kXIFTextContentType);
|
||||
aParserContext.SetMimeType( NS_ConvertToString(kXIFTextContentType) );
|
||||
result=ePrimaryDetect;
|
||||
}
|
||||
}
|
||||
|
||||
nsString charset("ISO-8859-1");
|
||||
nsString charset; charset.AssignWithConversion("ISO-8859-1");
|
||||
PRInt32 offset;
|
||||
offset = aBuffer.Find(kXIFDocInfo);
|
||||
|
||||
@ -534,7 +534,7 @@ nsresult nsXIFDTD::HandleTextToken(CToken* aToken) {
|
||||
{
|
||||
nsString& temp = aToken->GetStringValueXXX();
|
||||
|
||||
if (!temp.Equals("<xml version=\"1.0\"?>"))
|
||||
if (!temp.EqualsWithConversion("<xml version=\"1.0\"?>"))
|
||||
{
|
||||
result= AddLeaf(node);
|
||||
}
|
||||
@ -872,9 +872,9 @@ PRBool nsXIFDTD::GetAttributePair(nsIParserNode& aNode, nsString& aKey, nsString
|
||||
key.StripChars(quote);
|
||||
value.StripChars(quote);
|
||||
|
||||
if (key.Equals("name"))
|
||||
if (key.EqualsWithConversion("name"))
|
||||
aKey = value;
|
||||
if (key.Equals("value"))
|
||||
if (key.EqualsWithConversion("value"))
|
||||
{
|
||||
aValue = value;
|
||||
hasValue = PR_TRUE;
|
||||
@ -901,12 +901,12 @@ eHTMLTags nsXIFDTD::GetStartTag(const nsIParserNode& aNode, nsString& aName)
|
||||
{
|
||||
case eXIFTag_container:
|
||||
case eXIFTag_leaf:
|
||||
if (GetAttribute(aNode,nsString("isa"),aName))
|
||||
if (GetAttribute(aNode,NS_ConvertToString("isa"),aName))
|
||||
tag = tag = nsHTMLTags::LookupTag(aName);
|
||||
break;
|
||||
|
||||
case eXIFTag_css_stylesheet:
|
||||
aName = "style";
|
||||
aName.AssignWithConversion("style");
|
||||
tag = nsHTMLTags::LookupTag(aName);
|
||||
break;
|
||||
|
||||
@ -1299,7 +1299,7 @@ nsresult nsXIFDTD::CollectContentComment(CToken* aToken, nsCParserNode& aNode) {
|
||||
PRBool done=PR_FALSE;
|
||||
PRBool inContent=PR_FALSE;
|
||||
nsString& comment=aToken->GetStringValueXXX();
|
||||
comment="<!--"; // overwrite comment with "<!--"
|
||||
comment.AssignWithConversion("<!--"); // overwrite comment with "<!--"
|
||||
while (!done && NS_SUCCEEDED(result))
|
||||
{
|
||||
token=mTokenizer->PopToken();
|
||||
@ -1307,14 +1307,14 @@ nsresult nsXIFDTD::CollectContentComment(CToken* aToken, nsCParserNode& aNode) {
|
||||
if(!token) return result;
|
||||
|
||||
type=(eHTMLTokenTypes)token->GetTokenType();
|
||||
fragment=token->GetStringValueXXX();
|
||||
if(fragment.Equals("content")) {
|
||||
fragment.Assign(token->GetStringValueXXX());
|
||||
if(fragment.EqualsWithConversion("content")) {
|
||||
if(type==eToken_start)
|
||||
inContent=PR_TRUE;
|
||||
else inContent=PR_FALSE;
|
||||
}
|
||||
else if(fragment.Equals("comment")) {
|
||||
comment.Append("-->");
|
||||
else if(fragment.EqualsWithConversion("comment")) {
|
||||
comment.AppendWithConversion("-->");
|
||||
result=(mSink)? mSink->AddComment(aNode):NS_OK;
|
||||
done=PR_TRUE;
|
||||
}
|
||||
@ -1414,7 +1414,7 @@ void nsXIFDTD::ProcessEncodeTag(const nsIParserNode& aNode)
|
||||
nsString value;
|
||||
PRInt32 error;
|
||||
|
||||
if (GetAttribute(aNode,nsString("selection"),value))
|
||||
if (GetAttribute(aNode,NS_ConvertToString("selection"),value))
|
||||
{
|
||||
PRInt32 temp = value.ToInteger(&error);
|
||||
if (temp == 1)
|
||||
@ -1431,7 +1431,7 @@ void nsXIFDTD::ProcessEntityTag(const nsIParserNode& aNode)
|
||||
{
|
||||
nsAutoString value;
|
||||
|
||||
if (GetAttribute(aNode,nsString("value"),value)) {
|
||||
if (GetAttribute(aNode,NS_ConvertToString("value"),value)) {
|
||||
value+=';';
|
||||
CEntityToken* entity = new CEntityToken(value);
|
||||
nsCParserNode node((CToken*)entity);
|
||||
@ -1448,7 +1448,7 @@ void nsXIFDTD::BeginCSSStyleSheet(const nsIParserNode& aNode)
|
||||
|
||||
mBuffer.Truncate(0);
|
||||
mMaxCSSSelectorWidth = 10;
|
||||
if (GetAttribute(aNode,nsString("max_css_selector_width"),value))
|
||||
if (GetAttribute(aNode,NS_ConvertToString("max_css_selector_width"),value))
|
||||
{
|
||||
PRInt32 temp = value.ToInteger(&error);
|
||||
if (error == NS_OK)
|
||||
@ -1470,9 +1470,9 @@ void nsXIFDTD::EndCSSStyleSheet(const nsIParserNode& aNode)
|
||||
CStartToken startToken(tagName);
|
||||
nsCParserNode startNode((CToken*)&startToken);
|
||||
|
||||
mBuffer.Append("</");
|
||||
mBuffer.AppendWithConversion("</");
|
||||
mBuffer.Append(tagName);
|
||||
mBuffer.Append(">");
|
||||
mBuffer.AppendWithConversion(">");
|
||||
startNode.SetSkippedContent(mBuffer);
|
||||
mSink->AddLeaf(startNode);
|
||||
|
||||
@ -1494,7 +1494,7 @@ void nsXIFDTD::AddCSSSelector(const nsIParserNode& aNode)
|
||||
{
|
||||
nsString value;
|
||||
|
||||
if (GetAttribute(aNode, nsString("selectors"), value))
|
||||
if (GetAttribute(aNode, NS_ConvertToString("selectors"), value))
|
||||
{
|
||||
if (mLowerCaseAttributes == PR_TRUE)
|
||||
value.ToLowerCase();
|
||||
@ -1517,16 +1517,16 @@ void nsXIFDTD::BeginCSSDeclarationList(const nsIParserNode& aNode)
|
||||
count = 0;
|
||||
|
||||
for (PRInt32 i = 0; i < count; i++)
|
||||
mBuffer.Append(" ");
|
||||
mBuffer.AppendWithConversion(" ");
|
||||
|
||||
mBuffer.Append(" {");
|
||||
mBuffer.AppendWithConversion(" {");
|
||||
mCSSDeclarationCount = 0;
|
||||
|
||||
}
|
||||
|
||||
void nsXIFDTD::EndCSSDeclarationList(const nsIParserNode& aNode)
|
||||
{
|
||||
mBuffer.Append("}\n");
|
||||
mBuffer.AppendWithConversion("}\n");
|
||||
}
|
||||
|
||||
|
||||
@ -1536,14 +1536,14 @@ void nsXIFDTD::AddCSSDeclaration(const nsIParserNode& aNode)
|
||||
nsString value;
|
||||
|
||||
|
||||
if (PR_TRUE == GetAttribute(aNode, nsString("property"), property))
|
||||
if (PR_TRUE == GetAttribute(aNode, nsString("value"), value))
|
||||
if (PR_TRUE == GetAttribute(aNode, NS_ConvertToString("property"), property))
|
||||
if (PR_TRUE == GetAttribute(aNode, NS_ConvertToString("value"), value))
|
||||
{
|
||||
if (mCSSDeclarationCount != 0)
|
||||
mBuffer.Append(";");
|
||||
mBuffer.Append(" ");
|
||||
mBuffer.AppendWithConversion(";");
|
||||
mBuffer.AppendWithConversion(" ");
|
||||
mBuffer.Append(property);
|
||||
mBuffer.Append(": ");
|
||||
mBuffer.AppendWithConversion(": ");
|
||||
mBuffer.Append(value);
|
||||
mCSSDeclarationCount++;
|
||||
}
|
||||
|
||||
@ -237,7 +237,7 @@ nsresult nsXMLTokenizer::ConsumeSpecialMarkup(PRUnichar aChar,CToken*& aToken,ns
|
||||
PRBool isComment=PR_TRUE;
|
||||
nsAutoString theEmpty;
|
||||
if(theChar==kLeftSquareBracket) {
|
||||
nsAutoString CDATAString("[CDATA[");
|
||||
nsAutoString CDATAString; CDATAString.AssignWithConversion("[CDATA[");
|
||||
PRBool isCDATA = PR_FALSE;
|
||||
result = ConsumeConditional(aScanner, CDATAString, isCDATA);
|
||||
if (NS_OK == result) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user