Fixed non-ANSII compliant code.
git-svn-id: svn://10.0.0.236/trunk@30204 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -65,11 +65,14 @@ nsContentList::nsContentList(nsIDocument *aDocument,
|
||||
|
||||
nsContentList::nsContentList(nsIDocument *aDocument,
|
||||
nsContentListMatchFunc aFunc,
|
||||
void* aData,
|
||||
const nsString* aData,
|
||||
nsIContent* aRootContent)
|
||||
{
|
||||
mFunc = aFunc;
|
||||
mData = aData;
|
||||
if (nsnull != aData) {
|
||||
mData = new nsString(*aData);
|
||||
// If this fails, fail silently
|
||||
}
|
||||
mMatchAtom = nsnull;
|
||||
mRootContent = aRootContent;
|
||||
mMatchAll = PR_FALSE;
|
||||
@@ -100,8 +103,6 @@ nsContentList::~nsContentList()
|
||||
|
||||
NS_IF_RELEASE(mMatchAtom);
|
||||
|
||||
// XXX This is absolutely gross, since this is allocated
|
||||
// elsewhere.
|
||||
if (nsnull != mData) {
|
||||
delete mData;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "nsIDocumentObserver.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
|
||||
typedef PRBool (*nsContentListMatchFunc)(nsIContent* aContent, void* aData);
|
||||
typedef PRBool (*nsContentListMatchFunc)(nsIContent* aContent, nsString* aData);
|
||||
|
||||
class nsIDocument;
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
nsIContent* aRootContent=nsnull);
|
||||
nsContentList(nsIDocument *aDocument,
|
||||
nsContentListMatchFunc aFunc,
|
||||
void* aData,
|
||||
const nsString* aData,
|
||||
nsIContent* aRootContent=nsnull);
|
||||
virtual ~nsContentList();
|
||||
|
||||
@@ -133,10 +133,10 @@ protected:
|
||||
nsIAtom* mMatchAtom;
|
||||
PRInt32 mMatchNameSpaceId;
|
||||
nsContentListMatchFunc mFunc;
|
||||
void* mData;
|
||||
nsString* mData;
|
||||
nsVoidArray mContent;
|
||||
void *mScriptObject;
|
||||
nsIDocument *mDocument;
|
||||
nsIDocument* mDocument;
|
||||
nsIContent* mRootContent;
|
||||
PRBool mMatchAll;
|
||||
};
|
||||
|
||||
@@ -1073,7 +1073,7 @@ nsHTMLDocument::GetApplets(nsIDOMHTMLCollection** aApplets)
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHTMLDocument::MatchLinks(nsIContent *aContent, void* aData)
|
||||
nsHTMLDocument::MatchLinks(nsIContent *aContent, nsString* aData)
|
||||
{
|
||||
nsIAtom *name;
|
||||
aContent->GetTag(name);
|
||||
@@ -1108,7 +1108,7 @@ nsHTMLDocument::GetLinks(nsIDOMHTMLCollection** aLinks)
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHTMLDocument::MatchAnchors(nsIContent *aContent, void* aData)
|
||||
nsHTMLDocument::MatchAnchors(nsIContent *aContent, nsString* aData)
|
||||
{
|
||||
nsIAtom *name;
|
||||
aContent->GetTag(name);
|
||||
@@ -1358,16 +1358,15 @@ nsHTMLDocument::GetElementById(const nsString& aElementId, nsIDOMElement** aRetu
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHTMLDocument::MatchNameAttribute(nsIContent* aContent, void* aData)
|
||||
nsHTMLDocument::MatchNameAttribute(nsIContent* aContent, nsString* aData)
|
||||
{
|
||||
nsresult result;
|
||||
nsAutoString name;
|
||||
char* matchName = (char*)aData;
|
||||
|
||||
result = aContent->GetAttribute(kNameSpaceID_None,
|
||||
nsHTMLAtoms::name,
|
||||
name);
|
||||
if ((result == NS_OK) && name.Equals(matchName)) {
|
||||
if ((result == NS_OK) && (nsnull != aData) && name.Equals(*aData)) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
else {
|
||||
@@ -1379,10 +1378,9 @@ NS_IMETHODIMP
|
||||
nsHTMLDocument::GetElementsByName(const nsString& aElementName,
|
||||
nsIDOMNodeList** aReturn)
|
||||
{
|
||||
char* name = aElementName.ToNewCString();
|
||||
nsContentList* elements = new nsContentList(this,
|
||||
MatchNameAttribute,
|
||||
name);
|
||||
&aElementName);
|
||||
if (nsnull == elements) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@@ -163,9 +163,9 @@ protected:
|
||||
nsIContent *MatchName(nsIContent *aContent, const nsString& aName);
|
||||
|
||||
virtual void InternalAddStyleSheet(nsIStyleSheet* aSheet);
|
||||
static PRBool MatchLinks(nsIContent *aContent, void* aData);
|
||||
static PRBool MatchAnchors(nsIContent *aContent, void* aData);
|
||||
static PRBool MatchNameAttribute(nsIContent* aContent, void* aData);
|
||||
static PRBool MatchLinks(nsIContent *aContent, nsString* aData);
|
||||
static PRBool MatchAnchors(nsIContent *aContent, nsString* aData);
|
||||
static PRBool MatchNameAttribute(nsIContent* aContent, nsString* aData);
|
||||
|
||||
PRBool GetBodyContent();
|
||||
nsresult GetBodyElement(nsIDOMHTMLBodyElement** aBody);
|
||||
|
||||
@@ -65,11 +65,14 @@ nsContentList::nsContentList(nsIDocument *aDocument,
|
||||
|
||||
nsContentList::nsContentList(nsIDocument *aDocument,
|
||||
nsContentListMatchFunc aFunc,
|
||||
void* aData,
|
||||
const nsString* aData,
|
||||
nsIContent* aRootContent)
|
||||
{
|
||||
mFunc = aFunc;
|
||||
mData = aData;
|
||||
if (nsnull != aData) {
|
||||
mData = new nsString(*aData);
|
||||
// If this fails, fail silently
|
||||
}
|
||||
mMatchAtom = nsnull;
|
||||
mRootContent = aRootContent;
|
||||
mMatchAll = PR_FALSE;
|
||||
@@ -100,8 +103,6 @@ nsContentList::~nsContentList()
|
||||
|
||||
NS_IF_RELEASE(mMatchAtom);
|
||||
|
||||
// XXX This is absolutely gross, since this is allocated
|
||||
// elsewhere.
|
||||
if (nsnull != mData) {
|
||||
delete mData;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "nsIDocumentObserver.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
|
||||
typedef PRBool (*nsContentListMatchFunc)(nsIContent* aContent, void* aData);
|
||||
typedef PRBool (*nsContentListMatchFunc)(nsIContent* aContent, nsString* aData);
|
||||
|
||||
class nsIDocument;
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
nsIContent* aRootContent=nsnull);
|
||||
nsContentList(nsIDocument *aDocument,
|
||||
nsContentListMatchFunc aFunc,
|
||||
void* aData,
|
||||
const nsString* aData,
|
||||
nsIContent* aRootContent=nsnull);
|
||||
virtual ~nsContentList();
|
||||
|
||||
@@ -133,10 +133,10 @@ protected:
|
||||
nsIAtom* mMatchAtom;
|
||||
PRInt32 mMatchNameSpaceId;
|
||||
nsContentListMatchFunc mFunc;
|
||||
void* mData;
|
||||
nsString* mData;
|
||||
nsVoidArray mContent;
|
||||
void *mScriptObject;
|
||||
nsIDocument *mDocument;
|
||||
nsIDocument* mDocument;
|
||||
nsIContent* mRootContent;
|
||||
PRBool mMatchAll;
|
||||
};
|
||||
|
||||
@@ -1073,7 +1073,7 @@ nsHTMLDocument::GetApplets(nsIDOMHTMLCollection** aApplets)
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHTMLDocument::MatchLinks(nsIContent *aContent, void* aData)
|
||||
nsHTMLDocument::MatchLinks(nsIContent *aContent, nsString* aData)
|
||||
{
|
||||
nsIAtom *name;
|
||||
aContent->GetTag(name);
|
||||
@@ -1108,7 +1108,7 @@ nsHTMLDocument::GetLinks(nsIDOMHTMLCollection** aLinks)
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHTMLDocument::MatchAnchors(nsIContent *aContent, void* aData)
|
||||
nsHTMLDocument::MatchAnchors(nsIContent *aContent, nsString* aData)
|
||||
{
|
||||
nsIAtom *name;
|
||||
aContent->GetTag(name);
|
||||
@@ -1358,16 +1358,15 @@ nsHTMLDocument::GetElementById(const nsString& aElementId, nsIDOMElement** aRetu
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHTMLDocument::MatchNameAttribute(nsIContent* aContent, void* aData)
|
||||
nsHTMLDocument::MatchNameAttribute(nsIContent* aContent, nsString* aData)
|
||||
{
|
||||
nsresult result;
|
||||
nsAutoString name;
|
||||
char* matchName = (char*)aData;
|
||||
|
||||
result = aContent->GetAttribute(kNameSpaceID_None,
|
||||
nsHTMLAtoms::name,
|
||||
name);
|
||||
if ((result == NS_OK) && name.Equals(matchName)) {
|
||||
if ((result == NS_OK) && (nsnull != aData) && name.Equals(*aData)) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
else {
|
||||
@@ -1379,10 +1378,9 @@ NS_IMETHODIMP
|
||||
nsHTMLDocument::GetElementsByName(const nsString& aElementName,
|
||||
nsIDOMNodeList** aReturn)
|
||||
{
|
||||
char* name = aElementName.ToNewCString();
|
||||
nsContentList* elements = new nsContentList(this,
|
||||
MatchNameAttribute,
|
||||
name);
|
||||
&aElementName);
|
||||
if (nsnull == elements) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@@ -163,9 +163,9 @@ protected:
|
||||
nsIContent *MatchName(nsIContent *aContent, const nsString& aName);
|
||||
|
||||
virtual void InternalAddStyleSheet(nsIStyleSheet* aSheet);
|
||||
static PRBool MatchLinks(nsIContent *aContent, void* aData);
|
||||
static PRBool MatchAnchors(nsIContent *aContent, void* aData);
|
||||
static PRBool MatchNameAttribute(nsIContent* aContent, void* aData);
|
||||
static PRBool MatchLinks(nsIContent *aContent, nsString* aData);
|
||||
static PRBool MatchAnchors(nsIContent *aContent, nsString* aData);
|
||||
static PRBool MatchNameAttribute(nsIContent* aContent, nsString* aData);
|
||||
|
||||
PRBool GetBodyContent();
|
||||
nsresult GetBodyElement(nsIDOMHTMLBodyElement** aBody);
|
||||
|
||||
Reference in New Issue
Block a user