Browse Source

Use {} instead of "".

Calls default std::string constructor instead of converting from const
char*, might possibly save unneeded allocation.
pull/7/head
Vladimír Vondruš 13 years ago
parent
commit
9464e805e1
  1. 2
      src/Math/Test/Matrix3Test.cpp
  2. 2
      src/Math/Test/Matrix4Test.cpp
  3. 2
      src/Math/Test/MatrixTest.cpp
  4. 6
      src/Math/Test/QuaternionTest.cpp
  5. 2
      src/Math/Test/RectangularMatrixTest.cpp
  6. 4
      src/Math/Test/VectorTest.cpp
  7. 4
      src/Mesh.cpp
  8. 2
      src/Physics/Test/AbstractShapeTest.cpp
  9. 2
      src/Platform/EglContextHandler.cpp
  10. 2
      src/Test/ColorTest.cpp
  11. 2
      src/Test/ResourceManagerTest.cpp
  12. 2
      src/Trade/AbstractImporter.h

2
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");

2
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");

2
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"

6
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<float>::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<float>::quiet_NaN());
@ -310,7 +310,7 @@ void QuaternionTest::slerp() {
CORRADE_COMPARE(notSlerpA.scalar(), std::numeric_limits<float>::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<float>::quiet_NaN());

2
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"

4
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");
}

4
src/Mesh.cpp

@ -376,7 +376,7 @@ std::string ConfigurationValue<Magnum::Mesh::Primitive>::toString(Magnum::Mesh::
#undef _c
}
return "";
return {};
}
Magnum::Mesh::Primitive ConfigurationValue<Magnum::Mesh::Primitive>::fromString(const std::string& stringValue, ConfigurationValueFlags) {
@ -401,7 +401,7 @@ std::string ConfigurationValue<Magnum::Mesh::IndexType>::toString(Magnum::Mesh::
#undef _c
}
return "";
return {};
}
Magnum::Mesh::IndexType ConfigurationValue<Magnum::Mesh::IndexType>::fromString(const std::string& stringValue, ConfigurationValueFlags) {

2
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");
}

2
src/Platform/EglContextHandler.cpp

@ -119,7 +119,7 @@ const char* EglContextHandler::errorString(EGLint error) {
#undef _error
}
return "";
return {};
}
}}

2
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");
}

2
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>("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");
}

2
src/Trade/AbstractImporter.h

@ -62,7 +62,7 @@ class MAGNUM_EXPORT AbstractImporter: public Corrade::PluginManager::Plugin {
typedef Corrade::Containers::EnumSet<Feature, int> 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;

Loading…
Cancel
Save