replaced some `std::ostringstream` usage with `std::to_string()` (#4719)

This commit is contained in:
Oliver Stöneberg 2023-01-16 22:05:33 +01:00 committed by GitHub
parent a102ff3c2f
commit 124668979c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 20 deletions

View File

@ -272,9 +272,7 @@ unsigned int ProcessExecutor::check()
resultOfCheck = fileChecker.check(iFile->first); resultOfCheck = fileChecker.check(iFile->first);
} }
std::ostringstream oss; pipewriter.writeEnd(std::to_string(resultOfCheck));
oss << resultOfCheck;
pipewriter.writeEnd(oss.str());
std::exit(EXIT_SUCCESS); std::exit(EXIT_SUCCESS);
} }

View File

@ -32,7 +32,6 @@
#include <iostream> #include <iostream>
#include <map> #include <map>
#include <memory> #include <memory>
#include <sstream> // IWYU pragma: keep
#include <stack> #include <stack>
#include <utility> #include <utility>
@ -2422,9 +2421,7 @@ void TemplateSimplifier::simplifyTemplateArgs(Token *start, Token *end)
tok->deleteNext(); tok->deleteNext();
tok->deleteThis(); tok->deleteThis();
tok->deleteNext(); tok->deleteNext();
std::ostringstream sz; tok->str(std::to_string(1));
sz << 1;
tok->str(sz.str());
again = true; again = true;
} }
@ -2433,9 +2430,7 @@ void TemplateSimplifier::simplifyTemplateArgs(Token *start, Token *end)
tok->deleteNext(); tok->deleteNext();
tok->deleteThis(); tok->deleteThis();
tok->deleteNext(); tok->deleteNext();
std::ostringstream ostr; tok->str(std::to_string(Token::getStrLength(tok) + 1));
ostr << (Token::getStrLength(tok) + 1);
tok->str(ostr.str());
again = true; again = true;
} }

View File

@ -213,11 +213,7 @@ bool TestFixture::assertEquals(const char * const filename, const unsigned int l
bool TestFixture::assertEquals(const char * const filename, const unsigned int linenr, const long long expected, const long long actual, const std::string &msg) const bool TestFixture::assertEquals(const char * const filename, const unsigned int linenr, const long long expected, const long long actual, const std::string &msg) const
{ {
if (expected != actual) { if (expected != actual) {
std::ostringstream ostr1; assertEquals(filename, linenr, std::to_string(expected), std::to_string(actual), msg);
ostr1 << expected;
std::ostringstream ostr2;
ostr2 << actual;
assertEquals(filename, linenr, ostr1.str(), ostr2.str(), msg);
} }
return expected == actual; return expected == actual;
} }
@ -260,11 +256,7 @@ void TestFixture::todoAssertEquals(const char* const filename, const unsigned in
void TestFixture::todoAssertEquals(const char * const filename, const unsigned int linenr, const long long wanted, const long long current, const long long actual) const void TestFixture::todoAssertEquals(const char * const filename, const unsigned int linenr, const long long wanted, const long long current, const long long actual) const
{ {
std::ostringstream wantedStr, currentStr, actualStr; todoAssertEquals(filename, linenr, std::to_string(wanted), std::to_string(current), std::to_string(actual));
wantedStr << wanted;
currentStr << current;
actualStr << actual;
todoAssertEquals(filename, linenr, wantedStr.str(), currentStr.str(), actualStr.str());
} }
void TestFixture::assertThrow(const char * const filename, const unsigned int linenr) const void TestFixture::assertThrow(const char * const filename, const unsigned int linenr) const