Browse Source

GCC 4.5 compatibility: not possible to construct string using {}.

Vladimír Vondruš 11 years ago
parent
commit
d3ff70f742
  1. 3
      src/Magnum/DebugOutput.cpp
  2. 5
      src/MagnumPlugins/TgaImageConverter/Test/TgaImageConverterTest.cpp
  3. 20
      src/MagnumPlugins/TgaImporter/Test/TgaImporterTest.cpp
  4. 3
      src/MagnumPlugins/TgaImporter/TgaImporter.cpp

3
src/Magnum/DebugOutput.cpp

@ -42,7 +42,8 @@ void
APIENTRY
#endif
callbackWrapper(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam) {
Context::current()->state().debug->messageCallback(DebugOutput::Source(source), DebugOutput::Type(type), id, DebugOutput::Severity(severity), std::string{message, std::size_t(length)}, userParam);
/* GCC 4.5 doesn't like {} here */
Context::current()->state().debug->messageCallback(DebugOutput::Source(source), DebugOutput::Type(type), id, DebugOutput::Severity(severity), std::string(message, std::size_t(length)), userParam);
}
#endif

5
src/MagnumPlugins/TgaImageConverter/Test/TgaImageConverterTest.cpp

@ -107,8 +107,9 @@ void TgaImageConverterTest::data() {
CORRADE_COMPARE(converted->format(), ColorFormat::RGB);
#endif
CORRADE_COMPARE(converted->type(), ColorType::UnsignedByte);
CORRADE_COMPARE((std::string{converted->data(), 2*3*3}),
(std::string{original.data(), 2*3*3}));
/* GCC 4.5 can't handle {} here */
CORRADE_COMPARE(std::string(converted->data(), 2*3*3),
std::string(original.data(), 2*3*3));
}
}}}

20
src/MagnumPlugins/TgaImporter/Test/TgaImporterTest.cpp

@ -152,8 +152,9 @@ void TgaImporterTest::colorBits24() {
#endif
CORRADE_COMPARE(image->size(), Vector2i(2, 3));
CORRADE_COMPARE(image->type(), ColorType::UnsignedByte);
CORRADE_COMPARE((std::string{image->data(), 2*3*3}),
(std::string{pixels, 2*3*3}));
/* GCC 4.5 can't handle {} here */
CORRADE_COMPARE(std::string(image->data(), 2*3*3),
std::string(pixels, 2*3*3));
}
void TgaImporterTest::colorBits32() {
@ -184,8 +185,9 @@ void TgaImporterTest::colorBits32() {
#endif
CORRADE_COMPARE(image->size(), Vector2i(2, 3));
CORRADE_COMPARE(image->type(), ColorType::UnsignedByte);
CORRADE_COMPARE((std::string{image->data(), 2*3*3}),
(std::string{pixels, 2*3*3}));
/* GCC 4.5 can't handle {} here */
CORRADE_COMPARE(std::string(image->data(), 2*3*3),
std::string(pixels, 2*3*3));
}
void TgaImporterTest::grayscaleBits8() {
@ -207,8 +209,9 @@ void TgaImporterTest::grayscaleBits8() {
#endif
CORRADE_COMPARE(image->size(), Vector2i(2, 3));
CORRADE_COMPARE(image->type(), ColorType::UnsignedByte);
CORRADE_COMPARE((std::string{image->data(), 2*3}),
(std::string{data + 18, 2*3}));
/* GCC 4.5 can't handle {} here */
CORRADE_COMPARE(std::string(image->data(), 2*3),
std::string(data + 18, 2*3));
}
void TgaImporterTest::grayscaleBits16() {
@ -241,8 +244,9 @@ void TgaImporterTest::file() {
#endif
CORRADE_COMPARE(image->size(), Vector2i(2, 3));
CORRADE_COMPARE(image->type(), ColorType::UnsignedByte);
CORRADE_COMPARE((std::string{image->data(), 2*3}),
(std::string{data + 18, 2*3}));
/* GCC 4.5 can't handle {} here */
CORRADE_COMPARE(std::string(image->data(), 2*3),
std::string(data + 18, 2*3));
}
}}}

3
src/MagnumPlugins/TgaImporter/TgaImporter.cpp

@ -70,7 +70,8 @@ auto TgaImporter::doFeatures() const -> Features { return Feature::OpenData; }
bool TgaImporter::doIsOpened() const { return in; }
void TgaImporter::doOpenData(const Containers::ArrayReference<const char> data) {
in = new std::istringstream{{data, data.size()}};
/* GCC 4.5 can't handle {} here */
in = new std::istringstream{std::string(data, data.size())};
}
void TgaImporter::doOpenFile(const std::string& filename) {

Loading…
Cancel
Save