ICU-813 Fix for AIX and HP-UX

X-SVN-Rev: 13793
This commit is contained in:
George Rhoten 2003-11-21 00:10:52 +00:00
parent 9ded263c4a
commit 4f64d393b4
2 changed files with 9 additions and 4 deletions
icu4c/source/test/intltest

View file

@ -79,16 +79,19 @@ operator+(const UnicodeString& left,
}
UnicodeString
operator+(const UnicodeString& left,
int64_t num)
Int64ToUnicodeString(int64_t num)
{
char buffer[64]; // nos changed from 10 to 64
char danger = 'p'; // guard against overrunning the buffer (rtg)
#ifdef WIN32
sprintf(buffer, "%I64d", num);
#else
sprintf(buffer, "%lld", num);
#endif
assert(danger == 'p');
return left + buffer;
return buffer;
}
// [LIU] Just to get things working
@ -136,7 +139,7 @@ UnicodeString toString(const Formattable& f) {
break;
case Formattable::kInt64:
s = UnicodeString("[Int64:") + f.getInt64() + "]"; // TODO: UnicodeString append Int64?
s = UnicodeString("[Int64:") + Int64ToUnicodeString(f.getInt64()) + "]";
break;
case Formattable::kString:

View file

@ -26,6 +26,8 @@ U_NAMESPACE_USE
//convenience classes to ease porting code that uses the Java
//string-concatenation operator (moved from findword test by rtg)
UnicodeString UCharToUnicodeString(UChar c);
UnicodeString Int64ToUnicodeString(int64_t num);
//UnicodeString operator+(const UnicodeString& left, int64_t num); // Some compilers don't allow this because of the long type.
UnicodeString operator+(const UnicodeString& left, long num);
UnicodeString operator+(const UnicodeString& left, unsigned long num);
UnicodeString operator+(const UnicodeString& left, double num);