diff --git a/src/Plugins/TgaImporter/Test/TgaImporterTest.cpp b/src/Plugins/TgaImporter/Test/TgaImporterTest.cpp index 6d7574d7b..4f595a236 100644 --- a/src/Plugins/TgaImporter/Test/TgaImporterTest.cpp +++ b/src/Plugins/TgaImporter/Test/TgaImporterTest.cpp @@ -21,7 +21,6 @@ #include "../TgaImporter.h" -using namespace std; using namespace Corrade::Utility; CORRADE_TEST_MAIN(Magnum::Trade::TgaImporter::Test::TgaImporterTest) @@ -39,7 +38,7 @@ TgaImporterTest::TgaImporterTest() { } void TgaImporterTest::openInexistent() { - ostringstream debug; + std::ostringstream debug; Error::setOutput(&debug); TgaImporter importer; @@ -49,9 +48,9 @@ void TgaImporterTest::openInexistent() { void TgaImporterTest::openShort() { const char data[] = { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - istringstream in(string(data, sizeof(data))); + std::istringstream in(std::string(data, sizeof(data))); - ostringstream debug; + std::ostringstream debug; Error::setOutput(&debug); TgaImporter importer; @@ -61,9 +60,9 @@ void TgaImporterTest::openShort() { void TgaImporterTest::paletted() { const char data[] = { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - istringstream in(string(data, sizeof(data))); + std::istringstream in(std::string(data, sizeof(data))); - ostringstream debug; + std::ostringstream debug; Error::setOutput(&debug); TgaImporter importer; @@ -73,9 +72,9 @@ void TgaImporterTest::paletted() { void TgaImporterTest::nonRgb() { const char data[] = { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - istringstream in(string(data, sizeof(data))); + std::istringstream in(std::string(data, sizeof(data))); - ostringstream debug; + std::ostringstream debug; Error::setOutput(&debug); TgaImporter importer; @@ -85,9 +84,9 @@ void TgaImporterTest::nonRgb() { void TgaImporterTest::bits16() { const char data[] = { 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0 }; - istringstream in(string(data, sizeof(data))); + std::istringstream in(std::string(data, sizeof(data))); - ostringstream debug; + std::ostringstream debug; Error::setOutput(&debug); TgaImporter importer; @@ -107,7 +106,7 @@ void TgaImporterTest::bits24() { 3, 2, 1, 4, 3, 2, 5, 4, 3, 6, 5, 4, 7, 6, 5, 8, 7, 6 }; #endif - std::istringstream in(string(data, sizeof(data))); + std::istringstream in(std::string(data, sizeof(data))); TgaImporter importer; CORRADE_VERIFY(importer.open(in)); @@ -119,7 +118,7 @@ void TgaImporterTest::bits24() { #endif CORRADE_COMPARE(image->size(), Math::Vector2(2, 3)); CORRADE_VERIFY(image->type() == TypeTraits::imageType()); - CORRADE_COMPARE(string(static_cast(image->data()), 2*3*3), string(pixels, 2*3*3)); + CORRADE_COMPARE(std::string(static_cast(image->data()), 2*3*3), std::string(pixels, 2*3*3)); } void TgaImporterTest::bits32() { @@ -134,7 +133,7 @@ void TgaImporterTest::bits32() { 3, 2, 1, 1, 4, 3, 2, 1, 5, 4, 3, 1, 6, 5, 4, 1, 7, 6, 5, 1, 8, 7, 6, 1 }; #endif - std::istringstream in(string(data, sizeof(data))); + std::istringstream in(std::string(data, sizeof(data))); TgaImporter importer; CORRADE_VERIFY(importer.open(in)); @@ -146,7 +145,7 @@ void TgaImporterTest::bits32() { #endif CORRADE_COMPARE(image->size(), Math::Vector2(2, 3)); CORRADE_VERIFY(image->type() == TypeTraits::imageType()); - CORRADE_COMPARE(string(static_cast(image->data()), 2*3*3), string(pixels, 2*3*3)); + CORRADE_COMPARE(std::string(static_cast(image->data()), 2*3*3), std::string(pixels, 2*3*3)); } }}}} diff --git a/src/Plugins/TgaImporter/TgaImporter.cpp b/src/Plugins/TgaImporter/TgaImporter.cpp index d03a59d19..ec3c5bbb0 100644 --- a/src/Plugins/TgaImporter/TgaImporter.cpp +++ b/src/Plugins/TgaImporter/TgaImporter.cpp @@ -22,8 +22,6 @@ #include "Math/Vector2.h" #include #include "Trade/ImageData.h" - -using namespace std; using namespace Corrade::Utility; namespace Magnum { namespace Trade { namespace TgaImporter { @@ -32,8 +30,8 @@ namespace Magnum { namespace Trade { namespace TgaImporter { static_assert(sizeof(TgaImporter::Header) == 18, "TgaImporter: header size is not 18 bytes"); #endif -bool TgaImporter::TgaImporter::open(const string& filename, const string& name) { - ifstream in(filename.c_str()); +bool TgaImporter::TgaImporter::open(const std::string& filename, const std::string& name) { + std::ifstream in(filename.c_str()); if(!in.good()) { Error() << "TgaImporter: cannot open file" << filename; return false; @@ -43,7 +41,7 @@ bool TgaImporter::TgaImporter::open(const string& filename, const string& name) return status; } -bool TgaImporter::open(istream& in, const string& name) { +bool TgaImporter::open(std::istream& in, const std::string& name) { if(_image) close(); if(!in.good()) { Error() << "TgaImporter: cannot read input stream"; @@ -51,10 +49,10 @@ bool TgaImporter::open(istream& in, const string& name) { } /* Check if the file is long enough */ - in.seekg(0, istream::end); - streampos filesize = in.tellg(); - in.seekg(0, istream::beg); - if(filesize < streampos(sizeof(Header))) { + in.seekg(0, std::istream::end); + std::streampos filesize = in.tellg(); + in.seekg(0, std::istream::beg); + if(filesize < std::streampos(sizeof(Header))) { Error() << "TgaImporter: the file is too short:" << filesize << "bytes"; return false; } @@ -97,7 +95,7 @@ bool TgaImporter::open(istream& in, const string& name) { return false; } - size_t size = header.width*header.height*header.bpp/8; + std::size_t size = header.width*header.height*header.bpp/8; GLubyte* buffer = new GLubyte[size]; in.read(reinterpret_cast(buffer), size);