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); }