Commit b9c53d8d by Yuly Novikov Committed by Commit Bot

Remove FormatString

And the global static it uses. BUG=angleproject:1644 Change-Id: I6c8b186ef0dce83fe64620729af4d87ea81c77f5 Reviewed-on: https://chromium-review.googlesource.com/577922Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
parent 0d2ecb4e
...@@ -42,20 +42,3 @@ size_t FormatStringIntoVector(const char *fmt, va_list vararg, std::vector<char> ...@@ -42,20 +42,3 @@ size_t FormatStringIntoVector(const char *fmt, va_list vararg, std::vector<char>
ASSERT(len >= 0); ASSERT(len >= 0);
return static_cast<size_t>(len); return static_cast<size_t>(len);
} }
std::string FormatString(const char *fmt, va_list vararg)
{
static std::vector<char> buffer(512);
size_t len = FormatStringIntoVector(fmt, vararg, buffer);
return std::string(&buffer[0], len);
}
std::string FormatString(const char *fmt, ...)
{
va_list vararg;
va_start(vararg, fmt);
std::string result = FormatString(fmt, vararg);
va_end(vararg);
return result;
}
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#include "libANGLE/renderer/d3d/HLSLCompiler.h" #include "libANGLE/renderer/d3d/HLSLCompiler.h"
#include <sstream>
#include "common/utilities.h" #include "common/utilities.h"
#include "libANGLE/Program.h" #include "libANGLE/Program.h"
#include "libANGLE/features.h" #include "libANGLE/features.h"
...@@ -190,7 +192,9 @@ gl::Error HLSLCompiler::compileToBinary(gl::InfoLog &infoLog, const std::string ...@@ -190,7 +192,9 @@ gl::Error HLSLCompiler::compileToBinary(gl::InfoLog &infoLog, const std::string
if (gl::DebugAnnotationsActive()) if (gl::DebugAnnotationsActive())
{ {
std::string sourcePath = getTempPath(); std::string sourcePath = getTempPath();
std::string sourceText = FormatString("#line 2 \"%s\"\n\n%s", sourcePath.c_str(), hlsl.c_str()); std::ostringstream stream;
stream << "#line 2 \"" << sourcePath << "\"\n\n" << hlsl;
std::string sourceText = stream.str();
writeFile(sourcePath.c_str(), sourceText.c_str(), sourceText.size()); writeFile(sourcePath.c_str(), sourceText.c_str(), sourceText.size());
} }
#endif #endif
......
...@@ -104,7 +104,10 @@ egl::Error DisplayWGL::initialize(egl::Display *display) ...@@ -104,7 +104,10 @@ egl::Error DisplayWGL::initialize(egl::Display *display)
// Work around compile error from not defining "UNICODE" while Chromium does // Work around compile error from not defining "UNICODE" while Chromium does
const LPSTR idcArrow = MAKEINTRESOURCEA(32512); const LPSTR idcArrow = MAKEINTRESOURCEA(32512);
std::string className = FormatString("ANGLE DisplayWGL 0x%0.8p Intermediate Window Class", mDisplay); std::ostringstream stream;
stream << "ANGLE DisplayWGL " << std::internal << std::setw(10) << std::setfill('0') << mDisplay
<< " Intermediate Window Class";
std::string className = stream.str();
WNDCLASSA intermediateClassDesc = { 0 }; WNDCLASSA intermediateClassDesc = { 0 };
intermediateClassDesc.style = CS_OWNDC; intermediateClassDesc.style = CS_OWNDC;
......
...@@ -41,11 +41,6 @@ namespace base ...@@ -41,11 +41,6 @@ namespace base
using angle::SplitStringAlongWhitespace; using angle::SplitStringAlongWhitespace;
using angle::HexStringToUInt; using angle::HexStringToUInt;
using angle::ReadFileToString; using angle::ReadFileToString;
// StringPrintf is called differently in ANGLE but using cannot change
// the name of the imported function. Use a define to change the name.
using ::FormatString;
#define StringPrintf FormatString
} }
// TODO(jmadill): other platforms // TODO(jmadill): other platforms
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "gpu_test_expectations_parser.h" #include "gpu_test_expectations_parser.h"
#include <sstream>
#include "common/angleutils.h" #include "common/angleutils.h"
namespace base { namespace base {
...@@ -558,20 +560,18 @@ bool GPUTestExpectationsParser::DetectConflictsBetweenEntries() { ...@@ -558,20 +560,18 @@ bool GPUTestExpectationsParser::DetectConflictsBetweenEntries() {
void GPUTestExpectationsParser::PushErrorMessage( void GPUTestExpectationsParser::PushErrorMessage(
const std::string& message, size_t line_number) { const std::string& message, size_t line_number) {
error_messages_.push_back( std::ostringstream stream;
base::StringPrintf("Line %d : %s", stream << "Line " << line_number << " : " << message;
static_cast<int>(line_number), message.c_str())); error_messages_.push_back(stream.str());
} }
void GPUTestExpectationsParser::PushErrorMessage( void GPUTestExpectationsParser::PushErrorMessage(
const std::string& message, const std::string& message,
size_t entry1_line_number, size_t entry1_line_number,
size_t entry2_line_number) { size_t entry2_line_number) {
error_messages_.push_back( std::ostringstream stream;
base::StringPrintf("Line %d and %d : %s", stream << "Line " << entry1_line_number << " and " << entry2_line_number << " : " << message;
static_cast<int>(entry1_line_number), error_messages_.push_back(stream.str());
static_cast<int>(entry2_line_number),
message.c_str()));
} }
GPUTestExpectationsParser:: GPUTestExpectationEntry::GPUTestExpectationEntry() GPUTestExpectationsParser:: GPUTestExpectationEntry::GPUTestExpectationEntry()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment