зеркало из https://github.com/mozilla/gecko-dev.git
making string conversions explicit
This commit is contained in:
Родитель
eb70c597c4
Коммит
fbeea434b6
|
@ -79,15 +79,15 @@ NS_IMETHODIMP RobotSinkObserver::ProcessLink(const nsString& aURLSpec)
|
|||
// Geez this is ugly. temporary hack to only process html files
|
||||
str.Truncate();
|
||||
nsString(aURLSpec).Right(str,1);
|
||||
if (!str.Equals("/"))
|
||||
if (!str.EqualsWithConversion("/"))
|
||||
{
|
||||
str.Truncate();
|
||||
nsString(aURLSpec).Right(str,4);
|
||||
if (!str.Equals("html"))
|
||||
if (!str.EqualsWithConversion("html"))
|
||||
{
|
||||
str.Truncate();
|
||||
nsString(aURLSpec).Right(str,3);
|
||||
if (!str.Equals("htm"))
|
||||
if (!str.EqualsWithConversion("htm"))
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ NS_IMETHODIMP RobotSinkObserver::ProcessLink(const nsString& aURLSpec)
|
|||
g_duplicateList->AppendElement(new nsString(aURLSpec));
|
||||
str.Truncate();
|
||||
nsString(aURLSpec).Left(str,5);
|
||||
if (str.Equals("http:")) {
|
||||
if (str.EqualsWithConversion("http:")) {
|
||||
g_iProcessed++;
|
||||
if (g_iProcessed == (g_iMaxProcess > 0 ? g_iMaxProcess-1 : 0))
|
||||
g_bHitTop = PR_TRUE;
|
||||
|
@ -328,7 +328,7 @@ extern "C" NS_EXPORT int DebugRobot(
|
|||
}
|
||||
char* spec;
|
||||
(void)url->GetSpec(&spec);
|
||||
nsAutoString theSpec(spec);
|
||||
nsAutoString theSpec; theSpec.AssignWithConversion(spec);
|
||||
nsCRT::free(spec);
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(docShell));
|
||||
webNav->LoadURI(theSpec.GetUnicode());/* XXX hook up stream listener here! */
|
||||
|
|
|
@ -219,7 +219,7 @@ NS_IMETHODIMP RobotSink::OpenContainer(const nsIParserNode& aNode)
|
|||
{
|
||||
nsAutoString tmp(aNode.GetText());
|
||||
tmp.ToLowerCase();
|
||||
if (tmp.Equals("a")) {
|
||||
if (tmp.EqualsWithConversion("a")) {
|
||||
nsAutoString k, v;
|
||||
PRInt32 ac = aNode.GetAttributeCount();
|
||||
for (PRInt32 i = 0; i < ac; i++) {
|
||||
|
@ -228,7 +228,7 @@ NS_IMETHODIMP RobotSink::OpenContainer(const nsIParserNode& aNode)
|
|||
k.Truncate();
|
||||
k.Append(key);
|
||||
k.ToLowerCase();
|
||||
if (k.Equals("href")) {
|
||||
if (k.EqualsWithConversion("href")) {
|
||||
// Get value and remove mandatory quotes
|
||||
v.Truncate();
|
||||
v.Append(aNode.GetValueAt(i));
|
||||
|
@ -363,7 +363,7 @@ void RobotSink::ProcessLink(const nsString& aLink)
|
|||
absURLSpec.Truncate();
|
||||
char* str;
|
||||
absurl->GetSpec(&str);
|
||||
absURLSpec = str;
|
||||
absURLSpec.AssignWithConversion(str);
|
||||
nsCRT::free(str);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,9 +134,7 @@ NS_IMPL_RELEASE(CNavDTD)
|
|||
CNavDTD::CNavDTD() : nsIDTD(),
|
||||
mMisplacedContent(0),
|
||||
mSkippedContent(0),
|
||||
mSharedNodes(0),
|
||||
mScratch(""),
|
||||
mMimeType("") {
|
||||
mSharedNodes(0) {
|
||||
NS_INIT_REFCNT();
|
||||
mSink = 0;
|
||||
mParser=0;
|
||||
|
@ -373,18 +371,18 @@ eAutoDetectResult CNavDTD::CanParse(CParserContext& aParserContext,nsString& aBu
|
|||
|
||||
|
||||
if(eViewSource==aParserContext.mParserCommand) {
|
||||
if(PR_TRUE==aParserContext.mMimeType.Equals(kPlainTextContentType)) {
|
||||
if(PR_TRUE==aParserContext.mMimeType.EqualsWithConversion(kPlainTextContentType)) {
|
||||
result=ePrimaryDetect;
|
||||
}
|
||||
else if(aParserContext.mMimeType.Equals(kRTFTextContentType)){
|
||||
else if(aParserContext.mMimeType.EqualsWithConversion(kRTFTextContentType)){
|
||||
result=ePrimaryDetect;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(PR_TRUE==aParserContext.mMimeType.Equals(kHTMLTextContentType)) {
|
||||
if(PR_TRUE==aParserContext.mMimeType.EqualsWithConversion(kHTMLTextContentType)) {
|
||||
result=ePrimaryDetect;
|
||||
}
|
||||
else if(PR_TRUE==aParserContext.mMimeType.Equals(kPlainTextContentType)) {
|
||||
else if(PR_TRUE==aParserContext.mMimeType.EqualsWithConversion(kPlainTextContentType)) {
|
||||
result=ePrimaryDetect;
|
||||
}
|
||||
else {
|
||||
|
@ -393,7 +391,7 @@ eAutoDetectResult CNavDTD::CanParse(CParserContext& aParserContext,nsString& aBu
|
|||
if(BufferContainsHTML(aBuffer,theBufHasXML)){
|
||||
result = eValidDetect ;
|
||||
if(0==aParserContext.mMimeType.Length()) {
|
||||
aParserContext.SetMimeType(kHTMLTextContentType);
|
||||
aParserContext.SetMimeType(NS_ConvertToString(kHTMLTextContentType));
|
||||
result = (theBufHasXML) ? eValidDetect : ePrimaryDetect;
|
||||
}
|
||||
}
|
||||
|
@ -482,7 +480,7 @@ nsresult CNavDTD::BuildModel(nsIParser* aParser,nsITokenizer* aTokenizer,nsIToke
|
|||
|
||||
if(!mBodyContext->GetCount()) {
|
||||
//if the content model is empty, then begin by opening <html>...
|
||||
CStartToken *theToken=(CStartToken*)mTokenRecycler->CreateTokenOfType(eToken_start,eHTMLTag_html,"html");
|
||||
CStartToken *theToken=(CStartToken*)mTokenRecycler->CreateTokenOfType(eToken_start,eHTMLTag_html,NS_ConvertToString("html"));
|
||||
HandleStartToken(theToken); //this token should get pushed on the context stack, don't recycle it.
|
||||
|
||||
if(ePlainText==mDocType) {
|
||||
|
@ -540,7 +538,7 @@ nsresult CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParse
|
|||
|
||||
mSkipTarget=eHTMLTag_unknown; //clear this in case we were searching earlier.
|
||||
|
||||
CStartToken *theToken=(CStartToken*)mTokenRecycler->CreateTokenOfType(eToken_start,eHTMLTag_body,"body");
|
||||
CStartToken *theToken=(CStartToken*)mTokenRecycler->CreateTokenOfType(eToken_start,eHTMLTag_body,NS_ConvertToString("body"));
|
||||
mTokenizer->PushTokenFront(theToken); //this token should get pushed on the context stack, don't recycle it
|
||||
result=BuildModel(aParser,mTokenizer,0,aSink);
|
||||
}
|
||||
|
@ -726,7 +724,7 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){
|
|||
mMisplacedContent.Push(aToken);
|
||||
aToken->mUseCount++;
|
||||
if(mParseMode==eParseMode_quirks && (gHTMLElements[theTag].HasSpecialProperty(kRequiresBody))) {
|
||||
CToken* theBodyToken=(CToken*)mTokenRecycler->CreateTokenOfType(eToken_start,eHTMLTag_body,"body");
|
||||
CToken* theBodyToken=(CToken*)mTokenRecycler->CreateTokenOfType(eToken_start,eHTMLTag_body,NS_ConvertToString("body"));
|
||||
result=HandleToken(theBodyToken,aParser);
|
||||
}
|
||||
return result;
|
||||
|
@ -1131,7 +1129,7 @@ nsresult CNavDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsCParserNode
|
|||
CParserContext* pc=mParser->PeekContext();
|
||||
void* theDocID=(pc)? pc->mKey:0;
|
||||
|
||||
result=theService->Notify(aTag,aNode,(PRUint32)theDocID,kHTMLTextContentType,mParser);
|
||||
result=theService->Notify(aTag,aNode,(PRUint32)theDocID, NS_ConvertToString(kHTMLTextContentType), mParser);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2129,7 +2127,7 @@ NS_IMETHODIMP CNavDTD::StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const
|
|||
}
|
||||
|
||||
NS_IMETHODIMP CNavDTD::IntTagToStringTag(PRInt32 aIntTag, nsString& aTag) const {
|
||||
aTag = nsHTMLTags::GetStringValue((nsHTMLTag)aIntTag);
|
||||
aTag.AssignWithConversion(nsHTMLTags::GetStringValue((nsHTMLTag)aIntTag));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ class CTagFinder: public nsDequeFunctor{
|
|||
|
||||
public:
|
||||
CTagFinder(){}
|
||||
void Initialize(const nsString &aTagName) {mTagName = aTagName;}
|
||||
void Initialize(const nsString &aTagName) {mTagName.Assign(aTagName);}
|
||||
|
||||
virtual ~CTagFinder() {
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ NS_IMPL_RELEASE(COtherDTD)
|
|||
* @param
|
||||
* @return
|
||||
*/
|
||||
COtherDTD::COtherDTD() : nsIDTD(), mMisplacedContent(0), mSkippedContent(0), mSharedNodes(0), mScratch("") {
|
||||
COtherDTD::COtherDTD() : nsIDTD(), mMisplacedContent(0), mSkippedContent(0), mSharedNodes(0) {
|
||||
NS_INIT_REFCNT();
|
||||
mSink = 0;
|
||||
mParser=0;
|
||||
|
@ -471,7 +471,7 @@ eAutoDetectResult COtherDTD::CanParse(CParserContext& aParserContext,nsString& a
|
|||
|
||||
|
||||
if(eViewSource!=aParserContext.mParserCommand) {
|
||||
if(PR_TRUE==(aParserContext.mMimeType.Equals(kHTMLTextContentType) || aParserContext.mMimeType.Equals(kPlainTextContentType))) {
|
||||
if(PR_TRUE==(aParserContext.mMimeType.EqualsWithConversion(kHTMLTextContentType) || aParserContext.mMimeType.EqualsWithConversion(kPlainTextContentType))) {
|
||||
result=ePrimaryDetect;
|
||||
}
|
||||
else {
|
||||
|
@ -480,7 +480,7 @@ eAutoDetectResult COtherDTD::CanParse(CParserContext& aParserContext,nsString& a
|
|||
if(BufferContainsHTML(aBuffer,theBufHasXML)){
|
||||
result = eValidDetect ;
|
||||
if(0==aParserContext.mMimeType.Length()) {
|
||||
aParserContext.SetMimeType(kHTMLTextContentType);
|
||||
aParserContext.SetMimeType( NS_ConvertToString(kHTMLTextContentType) );
|
||||
result = (theBufHasXML) ? eValidDetect : ePrimaryDetect;
|
||||
}
|
||||
}
|
||||
|
@ -569,7 +569,7 @@ nsresult COtherDTD::BuildModel(nsIParser* aParser,nsITokenizer* aTokenizer,nsITo
|
|||
|
||||
if(!mBodyContext->GetCount()) {
|
||||
//if the content model is empty, then begin by opening <html>...
|
||||
CStartToken *theToken=(CStartToken*)mTokenRecycler->CreateTokenOfType(eToken_start,eHTMLTag_html,"html");
|
||||
CStartToken *theToken=(CStartToken*)mTokenRecycler->CreateTokenOfType(eToken_start,eHTMLTag_html, NS_ConvertToString("html"));
|
||||
HandleStartToken(theToken); //this token should get pushed on the context stack, don't recycle it.
|
||||
}
|
||||
|
||||
|
@ -623,11 +623,11 @@ nsresult COtherDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIPar
|
|||
mTokenizer->PrependTokens(mMisplacedContent); //push misplaced content
|
||||
|
||||
if(ePlainText==mDocType) {
|
||||
CStartToken *theToken=(CStartToken*)mTokenRecycler->CreateTokenOfType(eToken_start,eHTMLTag_pre,"pre");
|
||||
CStartToken *theToken=(CStartToken*)mTokenRecycler->CreateTokenOfType(eToken_start,eHTMLTag_pre, NS_ConvertToString("pre"));
|
||||
mTokenizer->PushTokenFront(theToken); //this token should get pushed on the context stack, don't recycle it
|
||||
}
|
||||
|
||||
CStartToken *theToken=(CStartToken*)mTokenRecycler->CreateTokenOfType(eToken_start,eHTMLTag_body,"body");
|
||||
CStartToken *theToken=(CStartToken*)mTokenRecycler->CreateTokenOfType(eToken_start,eHTMLTag_body, NS_ConvertToString("body"));
|
||||
mTokenizer->PushTokenFront(theToken); //this token should get pushed on the context stack, don't recycle it
|
||||
|
||||
result=BuildModel(aParser,mTokenizer,0,aSink);
|
||||
|
@ -1204,7 +1204,7 @@ nsresult COtherDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsCParserNo
|
|||
CParserContext* pc=mParser->PeekContext();
|
||||
void* theDocID=(pc)? pc->mKey:0;
|
||||
|
||||
result=theService->Notify(aTag,aNode,(PRUint32)theDocID,kHTMLTextContentType,mParser);
|
||||
result=theService->Notify(aTag,aNode,(PRUint32)theDocID, NS_ConvertToString(kHTMLTextContentType), mParser);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2075,7 +2075,7 @@ nsresult COtherDTD::CollectSkippedContent(nsCParserNode& aNode,PRInt32 &aCount)
|
|||
// the parser and into the form element code
|
||||
PRBool aMustConvertLinebreaks = PR_FALSE;
|
||||
|
||||
mScratch="";
|
||||
mScratch.SetLength(0);
|
||||
aNode.SetSkippedContent(mScratch);
|
||||
|
||||
for(aIndex=0;aIndex<aMax;aIndex++){
|
||||
|
@ -2154,7 +2154,7 @@ NS_IMETHODIMP COtherDTD::StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) con
|
|||
}
|
||||
|
||||
NS_IMETHODIMP COtherDTD::IntTagToStringTag(PRInt32 aIntTag, nsString& aTag) const {
|
||||
aTag = nsHTMLTags::GetStringValue((nsHTMLTag)aIntTag);
|
||||
aTag.AssignWithConversion(nsHTMLTags::GetStringValue((nsHTMLTag)aIntTag));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,8 +40,7 @@ CParserContext::CParserContext(nsScanner* aScanner,
|
|||
nsIStreamObserver* aListener,
|
||||
nsIDTD *aDTD,
|
||||
eAutoDetectResult aStatus,
|
||||
PRBool aCopyUnused) :
|
||||
mMimeType("")
|
||||
PRBool aCopyUnused)
|
||||
{
|
||||
MOZ_COUNT_CTOR(CParserContext);
|
||||
|
||||
|
@ -126,19 +125,19 @@ CParserContext::~CParserContext(){
|
|||
* @update rickg 03.18.2000
|
||||
*/
|
||||
void CParserContext::SetMimeType(const nsString& aMimeType){
|
||||
mMimeType=aMimeType;
|
||||
mMimeType.Assign(aMimeType);
|
||||
|
||||
mDocType=ePlainText;
|
||||
|
||||
if(mMimeType.Equals(kHTMLTextContentType))
|
||||
if(mMimeType.EqualsWithConversion(kHTMLTextContentType))
|
||||
mDocType=eHTMLText;
|
||||
else if(mMimeType.Equals(kXMLTextContentType))
|
||||
else if(mMimeType.EqualsWithConversion(kXMLTextContentType))
|
||||
mDocType=eXMLText;
|
||||
else if(mMimeType.Equals(kXULTextContentType))
|
||||
else if(mMimeType.EqualsWithConversion(kXULTextContentType))
|
||||
mDocType=eXMLText;
|
||||
else if(mMimeType.Equals(kRDFTextContentType))
|
||||
else if(mMimeType.EqualsWithConversion(kRDFTextContentType))
|
||||
mDocType=eXMLText;
|
||||
else if(mMimeType.Equals(kXIFTextContentType))
|
||||
else if(mMimeType.EqualsWithConversion(kXIFTextContentType))
|
||||
mDocType=eXMLText;
|
||||
|
||||
}
|
||||
|
|
|
@ -213,7 +213,7 @@ static eRTFTags GetTagID(const nsString& aTag) {
|
|||
while(low<=high) {
|
||||
middle=(PRInt32)(low+high)/2;
|
||||
|
||||
PRInt32 cmp=aTag.Compare(gRTFTable[middle].mName);
|
||||
PRInt32 cmp=aTag.CompareWithConversion(gRTFTable[middle].mName);
|
||||
if(0==cmp)
|
||||
return gRTFTable[middle].mTagID;
|
||||
if(-1==cmp)
|
||||
|
@ -342,7 +342,7 @@ eAutoDetectResult CRtfDTD::CanParse(CParserContext& aParserContext,nsString& aBu
|
|||
eAutoDetectResult result=eUnknownDetect;
|
||||
|
||||
if(eViewSource!=aParserContext.mParserCommand) {
|
||||
if(aParserContext.mMimeType.Equals(kRTFTextContentType)) {
|
||||
if(aParserContext.mMimeType.EqualsWithConversion(kRTFTextContentType)) {
|
||||
result=ePrimaryDetect;
|
||||
}
|
||||
else if(kNotFound!=aBuffer.Find(kRTFDocHeader)) {
|
||||
|
@ -542,7 +542,7 @@ NS_IMETHODIMP CRtfDTD::StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const
|
|||
}
|
||||
|
||||
NS_IMETHODIMP CRtfDTD::IntTagToStringTag(PRInt32 aIntTag, nsString& aTag) const {
|
||||
aTag = nsHTMLTags::GetStringValue((nsHTMLTag)aIntTag);
|
||||
aTag.AssignWithConversion(nsHTMLTags::GetStringValue((nsHTMLTag)aIntTag).GetBuffer());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -593,7 +593,7 @@ nsresult CRtfDTD::AddLeafContainer(eHTMLTags aTag,const char* aTagName){
|
|||
nsresult result=NS_OK;
|
||||
|
||||
if(mSink) {
|
||||
nsAutoString theStr(aTagName);
|
||||
nsAutoString theStr; theStr.AssignWithConversion(aTagName);
|
||||
CStartToken theToken(theStr,aTag);
|
||||
nsCParserNode theNode(&theToken);
|
||||
|
||||
|
@ -617,7 +617,7 @@ nsresult CRtfDTD::OpenContainer(eHTMLTags aTag,const char* aTagName){
|
|||
nsresult result=NS_OK;
|
||||
|
||||
if(mSink) {
|
||||
nsAutoString theStr(aTagName);
|
||||
nsAutoString theStr; theStr.AssignWithConversion(aTagName);
|
||||
CStartToken theToken(theStr,aTag);
|
||||
nsCParserNode theNode(&theToken);
|
||||
|
||||
|
@ -754,7 +754,7 @@ nsresult CRtfDTD::HandleControlWord(CToken* aToken){
|
|||
break;
|
||||
case eRTFCtrl_tab:
|
||||
{
|
||||
CTextToken theToken2(" ");
|
||||
CTextToken theToken2( NS_ConvertToString(" ") );
|
||||
result=HandleContent(&theToken2);
|
||||
}
|
||||
break;
|
||||
|
@ -890,7 +890,7 @@ nsresult CRTFControlWord::Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aM
|
|||
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
if(('a'<=theChar) && (theChar<='z')) {
|
||||
nsAutoString temp(gAlphaChars);
|
||||
nsAutoString temp; temp.AssignWithConversion(gAlphaChars);
|
||||
result=aScanner.ReadWhile(mTextValue,temp,PR_FALSE);
|
||||
if(NS_OK==result) {
|
||||
//ok, now look for an option parameter...
|
||||
|
@ -903,7 +903,7 @@ nsresult CRTFControlWord::Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aM
|
|||
case '5': case '6': case '7': case '8': case '9':
|
||||
case kMinus:
|
||||
{
|
||||
nsAutoString theDigits(gDigits);
|
||||
nsAutoString theDigits; theDigits.AssignWithConversion(gDigits);
|
||||
result=aScanner.ReadWhile(mArgument,theDigits,PR_FALSE);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -649,7 +649,7 @@ nsIParserNode* nsDTDContext::RemoveStyle(eHTMLTags aTag){
|
|||
* @update gess7/25/98
|
||||
* @param
|
||||
*/
|
||||
CTokenRecycler::CTokenRecycler() : nsITokenRecycler(),mEmpty("") {
|
||||
CTokenRecycler::CTokenRecycler() : nsITokenRecycler() {
|
||||
|
||||
MOZ_COUNT_CTOR(CTokenRecycler);
|
||||
|
||||
|
@ -971,8 +971,8 @@ nsresult nsObserverTopic::Notify(eHTMLTags aTag,nsIParserNode& aNode,PRUint32 aU
|
|||
theKeys[index] = aNode.GetKeyAt(index).GetUnicode();
|
||||
theValues[index] = aNode.GetValueAt(index).GetUnicode();
|
||||
}
|
||||
nsAutoString theCharsetKey("charset");
|
||||
nsAutoString theSourceKey("charsetSource");
|
||||
nsAutoString theCharsetKey; theCharsetKey.AssignWithConversion("charset");
|
||||
nsAutoString theSourceKey; theSourceKey.AssignWithConversion("charsetSource");
|
||||
nsAutoString intValue;
|
||||
|
||||
// Add pseudo attribute in the end
|
||||
|
@ -989,11 +989,11 @@ nsresult nsObserverTopic::Notify(eHTMLTags aTag,nsIParserNode& aNode,PRUint32 aU
|
|||
if(index < 50) {
|
||||
theKeys[index]=theSourceKey.GetUnicode();
|
||||
PRInt32 sourceInt = theCharsetSource;
|
||||
intValue.Append(sourceInt,10);
|
||||
intValue.AppendWithConversion(sourceInt,10);
|
||||
theValues[index] = intValue.GetUnicode();
|
||||
index++;
|
||||
}
|
||||
nsAutoString theDTDKey("X_COMMAND");
|
||||
nsAutoString theDTDKey; theDTDKey.AssignWithConversion("X_COMMAND");
|
||||
// nsAutoString theDTDValue(aCommand);
|
||||
if(index < 50) {
|
||||
theKeys[index]=theDTDKey.GetUnicode();
|
||||
|
@ -1026,10 +1026,10 @@ CObserverService::CObserverService() : mTopics(0) {
|
|||
|
||||
MOZ_COUNT_CTOR(CObserverService);
|
||||
|
||||
nsAutoString theHTMLTopic(kHTMLTextContentType);
|
||||
nsAutoString theHTMLTopic; theHTMLTopic.AssignWithConversion(kHTMLTextContentType);
|
||||
RegisterObservers(theHTMLTopic);
|
||||
|
||||
nsAutoString theXMLTopic(kXMLTextContentType); //use the mimetype for the topic
|
||||
nsAutoString theXMLTopic; theXMLTopic.AssignWithConversion(kXMLTextContentType); //use the mimetype for the topic
|
||||
RegisterObservers(theXMLTopic);
|
||||
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ NS_IMPL_RELEASE(nsExpatDTD)
|
|||
* @param
|
||||
* @return
|
||||
*/
|
||||
nsExpatDTD::nsExpatDTD() : nsIDTD(), mFilename("") {
|
||||
nsExpatDTD::nsExpatDTD() {
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
mExpatParser=0;
|
||||
|
@ -172,15 +172,15 @@ eAutoDetectResult nsExpatDTD::CanParse(CParserContext& aParserContext,nsString&
|
|||
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=eValidDetect;
|
||||
}
|
||||
else {
|
||||
if(-1<aBuffer.Find("<?xml ")) {
|
||||
if(0==aParserContext.mMimeType.Length()) {
|
||||
aParserContext.SetMimeType(kXMLTextContentType);
|
||||
aParserContext.SetMimeType( NS_ConvertToString(kXMLTextContentType) );
|
||||
}
|
||||
result=eValidDetect;
|
||||
}
|
||||
|
|
|
@ -184,7 +184,7 @@ nsExpatTokenizer::nsExpatTokenizer(nsString* aURL) : nsHTMLTokenizer() {
|
|||
mState->parser = nsnull;
|
||||
mState->tokenDeque = nsnull;
|
||||
|
||||
nsAutoString buffer("UTF-16");
|
||||
nsAutoString buffer; buffer.AssignWithConversion("UTF-16");
|
||||
const PRUnichar* encoding = buffer.GetUnicode();
|
||||
if (encoding) {
|
||||
mExpatParser = XML_ParserCreate((const XML_Char*) encoding);
|
||||
|
@ -267,7 +267,10 @@ void nsExpatTokenizer::GetLine(const char* aSourceBuffer, PRUint32 aLength,
|
|||
aLine.Truncate(0);
|
||||
if (startIndex == endIndex) {
|
||||
/* Special case if the error is on a line where the only character is a newline */
|
||||
aLine.Append("");
|
||||
// STRING USE WARNING: I have no idea what this is supposed to do; to me it looks like a no-op
|
||||
// ... so I'm not going to delete it but I will fix it to conform to the new standard.
|
||||
// aLine.Append("");
|
||||
aLine.AppendWithConversion("");
|
||||
}
|
||||
else {
|
||||
NS_ASSERTION(endIndex - startIndex >= sizeof(PRUnichar), "?");
|
||||
|
@ -291,15 +294,15 @@ void nsExpatTokenizer::GetLine(const char* aSourceBuffer, PRUint32 aLength,
|
|||
static nsresult
|
||||
CreateErrorText(const nsParserError* aError, nsString& aErrorString)
|
||||
{
|
||||
aErrorString = "XML Parsing Error: ";
|
||||
aErrorString.AssignWithConversion("XML Parsing Error: ");
|
||||
|
||||
if (aError) {
|
||||
aErrorString.Append(aError->description);
|
||||
aErrorString.Append("\nLine Number ");
|
||||
aErrorString.Append(aError->lineNumber, 10);
|
||||
aErrorString.Append(", Column ");
|
||||
aErrorString.Append(aError->colNumber, 10);
|
||||
aErrorString.Append(":");
|
||||
aErrorString.AppendWithConversion("\nLine Number ");
|
||||
aErrorString.AppendWithConversion(aError->lineNumber, 10);
|
||||
aErrorString.AppendWithConversion(", Column ");
|
||||
aErrorString.AppendWithConversion(aError->colNumber, 10);
|
||||
aErrorString.AppendWithConversion(":");
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -311,10 +314,10 @@ CreateSourceText(const nsParserError* aError, nsString& aSourceString)
|
|||
PRInt32 errorPosition = aError->colNumber;
|
||||
|
||||
aSourceString.Append(aError->sourceLine);
|
||||
aSourceString.Append("\n");
|
||||
aSourceString.AppendWithConversion("\n");
|
||||
for (int i = 0; i < errorPosition; i++)
|
||||
aSourceString.Append("-");
|
||||
aSourceString.Append("^");
|
||||
aSourceString.AppendWithConversion("-");
|
||||
aSourceString.AppendWithConversion("^");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -337,7 +340,7 @@ nsExpatTokenizer::AddErrorMessageTokens(nsParserError* aError)
|
|||
CAttributeToken* attrToken = (CAttributeToken*)
|
||||
mState->tokenRecycler->CreateTokenOfType(eToken_attribute, eHTMLTag_unknown);
|
||||
nsString& key = attrToken->GetKey();
|
||||
key.Assign("xmlns");
|
||||
key.AssignWithConversion("xmlns");
|
||||
attrToken->SetStringValue(kHTMLNameSpaceURI);
|
||||
newToken->SetAttributeCount(1);
|
||||
newToken = (CToken*) attrToken;
|
||||
|
@ -396,7 +399,7 @@ nsExpatTokenizer::PushXMLErrorTokens(const char *aBuffer, PRUint32 aLength, PRBo
|
|||
error->code = XML_GetErrorCode(mExpatParser);
|
||||
error->lineNumber = XML_GetCurrentLineNumber(mExpatParser);
|
||||
error->colNumber = XML_GetCurrentColumnNumber(mExpatParser);
|
||||
error->description = XML_ErrorString(error->code);
|
||||
error->description.AssignWithConversion(XML_ErrorString(error->code));
|
||||
if (!aIsFinal) {
|
||||
PRInt32 byteIndexRelativeToFile = 0;
|
||||
byteIndexRelativeToFile = XML_GetCurrentByteIndex(mExpatParser);
|
||||
|
@ -617,13 +620,13 @@ void nsExpatTokenizer::HandleProcessingInstruction(void *userData,
|
|||
CToken* theToken = state->tokenRecycler->CreateTokenOfType(eToken_instruction,eHTMLTag_unknown);
|
||||
if(theToken) {
|
||||
nsString& theString=theToken->GetStringValueXXX();
|
||||
theString. Append("<?");
|
||||
theString. AppendWithConversion("<?");
|
||||
theString.Append((PRUnichar *) target);
|
||||
if(data) {
|
||||
theString.Append(" ");
|
||||
theString.AppendWithConversion(" ");
|
||||
theString.Append((PRUnichar *) data);
|
||||
}
|
||||
theString.Append("?>");
|
||||
theString.AppendWithConversion("?>");
|
||||
AddToken(theToken, NS_OK, state->tokenDeque, state->tokenRecycler);
|
||||
}
|
||||
else{
|
||||
|
@ -687,8 +690,8 @@ IsLoadableDTD(nsIURI** aDTD)
|
|||
res = dtdURL->GetFileName(&fileName);
|
||||
if (NS_SUCCEEDED(res) && nsnull != fileName) {
|
||||
nsSpecialSystemDirectory dtdPath(nsSpecialSystemDirectory::OS_CurrentProcessDirectory);
|
||||
nsString path(kDTDDirectory);
|
||||
path.Append(fileName);
|
||||
nsString path; path.AssignWithConversion(kDTDDirectory);
|
||||
path.AppendWithConversion(fileName);
|
||||
dtdPath += path;
|
||||
if (dtdPath.Exists()) {
|
||||
// The DTD was found in the local DTD directory.
|
||||
|
@ -728,7 +731,7 @@ nsExpatTokenizer::OpenInputStream(const nsString& aURLStr,
|
|||
rv = NS_OpenURI(in, uri);
|
||||
char* absURL = nsnull;
|
||||
uri->GetSpec(&absURL);
|
||||
aAbsURL->Append(absURL);
|
||||
aAbsURL->AppendWithConversion(absURL);
|
||||
nsCRT::free(absURL);
|
||||
}
|
||||
else {
|
||||
|
@ -747,7 +750,7 @@ nsresult nsExpatTokenizer::LoadStream(nsIInputStream* in,
|
|||
PRUint32 aCount = 1024,
|
||||
bufsize = aCount*sizeof(PRUnichar);
|
||||
nsIUnicharInputStream *uniIn = nsnull;
|
||||
nsAutoString utf8("UTF-8");
|
||||
nsAutoString utf8; utf8.AssignWithConversion("UTF-8");
|
||||
|
||||
nsresult res = NS_NewConverterStream(&uniIn,
|
||||
nsnull,
|
||||
|
@ -815,7 +818,7 @@ int nsExpatTokenizer::HandleExternalEntityRef(XML_Parser parser,
|
|||
// Pass the buffer to expat for parsing
|
||||
if (NS_SUCCEEDED(rv) && nsnull != uniBuf) {
|
||||
// Create a parser for parsing the external entity
|
||||
nsAutoString encoding("UTF-16");
|
||||
nsAutoString encoding; encoding.AssignWithConversion("UTF-16");
|
||||
XML_Parser entParser = nsnull;
|
||||
|
||||
entParser = XML_ExternalEntityParserCreate(parser, 0,
|
||||
|
@ -854,10 +857,10 @@ void nsExpatTokenizer::HandleStartDoctypeDecl(void *userData,
|
|||
CToken* token = state->tokenRecycler->CreateTokenOfType(eToken_doctypeDecl, eHTMLTag_unknown);
|
||||
if (token) {
|
||||
nsString& str = token->GetStringValueXXX();
|
||||
str.Append(kDocTypeDeclPrefix);
|
||||
str.Append(" ");
|
||||
str.AppendWithConversion(kDocTypeDeclPrefix);
|
||||
str.AppendWithConversion(" ");
|
||||
str.Append((PRUnichar*) doctypeName);
|
||||
str.Append(">");
|
||||
str.AppendWithConversion(">");
|
||||
AddToken(token, NS_OK, state->tokenDeque, state->tokenRecycler);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ static char* gHeaderComment = "<!-- This page was created by the Gecko
|
|||
static char* gDocTypeHeader = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">";
|
||||
const int gTabSize=2;
|
||||
|
||||
static const nsString gMozDirty ("_moz_dirty");
|
||||
static const nsString gMozDirty = NS_ConvertToString("_moz_dirty");
|
||||
|
||||
static PRBool IsInline(eHTMLTags aTag);
|
||||
static PRBool IsBlockLevel(eHTMLTags aTag);
|
||||
|
@ -154,7 +154,7 @@ nsHTMLContentSinkStream::Initialize(nsIOutputStream* aOutStream,
|
|||
mStream = aOutStream;
|
||||
mString = aOutString;
|
||||
if (aCharsetOverride != nsnull)
|
||||
mCharsetOverride.Assign(*aCharsetOverride);
|
||||
mCharsetOverride.AssignWithConversion(aCharsetOverride->GetUnicode());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -218,12 +218,14 @@ nsHTMLContentSinkStream::InitEncoders()
|
|||
{
|
||||
nsAutoString charsetName = mCharsetOverride;
|
||||
NS_WITH_SERVICE(nsICharsetAlias, calias, kCharsetAliasCID, &res);
|
||||
if (NS_SUCCEEDED(res) && calias)
|
||||
res = calias->GetPreferred(mCharsetOverride, charsetName);
|
||||
if (NS_SUCCEEDED(res) && calias) {
|
||||
nsAutoString temp; temp.AssignWithConversion(mCharsetOverride);
|
||||
res = calias->GetPreferred(temp, charsetName);
|
||||
}
|
||||
if (NS_FAILED(res))
|
||||
{
|
||||
// failed - unknown alias , fallback to ISO-8859-1
|
||||
charsetName = "ISO-8859-1";
|
||||
charsetName.AssignWithConversion("ISO-8859-1");
|
||||
}
|
||||
|
||||
res = nsComponentManager::CreateInstance(kSaveAsCharsetCID, NULL,
|
||||
|
@ -345,7 +347,7 @@ void nsHTMLContentSinkStream::Write(const char* aData)
|
|||
}
|
||||
if (mString)
|
||||
{
|
||||
mString->Append(aData);
|
||||
mString->AppendWithConversion(aData);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -406,8 +408,8 @@ void nsHTMLContentSinkStream::WriteAttributes(const nsIParserNode& aNode)
|
|||
// used by the editor. Bug 16988. Yuck.
|
||||
//
|
||||
if ((eHTMLTags)aNode.GetNodeType() == eHTMLTag_br
|
||||
&& ((key.Equals("type", PR_TRUE) && value.Equals("_moz"))
|
||||
|| key.Equals("_moz", PR_TRUE, 4)))
|
||||
&& ((key.EqualsWithConversion("type", PR_TRUE) && value.EqualsWithConversion("_moz"))
|
||||
|| key.EqualsWithConversion("_moz", PR_TRUE, 4)))
|
||||
continue;
|
||||
|
||||
//
|
||||
|
@ -431,7 +433,7 @@ void nsHTMLContentSinkStream::WriteAttributes(const nsIParserNode& aNode)
|
|||
|
||||
// Make all links absolute when converting only the selection:
|
||||
if ((mFlags & nsIDocumentEncoder::OutputAbsoluteLinks)
|
||||
&& (key.Equals("href", PR_TRUE) || key.Equals("src", PR_TRUE)
|
||||
&& (key.EqualsWithConversion("href", PR_TRUE) || key.EqualsWithConversion("src", PR_TRUE)
|
||||
// Would be nice to handle OBJECT and APPLET tags,
|
||||
// but that gets more complicated since we have to
|
||||
// search the tag list for CODEBASE as well.
|
||||
|
@ -513,7 +515,7 @@ nsHTMLContentSinkStream::OpenHTML(const nsIParserNode& aNode)
|
|||
// See bug 20246: the html tag doesn't have "html" in its text,
|
||||
// so AddStartTag will do the wrong thing
|
||||
Write(kLessThan);
|
||||
nsAutoCString tagname (nsHTMLTags::GetStringValue(tag));
|
||||
nsAutoCString tagname( nsString(nsHTMLTags::GetStringValue(tag)) );
|
||||
Write(tagname);
|
||||
Write(kGreaterThan);
|
||||
}
|
||||
|
@ -700,7 +702,7 @@ nsHTMLContentSinkStream::CloseFrameset(const nsIParserNode& aNode){
|
|||
|
||||
void nsHTMLContentSinkStream::AddIndent()
|
||||
{
|
||||
nsString padding(" ");
|
||||
nsString padding; padding.AssignWithConversion(" ");
|
||||
for (PRInt32 i = mIndent; --i >= 0; )
|
||||
{
|
||||
Write(padding);
|
||||
|
@ -854,11 +856,11 @@ void nsHTMLContentSinkStream::AddEndTag(const nsIParserNode& aNode)
|
|||
|
||||
if (tag == eHTMLTag_unknown)
|
||||
{
|
||||
tagName = aNode.GetText();
|
||||
tagName.Assign(aNode.GetText());
|
||||
}
|
||||
else if (tag == eHTMLTag_comment)
|
||||
{
|
||||
tagName = "--";
|
||||
tagName.AssignWithConversion("--");
|
||||
}
|
||||
else if(tag == eHTMLTag_markupDecl)
|
||||
{
|
||||
|
@ -869,7 +871,7 @@ void nsHTMLContentSinkStream::AddEndTag(const nsIParserNode& aNode)
|
|||
}
|
||||
else
|
||||
{
|
||||
tagName = nsHTMLTags::GetStringValue(tag);
|
||||
tagName.AssignWithConversion(nsHTMLTags::GetStringValue(tag));
|
||||
}
|
||||
if (mLowerCaseTags == PR_TRUE)
|
||||
tagName.ToLowerCase();
|
||||
|
@ -1156,21 +1158,21 @@ nsHTMLContentSinkStream::OpenContainer(const nsIParserNode& aNode)
|
|||
if (tag == eHTMLTag_userdefined)
|
||||
{
|
||||
nsAutoString name = aNode.GetText();
|
||||
if (name.Equals("document_info"))
|
||||
if (name.EqualsWithConversion("document_info"))
|
||||
{
|
||||
PRInt32 count=aNode.GetAttributeCount();
|
||||
for(PRInt32 i=0;i<count;i++)
|
||||
{
|
||||
const nsString& key=aNode.GetKeyAt(i);
|
||||
|
||||
if (key.Equals("charset"))
|
||||
if (key.EqualsWithConversion("charset"))
|
||||
{
|
||||
const nsString& value=aNode.GetValueAt(i);
|
||||
if (mCharsetOverride.IsEmpty())
|
||||
mCharsetOverride.Assign(value);
|
||||
mCharsetOverride.AssignWithConversion(value.GetUnicode());
|
||||
InitEncoders();
|
||||
}
|
||||
else if (key.Equals("uri"))
|
||||
else if (key.EqualsWithConversion("uri"))
|
||||
{
|
||||
nsAutoString uristring (aNode.GetValueAt(i));
|
||||
|
||||
|
|
|
@ -221,12 +221,12 @@ public:
|
|||
NS_ASSERTION(value != -1, "can't find entity");
|
||||
NS_ASSERTION(value == gEntityArray[i].mUnicode, "bad unicode value");
|
||||
|
||||
entity = nsHTMLEntities::UnicodeToEntity(value);
|
||||
NS_ASSERTION(entity.Equals(gEntityArray[i].mStr.mStr), "bad entity name");
|
||||
entity.AssignWithConversion(nsHTMLEntities::UnicodeToEntity(value));
|
||||
NS_ASSERTION(entity.EqualsWithConversion(gEntityArray[i].mStr.mStr), "bad entity name");
|
||||
}
|
||||
|
||||
// Make sure we don't find things that aren't there
|
||||
value = nsHTMLEntities::EntityToUnicode(nsAutoString("@"));
|
||||
value = nsHTMLEntities::EntityToUnicode(NS_ConvertToString("@"));
|
||||
NS_ASSERTION(value == -1, "found @");
|
||||
value = nsHTMLEntities::EntityToUnicode(nsCAutoString("zzzzz"));
|
||||
NS_ASSERTION(value == -1, "found zzzzz");
|
||||
|
|
|
@ -107,7 +107,7 @@ NS_NewHTMLNullSink(nsIContentSink** aInstancePtrResult)
|
|||
* @param
|
||||
* @return
|
||||
*/
|
||||
nsHTMLNullSink::nsHTMLNullSink() : nsIHTMLContentSink(), mTitle("") {
|
||||
nsHTMLNullSink::nsHTMLNullSink() : nsIHTMLContentSink() {
|
||||
NS_INIT_REFCNT();
|
||||
mNodeStackPos=0;
|
||||
memset(mNodeStack,0,sizeof(mNodeStack));
|
||||
|
|
|
@ -71,7 +71,7 @@ nsresult nsHTMLToTXTSinkStream::InitEncoder(const nsString& aCharset)
|
|||
nsresult res = NS_OK;
|
||||
|
||||
// If the converter is ucs2, then do not use a converter
|
||||
if (aCharset.Equals("ucs2"))
|
||||
if (aCharset.EqualsWithConversion("ucs2"))
|
||||
{
|
||||
NS_IF_RELEASE(mUnicodeEncoder);
|
||||
return res;
|
||||
|
@ -92,7 +92,7 @@ nsresult nsHTMLToTXTSinkStream::InitEncoder(const nsString& aCharset)
|
|||
if(NS_FAILED(res))
|
||||
{
|
||||
// failed - unknown alias , fallback to ISO-8859-1
|
||||
charsetName = "ISO-8859-1";
|
||||
charsetName.AssignWithConversion("ISO-8859-1");
|
||||
}
|
||||
|
||||
nsICharsetConverterManager * ccm = nsnull;
|
||||
|
@ -178,7 +178,6 @@ nsHTMLToTXTSinkStream::nsHTMLToTXTSinkStream()
|
|||
|
||||
// Flow
|
||||
mEmptyLines=1; // The start of the document is an "empty line" in itself,
|
||||
mCurrentLine = "";
|
||||
mInWhitespace = PR_TRUE;
|
||||
mPreFormatted = PR_FALSE;
|
||||
mCacheLine = PR_FALSE;
|
||||
|
@ -368,7 +367,7 @@ nsHTMLToTXTSinkStream::GetValueOfAttribute(const nsIParserNode& aNode,
|
|||
char* aMatchKey,
|
||||
nsString& aValueRet)
|
||||
{
|
||||
nsAutoString matchKey (aMatchKey);
|
||||
nsAutoString matchKey; matchKey.AssignWithConversion(aMatchKey);
|
||||
PRInt32 count=aNode.GetAttributeCount();
|
||||
for (PRInt32 i=0;i<count;i++)
|
||||
{
|
||||
|
@ -418,7 +417,7 @@ nsHTMLToTXTSinkStream::OpenContainer(const nsIParserNode& aNode)
|
|||
printf("OpenContainer: %d ", type);
|
||||
#endif
|
||||
const nsString& name = aNode.GetText();
|
||||
if (name.Equals("document_info"))
|
||||
if (name.EqualsWithConversion("document_info"))
|
||||
{
|
||||
nsString value;
|
||||
if (NS_SUCCEEDED(GetValueOfAttribute(aNode, "charset", value)))
|
||||
|
@ -541,9 +540,9 @@ nsHTMLToTXTSinkStream::OpenContainer(const nsIParserNode& aNode)
|
|||
{
|
||||
if (mOLStackIndex > 0)
|
||||
// This is what nsBulletFrame does for OLs:
|
||||
mInIndentString.Append(mOLStack[mOLStackIndex-1]++, 10);
|
||||
mInIndentString.AppendWithConversion(mOLStack[mOLStackIndex-1]++, 10);
|
||||
else
|
||||
mInIndentString.Append("#");
|
||||
mInIndentString.AppendWithConversion("#");
|
||||
|
||||
mInIndentString.Append('.');
|
||||
|
||||
|
@ -565,7 +564,7 @@ nsHTMLToTXTSinkStream::OpenContainer(const nsIParserNode& aNode)
|
|||
// when a mail is sent.
|
||||
nsString value;
|
||||
if (NS_SUCCEEDED(GetValueOfAttribute(aNode, "type", value))
|
||||
&& value.StripChars("\"").Equals("cite", PR_TRUE))
|
||||
&& value.StripChars("\"").EqualsWithConversion("cite", PR_TRUE))
|
||||
mCiteQuoteLevel++;
|
||||
else
|
||||
mIndent += gTabSize; // Check for some maximum value?
|
||||
|
@ -586,30 +585,30 @@ nsHTMLToTXTSinkStream::OpenContainer(const nsIParserNode& aNode)
|
|||
if (NS_SUCCEEDED(GetValueOfAttribute(aNode, "alt", desc))
|
||||
&& !desc.IsEmpty())
|
||||
{
|
||||
temp += " (";
|
||||
temp.AppendWithConversion(" (");
|
||||
temp += desc.StripChars("\"");
|
||||
temp += " <";
|
||||
temp.AppendWithConversion(" <");
|
||||
temp += url.StripChars("\"");
|
||||
temp += ">) ";
|
||||
temp.AppendWithConversion(">) ");
|
||||
}
|
||||
else
|
||||
{
|
||||
temp += " <";
|
||||
temp.AppendWithConversion(" <");
|
||||
temp += url.StripChars("\"");
|
||||
temp += "> ";
|
||||
temp.AppendWithConversion("> ");
|
||||
}
|
||||
Write(temp);
|
||||
}
|
||||
}
|
||||
else if (type == eHTMLTag_sup)
|
||||
Write("^");
|
||||
Write( NS_ConvertToString("^") );
|
||||
// I don't know a plain text representation of sub
|
||||
else if (type == eHTMLTag_strong || type == eHTMLTag_b)
|
||||
Write("*");
|
||||
Write( NS_ConvertToString("*") );
|
||||
else if (type == eHTMLTag_em || type == eHTMLTag_i)
|
||||
Write("/");
|
||||
Write( NS_ConvertToString("/") );
|
||||
else if (type == eHTMLTag_u)
|
||||
Write("_");
|
||||
Write( NS_ConvertToString("_") );
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -667,9 +666,9 @@ nsHTMLToTXTSinkStream::CloseContainer(const nsIParserNode& aNode)
|
|||
if(!mInWhitespace) {
|
||||
// Maybe add something else? Several spaces? A TAB? SPACE+TAB?
|
||||
if(mCacheLine) {
|
||||
AddToLine(nsAutoString(" ").GetUnicode(), 1);
|
||||
AddToLine(NS_ConvertToString(" ").GetUnicode(), 1);
|
||||
} else {
|
||||
nsAutoString space(" ");
|
||||
nsAutoString space; space.AssignWithConversion(" ");
|
||||
WriteSimple(space);
|
||||
}
|
||||
mInWhitespace = PR_TRUE;
|
||||
|
@ -703,21 +702,21 @@ nsHTMLToTXTSinkStream::CloseContainer(const nsIParserNode& aNode)
|
|||
{ // these brackets must stay here
|
||||
if (!mURL.IsEmpty())
|
||||
{
|
||||
nsAutoString temp(" <");
|
||||
nsAutoString temp; temp.AssignWithConversion(" <");
|
||||
temp += mURL;
|
||||
temp += ">";
|
||||
temp.AppendWithConversion(">");
|
||||
Write(temp);
|
||||
mURL.Truncate();
|
||||
}
|
||||
}
|
||||
else if (type == eHTMLTag_sup)
|
||||
Write(" ");
|
||||
Write( NS_ConvertToString(" ") );
|
||||
else if (type == eHTMLTag_strong || type == eHTMLTag_b)
|
||||
Write("*");
|
||||
Write( NS_ConvertToString("*") );
|
||||
else if (type == eHTMLTag_em || type == eHTMLTag_i)
|
||||
Write("/");
|
||||
Write( NS_ConvertToString("/") );
|
||||
else if (type == eHTMLTag_u)
|
||||
Write("_");
|
||||
Write( NS_ConvertToString("_") );
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -793,7 +792,7 @@ nsHTMLToTXTSinkStream::AddLeaf(const nsIParserNode& aNode)
|
|||
{
|
||||
Write(text); // XXX: spacestuffing (maybe call AddToLine if mCacheLine==true)
|
||||
} else if(!mInWhitespace) {
|
||||
Write(" ");
|
||||
Write( NS_ConvertToString(" ") );
|
||||
mInWhitespace = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -920,7 +919,7 @@ void nsHTMLToTXTSinkStream::WriteSimple(nsString& aString)
|
|||
}
|
||||
if (mString != nsnull)
|
||||
{
|
||||
mString->Append(mBuffer);
|
||||
mString->AppendWithConversion(mBuffer);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -984,7 +983,7 @@ nsHTMLToTXTSinkStream::AddToLine(const PRUnichar * aLineFragment, PRInt32 aLineF
|
|||
goodSpace--;
|
||||
}
|
||||
|
||||
nsAutoString restOfLine = "";
|
||||
nsAutoString restOfLine;
|
||||
if(goodSpace<0) {
|
||||
// If we don't found a good place to break, accept long line and
|
||||
// try to find another place to break
|
||||
|
@ -1005,7 +1004,7 @@ nsHTMLToTXTSinkStream::AddToLine(const PRUnichar * aLineFragment, PRInt32 aLineF
|
|||
if(mFlags & nsIDocumentEncoder::OutputFormatFlowed) {
|
||||
if((restOfLine[0] == '>') ||
|
||||
(restOfLine[0] == ' ') ||
|
||||
(!restOfLine.Compare("From ",PR_FALSE,5))) {
|
||||
(!restOfLine.CompareWithConversion("From ",PR_FALSE,5))) {
|
||||
// Space stuffing a la RFC 2646 if this will be used in a mail,
|
||||
// but how can I know that??? Now space stuffing is done always
|
||||
// when formatting text as HTML and that is wrong! XXX: Fix this!
|
||||
|
@ -1042,7 +1041,7 @@ nsHTMLToTXTSinkStream::EndLine(PRBool softlinebreak)
|
|||
// Add the soft part of the soft linebreak (RFC 2646 4.1)
|
||||
mCurrentLine.Append(' ');
|
||||
}
|
||||
mCurrentLine.Append(NS_LINEBREAK);
|
||||
mCurrentLine.AppendWithConversion(NS_LINEBREAK);
|
||||
WriteSimple(mCurrentLine);
|
||||
mCurrentLine.Truncate();
|
||||
mColPos=0;
|
||||
|
@ -1059,7 +1058,7 @@ nsHTMLToTXTSinkStream::EndLine(PRBool softlinebreak)
|
|||
// Remove SPACE from the end of the line.
|
||||
while(' ' == mCurrentLine[mCurrentLine.Length()-1])
|
||||
mCurrentLine.SetLength(mCurrentLine.Length()-1);
|
||||
mCurrentLine.Append(NS_LINEBREAK);
|
||||
mCurrentLine.AppendWithConversion(NS_LINEBREAK);
|
||||
WriteSimple(mCurrentLine);
|
||||
mCurrentLine.Truncate();
|
||||
mColPos=0;
|
||||
|
@ -1250,7 +1249,7 @@ nsHTMLToTXTSinkStream::Write(const nsString& aString)
|
|||
if(mFlags & nsIDocumentEncoder::OutputPreformatted) {
|
||||
bol = nextpos;
|
||||
} else {
|
||||
tempstr.Append(" ");
|
||||
tempstr.AppendWithConversion(" ");
|
||||
bol = nextpos + 1;
|
||||
mInWhitespace = PR_TRUE;
|
||||
}
|
||||
|
@ -1268,7 +1267,7 @@ nsHTMLToTXTSinkStream::Write(const nsString& aString)
|
|||
} else {
|
||||
// Replace the whitespace with a space
|
||||
AddToLine(offsetIntoBuffer, nextpos-bol);
|
||||
AddToLine(nsAutoString(" ").GetUnicode(),1);
|
||||
AddToLine(NS_ConvertToString(" ").GetUnicode(),1);
|
||||
bol = nextpos + 1; // Let's eat the whitespace
|
||||
}
|
||||
}
|
||||
|
|
|
@ -243,7 +243,7 @@ NS_New_HTMLToTXT_SinkStream(nsIHTMLContentSink** aInstancePtrResult,
|
|||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
it->SetWrapColumn(aWrapColumn);
|
||||
nsAutoString ucs2("ucs2");
|
||||
nsAutoString ucs2; ucs2.AssignWithConversion("ucs2");
|
||||
it->SetCharsetOverride(&ucs2);
|
||||
rv = it->QueryInterface(NS_GET_IID(nsIHTMLContentSink),
|
||||
(void**)aInstancePtrResult);
|
||||
|
|
|
@ -386,7 +386,7 @@ nsresult nsHTMLTokenizer::ConsumeTag(PRUnichar aChar,CToken*& aToken,nsScanner&
|
|||
// We are not dealing with a tag. So, put back the char
|
||||
// and leave the decision to ConsumeText().
|
||||
aScanner.PutBack(aChar);
|
||||
nsAutoString temp("<");
|
||||
nsAutoString temp; temp.AssignWithConversion("<");
|
||||
result=ConsumeText(temp,aToken,aScanner);
|
||||
}
|
||||
} //switch
|
||||
|
@ -548,7 +548,7 @@ nsresult nsHTMLTokenizer::ConsumeStartTag(PRUnichar aChar,CToken*& aToken,nsScan
|
|||
|
||||
if((eHTMLTag_style==theTag) || (eHTMLTag_script==theTag)) {
|
||||
nsAutoString endTag(nsHTMLTags::GetStringValue(theTag));
|
||||
endTag.Insert("</",0,2);
|
||||
endTag.InsertWithConversion("</",0,2);
|
||||
CToken* textToken=theRecycler->CreateTokenOfType(eToken_text,theTag);
|
||||
result=((CTextToken*)textToken)->ConsumeUntil(0,PR_FALSE,aScanner,endTag,mParseMode,aFlushTokens); //tell new token to finish consuming text...
|
||||
//endTag.Append(">");
|
||||
|
@ -623,7 +623,7 @@ nsresult nsHTMLTokenizer::ConsumeEntity(PRUnichar aChar,CToken*& aToken,nsScanne
|
|||
}
|
||||
else {
|
||||
//oops, we're actually looking at plain text...
|
||||
nsAutoString temp("&");
|
||||
nsAutoString temp; temp.AssignWithConversion("&");
|
||||
aScanner.PutBack(theChar);
|
||||
return ConsumeText(temp,aToken,aScanner);
|
||||
}//if
|
||||
|
@ -632,7 +632,7 @@ nsresult nsHTMLTokenizer::ConsumeEntity(PRUnichar aChar,CToken*& aToken,nsScanne
|
|||
if((kHashsign!=theChar) && (-1==nsHTMLEntities::EntityToUnicode(theStr))){
|
||||
//if you're here we have a bogus entity.
|
||||
//convert it into a text token.
|
||||
nsAutoString temp("&");
|
||||
nsAutoString temp; temp.AssignWithConversion("&");
|
||||
temp.Append(theStr);
|
||||
CToken* theToken=theRecycler->CreateTokenOfType(eToken_text,eHTMLTag_text,temp);
|
||||
theRecycler->RecycleToken(aToken);
|
||||
|
|
|
@ -72,7 +72,7 @@ CHTMLToken::CHTMLToken(eHTMLTags aTag) : CToken(aTag) {
|
|||
*/
|
||||
void CHTMLToken::SetStringValue(const char* name){
|
||||
if(name) {
|
||||
mTextValue=name;
|
||||
mTextValue.AssignWithConversion(name);
|
||||
mTypeID = nsHTMLTags::LookupTag(mTextValue);
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ nsString& CHTMLToken::GetStringValueXXX(void) {
|
|||
|
||||
if((eHTMLTag_unknown<mTypeID) && (mTypeID<eHTMLTag_text)) {
|
||||
if(!mTextValue.Length()) {
|
||||
mTextValue = nsHTMLTags::GetStringValue((nsHTMLTag) mTypeID);
|
||||
mTextValue.AssignWithConversion(nsHTMLTags::GetStringValue((nsHTMLTag) mTypeID));
|
||||
}
|
||||
}
|
||||
return mTextValue;
|
||||
|
@ -248,7 +248,7 @@ nsresult CStartToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode
|
|||
}
|
||||
}
|
||||
else {
|
||||
mTextValue=aChar;
|
||||
mTextValue.AssignWithConversion(aChar);
|
||||
result=aScanner.ReadIdentifier(mTextValue);
|
||||
mTypeID = nsHTMLTags::LookupTag(mTextValue);
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ void CStartToken::DebugDumpSource(nsOutputStream& out) {
|
|||
* @return nada
|
||||
*/
|
||||
void CStartToken::GetSource(nsString& anOutputString){
|
||||
anOutputString="<";
|
||||
anOutputString.AssignWithConversion("<");
|
||||
/*
|
||||
* mTextValue used to contain the name of the tag.
|
||||
* But for the sake of performance we now rely on the tagID
|
||||
|
@ -302,7 +302,7 @@ void CStartToken::GetSource(nsString& anOutputString){
|
|||
* @return nada
|
||||
*/
|
||||
void CStartToken::AppendSource(nsString& anOutputString){
|
||||
anOutputString+="<";
|
||||
anOutputString.AppendWithConversion("<");
|
||||
/*
|
||||
* mTextValue used to contain the name of the tag.
|
||||
* But for the sake of performance we now rely on the tagID
|
||||
|
@ -352,7 +352,7 @@ nsresult CEndToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode)
|
|||
//Stop consuming as soon as you see a space or a '>'.
|
||||
//NOTE: We don't Consume the tag attributes here, nor do we eat the ">"
|
||||
|
||||
mTextValue="";
|
||||
mTextValue.SetLength(0);
|
||||
nsresult result=aScanner.ReadUntil(mTextValue,kGreaterThan,PR_FALSE);
|
||||
|
||||
if(NS_OK==result){
|
||||
|
@ -432,9 +432,9 @@ void CEndToken::DebugDumpSource(nsOutputStream& out) {
|
|||
* @return nada
|
||||
*/
|
||||
void CEndToken::GetSource(nsString& anOutputString){
|
||||
anOutputString="</";
|
||||
anOutputString.AssignWithConversion("</");
|
||||
anOutputString+=mTextValue;
|
||||
anOutputString+=">";
|
||||
anOutputString.AppendWithConversion(">");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -445,9 +445,9 @@ void CEndToken::GetSource(nsString& anOutputString){
|
|||
* @return nada
|
||||
*/
|
||||
void CEndToken::AppendSource(nsString& anOutputString){
|
||||
anOutputString+="</";
|
||||
anOutputString.AppendWithConversion("</");
|
||||
anOutputString+=mTextValue;
|
||||
anOutputString+=">";
|
||||
anOutputString.AppendWithConversion(">");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -503,7 +503,7 @@ PRInt32 CTextToken::GetTokenType(void) {
|
|||
* @return error result
|
||||
*/
|
||||
nsresult CTextToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode) {;
|
||||
static nsString theTerminals("\n\r&<",4);
|
||||
static nsString theTerminals = NS_ConvertToString("\n\r&<",4);
|
||||
nsresult result=NS_OK;
|
||||
PRBool done=PR_FALSE;
|
||||
|
||||
|
@ -528,23 +528,23 @@ nsresult CTextToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode)
|
|||
if(kLF==theNextChar) {
|
||||
result=aScanner.GetChar(theNextChar);
|
||||
}
|
||||
mTextValue.Append("\n");
|
||||
mTextValue.AppendWithConversion("\n");
|
||||
mNewlineCount++;
|
||||
}
|
||||
mTextValue.Append("\n");
|
||||
mTextValue.AppendWithConversion("\n");
|
||||
mNewlineCount++;
|
||||
break;
|
||||
case kLF:
|
||||
if((kLF==theNextChar) || (kCR==theNextChar)) {
|
||||
result=aScanner.GetChar(theNextChar);
|
||||
mTextValue.Append("\n");
|
||||
mTextValue.AppendWithConversion("\n");
|
||||
mNewlineCount++;
|
||||
}
|
||||
mTextValue.Append("\n");
|
||||
mTextValue.AppendWithConversion("\n");
|
||||
mNewlineCount++;
|
||||
break;
|
||||
default:
|
||||
mTextValue.Append("\n");
|
||||
mTextValue.AppendWithConversion("\n");
|
||||
mNewlineCount++;
|
||||
break;
|
||||
} //switch
|
||||
|
@ -732,14 +732,14 @@ nsresult CCDATASectionToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt3
|
|||
switch(aChar) {
|
||||
case kCR:
|
||||
result=aScanner.GetChar(aChar); //strip off the \r
|
||||
mTextValue.Append("\n\n");
|
||||
mTextValue.AppendWithConversion("\n\n");
|
||||
break;
|
||||
case kNewLine:
|
||||
//which means we saw \r\n, which becomes \n
|
||||
result=aScanner.GetChar(aChar); //strip off the \n
|
||||
//now fall through on purpose...
|
||||
default:
|
||||
mTextValue.Append("\n");
|
||||
mTextValue.AppendWithConversion("\n");
|
||||
break;
|
||||
} //switch
|
||||
} //if
|
||||
|
@ -809,7 +809,7 @@ nsresult ConsumeStrictComment(PRUnichar aChar, nsScanner& aScanner,nsString& aSt
|
|||
<!-- xx -- xx -->
|
||||
*********************************************************/
|
||||
|
||||
aString="<!";
|
||||
aString.AssignWithConversion("<!");
|
||||
while(NS_OK==result) {
|
||||
result=aScanner.GetChar(aChar);
|
||||
if(NS_OK==result) {
|
||||
|
@ -822,7 +822,7 @@ nsresult ConsumeStrictComment(PRUnichar aChar, nsScanner& aScanner,nsString& aSt
|
|||
aString+=aChar;
|
||||
if(NS_OK==result) {
|
||||
PRInt32 findpos=-1;
|
||||
nsAutoString temp("");
|
||||
nsAutoString temp;
|
||||
//Read to the first ending sequence '--'
|
||||
while((kNotFound==findpos) && (NS_OK==result)) {
|
||||
result=aScanner.ReadUntil(temp,kMinus,PR_TRUE);
|
||||
|
@ -831,7 +831,7 @@ nsresult ConsumeStrictComment(PRUnichar aChar, nsScanner& aScanner,nsString& aSt
|
|||
aString+=temp;
|
||||
if(NS_OK==result) {
|
||||
if(NS_OK==result) {
|
||||
temp="->";
|
||||
temp.AssignWithConversion("->");
|
||||
result=aScanner.ReadUntil(aString,temp,PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
@ -1043,8 +1043,10 @@ PRInt32 CNewlineToken::GetTokenType(void) {
|
|||
*/
|
||||
nsString& CNewlineToken::GetStringValueXXX(void) {
|
||||
static nsString* theStr=0;
|
||||
if(!theStr)
|
||||
theStr=new nsString("\n");
|
||||
if(!theStr) {
|
||||
theStr=new nsString;
|
||||
theStr->AssignWithConversion("\n");
|
||||
}
|
||||
return *theStr;
|
||||
}
|
||||
|
||||
|
@ -1059,7 +1061,7 @@ nsString& CNewlineToken::GetStringValueXXX(void) {
|
|||
nsresult CNewlineToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode) {
|
||||
|
||||
#if 1
|
||||
mTextValue=kNewLine; //This is what I THINK we should be doing.
|
||||
mTextValue.AssignWithConversion(kNewLine); //This is what I THINK we should be doing.
|
||||
#else
|
||||
mTextValue=aChar;
|
||||
#endif
|
||||
|
@ -1216,9 +1218,9 @@ void CAttributeToken::DebugDumpToken(nsOutputStream& out) {
|
|||
*/
|
||||
void CAttributeToken::GetSource(nsString& anOutputString){
|
||||
anOutputString=mTextKey;
|
||||
anOutputString+="=";
|
||||
anOutputString.AppendWithConversion("=");
|
||||
anOutputString+=mTextValue;
|
||||
anOutputString+=";";
|
||||
anOutputString.AppendWithConversion(";");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1230,9 +1232,9 @@ void CAttributeToken::GetSource(nsString& anOutputString){
|
|||
*/
|
||||
void CAttributeToken::AppendSource(nsString& anOutputString){
|
||||
anOutputString+=mTextKey;
|
||||
anOutputString+="=";
|
||||
anOutputString.AppendWithConversion("=");
|
||||
anOutputString+=mTextValue;
|
||||
anOutputString+=";";
|
||||
anOutputString.AppendWithConversion(";");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1277,7 +1279,7 @@ nsresult ConsumeQuotedString(PRUnichar aChar,nsString& aString,nsScanner& aScann
|
|||
*/
|
||||
static
|
||||
nsresult ConsumeAttributeValueText(PRUnichar,nsString& aString,nsScanner& aScanner){
|
||||
static nsString theTerminals("\b\t\n\r >",6);
|
||||
static nsString theTerminals = NS_ConvertToString("\b\t\n\r >",6);
|
||||
nsresult result=aScanner.ReadUntil(aString,theTerminals,PR_FALSE);
|
||||
|
||||
//Let's force quotes if either the first or last char is quoted.
|
||||
|
@ -1333,7 +1335,7 @@ nsresult CAttributeToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 a
|
|||
}
|
||||
else {
|
||||
//If you're here, handle an unquoted key.
|
||||
static nsString theTerminals("\b\t\n\r \"<=>",9);
|
||||
static nsString theTerminals = NS_ConvertToString("\b\t\n\r \"<=>",9);
|
||||
result=aScanner.ReadUntil(mTextKey,theTerminals,PR_FALSE);
|
||||
}
|
||||
|
||||
|
@ -1475,7 +1477,7 @@ PRInt32 CWhitespaceToken::GetTokenType(void) {
|
|||
* @return error result
|
||||
*/
|
||||
nsresult CWhitespaceToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode) {
|
||||
mTextValue=aChar;
|
||||
mTextValue.AssignWithConversion(aChar);
|
||||
nsresult result=aScanner.ReadWhitespace(mTextValue);
|
||||
if(NS_OK==result) {
|
||||
mTextValue.StripChar(kCR);
|
||||
|
@ -1520,7 +1522,7 @@ CEntityToken::CEntityToken(const nsString& aName) : CHTMLToken(aName) {
|
|||
*/
|
||||
nsresult CEntityToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode) {
|
||||
if(aChar)
|
||||
mTextValue=aChar;
|
||||
mTextValue.AssignWithConversion(aChar);
|
||||
nsresult result=ConsumeEntity(aChar,mTextValue,aScanner);
|
||||
return result;
|
||||
}
|
||||
|
@ -1686,7 +1688,7 @@ PRInt32 CEntityToken::TranslateToUnicodeStr(nsString& aString) {
|
|||
value = nsHTMLEntities::EntityToUnicode(mTextValue);
|
||||
if(-1<value) {
|
||||
//we found a named entity...
|
||||
aString=PRUnichar(value);
|
||||
aString.AssignWithConversion(PRUnichar(value));
|
||||
}
|
||||
}//else
|
||||
}//if
|
||||
|
@ -1715,7 +1717,7 @@ void CEntityToken::DebugDumpSource(nsOutputStream& out) {
|
|||
* @return nada
|
||||
*/
|
||||
void CEntityToken::GetSource(nsString& anOutputString){
|
||||
anOutputString="&";
|
||||
anOutputString.AssignWithConversion("&");
|
||||
anOutputString+=mTextValue;
|
||||
//anOutputString+=";";
|
||||
}
|
||||
|
@ -1728,7 +1730,7 @@ void CEntityToken::GetSource(nsString& anOutputString){
|
|||
* @return nada
|
||||
*/
|
||||
void CEntityToken::AppendSource(nsString& anOutputString){
|
||||
anOutputString+="&";
|
||||
anOutputString.AppendWithConversion("&");
|
||||
anOutputString+=mTextValue;
|
||||
//anOutputString+=";";
|
||||
}
|
||||
|
@ -1806,7 +1808,7 @@ PRInt32 CStyleToken::GetTokenType(void) {
|
|||
* @return
|
||||
*/
|
||||
CSkippedContentToken::CSkippedContentToken(const nsString& aName) : CAttributeToken(aName) {
|
||||
mTextKey = "$skipped-content";/* XXX need a better answer! */
|
||||
mTextKey.AssignWithConversion("$skipped-content");/* XXX need a better answer! */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1885,7 +1887,7 @@ nsresult CSkippedContentToken::Consume(PRUnichar aChar,nsScanner& aScanner,PRInt
|
|||
}
|
||||
nsAutoString theRight;
|
||||
temp.Right(theRight,mTextValue.Length());
|
||||
done=PRBool(0==theRight.Compare(mTextValue,PR_TRUE));
|
||||
done=PRBool(0==theRight.CompareWithConversion(mTextValue,PR_TRUE));
|
||||
}
|
||||
int len=temp.Length();
|
||||
temp.Truncate(len-mTextValue.Length());
|
||||
|
@ -1916,7 +1918,7 @@ void CSkippedContentToken::DebugDumpSource(nsOutputStream& out) {
|
|||
* @return nada
|
||||
*/
|
||||
void CSkippedContentToken::GetSource(nsString& anOutputString){
|
||||
anOutputString="$skipped-content";
|
||||
anOutputString.AssignWithConversion("$skipped-content");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1927,7 +1929,7 @@ void CSkippedContentToken::GetSource(nsString& anOutputString){
|
|||
* @return nada
|
||||
*/
|
||||
void CSkippedContentToken::AppendSource(nsString& anOutputString){
|
||||
anOutputString+="$skipped-content";
|
||||
anOutputString.AppendWithConversion("$skipped-content");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1975,7 +1977,7 @@ CInstructionToken::CInstructionToken(const nsString& aString) : CHTMLToken(aStri
|
|||
* @return
|
||||
*/
|
||||
nsresult CInstructionToken::Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode){
|
||||
mTextValue="<?";
|
||||
mTextValue.AssignWithConversion("<?");
|
||||
nsresult result=aScanner.ReadUntil(mTextValue,kGreaterThan,PR_TRUE);
|
||||
return result;
|
||||
}
|
||||
|
@ -2045,7 +2047,7 @@ CDoctypeDeclToken::CDoctypeDeclToken(eHTMLTags aTag) : CHTMLToken(aTag) {
|
|||
*/
|
||||
nsresult CDoctypeDeclToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode) {
|
||||
|
||||
mTextValue="<!";
|
||||
mTextValue.AssignWithConversion("<!");
|
||||
|
||||
nsresult result=aScanner.ReadUntil(mTextValue,'<',PR_FALSE);
|
||||
return result;
|
||||
|
|
|
@ -79,15 +79,15 @@ NS_IMETHODIMP RobotSinkObserver::ProcessLink(const nsString& aURLSpec)
|
|||
// Geez this is ugly. temporary hack to only process html files
|
||||
str.Truncate();
|
||||
nsString(aURLSpec).Right(str,1);
|
||||
if (!str.Equals("/"))
|
||||
if (!str.EqualsWithConversion("/"))
|
||||
{
|
||||
str.Truncate();
|
||||
nsString(aURLSpec).Right(str,4);
|
||||
if (!str.Equals("html"))
|
||||
if (!str.EqualsWithConversion("html"))
|
||||
{
|
||||
str.Truncate();
|
||||
nsString(aURLSpec).Right(str,3);
|
||||
if (!str.Equals("htm"))
|
||||
if (!str.EqualsWithConversion("htm"))
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ NS_IMETHODIMP RobotSinkObserver::ProcessLink(const nsString& aURLSpec)
|
|||
g_duplicateList->AppendElement(new nsString(aURLSpec));
|
||||
str.Truncate();
|
||||
nsString(aURLSpec).Left(str,5);
|
||||
if (str.Equals("http:")) {
|
||||
if (str.EqualsWithConversion("http:")) {
|
||||
g_iProcessed++;
|
||||
if (g_iProcessed == (g_iMaxProcess > 0 ? g_iMaxProcess-1 : 0))
|
||||
g_bHitTop = PR_TRUE;
|
||||
|
@ -328,7 +328,7 @@ extern "C" NS_EXPORT int DebugRobot(
|
|||
}
|
||||
char* spec;
|
||||
(void)url->GetSpec(&spec);
|
||||
nsAutoString theSpec(spec);
|
||||
nsAutoString theSpec; theSpec.AssignWithConversion(spec);
|
||||
nsCRT::free(spec);
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(docShell));
|
||||
webNav->LoadURI(theSpec.GetUnicode());/* XXX hook up stream listener here! */
|
||||
|
|
|
@ -219,7 +219,7 @@ NS_IMETHODIMP RobotSink::OpenContainer(const nsIParserNode& aNode)
|
|||
{
|
||||
nsAutoString tmp(aNode.GetText());
|
||||
tmp.ToLowerCase();
|
||||
if (tmp.Equals("a")) {
|
||||
if (tmp.EqualsWithConversion("a")) {
|
||||
nsAutoString k, v;
|
||||
PRInt32 ac = aNode.GetAttributeCount();
|
||||
for (PRInt32 i = 0; i < ac; i++) {
|
||||
|
@ -228,7 +228,7 @@ NS_IMETHODIMP RobotSink::OpenContainer(const nsIParserNode& aNode)
|
|||
k.Truncate();
|
||||
k.Append(key);
|
||||
k.ToLowerCase();
|
||||
if (k.Equals("href")) {
|
||||
if (k.EqualsWithConversion("href")) {
|
||||
// Get value and remove mandatory quotes
|
||||
v.Truncate();
|
||||
v.Append(aNode.GetValueAt(i));
|
||||
|
@ -363,7 +363,7 @@ void RobotSink::ProcessLink(const nsString& aLink)
|
|||
absURLSpec.Truncate();
|
||||
char* str;
|
||||
absurl->GetSpec(&str);
|
||||
absURLSpec = str;
|
||||
absURLSpec.AssignWithConversion(str);
|
||||
nsCRT::free(str);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,9 +134,7 @@ NS_IMPL_RELEASE(CNavDTD)
|
|||
CNavDTD::CNavDTD() : nsIDTD(),
|
||||
mMisplacedContent(0),
|
||||
mSkippedContent(0),
|
||||
mSharedNodes(0),
|
||||
mScratch(""),
|
||||
mMimeType("") {
|
||||
mSharedNodes(0) {
|
||||
NS_INIT_REFCNT();
|
||||
mSink = 0;
|
||||
mParser=0;
|
||||
|
@ -373,18 +371,18 @@ eAutoDetectResult CNavDTD::CanParse(CParserContext& aParserContext,nsString& aBu
|
|||
|
||||
|
||||
if(eViewSource==aParserContext.mParserCommand) {
|
||||
if(PR_TRUE==aParserContext.mMimeType.Equals(kPlainTextContentType)) {
|
||||
if(PR_TRUE==aParserContext.mMimeType.EqualsWithConversion(kPlainTextContentType)) {
|
||||
result=ePrimaryDetect;
|
||||
}
|
||||
else if(aParserContext.mMimeType.Equals(kRTFTextContentType)){
|
||||
else if(aParserContext.mMimeType.EqualsWithConversion(kRTFTextContentType)){
|
||||
result=ePrimaryDetect;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(PR_TRUE==aParserContext.mMimeType.Equals(kHTMLTextContentType)) {
|
||||
if(PR_TRUE==aParserContext.mMimeType.EqualsWithConversion(kHTMLTextContentType)) {
|
||||
result=ePrimaryDetect;
|
||||
}
|
||||
else if(PR_TRUE==aParserContext.mMimeType.Equals(kPlainTextContentType)) {
|
||||
else if(PR_TRUE==aParserContext.mMimeType.EqualsWithConversion(kPlainTextContentType)) {
|
||||
result=ePrimaryDetect;
|
||||
}
|
||||
else {
|
||||
|
@ -393,7 +391,7 @@ eAutoDetectResult CNavDTD::CanParse(CParserContext& aParserContext,nsString& aBu
|
|||
if(BufferContainsHTML(aBuffer,theBufHasXML)){
|
||||
result = eValidDetect ;
|
||||
if(0==aParserContext.mMimeType.Length()) {
|
||||
aParserContext.SetMimeType(kHTMLTextContentType);
|
||||
aParserContext.SetMimeType(NS_ConvertToString(kHTMLTextContentType));
|
||||
result = (theBufHasXML) ? eValidDetect : ePrimaryDetect;
|
||||
}
|
||||
}
|
||||
|
@ -482,7 +480,7 @@ nsresult CNavDTD::BuildModel(nsIParser* aParser,nsITokenizer* aTokenizer,nsIToke
|
|||
|
||||
if(!mBodyContext->GetCount()) {
|
||||
//if the content model is empty, then begin by opening <html>...
|
||||
CStartToken *theToken=(CStartToken*)mTokenRecycler->CreateTokenOfType(eToken_start,eHTMLTag_html,"html");
|
||||
CStartToken *theToken=(CStartToken*)mTokenRecycler->CreateTokenOfType(eToken_start,eHTMLTag_html,NS_ConvertToString("html"));
|
||||
HandleStartToken(theToken); //this token should get pushed on the context stack, don't recycle it.
|
||||
|
||||
if(ePlainText==mDocType) {
|
||||
|
@ -540,7 +538,7 @@ nsresult CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParse
|
|||
|
||||
mSkipTarget=eHTMLTag_unknown; //clear this in case we were searching earlier.
|
||||
|
||||
CStartToken *theToken=(CStartToken*)mTokenRecycler->CreateTokenOfType(eToken_start,eHTMLTag_body,"body");
|
||||
CStartToken *theToken=(CStartToken*)mTokenRecycler->CreateTokenOfType(eToken_start,eHTMLTag_body,NS_ConvertToString("body"));
|
||||
mTokenizer->PushTokenFront(theToken); //this token should get pushed on the context stack, don't recycle it
|
||||
result=BuildModel(aParser,mTokenizer,0,aSink);
|
||||
}
|
||||
|
@ -726,7 +724,7 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){
|
|||
mMisplacedContent.Push(aToken);
|
||||
aToken->mUseCount++;
|
||||
if(mParseMode==eParseMode_quirks && (gHTMLElements[theTag].HasSpecialProperty(kRequiresBody))) {
|
||||
CToken* theBodyToken=(CToken*)mTokenRecycler->CreateTokenOfType(eToken_start,eHTMLTag_body,"body");
|
||||
CToken* theBodyToken=(CToken*)mTokenRecycler->CreateTokenOfType(eToken_start,eHTMLTag_body,NS_ConvertToString("body"));
|
||||
result=HandleToken(theBodyToken,aParser);
|
||||
}
|
||||
return result;
|
||||
|
@ -1131,7 +1129,7 @@ nsresult CNavDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsCParserNode
|
|||
CParserContext* pc=mParser->PeekContext();
|
||||
void* theDocID=(pc)? pc->mKey:0;
|
||||
|
||||
result=theService->Notify(aTag,aNode,(PRUint32)theDocID,kHTMLTextContentType,mParser);
|
||||
result=theService->Notify(aTag,aNode,(PRUint32)theDocID, NS_ConvertToString(kHTMLTextContentType), mParser);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2129,7 +2127,7 @@ NS_IMETHODIMP CNavDTD::StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const
|
|||
}
|
||||
|
||||
NS_IMETHODIMP CNavDTD::IntTagToStringTag(PRInt32 aIntTag, nsString& aTag) const {
|
||||
aTag = nsHTMLTags::GetStringValue((nsHTMLTag)aIntTag);
|
||||
aTag.AssignWithConversion(nsHTMLTags::GetStringValue((nsHTMLTag)aIntTag));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ class CTagFinder: public nsDequeFunctor{
|
|||
|
||||
public:
|
||||
CTagFinder(){}
|
||||
void Initialize(const nsString &aTagName) {mTagName = aTagName;}
|
||||
void Initialize(const nsString &aTagName) {mTagName.Assign(aTagName);}
|
||||
|
||||
virtual ~CTagFinder() {
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ NS_IMPL_RELEASE(COtherDTD)
|
|||
* @param
|
||||
* @return
|
||||
*/
|
||||
COtherDTD::COtherDTD() : nsIDTD(), mMisplacedContent(0), mSkippedContent(0), mSharedNodes(0), mScratch("") {
|
||||
COtherDTD::COtherDTD() : nsIDTD(), mMisplacedContent(0), mSkippedContent(0), mSharedNodes(0) {
|
||||
NS_INIT_REFCNT();
|
||||
mSink = 0;
|
||||
mParser=0;
|
||||
|
@ -471,7 +471,7 @@ eAutoDetectResult COtherDTD::CanParse(CParserContext& aParserContext,nsString& a
|
|||
|
||||
|
||||
if(eViewSource!=aParserContext.mParserCommand) {
|
||||
if(PR_TRUE==(aParserContext.mMimeType.Equals(kHTMLTextContentType) || aParserContext.mMimeType.Equals(kPlainTextContentType))) {
|
||||
if(PR_TRUE==(aParserContext.mMimeType.EqualsWithConversion(kHTMLTextContentType) || aParserContext.mMimeType.EqualsWithConversion(kPlainTextContentType))) {
|
||||
result=ePrimaryDetect;
|
||||
}
|
||||
else {
|
||||
|
@ -480,7 +480,7 @@ eAutoDetectResult COtherDTD::CanParse(CParserContext& aParserContext,nsString& a
|
|||
if(BufferContainsHTML(aBuffer,theBufHasXML)){
|
||||
result = eValidDetect ;
|
||||
if(0==aParserContext.mMimeType.Length()) {
|
||||
aParserContext.SetMimeType(kHTMLTextContentType);
|
||||
aParserContext.SetMimeType( NS_ConvertToString(kHTMLTextContentType) );
|
||||
result = (theBufHasXML) ? eValidDetect : ePrimaryDetect;
|
||||
}
|
||||
}
|
||||
|
@ -569,7 +569,7 @@ nsresult COtherDTD::BuildModel(nsIParser* aParser,nsITokenizer* aTokenizer,nsITo
|
|||
|
||||
if(!mBodyContext->GetCount()) {
|
||||
//if the content model is empty, then begin by opening <html>...
|
||||
CStartToken *theToken=(CStartToken*)mTokenRecycler->CreateTokenOfType(eToken_start,eHTMLTag_html,"html");
|
||||
CStartToken *theToken=(CStartToken*)mTokenRecycler->CreateTokenOfType(eToken_start,eHTMLTag_html, NS_ConvertToString("html"));
|
||||
HandleStartToken(theToken); //this token should get pushed on the context stack, don't recycle it.
|
||||
}
|
||||
|
||||
|
@ -623,11 +623,11 @@ nsresult COtherDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIPar
|
|||
mTokenizer->PrependTokens(mMisplacedContent); //push misplaced content
|
||||
|
||||
if(ePlainText==mDocType) {
|
||||
CStartToken *theToken=(CStartToken*)mTokenRecycler->CreateTokenOfType(eToken_start,eHTMLTag_pre,"pre");
|
||||
CStartToken *theToken=(CStartToken*)mTokenRecycler->CreateTokenOfType(eToken_start,eHTMLTag_pre, NS_ConvertToString("pre"));
|
||||
mTokenizer->PushTokenFront(theToken); //this token should get pushed on the context stack, don't recycle it
|
||||
}
|
||||
|
||||
CStartToken *theToken=(CStartToken*)mTokenRecycler->CreateTokenOfType(eToken_start,eHTMLTag_body,"body");
|
||||
CStartToken *theToken=(CStartToken*)mTokenRecycler->CreateTokenOfType(eToken_start,eHTMLTag_body, NS_ConvertToString("body"));
|
||||
mTokenizer->PushTokenFront(theToken); //this token should get pushed on the context stack, don't recycle it
|
||||
|
||||
result=BuildModel(aParser,mTokenizer,0,aSink);
|
||||
|
@ -1204,7 +1204,7 @@ nsresult COtherDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsCParserNo
|
|||
CParserContext* pc=mParser->PeekContext();
|
||||
void* theDocID=(pc)? pc->mKey:0;
|
||||
|
||||
result=theService->Notify(aTag,aNode,(PRUint32)theDocID,kHTMLTextContentType,mParser);
|
||||
result=theService->Notify(aTag,aNode,(PRUint32)theDocID, NS_ConvertToString(kHTMLTextContentType), mParser);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2075,7 +2075,7 @@ nsresult COtherDTD::CollectSkippedContent(nsCParserNode& aNode,PRInt32 &aCount)
|
|||
// the parser and into the form element code
|
||||
PRBool aMustConvertLinebreaks = PR_FALSE;
|
||||
|
||||
mScratch="";
|
||||
mScratch.SetLength(0);
|
||||
aNode.SetSkippedContent(mScratch);
|
||||
|
||||
for(aIndex=0;aIndex<aMax;aIndex++){
|
||||
|
@ -2154,7 +2154,7 @@ NS_IMETHODIMP COtherDTD::StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) con
|
|||
}
|
||||
|
||||
NS_IMETHODIMP COtherDTD::IntTagToStringTag(PRInt32 aIntTag, nsString& aTag) const {
|
||||
aTag = nsHTMLTags::GetStringValue((nsHTMLTag)aIntTag);
|
||||
aTag.AssignWithConversion(nsHTMLTags::GetStringValue((nsHTMLTag)aIntTag));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,8 +40,7 @@ CParserContext::CParserContext(nsScanner* aScanner,
|
|||
nsIStreamObserver* aListener,
|
||||
nsIDTD *aDTD,
|
||||
eAutoDetectResult aStatus,
|
||||
PRBool aCopyUnused) :
|
||||
mMimeType("")
|
||||
PRBool aCopyUnused)
|
||||
{
|
||||
MOZ_COUNT_CTOR(CParserContext);
|
||||
|
||||
|
@ -126,19 +125,19 @@ CParserContext::~CParserContext(){
|
|||
* @update rickg 03.18.2000
|
||||
*/
|
||||
void CParserContext::SetMimeType(const nsString& aMimeType){
|
||||
mMimeType=aMimeType;
|
||||
mMimeType.Assign(aMimeType);
|
||||
|
||||
mDocType=ePlainText;
|
||||
|
||||
if(mMimeType.Equals(kHTMLTextContentType))
|
||||
if(mMimeType.EqualsWithConversion(kHTMLTextContentType))
|
||||
mDocType=eHTMLText;
|
||||
else if(mMimeType.Equals(kXMLTextContentType))
|
||||
else if(mMimeType.EqualsWithConversion(kXMLTextContentType))
|
||||
mDocType=eXMLText;
|
||||
else if(mMimeType.Equals(kXULTextContentType))
|
||||
else if(mMimeType.EqualsWithConversion(kXULTextContentType))
|
||||
mDocType=eXMLText;
|
||||
else if(mMimeType.Equals(kRDFTextContentType))
|
||||
else if(mMimeType.EqualsWithConversion(kRDFTextContentType))
|
||||
mDocType=eXMLText;
|
||||
else if(mMimeType.Equals(kXIFTextContentType))
|
||||
else if(mMimeType.EqualsWithConversion(kXIFTextContentType))
|
||||
mDocType=eXMLText;
|
||||
|
||||
}
|
||||
|
|
|
@ -213,7 +213,7 @@ static eRTFTags GetTagID(const nsString& aTag) {
|
|||
while(low<=high) {
|
||||
middle=(PRInt32)(low+high)/2;
|
||||
|
||||
PRInt32 cmp=aTag.Compare(gRTFTable[middle].mName);
|
||||
PRInt32 cmp=aTag.CompareWithConversion(gRTFTable[middle].mName);
|
||||
if(0==cmp)
|
||||
return gRTFTable[middle].mTagID;
|
||||
if(-1==cmp)
|
||||
|
@ -342,7 +342,7 @@ eAutoDetectResult CRtfDTD::CanParse(CParserContext& aParserContext,nsString& aBu
|
|||
eAutoDetectResult result=eUnknownDetect;
|
||||
|
||||
if(eViewSource!=aParserContext.mParserCommand) {
|
||||
if(aParserContext.mMimeType.Equals(kRTFTextContentType)) {
|
||||
if(aParserContext.mMimeType.EqualsWithConversion(kRTFTextContentType)) {
|
||||
result=ePrimaryDetect;
|
||||
}
|
||||
else if(kNotFound!=aBuffer.Find(kRTFDocHeader)) {
|
||||
|
@ -542,7 +542,7 @@ NS_IMETHODIMP CRtfDTD::StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const
|
|||
}
|
||||
|
||||
NS_IMETHODIMP CRtfDTD::IntTagToStringTag(PRInt32 aIntTag, nsString& aTag) const {
|
||||
aTag = nsHTMLTags::GetStringValue((nsHTMLTag)aIntTag);
|
||||
aTag.AssignWithConversion(nsHTMLTags::GetStringValue((nsHTMLTag)aIntTag).GetBuffer());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -593,7 +593,7 @@ nsresult CRtfDTD::AddLeafContainer(eHTMLTags aTag,const char* aTagName){
|
|||
nsresult result=NS_OK;
|
||||
|
||||
if(mSink) {
|
||||
nsAutoString theStr(aTagName);
|
||||
nsAutoString theStr; theStr.AssignWithConversion(aTagName);
|
||||
CStartToken theToken(theStr,aTag);
|
||||
nsCParserNode theNode(&theToken);
|
||||
|
||||
|
@ -617,7 +617,7 @@ nsresult CRtfDTD::OpenContainer(eHTMLTags aTag,const char* aTagName){
|
|||
nsresult result=NS_OK;
|
||||
|
||||
if(mSink) {
|
||||
nsAutoString theStr(aTagName);
|
||||
nsAutoString theStr; theStr.AssignWithConversion(aTagName);
|
||||
CStartToken theToken(theStr,aTag);
|
||||
nsCParserNode theNode(&theToken);
|
||||
|
||||
|
@ -754,7 +754,7 @@ nsresult CRtfDTD::HandleControlWord(CToken* aToken){
|
|||
break;
|
||||
case eRTFCtrl_tab:
|
||||
{
|
||||
CTextToken theToken2(" ");
|
||||
CTextToken theToken2( NS_ConvertToString(" ") );
|
||||
result=HandleContent(&theToken2);
|
||||
}
|
||||
break;
|
||||
|
@ -890,7 +890,7 @@ nsresult CRTFControlWord::Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aM
|
|||
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
if(('a'<=theChar) && (theChar<='z')) {
|
||||
nsAutoString temp(gAlphaChars);
|
||||
nsAutoString temp; temp.AssignWithConversion(gAlphaChars);
|
||||
result=aScanner.ReadWhile(mTextValue,temp,PR_FALSE);
|
||||
if(NS_OK==result) {
|
||||
//ok, now look for an option parameter...
|
||||
|
@ -903,7 +903,7 @@ nsresult CRTFControlWord::Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aM
|
|||
case '5': case '6': case '7': case '8': case '9':
|
||||
case kMinus:
|
||||
{
|
||||
nsAutoString theDigits(gDigits);
|
||||
nsAutoString theDigits; theDigits.AssignWithConversion(gDigits);
|
||||
result=aScanner.ReadWhile(mArgument,theDigits,PR_FALSE);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -649,7 +649,7 @@ nsIParserNode* nsDTDContext::RemoveStyle(eHTMLTags aTag){
|
|||
* @update gess7/25/98
|
||||
* @param
|
||||
*/
|
||||
CTokenRecycler::CTokenRecycler() : nsITokenRecycler(),mEmpty("") {
|
||||
CTokenRecycler::CTokenRecycler() : nsITokenRecycler() {
|
||||
|
||||
MOZ_COUNT_CTOR(CTokenRecycler);
|
||||
|
||||
|
@ -971,8 +971,8 @@ nsresult nsObserverTopic::Notify(eHTMLTags aTag,nsIParserNode& aNode,PRUint32 aU
|
|||
theKeys[index] = aNode.GetKeyAt(index).GetUnicode();
|
||||
theValues[index] = aNode.GetValueAt(index).GetUnicode();
|
||||
}
|
||||
nsAutoString theCharsetKey("charset");
|
||||
nsAutoString theSourceKey("charsetSource");
|
||||
nsAutoString theCharsetKey; theCharsetKey.AssignWithConversion("charset");
|
||||
nsAutoString theSourceKey; theSourceKey.AssignWithConversion("charsetSource");
|
||||
nsAutoString intValue;
|
||||
|
||||
// Add pseudo attribute in the end
|
||||
|
@ -989,11 +989,11 @@ nsresult nsObserverTopic::Notify(eHTMLTags aTag,nsIParserNode& aNode,PRUint32 aU
|
|||
if(index < 50) {
|
||||
theKeys[index]=theSourceKey.GetUnicode();
|
||||
PRInt32 sourceInt = theCharsetSource;
|
||||
intValue.Append(sourceInt,10);
|
||||
intValue.AppendWithConversion(sourceInt,10);
|
||||
theValues[index] = intValue.GetUnicode();
|
||||
index++;
|
||||
}
|
||||
nsAutoString theDTDKey("X_COMMAND");
|
||||
nsAutoString theDTDKey; theDTDKey.AssignWithConversion("X_COMMAND");
|
||||
// nsAutoString theDTDValue(aCommand);
|
||||
if(index < 50) {
|
||||
theKeys[index]=theDTDKey.GetUnicode();
|
||||
|
@ -1026,10 +1026,10 @@ CObserverService::CObserverService() : mTopics(0) {
|
|||
|
||||
MOZ_COUNT_CTOR(CObserverService);
|
||||
|
||||
nsAutoString theHTMLTopic(kHTMLTextContentType);
|
||||
nsAutoString theHTMLTopic; theHTMLTopic.AssignWithConversion(kHTMLTextContentType);
|
||||
RegisterObservers(theHTMLTopic);
|
||||
|
||||
nsAutoString theXMLTopic(kXMLTextContentType); //use the mimetype for the topic
|
||||
nsAutoString theXMLTopic; theXMLTopic.AssignWithConversion(kXMLTextContentType); //use the mimetype for the topic
|
||||
RegisterObservers(theXMLTopic);
|
||||
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ NS_IMPL_RELEASE(nsExpatDTD)
|
|||
* @param
|
||||
* @return
|
||||
*/
|
||||
nsExpatDTD::nsExpatDTD() : nsIDTD(), mFilename("") {
|
||||
nsExpatDTD::nsExpatDTD() {
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
mExpatParser=0;
|
||||
|
@ -172,15 +172,15 @@ eAutoDetectResult nsExpatDTD::CanParse(CParserContext& aParserContext,nsString&
|
|||
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=eValidDetect;
|
||||
}
|
||||
else {
|
||||
if(-1<aBuffer.Find("<?xml ")) {
|
||||
if(0==aParserContext.mMimeType.Length()) {
|
||||
aParserContext.SetMimeType(kXMLTextContentType);
|
||||
aParserContext.SetMimeType( NS_ConvertToString(kXMLTextContentType) );
|
||||
}
|
||||
result=eValidDetect;
|
||||
}
|
||||
|
|
|
@ -184,7 +184,7 @@ nsExpatTokenizer::nsExpatTokenizer(nsString* aURL) : nsHTMLTokenizer() {
|
|||
mState->parser = nsnull;
|
||||
mState->tokenDeque = nsnull;
|
||||
|
||||
nsAutoString buffer("UTF-16");
|
||||
nsAutoString buffer; buffer.AssignWithConversion("UTF-16");
|
||||
const PRUnichar* encoding = buffer.GetUnicode();
|
||||
if (encoding) {
|
||||
mExpatParser = XML_ParserCreate((const XML_Char*) encoding);
|
||||
|
@ -267,7 +267,10 @@ void nsExpatTokenizer::GetLine(const char* aSourceBuffer, PRUint32 aLength,
|
|||
aLine.Truncate(0);
|
||||
if (startIndex == endIndex) {
|
||||
/* Special case if the error is on a line where the only character is a newline */
|
||||
aLine.Append("");
|
||||
// STRING USE WARNING: I have no idea what this is supposed to do; to me it looks like a no-op
|
||||
// ... so I'm not going to delete it but I will fix it to conform to the new standard.
|
||||
// aLine.Append("");
|
||||
aLine.AppendWithConversion("");
|
||||
}
|
||||
else {
|
||||
NS_ASSERTION(endIndex - startIndex >= sizeof(PRUnichar), "?");
|
||||
|
@ -291,15 +294,15 @@ void nsExpatTokenizer::GetLine(const char* aSourceBuffer, PRUint32 aLength,
|
|||
static nsresult
|
||||
CreateErrorText(const nsParserError* aError, nsString& aErrorString)
|
||||
{
|
||||
aErrorString = "XML Parsing Error: ";
|
||||
aErrorString.AssignWithConversion("XML Parsing Error: ");
|
||||
|
||||
if (aError) {
|
||||
aErrorString.Append(aError->description);
|
||||
aErrorString.Append("\nLine Number ");
|
||||
aErrorString.Append(aError->lineNumber, 10);
|
||||
aErrorString.Append(", Column ");
|
||||
aErrorString.Append(aError->colNumber, 10);
|
||||
aErrorString.Append(":");
|
||||
aErrorString.AppendWithConversion("\nLine Number ");
|
||||
aErrorString.AppendWithConversion(aError->lineNumber, 10);
|
||||
aErrorString.AppendWithConversion(", Column ");
|
||||
aErrorString.AppendWithConversion(aError->colNumber, 10);
|
||||
aErrorString.AppendWithConversion(":");
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -311,10 +314,10 @@ CreateSourceText(const nsParserError* aError, nsString& aSourceString)
|
|||
PRInt32 errorPosition = aError->colNumber;
|
||||
|
||||
aSourceString.Append(aError->sourceLine);
|
||||
aSourceString.Append("\n");
|
||||
aSourceString.AppendWithConversion("\n");
|
||||
for (int i = 0; i < errorPosition; i++)
|
||||
aSourceString.Append("-");
|
||||
aSourceString.Append("^");
|
||||
aSourceString.AppendWithConversion("-");
|
||||
aSourceString.AppendWithConversion("^");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -337,7 +340,7 @@ nsExpatTokenizer::AddErrorMessageTokens(nsParserError* aError)
|
|||
CAttributeToken* attrToken = (CAttributeToken*)
|
||||
mState->tokenRecycler->CreateTokenOfType(eToken_attribute, eHTMLTag_unknown);
|
||||
nsString& key = attrToken->GetKey();
|
||||
key.Assign("xmlns");
|
||||
key.AssignWithConversion("xmlns");
|
||||
attrToken->SetStringValue(kHTMLNameSpaceURI);
|
||||
newToken->SetAttributeCount(1);
|
||||
newToken = (CToken*) attrToken;
|
||||
|
@ -396,7 +399,7 @@ nsExpatTokenizer::PushXMLErrorTokens(const char *aBuffer, PRUint32 aLength, PRBo
|
|||
error->code = XML_GetErrorCode(mExpatParser);
|
||||
error->lineNumber = XML_GetCurrentLineNumber(mExpatParser);
|
||||
error->colNumber = XML_GetCurrentColumnNumber(mExpatParser);
|
||||
error->description = XML_ErrorString(error->code);
|
||||
error->description.AssignWithConversion(XML_ErrorString(error->code));
|
||||
if (!aIsFinal) {
|
||||
PRInt32 byteIndexRelativeToFile = 0;
|
||||
byteIndexRelativeToFile = XML_GetCurrentByteIndex(mExpatParser);
|
||||
|
@ -617,13 +620,13 @@ void nsExpatTokenizer::HandleProcessingInstruction(void *userData,
|
|||
CToken* theToken = state->tokenRecycler->CreateTokenOfType(eToken_instruction,eHTMLTag_unknown);
|
||||
if(theToken) {
|
||||
nsString& theString=theToken->GetStringValueXXX();
|
||||
theString. Append("<?");
|
||||
theString. AppendWithConversion("<?");
|
||||
theString.Append((PRUnichar *) target);
|
||||
if(data) {
|
||||
theString.Append(" ");
|
||||
theString.AppendWithConversion(" ");
|
||||
theString.Append((PRUnichar *) data);
|
||||
}
|
||||
theString.Append("?>");
|
||||
theString.AppendWithConversion("?>");
|
||||
AddToken(theToken, NS_OK, state->tokenDeque, state->tokenRecycler);
|
||||
}
|
||||
else{
|
||||
|
@ -687,8 +690,8 @@ IsLoadableDTD(nsIURI** aDTD)
|
|||
res = dtdURL->GetFileName(&fileName);
|
||||
if (NS_SUCCEEDED(res) && nsnull != fileName) {
|
||||
nsSpecialSystemDirectory dtdPath(nsSpecialSystemDirectory::OS_CurrentProcessDirectory);
|
||||
nsString path(kDTDDirectory);
|
||||
path.Append(fileName);
|
||||
nsString path; path.AssignWithConversion(kDTDDirectory);
|
||||
path.AppendWithConversion(fileName);
|
||||
dtdPath += path;
|
||||
if (dtdPath.Exists()) {
|
||||
// The DTD was found in the local DTD directory.
|
||||
|
@ -728,7 +731,7 @@ nsExpatTokenizer::OpenInputStream(const nsString& aURLStr,
|
|||
rv = NS_OpenURI(in, uri);
|
||||
char* absURL = nsnull;
|
||||
uri->GetSpec(&absURL);
|
||||
aAbsURL->Append(absURL);
|
||||
aAbsURL->AppendWithConversion(absURL);
|
||||
nsCRT::free(absURL);
|
||||
}
|
||||
else {
|
||||
|
@ -747,7 +750,7 @@ nsresult nsExpatTokenizer::LoadStream(nsIInputStream* in,
|
|||
PRUint32 aCount = 1024,
|
||||
bufsize = aCount*sizeof(PRUnichar);
|
||||
nsIUnicharInputStream *uniIn = nsnull;
|
||||
nsAutoString utf8("UTF-8");
|
||||
nsAutoString utf8; utf8.AssignWithConversion("UTF-8");
|
||||
|
||||
nsresult res = NS_NewConverterStream(&uniIn,
|
||||
nsnull,
|
||||
|
@ -815,7 +818,7 @@ int nsExpatTokenizer::HandleExternalEntityRef(XML_Parser parser,
|
|||
// Pass the buffer to expat for parsing
|
||||
if (NS_SUCCEEDED(rv) && nsnull != uniBuf) {
|
||||
// Create a parser for parsing the external entity
|
||||
nsAutoString encoding("UTF-16");
|
||||
nsAutoString encoding; encoding.AssignWithConversion("UTF-16");
|
||||
XML_Parser entParser = nsnull;
|
||||
|
||||
entParser = XML_ExternalEntityParserCreate(parser, 0,
|
||||
|
@ -854,10 +857,10 @@ void nsExpatTokenizer::HandleStartDoctypeDecl(void *userData,
|
|||
CToken* token = state->tokenRecycler->CreateTokenOfType(eToken_doctypeDecl, eHTMLTag_unknown);
|
||||
if (token) {
|
||||
nsString& str = token->GetStringValueXXX();
|
||||
str.Append(kDocTypeDeclPrefix);
|
||||
str.Append(" ");
|
||||
str.AppendWithConversion(kDocTypeDeclPrefix);
|
||||
str.AppendWithConversion(" ");
|
||||
str.Append((PRUnichar*) doctypeName);
|
||||
str.Append(">");
|
||||
str.AppendWithConversion(">");
|
||||
AddToken(token, NS_OK, state->tokenDeque, state->tokenRecycler);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ static char* gHeaderComment = "<!-- This page was created by the Gecko
|
|||
static char* gDocTypeHeader = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">";
|
||||
const int gTabSize=2;
|
||||
|
||||
static const nsString gMozDirty ("_moz_dirty");
|
||||
static const nsString gMozDirty = NS_ConvertToString("_moz_dirty");
|
||||
|
||||
static PRBool IsInline(eHTMLTags aTag);
|
||||
static PRBool IsBlockLevel(eHTMLTags aTag);
|
||||
|
@ -154,7 +154,7 @@ nsHTMLContentSinkStream::Initialize(nsIOutputStream* aOutStream,
|
|||
mStream = aOutStream;
|
||||
mString = aOutString;
|
||||
if (aCharsetOverride != nsnull)
|
||||
mCharsetOverride.Assign(*aCharsetOverride);
|
||||
mCharsetOverride.AssignWithConversion(aCharsetOverride->GetUnicode());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -218,12 +218,14 @@ nsHTMLContentSinkStream::InitEncoders()
|
|||
{
|
||||
nsAutoString charsetName = mCharsetOverride;
|
||||
NS_WITH_SERVICE(nsICharsetAlias, calias, kCharsetAliasCID, &res);
|
||||
if (NS_SUCCEEDED(res) && calias)
|
||||
res = calias->GetPreferred(mCharsetOverride, charsetName);
|
||||
if (NS_SUCCEEDED(res) && calias) {
|
||||
nsAutoString temp; temp.AssignWithConversion(mCharsetOverride);
|
||||
res = calias->GetPreferred(temp, charsetName);
|
||||
}
|
||||
if (NS_FAILED(res))
|
||||
{
|
||||
// failed - unknown alias , fallback to ISO-8859-1
|
||||
charsetName = "ISO-8859-1";
|
||||
charsetName.AssignWithConversion("ISO-8859-1");
|
||||
}
|
||||
|
||||
res = nsComponentManager::CreateInstance(kSaveAsCharsetCID, NULL,
|
||||
|
@ -345,7 +347,7 @@ void nsHTMLContentSinkStream::Write(const char* aData)
|
|||
}
|
||||
if (mString)
|
||||
{
|
||||
mString->Append(aData);
|
||||
mString->AppendWithConversion(aData);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -406,8 +408,8 @@ void nsHTMLContentSinkStream::WriteAttributes(const nsIParserNode& aNode)
|
|||
// used by the editor. Bug 16988. Yuck.
|
||||
//
|
||||
if ((eHTMLTags)aNode.GetNodeType() == eHTMLTag_br
|
||||
&& ((key.Equals("type", PR_TRUE) && value.Equals("_moz"))
|
||||
|| key.Equals("_moz", PR_TRUE, 4)))
|
||||
&& ((key.EqualsWithConversion("type", PR_TRUE) && value.EqualsWithConversion("_moz"))
|
||||
|| key.EqualsWithConversion("_moz", PR_TRUE, 4)))
|
||||
continue;
|
||||
|
||||
//
|
||||
|
@ -431,7 +433,7 @@ void nsHTMLContentSinkStream::WriteAttributes(const nsIParserNode& aNode)
|
|||
|
||||
// Make all links absolute when converting only the selection:
|
||||
if ((mFlags & nsIDocumentEncoder::OutputAbsoluteLinks)
|
||||
&& (key.Equals("href", PR_TRUE) || key.Equals("src", PR_TRUE)
|
||||
&& (key.EqualsWithConversion("href", PR_TRUE) || key.EqualsWithConversion("src", PR_TRUE)
|
||||
// Would be nice to handle OBJECT and APPLET tags,
|
||||
// but that gets more complicated since we have to
|
||||
// search the tag list for CODEBASE as well.
|
||||
|
@ -513,7 +515,7 @@ nsHTMLContentSinkStream::OpenHTML(const nsIParserNode& aNode)
|
|||
// See bug 20246: the html tag doesn't have "html" in its text,
|
||||
// so AddStartTag will do the wrong thing
|
||||
Write(kLessThan);
|
||||
nsAutoCString tagname (nsHTMLTags::GetStringValue(tag));
|
||||
nsAutoCString tagname( nsString(nsHTMLTags::GetStringValue(tag)) );
|
||||
Write(tagname);
|
||||
Write(kGreaterThan);
|
||||
}
|
||||
|
@ -700,7 +702,7 @@ nsHTMLContentSinkStream::CloseFrameset(const nsIParserNode& aNode){
|
|||
|
||||
void nsHTMLContentSinkStream::AddIndent()
|
||||
{
|
||||
nsString padding(" ");
|
||||
nsString padding; padding.AssignWithConversion(" ");
|
||||
for (PRInt32 i = mIndent; --i >= 0; )
|
||||
{
|
||||
Write(padding);
|
||||
|
@ -854,11 +856,11 @@ void nsHTMLContentSinkStream::AddEndTag(const nsIParserNode& aNode)
|
|||
|
||||
if (tag == eHTMLTag_unknown)
|
||||
{
|
||||
tagName = aNode.GetText();
|
||||
tagName.Assign(aNode.GetText());
|
||||
}
|
||||
else if (tag == eHTMLTag_comment)
|
||||
{
|
||||
tagName = "--";
|
||||
tagName.AssignWithConversion("--");
|
||||
}
|
||||
else if(tag == eHTMLTag_markupDecl)
|
||||
{
|
||||
|
@ -869,7 +871,7 @@ void nsHTMLContentSinkStream::AddEndTag(const nsIParserNode& aNode)
|
|||
}
|
||||
else
|
||||
{
|
||||
tagName = nsHTMLTags::GetStringValue(tag);
|
||||
tagName.AssignWithConversion(nsHTMLTags::GetStringValue(tag));
|
||||
}
|
||||
if (mLowerCaseTags == PR_TRUE)
|
||||
tagName.ToLowerCase();
|
||||
|
@ -1156,21 +1158,21 @@ nsHTMLContentSinkStream::OpenContainer(const nsIParserNode& aNode)
|
|||
if (tag == eHTMLTag_userdefined)
|
||||
{
|
||||
nsAutoString name = aNode.GetText();
|
||||
if (name.Equals("document_info"))
|
||||
if (name.EqualsWithConversion("document_info"))
|
||||
{
|
||||
PRInt32 count=aNode.GetAttributeCount();
|
||||
for(PRInt32 i=0;i<count;i++)
|
||||
{
|
||||
const nsString& key=aNode.GetKeyAt(i);
|
||||
|
||||
if (key.Equals("charset"))
|
||||
if (key.EqualsWithConversion("charset"))
|
||||
{
|
||||
const nsString& value=aNode.GetValueAt(i);
|
||||
if (mCharsetOverride.IsEmpty())
|
||||
mCharsetOverride.Assign(value);
|
||||
mCharsetOverride.AssignWithConversion(value.GetUnicode());
|
||||
InitEncoders();
|
||||
}
|
||||
else if (key.Equals("uri"))
|
||||
else if (key.EqualsWithConversion("uri"))
|
||||
{
|
||||
nsAutoString uristring (aNode.GetValueAt(i));
|
||||
|
||||
|
|
|
@ -221,12 +221,12 @@ public:
|
|||
NS_ASSERTION(value != -1, "can't find entity");
|
||||
NS_ASSERTION(value == gEntityArray[i].mUnicode, "bad unicode value");
|
||||
|
||||
entity = nsHTMLEntities::UnicodeToEntity(value);
|
||||
NS_ASSERTION(entity.Equals(gEntityArray[i].mStr.mStr), "bad entity name");
|
||||
entity.AssignWithConversion(nsHTMLEntities::UnicodeToEntity(value));
|
||||
NS_ASSERTION(entity.EqualsWithConversion(gEntityArray[i].mStr.mStr), "bad entity name");
|
||||
}
|
||||
|
||||
// Make sure we don't find things that aren't there
|
||||
value = nsHTMLEntities::EntityToUnicode(nsAutoString("@"));
|
||||
value = nsHTMLEntities::EntityToUnicode(NS_ConvertToString("@"));
|
||||
NS_ASSERTION(value == -1, "found @");
|
||||
value = nsHTMLEntities::EntityToUnicode(nsCAutoString("zzzzz"));
|
||||
NS_ASSERTION(value == -1, "found zzzzz");
|
||||
|
|
|
@ -107,7 +107,7 @@ NS_NewHTMLNullSink(nsIContentSink** aInstancePtrResult)
|
|||
* @param
|
||||
* @return
|
||||
*/
|
||||
nsHTMLNullSink::nsHTMLNullSink() : nsIHTMLContentSink(), mTitle("") {
|
||||
nsHTMLNullSink::nsHTMLNullSink() : nsIHTMLContentSink() {
|
||||
NS_INIT_REFCNT();
|
||||
mNodeStackPos=0;
|
||||
memset(mNodeStack,0,sizeof(mNodeStack));
|
||||
|
|
|
@ -71,7 +71,7 @@ nsresult nsHTMLToTXTSinkStream::InitEncoder(const nsString& aCharset)
|
|||
nsresult res = NS_OK;
|
||||
|
||||
// If the converter is ucs2, then do not use a converter
|
||||
if (aCharset.Equals("ucs2"))
|
||||
if (aCharset.EqualsWithConversion("ucs2"))
|
||||
{
|
||||
NS_IF_RELEASE(mUnicodeEncoder);
|
||||
return res;
|
||||
|
@ -92,7 +92,7 @@ nsresult nsHTMLToTXTSinkStream::InitEncoder(const nsString& aCharset)
|
|||
if(NS_FAILED(res))
|
||||
{
|
||||
// failed - unknown alias , fallback to ISO-8859-1
|
||||
charsetName = "ISO-8859-1";
|
||||
charsetName.AssignWithConversion("ISO-8859-1");
|
||||
}
|
||||
|
||||
nsICharsetConverterManager * ccm = nsnull;
|
||||
|
@ -178,7 +178,6 @@ nsHTMLToTXTSinkStream::nsHTMLToTXTSinkStream()
|
|||
|
||||
// Flow
|
||||
mEmptyLines=1; // The start of the document is an "empty line" in itself,
|
||||
mCurrentLine = "";
|
||||
mInWhitespace = PR_TRUE;
|
||||
mPreFormatted = PR_FALSE;
|
||||
mCacheLine = PR_FALSE;
|
||||
|
@ -368,7 +367,7 @@ nsHTMLToTXTSinkStream::GetValueOfAttribute(const nsIParserNode& aNode,
|
|||
char* aMatchKey,
|
||||
nsString& aValueRet)
|
||||
{
|
||||
nsAutoString matchKey (aMatchKey);
|
||||
nsAutoString matchKey; matchKey.AssignWithConversion(aMatchKey);
|
||||
PRInt32 count=aNode.GetAttributeCount();
|
||||
for (PRInt32 i=0;i<count;i++)
|
||||
{
|
||||
|
@ -418,7 +417,7 @@ nsHTMLToTXTSinkStream::OpenContainer(const nsIParserNode& aNode)
|
|||
printf("OpenContainer: %d ", type);
|
||||
#endif
|
||||
const nsString& name = aNode.GetText();
|
||||
if (name.Equals("document_info"))
|
||||
if (name.EqualsWithConversion("document_info"))
|
||||
{
|
||||
nsString value;
|
||||
if (NS_SUCCEEDED(GetValueOfAttribute(aNode, "charset", value)))
|
||||
|
@ -541,9 +540,9 @@ nsHTMLToTXTSinkStream::OpenContainer(const nsIParserNode& aNode)
|
|||
{
|
||||
if (mOLStackIndex > 0)
|
||||
// This is what nsBulletFrame does for OLs:
|
||||
mInIndentString.Append(mOLStack[mOLStackIndex-1]++, 10);
|
||||
mInIndentString.AppendWithConversion(mOLStack[mOLStackIndex-1]++, 10);
|
||||
else
|
||||
mInIndentString.Append("#");
|
||||
mInIndentString.AppendWithConversion("#");
|
||||
|
||||
mInIndentString.Append('.');
|
||||
|
||||
|
@ -565,7 +564,7 @@ nsHTMLToTXTSinkStream::OpenContainer(const nsIParserNode& aNode)
|
|||
// when a mail is sent.
|
||||
nsString value;
|
||||
if (NS_SUCCEEDED(GetValueOfAttribute(aNode, "type", value))
|
||||
&& value.StripChars("\"").Equals("cite", PR_TRUE))
|
||||
&& value.StripChars("\"").EqualsWithConversion("cite", PR_TRUE))
|
||||
mCiteQuoteLevel++;
|
||||
else
|
||||
mIndent += gTabSize; // Check for some maximum value?
|
||||
|
@ -586,30 +585,30 @@ nsHTMLToTXTSinkStream::OpenContainer(const nsIParserNode& aNode)
|
|||
if (NS_SUCCEEDED(GetValueOfAttribute(aNode, "alt", desc))
|
||||
&& !desc.IsEmpty())
|
||||
{
|
||||
temp += " (";
|
||||
temp.AppendWithConversion(" (");
|
||||
temp += desc.StripChars("\"");
|
||||
temp += " <";
|
||||
temp.AppendWithConversion(" <");
|
||||
temp += url.StripChars("\"");
|
||||
temp += ">) ";
|
||||
temp.AppendWithConversion(">) ");
|
||||
}
|
||||
else
|
||||
{
|
||||
temp += " <";
|
||||
temp.AppendWithConversion(" <");
|
||||
temp += url.StripChars("\"");
|
||||
temp += "> ";
|
||||
temp.AppendWithConversion("> ");
|
||||
}
|
||||
Write(temp);
|
||||
}
|
||||
}
|
||||
else if (type == eHTMLTag_sup)
|
||||
Write("^");
|
||||
Write( NS_ConvertToString("^") );
|
||||
// I don't know a plain text representation of sub
|
||||
else if (type == eHTMLTag_strong || type == eHTMLTag_b)
|
||||
Write("*");
|
||||
Write( NS_ConvertToString("*") );
|
||||
else if (type == eHTMLTag_em || type == eHTMLTag_i)
|
||||
Write("/");
|
||||
Write( NS_ConvertToString("/") );
|
||||
else if (type == eHTMLTag_u)
|
||||
Write("_");
|
||||
Write( NS_ConvertToString("_") );
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -667,9 +666,9 @@ nsHTMLToTXTSinkStream::CloseContainer(const nsIParserNode& aNode)
|
|||
if(!mInWhitespace) {
|
||||
// Maybe add something else? Several spaces? A TAB? SPACE+TAB?
|
||||
if(mCacheLine) {
|
||||
AddToLine(nsAutoString(" ").GetUnicode(), 1);
|
||||
AddToLine(NS_ConvertToString(" ").GetUnicode(), 1);
|
||||
} else {
|
||||
nsAutoString space(" ");
|
||||
nsAutoString space; space.AssignWithConversion(" ");
|
||||
WriteSimple(space);
|
||||
}
|
||||
mInWhitespace = PR_TRUE;
|
||||
|
@ -703,21 +702,21 @@ nsHTMLToTXTSinkStream::CloseContainer(const nsIParserNode& aNode)
|
|||
{ // these brackets must stay here
|
||||
if (!mURL.IsEmpty())
|
||||
{
|
||||
nsAutoString temp(" <");
|
||||
nsAutoString temp; temp.AssignWithConversion(" <");
|
||||
temp += mURL;
|
||||
temp += ">";
|
||||
temp.AppendWithConversion(">");
|
||||
Write(temp);
|
||||
mURL.Truncate();
|
||||
}
|
||||
}
|
||||
else if (type == eHTMLTag_sup)
|
||||
Write(" ");
|
||||
Write( NS_ConvertToString(" ") );
|
||||
else if (type == eHTMLTag_strong || type == eHTMLTag_b)
|
||||
Write("*");
|
||||
Write( NS_ConvertToString("*") );
|
||||
else if (type == eHTMLTag_em || type == eHTMLTag_i)
|
||||
Write("/");
|
||||
Write( NS_ConvertToString("/") );
|
||||
else if (type == eHTMLTag_u)
|
||||
Write("_");
|
||||
Write( NS_ConvertToString("_") );
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -793,7 +792,7 @@ nsHTMLToTXTSinkStream::AddLeaf(const nsIParserNode& aNode)
|
|||
{
|
||||
Write(text); // XXX: spacestuffing (maybe call AddToLine if mCacheLine==true)
|
||||
} else if(!mInWhitespace) {
|
||||
Write(" ");
|
||||
Write( NS_ConvertToString(" ") );
|
||||
mInWhitespace = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -920,7 +919,7 @@ void nsHTMLToTXTSinkStream::WriteSimple(nsString& aString)
|
|||
}
|
||||
if (mString != nsnull)
|
||||
{
|
||||
mString->Append(mBuffer);
|
||||
mString->AppendWithConversion(mBuffer);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -984,7 +983,7 @@ nsHTMLToTXTSinkStream::AddToLine(const PRUnichar * aLineFragment, PRInt32 aLineF
|
|||
goodSpace--;
|
||||
}
|
||||
|
||||
nsAutoString restOfLine = "";
|
||||
nsAutoString restOfLine;
|
||||
if(goodSpace<0) {
|
||||
// If we don't found a good place to break, accept long line and
|
||||
// try to find another place to break
|
||||
|
@ -1005,7 +1004,7 @@ nsHTMLToTXTSinkStream::AddToLine(const PRUnichar * aLineFragment, PRInt32 aLineF
|
|||
if(mFlags & nsIDocumentEncoder::OutputFormatFlowed) {
|
||||
if((restOfLine[0] == '>') ||
|
||||
(restOfLine[0] == ' ') ||
|
||||
(!restOfLine.Compare("From ",PR_FALSE,5))) {
|
||||
(!restOfLine.CompareWithConversion("From ",PR_FALSE,5))) {
|
||||
// Space stuffing a la RFC 2646 if this will be used in a mail,
|
||||
// but how can I know that??? Now space stuffing is done always
|
||||
// when formatting text as HTML and that is wrong! XXX: Fix this!
|
||||
|
@ -1042,7 +1041,7 @@ nsHTMLToTXTSinkStream::EndLine(PRBool softlinebreak)
|
|||
// Add the soft part of the soft linebreak (RFC 2646 4.1)
|
||||
mCurrentLine.Append(' ');
|
||||
}
|
||||
mCurrentLine.Append(NS_LINEBREAK);
|
||||
mCurrentLine.AppendWithConversion(NS_LINEBREAK);
|
||||
WriteSimple(mCurrentLine);
|
||||
mCurrentLine.Truncate();
|
||||
mColPos=0;
|
||||
|
@ -1059,7 +1058,7 @@ nsHTMLToTXTSinkStream::EndLine(PRBool softlinebreak)
|
|||
// Remove SPACE from the end of the line.
|
||||
while(' ' == mCurrentLine[mCurrentLine.Length()-1])
|
||||
mCurrentLine.SetLength(mCurrentLine.Length()-1);
|
||||
mCurrentLine.Append(NS_LINEBREAK);
|
||||
mCurrentLine.AppendWithConversion(NS_LINEBREAK);
|
||||
WriteSimple(mCurrentLine);
|
||||
mCurrentLine.Truncate();
|
||||
mColPos=0;
|
||||
|
@ -1250,7 +1249,7 @@ nsHTMLToTXTSinkStream::Write(const nsString& aString)
|
|||
if(mFlags & nsIDocumentEncoder::OutputPreformatted) {
|
||||
bol = nextpos;
|
||||
} else {
|
||||
tempstr.Append(" ");
|
||||
tempstr.AppendWithConversion(" ");
|
||||
bol = nextpos + 1;
|
||||
mInWhitespace = PR_TRUE;
|
||||
}
|
||||
|
@ -1268,7 +1267,7 @@ nsHTMLToTXTSinkStream::Write(const nsString& aString)
|
|||
} else {
|
||||
// Replace the whitespace with a space
|
||||
AddToLine(offsetIntoBuffer, nextpos-bol);
|
||||
AddToLine(nsAutoString(" ").GetUnicode(),1);
|
||||
AddToLine(NS_ConvertToString(" ").GetUnicode(),1);
|
||||
bol = nextpos + 1; // Let's eat the whitespace
|
||||
}
|
||||
}
|
||||
|
|
|
@ -243,7 +243,7 @@ NS_New_HTMLToTXT_SinkStream(nsIHTMLContentSink** aInstancePtrResult,
|
|||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
it->SetWrapColumn(aWrapColumn);
|
||||
nsAutoString ucs2("ucs2");
|
||||
nsAutoString ucs2; ucs2.AssignWithConversion("ucs2");
|
||||
it->SetCharsetOverride(&ucs2);
|
||||
rv = it->QueryInterface(NS_GET_IID(nsIHTMLContentSink),
|
||||
(void**)aInstancePtrResult);
|
||||
|
|
|
@ -386,7 +386,7 @@ nsresult nsHTMLTokenizer::ConsumeTag(PRUnichar aChar,CToken*& aToken,nsScanner&
|
|||
// We are not dealing with a tag. So, put back the char
|
||||
// and leave the decision to ConsumeText().
|
||||
aScanner.PutBack(aChar);
|
||||
nsAutoString temp("<");
|
||||
nsAutoString temp; temp.AssignWithConversion("<");
|
||||
result=ConsumeText(temp,aToken,aScanner);
|
||||
}
|
||||
} //switch
|
||||
|
@ -548,7 +548,7 @@ nsresult nsHTMLTokenizer::ConsumeStartTag(PRUnichar aChar,CToken*& aToken,nsScan
|
|||
|
||||
if((eHTMLTag_style==theTag) || (eHTMLTag_script==theTag)) {
|
||||
nsAutoString endTag(nsHTMLTags::GetStringValue(theTag));
|
||||
endTag.Insert("</",0,2);
|
||||
endTag.InsertWithConversion("</",0,2);
|
||||
CToken* textToken=theRecycler->CreateTokenOfType(eToken_text,theTag);
|
||||
result=((CTextToken*)textToken)->ConsumeUntil(0,PR_FALSE,aScanner,endTag,mParseMode,aFlushTokens); //tell new token to finish consuming text...
|
||||
//endTag.Append(">");
|
||||
|
@ -623,7 +623,7 @@ nsresult nsHTMLTokenizer::ConsumeEntity(PRUnichar aChar,CToken*& aToken,nsScanne
|
|||
}
|
||||
else {
|
||||
//oops, we're actually looking at plain text...
|
||||
nsAutoString temp("&");
|
||||
nsAutoString temp; temp.AssignWithConversion("&");
|
||||
aScanner.PutBack(theChar);
|
||||
return ConsumeText(temp,aToken,aScanner);
|
||||
}//if
|
||||
|
@ -632,7 +632,7 @@ nsresult nsHTMLTokenizer::ConsumeEntity(PRUnichar aChar,CToken*& aToken,nsScanne
|
|||
if((kHashsign!=theChar) && (-1==nsHTMLEntities::EntityToUnicode(theStr))){
|
||||
//if you're here we have a bogus entity.
|
||||
//convert it into a text token.
|
||||
nsAutoString temp("&");
|
||||
nsAutoString temp; temp.AssignWithConversion("&");
|
||||
temp.Append(theStr);
|
||||
CToken* theToken=theRecycler->CreateTokenOfType(eToken_text,eHTMLTag_text,temp);
|
||||
theRecycler->RecycleToken(aToken);
|
||||
|
|
|
@ -72,7 +72,7 @@ CHTMLToken::CHTMLToken(eHTMLTags aTag) : CToken(aTag) {
|
|||
*/
|
||||
void CHTMLToken::SetStringValue(const char* name){
|
||||
if(name) {
|
||||
mTextValue=name;
|
||||
mTextValue.AssignWithConversion(name);
|
||||
mTypeID = nsHTMLTags::LookupTag(mTextValue);
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ nsString& CHTMLToken::GetStringValueXXX(void) {
|
|||
|
||||
if((eHTMLTag_unknown<mTypeID) && (mTypeID<eHTMLTag_text)) {
|
||||
if(!mTextValue.Length()) {
|
||||
mTextValue = nsHTMLTags::GetStringValue((nsHTMLTag) mTypeID);
|
||||
mTextValue.AssignWithConversion(nsHTMLTags::GetStringValue((nsHTMLTag) mTypeID));
|
||||
}
|
||||
}
|
||||
return mTextValue;
|
||||
|
@ -248,7 +248,7 @@ nsresult CStartToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode
|
|||
}
|
||||
}
|
||||
else {
|
||||
mTextValue=aChar;
|
||||
mTextValue.AssignWithConversion(aChar);
|
||||
result=aScanner.ReadIdentifier(mTextValue);
|
||||
mTypeID = nsHTMLTags::LookupTag(mTextValue);
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ void CStartToken::DebugDumpSource(nsOutputStream& out) {
|
|||
* @return nada
|
||||
*/
|
||||
void CStartToken::GetSource(nsString& anOutputString){
|
||||
anOutputString="<";
|
||||
anOutputString.AssignWithConversion("<");
|
||||
/*
|
||||
* mTextValue used to contain the name of the tag.
|
||||
* But for the sake of performance we now rely on the tagID
|
||||
|
@ -302,7 +302,7 @@ void CStartToken::GetSource(nsString& anOutputString){
|
|||
* @return nada
|
||||
*/
|
||||
void CStartToken::AppendSource(nsString& anOutputString){
|
||||
anOutputString+="<";
|
||||
anOutputString.AppendWithConversion("<");
|
||||
/*
|
||||
* mTextValue used to contain the name of the tag.
|
||||
* But for the sake of performance we now rely on the tagID
|
||||
|
@ -352,7 +352,7 @@ nsresult CEndToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode)
|
|||
//Stop consuming as soon as you see a space or a '>'.
|
||||
//NOTE: We don't Consume the tag attributes here, nor do we eat the ">"
|
||||
|
||||
mTextValue="";
|
||||
mTextValue.SetLength(0);
|
||||
nsresult result=aScanner.ReadUntil(mTextValue,kGreaterThan,PR_FALSE);
|
||||
|
||||
if(NS_OK==result){
|
||||
|
@ -432,9 +432,9 @@ void CEndToken::DebugDumpSource(nsOutputStream& out) {
|
|||
* @return nada
|
||||
*/
|
||||
void CEndToken::GetSource(nsString& anOutputString){
|
||||
anOutputString="</";
|
||||
anOutputString.AssignWithConversion("</");
|
||||
anOutputString+=mTextValue;
|
||||
anOutputString+=">";
|
||||
anOutputString.AppendWithConversion(">");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -445,9 +445,9 @@ void CEndToken::GetSource(nsString& anOutputString){
|
|||
* @return nada
|
||||
*/
|
||||
void CEndToken::AppendSource(nsString& anOutputString){
|
||||
anOutputString+="</";
|
||||
anOutputString.AppendWithConversion("</");
|
||||
anOutputString+=mTextValue;
|
||||
anOutputString+=">";
|
||||
anOutputString.AppendWithConversion(">");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -503,7 +503,7 @@ PRInt32 CTextToken::GetTokenType(void) {
|
|||
* @return error result
|
||||
*/
|
||||
nsresult CTextToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode) {;
|
||||
static nsString theTerminals("\n\r&<",4);
|
||||
static nsString theTerminals = NS_ConvertToString("\n\r&<",4);
|
||||
nsresult result=NS_OK;
|
||||
PRBool done=PR_FALSE;
|
||||
|
||||
|
@ -528,23 +528,23 @@ nsresult CTextToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode)
|
|||
if(kLF==theNextChar) {
|
||||
result=aScanner.GetChar(theNextChar);
|
||||
}
|
||||
mTextValue.Append("\n");
|
||||
mTextValue.AppendWithConversion("\n");
|
||||
mNewlineCount++;
|
||||
}
|
||||
mTextValue.Append("\n");
|
||||
mTextValue.AppendWithConversion("\n");
|
||||
mNewlineCount++;
|
||||
break;
|
||||
case kLF:
|
||||
if((kLF==theNextChar) || (kCR==theNextChar)) {
|
||||
result=aScanner.GetChar(theNextChar);
|
||||
mTextValue.Append("\n");
|
||||
mTextValue.AppendWithConversion("\n");
|
||||
mNewlineCount++;
|
||||
}
|
||||
mTextValue.Append("\n");
|
||||
mTextValue.AppendWithConversion("\n");
|
||||
mNewlineCount++;
|
||||
break;
|
||||
default:
|
||||
mTextValue.Append("\n");
|
||||
mTextValue.AppendWithConversion("\n");
|
||||
mNewlineCount++;
|
||||
break;
|
||||
} //switch
|
||||
|
@ -732,14 +732,14 @@ nsresult CCDATASectionToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt3
|
|||
switch(aChar) {
|
||||
case kCR:
|
||||
result=aScanner.GetChar(aChar); //strip off the \r
|
||||
mTextValue.Append("\n\n");
|
||||
mTextValue.AppendWithConversion("\n\n");
|
||||
break;
|
||||
case kNewLine:
|
||||
//which means we saw \r\n, which becomes \n
|
||||
result=aScanner.GetChar(aChar); //strip off the \n
|
||||
//now fall through on purpose...
|
||||
default:
|
||||
mTextValue.Append("\n");
|
||||
mTextValue.AppendWithConversion("\n");
|
||||
break;
|
||||
} //switch
|
||||
} //if
|
||||
|
@ -809,7 +809,7 @@ nsresult ConsumeStrictComment(PRUnichar aChar, nsScanner& aScanner,nsString& aSt
|
|||
<!-- xx -- xx -->
|
||||
*********************************************************/
|
||||
|
||||
aString="<!";
|
||||
aString.AssignWithConversion("<!");
|
||||
while(NS_OK==result) {
|
||||
result=aScanner.GetChar(aChar);
|
||||
if(NS_OK==result) {
|
||||
|
@ -822,7 +822,7 @@ nsresult ConsumeStrictComment(PRUnichar aChar, nsScanner& aScanner,nsString& aSt
|
|||
aString+=aChar;
|
||||
if(NS_OK==result) {
|
||||
PRInt32 findpos=-1;
|
||||
nsAutoString temp("");
|
||||
nsAutoString temp;
|
||||
//Read to the first ending sequence '--'
|
||||
while((kNotFound==findpos) && (NS_OK==result)) {
|
||||
result=aScanner.ReadUntil(temp,kMinus,PR_TRUE);
|
||||
|
@ -831,7 +831,7 @@ nsresult ConsumeStrictComment(PRUnichar aChar, nsScanner& aScanner,nsString& aSt
|
|||
aString+=temp;
|
||||
if(NS_OK==result) {
|
||||
if(NS_OK==result) {
|
||||
temp="->";
|
||||
temp.AssignWithConversion("->");
|
||||
result=aScanner.ReadUntil(aString,temp,PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
@ -1043,8 +1043,10 @@ PRInt32 CNewlineToken::GetTokenType(void) {
|
|||
*/
|
||||
nsString& CNewlineToken::GetStringValueXXX(void) {
|
||||
static nsString* theStr=0;
|
||||
if(!theStr)
|
||||
theStr=new nsString("\n");
|
||||
if(!theStr) {
|
||||
theStr=new nsString;
|
||||
theStr->AssignWithConversion("\n");
|
||||
}
|
||||
return *theStr;
|
||||
}
|
||||
|
||||
|
@ -1059,7 +1061,7 @@ nsString& CNewlineToken::GetStringValueXXX(void) {
|
|||
nsresult CNewlineToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode) {
|
||||
|
||||
#if 1
|
||||
mTextValue=kNewLine; //This is what I THINK we should be doing.
|
||||
mTextValue.AssignWithConversion(kNewLine); //This is what I THINK we should be doing.
|
||||
#else
|
||||
mTextValue=aChar;
|
||||
#endif
|
||||
|
@ -1216,9 +1218,9 @@ void CAttributeToken::DebugDumpToken(nsOutputStream& out) {
|
|||
*/
|
||||
void CAttributeToken::GetSource(nsString& anOutputString){
|
||||
anOutputString=mTextKey;
|
||||
anOutputString+="=";
|
||||
anOutputString.AppendWithConversion("=");
|
||||
anOutputString+=mTextValue;
|
||||
anOutputString+=";";
|
||||
anOutputString.AppendWithConversion(";");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1230,9 +1232,9 @@ void CAttributeToken::GetSource(nsString& anOutputString){
|
|||
*/
|
||||
void CAttributeToken::AppendSource(nsString& anOutputString){
|
||||
anOutputString+=mTextKey;
|
||||
anOutputString+="=";
|
||||
anOutputString.AppendWithConversion("=");
|
||||
anOutputString+=mTextValue;
|
||||
anOutputString+=";";
|
||||
anOutputString.AppendWithConversion(";");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1277,7 +1279,7 @@ nsresult ConsumeQuotedString(PRUnichar aChar,nsString& aString,nsScanner& aScann
|
|||
*/
|
||||
static
|
||||
nsresult ConsumeAttributeValueText(PRUnichar,nsString& aString,nsScanner& aScanner){
|
||||
static nsString theTerminals("\b\t\n\r >",6);
|
||||
static nsString theTerminals = NS_ConvertToString("\b\t\n\r >",6);
|
||||
nsresult result=aScanner.ReadUntil(aString,theTerminals,PR_FALSE);
|
||||
|
||||
//Let's force quotes if either the first or last char is quoted.
|
||||
|
@ -1333,7 +1335,7 @@ nsresult CAttributeToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 a
|
|||
}
|
||||
else {
|
||||
//If you're here, handle an unquoted key.
|
||||
static nsString theTerminals("\b\t\n\r \"<=>",9);
|
||||
static nsString theTerminals = NS_ConvertToString("\b\t\n\r \"<=>",9);
|
||||
result=aScanner.ReadUntil(mTextKey,theTerminals,PR_FALSE);
|
||||
}
|
||||
|
||||
|
@ -1475,7 +1477,7 @@ PRInt32 CWhitespaceToken::GetTokenType(void) {
|
|||
* @return error result
|
||||
*/
|
||||
nsresult CWhitespaceToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode) {
|
||||
mTextValue=aChar;
|
||||
mTextValue.AssignWithConversion(aChar);
|
||||
nsresult result=aScanner.ReadWhitespace(mTextValue);
|
||||
if(NS_OK==result) {
|
||||
mTextValue.StripChar(kCR);
|
||||
|
@ -1520,7 +1522,7 @@ CEntityToken::CEntityToken(const nsString& aName) : CHTMLToken(aName) {
|
|||
*/
|
||||
nsresult CEntityToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode) {
|
||||
if(aChar)
|
||||
mTextValue=aChar;
|
||||
mTextValue.AssignWithConversion(aChar);
|
||||
nsresult result=ConsumeEntity(aChar,mTextValue,aScanner);
|
||||
return result;
|
||||
}
|
||||
|
@ -1686,7 +1688,7 @@ PRInt32 CEntityToken::TranslateToUnicodeStr(nsString& aString) {
|
|||
value = nsHTMLEntities::EntityToUnicode(mTextValue);
|
||||
if(-1<value) {
|
||||
//we found a named entity...
|
||||
aString=PRUnichar(value);
|
||||
aString.AssignWithConversion(PRUnichar(value));
|
||||
}
|
||||
}//else
|
||||
}//if
|
||||
|
@ -1715,7 +1717,7 @@ void CEntityToken::DebugDumpSource(nsOutputStream& out) {
|
|||
* @return nada
|
||||
*/
|
||||
void CEntityToken::GetSource(nsString& anOutputString){
|
||||
anOutputString="&";
|
||||
anOutputString.AssignWithConversion("&");
|
||||
anOutputString+=mTextValue;
|
||||
//anOutputString+=";";
|
||||
}
|
||||
|
@ -1728,7 +1730,7 @@ void CEntityToken::GetSource(nsString& anOutputString){
|
|||
* @return nada
|
||||
*/
|
||||
void CEntityToken::AppendSource(nsString& anOutputString){
|
||||
anOutputString+="&";
|
||||
anOutputString.AppendWithConversion("&");
|
||||
anOutputString+=mTextValue;
|
||||
//anOutputString+=";";
|
||||
}
|
||||
|
@ -1806,7 +1808,7 @@ PRInt32 CStyleToken::GetTokenType(void) {
|
|||
* @return
|
||||
*/
|
||||
CSkippedContentToken::CSkippedContentToken(const nsString& aName) : CAttributeToken(aName) {
|
||||
mTextKey = "$skipped-content";/* XXX need a better answer! */
|
||||
mTextKey.AssignWithConversion("$skipped-content");/* XXX need a better answer! */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1885,7 +1887,7 @@ nsresult CSkippedContentToken::Consume(PRUnichar aChar,nsScanner& aScanner,PRInt
|
|||
}
|
||||
nsAutoString theRight;
|
||||
temp.Right(theRight,mTextValue.Length());
|
||||
done=PRBool(0==theRight.Compare(mTextValue,PR_TRUE));
|
||||
done=PRBool(0==theRight.CompareWithConversion(mTextValue,PR_TRUE));
|
||||
}
|
||||
int len=temp.Length();
|
||||
temp.Truncate(len-mTextValue.Length());
|
||||
|
@ -1916,7 +1918,7 @@ void CSkippedContentToken::DebugDumpSource(nsOutputStream& out) {
|
|||
* @return nada
|
||||
*/
|
||||
void CSkippedContentToken::GetSource(nsString& anOutputString){
|
||||
anOutputString="$skipped-content";
|
||||
anOutputString.AssignWithConversion("$skipped-content");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1927,7 +1929,7 @@ void CSkippedContentToken::GetSource(nsString& anOutputString){
|
|||
* @return nada
|
||||
*/
|
||||
void CSkippedContentToken::AppendSource(nsString& anOutputString){
|
||||
anOutputString+="$skipped-content";
|
||||
anOutputString.AppendWithConversion("$skipped-content");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1975,7 +1977,7 @@ CInstructionToken::CInstructionToken(const nsString& aString) : CHTMLToken(aStri
|
|||
* @return
|
||||
*/
|
||||
nsresult CInstructionToken::Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode){
|
||||
mTextValue="<?";
|
||||
mTextValue.AssignWithConversion("<?");
|
||||
nsresult result=aScanner.ReadUntil(mTextValue,kGreaterThan,PR_TRUE);
|
||||
return result;
|
||||
}
|
||||
|
@ -2045,7 +2047,7 @@ CDoctypeDeclToken::CDoctypeDeclToken(eHTMLTags aTag) : CHTMLToken(aTag) {
|
|||
*/
|
||||
nsresult CDoctypeDeclToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode) {
|
||||
|
||||
mTextValue="<!";
|
||||
mTextValue.AssignWithConversion("<!");
|
||||
|
||||
nsresult result=aScanner.ReadUntil(mTextValue,'<',PR_FALSE);
|
||||
return result;
|
||||
|
|
Загрузка…
Ссылка в новой задаче