diff options
author | Steven Bennetts <steve@lindenlab.com> | 2008-06-26 00:39:00 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2008-06-26 00:39:00 +0000 |
commit | 25c10ed028da5c547b11f1f461916897272b0e6d (patch) | |
tree | 350a5858f8970b6e28b2dc395625d74d8bd597b2 /indra/llcommon/u64.cpp | |
parent | 6dd125d375b38455997a0c4b8747659f4c2351aa (diff) |
QAR-628 merge string-cleanup-5 -r 90476:90508 -> release
dataserver-is-deprecated
Diffstat (limited to 'indra/llcommon/u64.cpp')
-rw-r--r-- | indra/llcommon/u64.cpp | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/indra/llcommon/u64.cpp b/indra/llcommon/u64.cpp index f3422770ae..b23c74b79e 100644 --- a/indra/llcommon/u64.cpp +++ b/indra/llcommon/u64.cpp @@ -34,10 +34,10 @@ #include "u64.h" -U64 str_to_U64(const char *str) +U64 str_to_U64(const std::string& str) { U64 result = 0; - const char *aptr = strpbrk(str,"0123456789"); + const char *aptr = strpbrk(str.c_str(),"0123456789"); if (!aptr) { @@ -54,8 +54,9 @@ U64 str_to_U64(const char *str) } -char* U64_to_str(U64 value, char* result, S32 result_size) -{ +std::string U64_to_str(U64 value) +{ + std::string res; U32 part1,part2,part3; part3 = (U32)(value % (U64)10000000); @@ -70,31 +71,26 @@ char* U64_to_str(U64 value, char* result, S32 result_size) if (part1) { - snprintf( /* Flawfinder: ignore */ - result, - result_size, - "%u%07u%07u", - part1,part2,part3); + res = llformat("%u%07u%07u",part1,part2,part3); } else if (part2) { - snprintf( /* Flawfinder: ignore */ - result, - result_size, - "%u%07u", - part2,part3); + res = llformat("%u%07u",part2,part3); } else { - snprintf( /* Flawfinder: ignore */ - result, - result_size, - "%u", - part3); + res = llformat("%u",part3); } - return (result); + return res; } +char* U64_to_str(U64 value, char* result, S32 result_size) +{ + std::string res = U64_to_str(value); + LLStringUtil::copy(result, res.c_str(), result_size); + return result; +} + F64 U64_to_F64(const U64 value) { S64 top_bits = (S64)(value >> 1); |