From aaaf38083e9fbc0b1fb5bb64cba9227743966a04 Mon Sep 17 00:00:00 2001 From: "rickg%netscape.com" Date: Fri, 15 Jan 1999 19:20:51 +0000 Subject: [PATCH] exposed objectAt in deque, and fixed toInteger bug git-svn-id: svn://10.0.0.236/trunk@17859 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/base/src/nsDeque.cpp | 2 +- mozilla/base/src/nsDeque.h | 21 ++++++++++----------- mozilla/base/src/nsString.cpp | 7 ++++++- mozilla/string/obsolete/nsString.cpp | 7 ++++++- mozilla/xpcom/ds/nsDeque.cpp | 2 +- mozilla/xpcom/ds/nsDeque.h | 21 ++++++++++----------- mozilla/xpcom/ds/nsString.cpp | 7 ++++++- mozilla/xpcom/string/obsolete/nsString.cpp | 7 ++++++- 8 files changed, 46 insertions(+), 28 deletions(-) diff --git a/mozilla/base/src/nsDeque.cpp b/mozilla/base/src/nsDeque.cpp index 8be672a91e3..3124f7ab017 100644 --- a/mozilla/base/src/nsDeque.cpp +++ b/mozilla/base/src/nsDeque.cpp @@ -16,7 +16,7 @@ * Reserved. */ - + #include "nsDeque.h" #include "nsCRT.h" diff --git a/mozilla/base/src/nsDeque.h b/mozilla/base/src/nsDeque.h index 3f8269368b6..01add17a223 100644 --- a/mozilla/base/src/nsDeque.h +++ b/mozilla/base/src/nsDeque.h @@ -131,6 +131,16 @@ friend class nsDequeIterator; */ void* Peek(void); + /** + * method used to retrieve ptr to + * ith member in container. DOesn't remove + * that item. + * + * @update gess4/18/98 + * @param index of desired item + * @return ptr to ith element in list + */ + void* ObjectAt(int anIndex) const; /** * Remove all items from container without destroying them @@ -240,17 +250,6 @@ private: */ nsDeque& operator=(const nsDeque& anOther); - /** - * PRIVATE method used to retrieve ptr to - * ith member in container. DOesn't remove - * that item. - * - * @update gess4/18/98 - * @param index of desired item - * @return ptr to ith element in list - */ - void* ObjectAt(int anIndex) const; - }; /****************************************************** diff --git a/mozilla/base/src/nsString.cpp b/mozilla/base/src/nsString.cpp index 0b7b83e393b..044f0c8d414 100644 --- a/mozilla/base/src/nsString.cpp +++ b/mozilla/base/src/nsString.cpp @@ -664,7 +664,10 @@ PRInt32 nsString::ToInteger(PRInt32* aErrorCode,PRInt32 aRadix) const { result=-result; break; } - else if('+'==theChar) { + else if('+'==theChar) { //stop in a good state if you see this... + break; + } + else if(' '==theChar){ //stop in a good state if you see this... break; } else{ @@ -2066,9 +2069,11 @@ void nsString::SelfTest(void) { nsAutoString a("foobar"); nsAutoString b("foo"); nsAutoString c(".5111"); + nsAutoString d(" 5"); PRInt32 result=a.Compare(b); PRInt32 result2=result; result=c.ToInteger(&result2); + result=d.ToInteger(&result2); result2=result; #if 0 diff --git a/mozilla/string/obsolete/nsString.cpp b/mozilla/string/obsolete/nsString.cpp index 0b7b83e393b..044f0c8d414 100644 --- a/mozilla/string/obsolete/nsString.cpp +++ b/mozilla/string/obsolete/nsString.cpp @@ -664,7 +664,10 @@ PRInt32 nsString::ToInteger(PRInt32* aErrorCode,PRInt32 aRadix) const { result=-result; break; } - else if('+'==theChar) { + else if('+'==theChar) { //stop in a good state if you see this... + break; + } + else if(' '==theChar){ //stop in a good state if you see this... break; } else{ @@ -2066,9 +2069,11 @@ void nsString::SelfTest(void) { nsAutoString a("foobar"); nsAutoString b("foo"); nsAutoString c(".5111"); + nsAutoString d(" 5"); PRInt32 result=a.Compare(b); PRInt32 result2=result; result=c.ToInteger(&result2); + result=d.ToInteger(&result2); result2=result; #if 0 diff --git a/mozilla/xpcom/ds/nsDeque.cpp b/mozilla/xpcom/ds/nsDeque.cpp index 8be672a91e3..3124f7ab017 100644 --- a/mozilla/xpcom/ds/nsDeque.cpp +++ b/mozilla/xpcom/ds/nsDeque.cpp @@ -16,7 +16,7 @@ * Reserved. */ - + #include "nsDeque.h" #include "nsCRT.h" diff --git a/mozilla/xpcom/ds/nsDeque.h b/mozilla/xpcom/ds/nsDeque.h index 3f8269368b6..01add17a223 100644 --- a/mozilla/xpcom/ds/nsDeque.h +++ b/mozilla/xpcom/ds/nsDeque.h @@ -131,6 +131,16 @@ friend class nsDequeIterator; */ void* Peek(void); + /** + * method used to retrieve ptr to + * ith member in container. DOesn't remove + * that item. + * + * @update gess4/18/98 + * @param index of desired item + * @return ptr to ith element in list + */ + void* ObjectAt(int anIndex) const; /** * Remove all items from container without destroying them @@ -240,17 +250,6 @@ private: */ nsDeque& operator=(const nsDeque& anOther); - /** - * PRIVATE method used to retrieve ptr to - * ith member in container. DOesn't remove - * that item. - * - * @update gess4/18/98 - * @param index of desired item - * @return ptr to ith element in list - */ - void* ObjectAt(int anIndex) const; - }; /****************************************************** diff --git a/mozilla/xpcom/ds/nsString.cpp b/mozilla/xpcom/ds/nsString.cpp index 0b7b83e393b..044f0c8d414 100644 --- a/mozilla/xpcom/ds/nsString.cpp +++ b/mozilla/xpcom/ds/nsString.cpp @@ -664,7 +664,10 @@ PRInt32 nsString::ToInteger(PRInt32* aErrorCode,PRInt32 aRadix) const { result=-result; break; } - else if('+'==theChar) { + else if('+'==theChar) { //stop in a good state if you see this... + break; + } + else if(' '==theChar){ //stop in a good state if you see this... break; } else{ @@ -2066,9 +2069,11 @@ void nsString::SelfTest(void) { nsAutoString a("foobar"); nsAutoString b("foo"); nsAutoString c(".5111"); + nsAutoString d(" 5"); PRInt32 result=a.Compare(b); PRInt32 result2=result; result=c.ToInteger(&result2); + result=d.ToInteger(&result2); result2=result; #if 0 diff --git a/mozilla/xpcom/string/obsolete/nsString.cpp b/mozilla/xpcom/string/obsolete/nsString.cpp index 0b7b83e393b..044f0c8d414 100644 --- a/mozilla/xpcom/string/obsolete/nsString.cpp +++ b/mozilla/xpcom/string/obsolete/nsString.cpp @@ -664,7 +664,10 @@ PRInt32 nsString::ToInteger(PRInt32* aErrorCode,PRInt32 aRadix) const { result=-result; break; } - else if('+'==theChar) { + else if('+'==theChar) { //stop in a good state if you see this... + break; + } + else if(' '==theChar){ //stop in a good state if you see this... break; } else{ @@ -2066,9 +2069,11 @@ void nsString::SelfTest(void) { nsAutoString a("foobar"); nsAutoString b("foo"); nsAutoString c(".5111"); + nsAutoString d(" 5"); PRInt32 result=a.Compare(b); PRInt32 result2=result; result=c.ToInteger(&result2); + result=d.ToInteger(&result2); result2=result; #if 0