Skip to content
Snippets Groups Projects
Commit 192e6915 authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Fix broken usage of absl::format exposed by clang

parent b75d18df
No related branches found
No related tags found
No related merge requests found
......@@ -1230,7 +1230,14 @@ void LLSDFormatter::boolalpha(bool alpha)
void LLSDFormatter::realFormat(const std::string& format)
{
mRealFormat = format;
if(!format.empty())
{
mRealFormat = absl::ParsedFormat<absl::FormatConversionCharSet::kFloating>::New(format);
if(!mRealFormat)
{
LL_WARNS() << "Invalid real format spec: " << format << LL_ENDL;
}
}
}
S32 LLSDFormatter::format(const LLSD& data, std::ostream& ostr) const
......@@ -1246,7 +1253,7 @@ S32 LLSDFormatter::format(const LLSD& data, std::ostream& ostr, EFormatterOption
void LLSDFormatter::formatReal(LLSD::Real real, std::ostream& ostr) const
{
ostr << absl::StreamFormat(mRealFormat.c_str(), real);
ostr << absl::StreamFormat(*mRealFormat, real);
}
/**
......@@ -1354,7 +1361,7 @@ S32 LLSDNotationFormatter::format_impl(const LLSD& data, std::ostream& ostr,
case LLSD::TypeReal:
ostr << "r";
if(mRealFormat.empty())
if(!mRealFormat)
{
ostr << data.asReal();
}
......
......@@ -34,6 +34,8 @@
#include "llrefcount.h"
#include "llsd.h"
#include "absl/strings/str_format.h"
/**
* @class LLSDParser
* @brief Abstract base class for LLSD parsers.
......@@ -500,7 +502,7 @@ class LL_COMMON_API LLSDFormatter : public LLRefCount
void formatReal(LLSD::Real real, std::ostream& ostr) const;
bool mBoolAlpha;
std::string mRealFormat;
std::unique_ptr<absl::ParsedFormat<absl::FormatConversionCharSet::kFloating> > mRealFormat;
EFormatterOptions mOptions;
};
......
......@@ -150,7 +150,7 @@ S32 LLSDXMLFormatter::format_impl(const LLSD& data, std::ostream& ostr,
case LLSD::TypeReal:
ostr << pre << "<real>";
if(mRealFormat.empty())
if(!mRealFormat)
{
ostr << data.asReal();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment