From 9464e805e16b212ccc6f8b81c96d1efbad14ef29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 22 Feb 2013 16:47:26 +0100 Subject: [PATCH] Use {} instead of "". Calls default std::string constructor instead of converting from const char*, might possibly save unneeded allocation. --- src/Math/Test/Matrix3Test.cpp | 2 +- src/Math/Test/Matrix4Test.cpp | 2 +- src/Math/Test/MatrixTest.cpp | 2 +- src/Math/Test/QuaternionTest.cpp | 6 +++--- src/Math/Test/RectangularMatrixTest.cpp | 2 +- src/Math/Test/VectorTest.cpp | 4 ++-- src/Mesh.cpp | 4 ++-- src/Physics/Test/AbstractShapeTest.cpp | 2 +- src/Platform/EglContextHandler.cpp | 2 +- src/Test/ColorTest.cpp | 2 +- src/Test/ResourceManagerTest.cpp | 2 +- src/Trade/AbstractImporter.h | 2 +- 12 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Math/Test/Matrix3Test.cpp b/src/Math/Test/Matrix3Test.cpp index 3ac4de620..2739fccf1 100644 --- a/src/Math/Test/Matrix3Test.cpp +++ b/src/Math/Test/Matrix3Test.cpp @@ -191,7 +191,7 @@ void Matrix3Test::invertedEuclidean() { CORRADE_COMPARE(m.invertedEuclidean(), Matrix3()); CORRADE_COMPARE(o.str(), "Math::Matrix3::invertedEuclidean(): unexpected values on last row\n"); - o.str(""); + o.str({}); CORRADE_COMPARE(Matrix3::scaling(Vector2(2.0f)).invertedEuclidean(), Matrix3()); CORRADE_COMPARE(o.str(), "Math::Matrix3::invertedEuclidean(): the matrix doesn't represent Euclidean transformation\n"); diff --git a/src/Math/Test/Matrix4Test.cpp b/src/Math/Test/Matrix4Test.cpp index 434ff84d7..f997450bb 100644 --- a/src/Math/Test/Matrix4Test.cpp +++ b/src/Math/Test/Matrix4Test.cpp @@ -266,7 +266,7 @@ void Matrix4Test::invertedEuclidean() { CORRADE_COMPARE(m.invertedEuclidean(), Matrix4()); CORRADE_COMPARE(o.str(), "Math::Matrix4::invertedEuclidean(): unexpected values on last row\n"); - o.str(""); + o.str({}); CORRADE_COMPARE(Matrix4::scaling(Vector3(2.0f)).invertedEuclidean(), Matrix4()); CORRADE_COMPARE(o.str(), "Math::Matrix4::invertedEuclidean(): the matrix doesn't represent Euclidean transformation\n"); diff --git a/src/Math/Test/MatrixTest.cpp b/src/Math/Test/MatrixTest.cpp index 330a86b04..1cd499397 100644 --- a/src/Math/Test/MatrixTest.cpp +++ b/src/Math/Test/MatrixTest.cpp @@ -168,7 +168,7 @@ void MatrixTest::debug() { " 8, 7, 8, 5,\n" " 4, 3, 0, 9)\n"); - o.str(""); + o.str({}); Debug(&o) << "a" << Matrix4() << "b" << Matrix4(); CORRADE_COMPARE(o.str(), "a Matrix(1, 0, 0, 0,\n" " 0, 1, 0, 0,\n" diff --git a/src/Math/Test/QuaternionTest.cpp b/src/Math/Test/QuaternionTest.cpp index 250e958c7..e35d3ffc3 100644 --- a/src/Math/Test/QuaternionTest.cpp +++ b/src/Math/Test/QuaternionTest.cpp @@ -257,7 +257,7 @@ void QuaternionTest::angle() { CORRADE_VERIFY(angle != angle); CORRADE_COMPARE(o.str(), "Math::Quaternion::angle(): quaternions must be normalized\n"); - o.str(""); + o.str({}); angle = Quaternion::angle({{1.0f, 2.0f, -3.0f}, -4.0f}, Quaternion({4.0f, -3.0f, 2.0f}, -1.0f).normalized()); CORRADE_VERIFY(angle != angle); CORRADE_COMPARE(o.str(), "Math::Quaternion::angle(): quaternions must be normalized\n"); @@ -288,7 +288,7 @@ void QuaternionTest::lerp() { CORRADE_COMPARE(notLerpA.scalar(), std::numeric_limits::quiet_NaN()); CORRADE_COMPARE(o.str(), "Math::Quaternion::lerp(): quaternions must be normalized\n"); - o.str(""); + o.str({}); Quaternion notLerpB = Quaternion::lerp(a, b*-3.0f, 0.35f); CORRADE_COMPARE(notLerpB.vector(), Vector3()); CORRADE_COMPARE(notLerpB.scalar(), std::numeric_limits::quiet_NaN()); @@ -310,7 +310,7 @@ void QuaternionTest::slerp() { CORRADE_COMPARE(notSlerpA.scalar(), std::numeric_limits::quiet_NaN()); CORRADE_COMPARE(o.str(), "Math::Quaternion::slerp(): quaternions must be normalized\n"); - o.str(""); + o.str({}); Quaternion notSlerpB = Quaternion::slerp(a, b*-3.0f, 0.35f); CORRADE_COMPARE(notSlerpB.vector(), Vector3()); CORRADE_COMPARE(notSlerpB.scalar(), std::numeric_limits::quiet_NaN()); diff --git a/src/Math/Test/RectangularMatrixTest.cpp b/src/Math/Test/RectangularMatrixTest.cpp index 95aefcc8b..5f3e8867f 100644 --- a/src/Math/Test/RectangularMatrixTest.cpp +++ b/src/Math/Test/RectangularMatrixTest.cpp @@ -398,7 +398,7 @@ void RectangularMatrixTest::debug() { " 8, 7, 8,\n" " 4, 3, 0)\n"); - o.str(""); + o.str({}); Debug(&o) << "a" << Matrix3x4() << "b" << RectangularMatrix<4, 3, std::int8_t>(); CORRADE_COMPARE(o.str(), "a Matrix(0, 0, 0,\n" " 0, 0, 0,\n" diff --git a/src/Math/Test/VectorTest.cpp b/src/Math/Test/VectorTest.cpp index 4c5273d99..d334430a3 100644 --- a/src/Math/Test/VectorTest.cpp +++ b/src/Math/Test/VectorTest.cpp @@ -309,7 +309,7 @@ void VectorTest::angle() { CORRADE_VERIFY(angle != angle); CORRADE_COMPARE(o.str(), "Math::Vector::angle(): vectors must be normalized\n"); - o.str(""); + o.str({}); angle = Vector3::angle({2.0f, 3.0f, 4.0f}, Vector3(1.0f, -2.0f, 3.0f).normalized()); CORRADE_VERIFY(angle != angle); CORRADE_COMPARE(o.str(), "Math::Vector::angle(): vectors must be normalized\n"); @@ -324,7 +324,7 @@ void VectorTest::debug() { Debug(&o) << Vector4(0.5f, 15.0f, 1.0f, 1.0f); CORRADE_COMPARE(o.str(), "Vector(0.5, 15, 1, 1)\n"); - o.str(""); + o.str({}); Debug(&o) << "a" << Vector4() << "b" << Vector4(); CORRADE_COMPARE(o.str(), "a Vector(0, 0, 0, 0) b Vector(0, 0, 0, 0)\n"); } diff --git a/src/Mesh.cpp b/src/Mesh.cpp index 2275d197d..f78cd89de 100644 --- a/src/Mesh.cpp +++ b/src/Mesh.cpp @@ -376,7 +376,7 @@ std::string ConfigurationValue::toString(Magnum::Mesh:: #undef _c } - return ""; + return {}; } Magnum::Mesh::Primitive ConfigurationValue::fromString(const std::string& stringValue, ConfigurationValueFlags) { @@ -401,7 +401,7 @@ std::string ConfigurationValue::toString(Magnum::Mesh:: #undef _c } - return ""; + return {}; } Magnum::Mesh::IndexType ConfigurationValue::fromString(const std::string& stringValue, ConfigurationValueFlags) { diff --git a/src/Physics/Test/AbstractShapeTest.cpp b/src/Physics/Test/AbstractShapeTest.cpp index 973041087..575d1d6df 100644 --- a/src/Physics/Test/AbstractShapeTest.cpp +++ b/src/Physics/Test/AbstractShapeTest.cpp @@ -36,7 +36,7 @@ void AbstractShapeTest::debug() { Debug(&o) << AbstractShape2D::Type::ShapeGroup; CORRADE_COMPARE(o.str(), "AbstractShape2D::Type::ShapeGroup\n"); - o.str(""); + o.str({}); Debug(&o) << AbstractShape3D::Type::Plane; CORRADE_COMPARE(o.str(), "AbstractShape3D::Type::Plane\n"); } diff --git a/src/Platform/EglContextHandler.cpp b/src/Platform/EglContextHandler.cpp index 92cae17b6..a002feace 100644 --- a/src/Platform/EglContextHandler.cpp +++ b/src/Platform/EglContextHandler.cpp @@ -119,7 +119,7 @@ const char* EglContextHandler::errorString(EGLint error) { #undef _error } - return ""; + return {}; } }} diff --git a/src/Test/ColorTest.cpp b/src/Test/ColorTest.cpp index e498e1da7..b7af66ad9 100644 --- a/src/Test/ColorTest.cpp +++ b/src/Test/ColorTest.cpp @@ -163,7 +163,7 @@ void ColorTest::debug() { Debug(&o) << Color3f(0.5f, 0.75f, 1.0f); CORRADE_COMPARE(o.str(), "Vector(0.5, 0.75, 1)\n"); - o.str(""); + o.str({}); Debug(&o) << Color4f(0.5f, 0.75f, 0.0f, 1.0f); CORRADE_COMPARE(o.str(), "Vector(0.5, 0.75, 0, 1)\n"); } diff --git a/src/Test/ResourceManagerTest.cpp b/src/Test/ResourceManagerTest.cpp index 25ec60ac4..6028555d8 100644 --- a/src/Test/ResourceManagerTest.cpp +++ b/src/Test/ResourceManagerTest.cpp @@ -132,7 +132,7 @@ void ResourceManagerTest::stateDisallowed() { rm.set("data", &d, ResourceDataState::Loading, ResourcePolicy::Resident); CORRADE_COMPARE(out.str(), "ResourceManager::set(): data should be null if and only if state is NotFound or Loading\n"); - out.str(""); + out.str({}); rm.set("data", nullptr, ResourceDataState::Final, ResourcePolicy::Resident); CORRADE_COMPARE(out.str(), "ResourceManager::set(): data should be null if and only if state is NotFound or Loading\n"); } diff --git a/src/Trade/AbstractImporter.h b/src/Trade/AbstractImporter.h index f31d18dbd..8bc77668f 100644 --- a/src/Trade/AbstractImporter.h +++ b/src/Trade/AbstractImporter.h @@ -62,7 +62,7 @@ class MAGNUM_EXPORT AbstractImporter: public Corrade::PluginManager::Plugin { typedef Corrade::Containers::EnumSet Features; /** @brief Constructor */ - inline explicit AbstractImporter(Corrade::PluginManager::AbstractPluginManager* manager = nullptr, const std::string& plugin = ""): Plugin(manager, plugin) {} + inline explicit AbstractImporter(Corrade::PluginManager::AbstractPluginManager* manager = nullptr, const std::string& plugin = {}): Plugin(manager, plugin) {} /** @brief Features supported by this importer */ virtual Features features() const = 0;