Bug 461047 follow-up patch - Fix a number of small issues from the nsStringArray to nsTArray<nsString> switchover, mostly related to signed vs unsigned array sizes. r+sr=roc

This commit is contained in:
Daniel Holbert 2009-02-10 12:39:43 -08:00
parent f6229466f3
commit f8f9766310
6 changed files with 15 additions and 14 deletions

View file

@ -172,7 +172,7 @@ nsNameList::ContainsNS(const nsAString& aNamespaceURI, const nsAString& aName,
PRBool *aResult) PRBool *aResult)
{ {
PRUint32 index = mNames.IndexOf(aName); PRUint32 index = mNames.IndexOf(aName);
if (index != PRUint32(-1)) { if (index != mNames.NoIndex) {
*aResult = mNamespaceURIs[index].Equals(aNamespaceURI); *aResult = mNamespaceURIs[index].Equals(aNamespaceURI);
} }
else { else {

View file

@ -58,7 +58,6 @@
#include "nsDoubleHashtable.h" #include "nsDoubleHashtable.h"
#include "nsString.h" #include "nsString.h"
#include "nsVoidArray.h" #include "nsVoidArray.h"
#include "nsTArray.h"
#include "txCore.h" #include "txCore.h"
#include "nsAutoPtr.h" #include "nsAutoPtr.h"
@ -423,7 +422,7 @@ public:
"called without matching shutdown()"); "called without matching shutdown()");
if (mNamespaces) if (mNamespaces)
return MB_TRUE; return MB_TRUE;
mNamespaces = new nsTArray<nsString>(); mNamespaces = new nsStringArray();
if (!mNamespaces) if (!mNamespaces)
return MB_FALSE; return MB_FALSE;
/* /*
@ -453,10 +452,10 @@ public:
} }
private: private:
static nsTArray<nsString>* mNamespaces; static nsStringArray* mNamespaces;
}; };
#define TX_IMPL_DOM_STATICS \ #define TX_IMPL_DOM_STATICS \
nsTArray<nsString>* txStandaloneNamespaceManager::mNamespaces = 0 nsStringArray* txStandaloneNamespaceManager::mNamespaces = 0
#endif #endif

View file

@ -254,7 +254,7 @@ nsresult NodeDefinition::getBaseURI(nsAString& aURI)
while (count > 0) { while (count > 0) {
nsAutoString dest; nsAutoString dest;
URIUtils::resolveHref(*baseUrls[--count], aURI, dest); URIUtils::resolveHref(baseUrls[--count], aURI, dest);
aURI = dest; aURI = dest;
} }
} }

View file

@ -3727,9 +3727,9 @@ nsresult
nsHTMLEditor::RemoveStyleSheetFromList(const nsAString &aURL) nsHTMLEditor::RemoveStyleSheetFromList(const nsAString &aURL)
{ {
// is it already in the list? // is it already in the list?
PRInt32 foundIndex; PRUint32 foundIndex;
foundIndex = mStyleSheetURLs.IndexOf(aURL); foundIndex = mStyleSheetURLs.IndexOf(aURL);
if (foundIndex < 0) if (foundIndex == mStyleSheetURLs.NoIndex)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
// Attempt both removals; if one fails there's not much we can do. // Attempt both removals; if one fails there's not much we can do.
@ -3749,9 +3749,9 @@ nsHTMLEditor::GetStyleSheetForURL(const nsAString &aURL,
*aStyleSheet = 0; *aStyleSheet = 0;
// is it already in the list? // is it already in the list?
PRInt32 foundIndex; PRUint32 foundIndex;
foundIndex = mStyleSheetURLs.IndexOf(aURL); foundIndex = mStyleSheetURLs.IndexOf(aURL);
if (foundIndex < 0) if (foundIndex == mStyleSheetURLs.NoIndex)
return NS_OK; //No sheet -- don't fail! return NS_OK; //No sheet -- don't fail!
*aStyleSheet = mStyleSheets[foundIndex]; *aStyleSheet = mStyleSheets[foundIndex];
@ -3771,6 +3771,8 @@ nsHTMLEditor::GetURLForStyleSheet(nsICSSStyleSheet *aStyleSheet,
PRInt32 foundIndex = mStyleSheets.IndexOf(aStyleSheet); PRInt32 foundIndex = mStyleSheets.IndexOf(aStyleSheet);
// Don't fail if we don't find it in our list // Don't fail if we don't find it in our list
// Note: mStyleSheets is nsCOMArray, so its IndexOf() method
// returns -1 on failure.
if (foundIndex == -1) if (foundIndex == -1)
return NS_OK; return NS_OK;

View file

@ -166,7 +166,7 @@ NS_IMETHODIMP
nsCommandLine::RemoveArguments(PRInt32 aStart, PRInt32 aEnd) nsCommandLine::RemoveArguments(PRInt32 aStart, PRInt32 aEnd)
{ {
NS_ENSURE_ARG_MIN(aStart, 0); NS_ENSURE_ARG_MIN(aStart, 0);
NS_ENSURE_ARG_MAX(aEnd, mArgs.Length() - 1); NS_ENSURE_ARG_MAX(aEnd + 1, mArgs.Length());
for (PRInt32 i = aEnd; i >= aStart; --i) { for (PRInt32 i = aEnd; i >= aStart; --i) {
mArgs.RemoveElementAt(i); mArgs.RemoveElementAt(i);

View file

@ -125,8 +125,8 @@ NSView* nsFilePicker::GetAccessoryView()
// set up popup button // set up popup button
NSPopUpButton* popupButton = [[[NSPopUpButton alloc] initWithFrame:NSMakeRect(0, 0, 0, 0) pullsDown:NO] autorelease]; NSPopUpButton* popupButton = [[[NSPopUpButton alloc] initWithFrame:NSMakeRect(0, 0, 0, 0) pullsDown:NO] autorelease];
PRInt32 numMenuItems = mTitles.Length(); PRUint32 numMenuItems = mTitles.Length();
for (int i = 0; i < numMenuItems; i++) { for (PRUint32 i = 0; i < numMenuItems; i++) {
const nsString& currentTitle = mTitles[i]; const nsString& currentTitle = mTitles[i];
NSString *titleString; NSString *titleString;
if (currentTitle.IsEmpty()) { if (currentTitle.IsEmpty()) {
@ -423,7 +423,7 @@ nsFilePicker::GenerateFilterList()
NSMutableString *giantFilterString = [[[NSMutableString alloc] initWithString:@""] autorelease]; NSMutableString *giantFilterString = [[[NSMutableString alloc] initWithString:@""] autorelease];
// Loop through each of the filter strings // Loop through each of the filter strings
for (PRInt32 loop = 0; PRInt32(loop < mFilters.Length()); loop++) { for (PRUint32 loop = 0; loop < mFilters.Length(); loop++) {
const nsString& filterWide = mFilters[loop]; const nsString& filterWide = mFilters[loop];
// separate individual filters // separate individual filters