diff options
Diffstat (limited to 'linden/indra/llcommon/u64.cpp')
-rw-r--r-- | linden/indra/llcommon/u64.cpp | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/linden/indra/llcommon/u64.cpp b/linden/indra/llcommon/u64.cpp index bbeed9f..5aebdb3 100644 --- a/linden/indra/llcommon/u64.cpp +++ b/linden/indra/llcommon/u64.cpp | |||
@@ -34,10 +34,10 @@ | |||
34 | #include "u64.h" | 34 | #include "u64.h" |
35 | 35 | ||
36 | 36 | ||
37 | U64 str_to_U64(const char *str) | 37 | U64 str_to_U64(const std::string& str) |
38 | { | 38 | { |
39 | U64 result = 0; | 39 | U64 result = 0; |
40 | const char *aptr = strpbrk(str,"0123456789"); | 40 | const char *aptr = strpbrk(str.c_str(),"0123456789"); |
41 | 41 | ||
42 | if (!aptr) | 42 | if (!aptr) |
43 | { | 43 | { |
@@ -54,8 +54,9 @@ U64 str_to_U64(const char *str) | |||
54 | } | 54 | } |
55 | 55 | ||
56 | 56 | ||
57 | char* U64_to_str(U64 value, char* result, S32 result_size) | 57 | std::string U64_to_str(U64 value) |
58 | { | 58 | { |
59 | std::string res; | ||
59 | U32 part1,part2,part3; | 60 | U32 part1,part2,part3; |
60 | 61 | ||
61 | part3 = (U32)(value % (U64)10000000); | 62 | part3 = (U32)(value % (U64)10000000); |
@@ -70,31 +71,26 @@ char* U64_to_str(U64 value, char* result, S32 result_size) | |||
70 | 71 | ||
71 | if (part1) | 72 | if (part1) |
72 | { | 73 | { |
73 | snprintf( /* Flawfinder: ignore */ | 74 | res = llformat("%u%07u%07u",part1,part2,part3); |
74 | result, | ||
75 | result_size, | ||
76 | "%u%07u%07u", | ||
77 | part1,part2,part3); | ||
78 | } | 75 | } |
79 | else if (part2) | 76 | else if (part2) |
80 | { | 77 | { |
81 | snprintf( /* Flawfinder: ignore */ | 78 | res = llformat("%u%07u",part2,part3); |
82 | result, | ||
83 | result_size, | ||
84 | "%u%07u", | ||
85 | part2,part3); | ||
86 | } | 79 | } |
87 | else | 80 | else |
88 | { | 81 | { |
89 | snprintf( /* Flawfinder: ignore */ | 82 | res = llformat("%u",part3); |
90 | result, | ||
91 | result_size, | ||
92 | "%u", | ||
93 | part3); | ||
94 | } | 83 | } |
95 | return (result); | 84 | return res; |
96 | } | 85 | } |
97 | 86 | ||
87 | char* U64_to_str(U64 value, char* result, S32 result_size) | ||
88 | { | ||
89 | std::string res = U64_to_str(value); | ||
90 | LLStringUtil::copy(result, res.c_str(), result_size); | ||
91 | return result; | ||
92 | } | ||
93 | |||
98 | F64 U64_to_F64(const U64 value) | 94 | F64 U64_to_F64(const U64 value) |
99 | { | 95 | { |
100 | S64 top_bits = (S64)(value >> 1); | 96 | S64 top_bits = (S64)(value >> 1); |