From 216c1ed489b654f8c760f1cabec936e9f6ca74bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Ma=C5=82ecki?= Date: Mon, 27 May 2024 08:06:12 +0200 Subject: [PATCH] Removed ostringstream use. Fixed C++03 problem with Ensure declaration --- apps/logsupport.cpp | 2 +- apps/uriparser.cpp | 2 +- srtcore/sfmt.h | 6 +++++- srtcore/utilities.h | 4 ++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/logsupport.cpp b/apps/logsupport.cpp index fbd70c47e..7192f4596 100644 --- a/apps/logsupport.cpp +++ b/apps/logsupport.cpp @@ -173,7 +173,7 @@ set SrtParseLogFA(string fa, set* punknown) void ParseLogFASpec(const vector& speclist, string& w_on, string& w_off) { - std::ostringstream son, soff; + fmt::obufstream son, soff; for (auto& s: speclist) { diff --git a/apps/uriparser.cpp b/apps/uriparser.cpp index 6b8c80713..47e8f6a7f 100644 --- a/apps/uriparser.cpp +++ b/apps/uriparser.cpp @@ -64,7 +64,7 @@ string UriParser::makeUri() prefix = m_proto + "://"; } - std::ostringstream out; + fmt::obufstream out; out << prefix << m_host; if ((m_port == "" || m_port == "0") && m_expect == EXPECT_FILE) diff --git a/srtcore/sfmt.h b/srtcore/sfmt.h index 367926bce..61bbd8914 100644 --- a/srtcore/sfmt.h +++ b/srtcore/sfmt.h @@ -242,7 +242,11 @@ struct Ensure template struct Ensure { - typename AnyType::wrong_condition v = AnyType::wrong_condition; + static void CheckIfCharsetNonEmpty() + { + typename AnyType::wrong_condition v = AnyType::wrong_condition; + (void)v; + } }; template inline diff --git a/srtcore/utilities.h b/srtcore/utilities.h index 697e43e08..b82beb76f 100644 --- a/srtcore/utilities.h +++ b/srtcore/utilities.h @@ -531,8 +531,8 @@ struct explicit_t // but this function has a different definition for C++11 and C++03. namespace srt_pair_op { - template - std::ostream& operator<<(std::ostream& s, const std::pair& v) + template + Stream& operator<<(Stream& s, const std::pair& v) { s << "{" << v.first << " " << v.second << "}"; return s;