diff options
| author | Rye <rye@alchemyviewer.org> | 2026-01-12 18:33:39 -0500 |
|---|---|---|
| committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2026-01-21 22:07:08 +0200 |
| commit | 0b2f7fcc6b67f629b41a804f77214d51497127a7 (patch) | |
| tree | 51fea32a1ec5566279e32c3223ce70e57ae87339 /indra/llcommon/llsd.cpp | |
| parent | 4de1ba776c60e935e8cf069c1aef104ee2b07559 (diff) | |
Address feedback from review
Move LLSD string->real conversion function to shared impl and utilize in xml parsing
Introducing additional error handling to menu init
Cleanup comments and trace tagging
Remove dead Memory menu entry
Diffstat (limited to 'indra/llcommon/llsd.cpp')
| -rw-r--r-- | indra/llcommon/llsd.cpp | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp index 6bc2841081..ce39bc7af3 100644 --- a/indra/llcommon/llsd.cpp +++ b/indra/llcommon/llsd.cpp @@ -351,18 +351,7 @@ namespace LLSD::Real ImplString::asReal() const { - F64 v = 0.0; - boost::iostreams::stream<boost::iostreams::array_source> i_stream(mValue.data(), mValue.size()); - i_stream >> v; - - // we would probably like to ignore all trailing whitespace as - // well, but for now, simply eat the next character, and make - // sure we reached the end of the string. - // *NOTE: gcc 2.95 does not generate an eof() event on the - // stream operation above, so we manually get here to force it - // across platforms. - int c = i_stream.get(); - return ((EOF ==c) ? v : 0.0); + return llsd::string_to_real(mValue); } @@ -1264,6 +1253,22 @@ LLSD::reverse_array_iterator LLSD::rendArray() { return makeArray(impl) namespace llsd { +LLSD::Real string_to_real(std::string_view in_string) +{ + LLSD::Real v = 0.0; + boost::iostreams::stream<boost::iostreams::array_source> i_stream(in_string.data(), in_string.size()); + i_stream >> v; + + // we would probably like to ignore all trailing whitespace as + // well, but for now, simply eat the next character, and make + // sure we reached the end of the string. + // *NOTE: gcc 2.95 does not generate an eof() event on the + // stream operation above, so we manually get here to force it + // across platforms. + int c = i_stream.get(); + return ((EOF == c) ? v : 0.0); +} + U32 allocationCount() { return LLSD::Impl::sAllocationCount; } U32 outstandingCount() { return LLSD::Impl::sOutstandingCount; } |
