From 03b7c238c384934f3d7bb411bb94db06fa5af9c3 Mon Sep 17 00:00:00 2001 From: "rickg%netscape.com" Date: Mon, 20 Sep 1999 05:50:43 +0000 Subject: [PATCH] back out update to Append(int,radix) until I can find ltoa() on linux git-svn-id: svn://10.0.0.236/trunk@48325 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/string/obsolete/nsString.cpp | 15 +++++++++++++++ mozilla/string/obsolete/nsString2.cpp | 17 ++++++++++++++++- mozilla/xpcom/ds/nsString.cpp | 15 +++++++++++++++ mozilla/xpcom/ds/nsString2.cpp | 17 ++++++++++++++++- mozilla/xpcom/string/obsolete/nsString.cpp | 15 +++++++++++++++ mozilla/xpcom/string/obsolete/nsString2.cpp | 17 ++++++++++++++++- 6 files changed, 93 insertions(+), 3 deletions(-) diff --git a/mozilla/string/obsolete/nsString.cpp b/mozilla/string/obsolete/nsString.cpp index 4c746be8d77..8d361c2d1d8 100644 --- a/mozilla/string/obsolete/nsString.cpp +++ b/mozilla/string/obsolete/nsString.cpp @@ -953,6 +953,8 @@ nsCString& nsCString::Append(char aChar) { * @return */ nsCString& nsCString::Append(PRInt32 aInteger,PRInt32 aRadix) { + +#if 0 char buf[128]={0,0}; char* buffer=buf; @@ -974,6 +976,19 @@ nsCString& nsCString::Append(PRInt32 aInteger,PRInt32 aRadix) { buf[len] = "0123456789abcdefghijklmnopqrstuvwxyz"[(int)r.rem]; buf[len+1] =0; +#endif + + char* fmt = "%d"; + if (8 == aRadix) { + fmt = "%o"; + } else if (16 == aRadix) { + fmt = "%x"; + } + char buf[40]; + // *** XX UNCOMMENT THIS LINE + //PR_snprintf(buf, sizeof(buf), fmt, aInteger); + sprintf(buf,fmt,aInteger); + return Append(buf); } diff --git a/mozilla/string/obsolete/nsString2.cpp b/mozilla/string/obsolete/nsString2.cpp index b2497ab52bd..0d91c8c35af 100644 --- a/mozilla/string/obsolete/nsString2.cpp +++ b/mozilla/string/obsolete/nsString2.cpp @@ -1125,6 +1125,8 @@ nsString& nsString::Append(PRUnichar aChar) { * @return */ nsString& nsString::Append(PRInt32 aInteger,PRInt32 aRadix) { + +#if 0 char buf[128]={0,0}; char* buffer=buf; @@ -1145,7 +1147,20 @@ nsString& nsString::Append(PRInt32 aInteger,PRInt32 aRadix) { int len=strlen(buffer); buf[len] = "0123456789abcdefghijklmnopqrstuvwxyz"[(int)r.rem]; buf[len+1] =0; - + +#endif + + char* fmt = "%d"; + if (8 == aRadix) { + fmt = "%o"; + } else if (16 == aRadix) { + fmt = "%x"; + } + char buf[40]; + // *** XX UNCOMMENT THIS LINE + //PR_snprintf(buf, sizeof(buf), fmt, aInteger); + sprintf(buf,fmt,aInteger); + return Append(buf); } diff --git a/mozilla/xpcom/ds/nsString.cpp b/mozilla/xpcom/ds/nsString.cpp index 4c746be8d77..8d361c2d1d8 100644 --- a/mozilla/xpcom/ds/nsString.cpp +++ b/mozilla/xpcom/ds/nsString.cpp @@ -953,6 +953,8 @@ nsCString& nsCString::Append(char aChar) { * @return */ nsCString& nsCString::Append(PRInt32 aInteger,PRInt32 aRadix) { + +#if 0 char buf[128]={0,0}; char* buffer=buf; @@ -974,6 +976,19 @@ nsCString& nsCString::Append(PRInt32 aInteger,PRInt32 aRadix) { buf[len] = "0123456789abcdefghijklmnopqrstuvwxyz"[(int)r.rem]; buf[len+1] =0; +#endif + + char* fmt = "%d"; + if (8 == aRadix) { + fmt = "%o"; + } else if (16 == aRadix) { + fmt = "%x"; + } + char buf[40]; + // *** XX UNCOMMENT THIS LINE + //PR_snprintf(buf, sizeof(buf), fmt, aInteger); + sprintf(buf,fmt,aInteger); + return Append(buf); } diff --git a/mozilla/xpcom/ds/nsString2.cpp b/mozilla/xpcom/ds/nsString2.cpp index b2497ab52bd..0d91c8c35af 100644 --- a/mozilla/xpcom/ds/nsString2.cpp +++ b/mozilla/xpcom/ds/nsString2.cpp @@ -1125,6 +1125,8 @@ nsString& nsString::Append(PRUnichar aChar) { * @return */ nsString& nsString::Append(PRInt32 aInteger,PRInt32 aRadix) { + +#if 0 char buf[128]={0,0}; char* buffer=buf; @@ -1145,7 +1147,20 @@ nsString& nsString::Append(PRInt32 aInteger,PRInt32 aRadix) { int len=strlen(buffer); buf[len] = "0123456789abcdefghijklmnopqrstuvwxyz"[(int)r.rem]; buf[len+1] =0; - + +#endif + + char* fmt = "%d"; + if (8 == aRadix) { + fmt = "%o"; + } else if (16 == aRadix) { + fmt = "%x"; + } + char buf[40]; + // *** XX UNCOMMENT THIS LINE + //PR_snprintf(buf, sizeof(buf), fmt, aInteger); + sprintf(buf,fmt,aInteger); + return Append(buf); } diff --git a/mozilla/xpcom/string/obsolete/nsString.cpp b/mozilla/xpcom/string/obsolete/nsString.cpp index 4c746be8d77..8d361c2d1d8 100644 --- a/mozilla/xpcom/string/obsolete/nsString.cpp +++ b/mozilla/xpcom/string/obsolete/nsString.cpp @@ -953,6 +953,8 @@ nsCString& nsCString::Append(char aChar) { * @return */ nsCString& nsCString::Append(PRInt32 aInteger,PRInt32 aRadix) { + +#if 0 char buf[128]={0,0}; char* buffer=buf; @@ -974,6 +976,19 @@ nsCString& nsCString::Append(PRInt32 aInteger,PRInt32 aRadix) { buf[len] = "0123456789abcdefghijklmnopqrstuvwxyz"[(int)r.rem]; buf[len+1] =0; +#endif + + char* fmt = "%d"; + if (8 == aRadix) { + fmt = "%o"; + } else if (16 == aRadix) { + fmt = "%x"; + } + char buf[40]; + // *** XX UNCOMMENT THIS LINE + //PR_snprintf(buf, sizeof(buf), fmt, aInteger); + sprintf(buf,fmt,aInteger); + return Append(buf); } diff --git a/mozilla/xpcom/string/obsolete/nsString2.cpp b/mozilla/xpcom/string/obsolete/nsString2.cpp index b2497ab52bd..0d91c8c35af 100644 --- a/mozilla/xpcom/string/obsolete/nsString2.cpp +++ b/mozilla/xpcom/string/obsolete/nsString2.cpp @@ -1125,6 +1125,8 @@ nsString& nsString::Append(PRUnichar aChar) { * @return */ nsString& nsString::Append(PRInt32 aInteger,PRInt32 aRadix) { + +#if 0 char buf[128]={0,0}; char* buffer=buf; @@ -1145,7 +1147,20 @@ nsString& nsString::Append(PRInt32 aInteger,PRInt32 aRadix) { int len=strlen(buffer); buf[len] = "0123456789abcdefghijklmnopqrstuvwxyz"[(int)r.rem]; buf[len+1] =0; - + +#endif + + char* fmt = "%d"; + if (8 == aRadix) { + fmt = "%o"; + } else if (16 == aRadix) { + fmt = "%x"; + } + char buf[40]; + // *** XX UNCOMMENT THIS LINE + //PR_snprintf(buf, sizeof(buf), fmt, aInteger); + sprintf(buf,fmt,aInteger); + return Append(buf); }