From e55b4b80c69599e8baf1ecd81d4688452fae67dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 23 Jul 2013 14:24:28 +0200 Subject: [PATCH] Cleaned up and unified error and assertion messages. --- src/Plugins/MagnumFont/MagnumFont.cpp | 20 +++++++++---------- .../TgaImageConverter/TgaImageConverter.cpp | 4 ++-- src/Plugins/TgaImporter/TgaImporter.cpp | 12 +++++------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Plugins/MagnumFont/MagnumFont.cpp b/src/Plugins/MagnumFont/MagnumFont.cpp index 4c1448f57..82111786d 100644 --- a/src/Plugins/MagnumFont/MagnumFont.cpp +++ b/src/Plugins/MagnumFont/MagnumFont.cpp @@ -68,7 +68,7 @@ bool MagnumFont::doIsOpened() const { return _opened; } void MagnumFont::doOpenData(const std::vector>>& data, const Float) { /* We need just the configuration file and image file */ if(data.size() != 2) { - Error() << "Magnum::Text::MagnumFont::openData(): wanted two files, got" << data.size(); + Error() << "Text::MagnumFont::openData(): wanted two files, got" << data.size(); return; } @@ -76,20 +76,20 @@ void MagnumFont::doOpenData(const std::vector(data[0].second.begin()), data[0].second.size()}); Utility::Configuration conf(in, Utility::Configuration::Flag::SkipComments); if(!conf.isValid() || conf.isEmpty()) { - Error() << "Magnum::Text::MagnumFont::openData(): cannot open file" << data[0].first << conf.isValid(); + Error() << "Text::MagnumFont::openData(): cannot open file" << data[0].first << conf.isValid(); return; } /* Check version */ if(conf.value("version") != 1) { - Error() << "Magnum::Text::MagnumFont::openData(): unsupported file version, expected 1 but got" + Error() << "Text::MagnumFont::openData(): unsupported file version, expected 1 but got" << conf.value("version"); return; } /* Check that we have also the image file */ if(conf.value("image") != data[1].first) { - Error() << "Magnum::Text::MagnumFont::openData(): expected file" + Error() << "Text::MagnumFont::openData(): expected file" << conf.value("image") << "but got" << data[1].first; return; } @@ -97,12 +97,12 @@ void MagnumFont::doOpenData(const std::vector("version") != 1) { - Error() << "Magnum::Text::MagnumFont::openFile(): unsupported file version, expected 1 but got" + Error() << "Text::MagnumFont::openFile(): unsupported file version, expected 1 but got" << conf.value("version"); return; } @@ -129,12 +129,12 @@ void MagnumFont::doOpenFile(const std::string& filename, Float) { const std::string imageFilename = Utility::Directory::join(Utility::Directory::path(filename), conf.value("image")); Trade::TgaImporter importer; if(!importer.openFile(imageFilename)) { - Error() << "Magnum::Text::MagnumFont::openFile(): cannot open image file" << imageFilename; + Error() << "Text::MagnumFont::openFile(): cannot open image file" << imageFilename; return; } Trade::ImageData2D* image = importer.image2D(0); if(!image) { - Error() << "Magnum::Text::MagnumFont::openFile(): cannot load image file"; + Error() << "Text::MagnumFont::openFile(): cannot load image file"; return; } diff --git a/src/Plugins/TgaImageConverter/TgaImageConverter.cpp b/src/Plugins/TgaImageConverter/TgaImageConverter.cpp index ed236a02f..1e259fdc0 100644 --- a/src/Plugins/TgaImageConverter/TgaImageConverter.cpp +++ b/src/Plugins/TgaImageConverter/TgaImageConverter.cpp @@ -57,12 +57,12 @@ Containers::Array TgaImageConverter::doExportToData(const ImageRe image.format() != ImageFormat::Red) #endif { - Error() << "Trade::TgaImageConverter::TgaImageConverter::convertToData(): unsupported image format" << image.format(); + Error() << "Trade::TgaImageConverter::convertToData(): unsupported image format" << image.format(); return nullptr; } if(image.type() != ImageType::UnsignedByte) { - Error() << "Trade::TgaImageConverter::TgaImageConverter::convertToData(): unsupported image type" << image.type(); + Error() << "Trade::TgaImageConverter::convertToData(): unsupported image type" << image.type(); return nullptr; } diff --git a/src/Plugins/TgaImporter/TgaImporter.cpp b/src/Plugins/TgaImporter/TgaImporter.cpp index 12aeac28f..4838767ea 100644 --- a/src/Plugins/TgaImporter/TgaImporter.cpp +++ b/src/Plugins/TgaImporter/TgaImporter.cpp @@ -60,7 +60,7 @@ void TgaImporter::doOpenFile(const std::string& filename) { in = new std::ifstream(filename.c_str()); if(in->good()) return; - Error() << "Trade::TgaImporter::TgaImporter::openFile(): cannot open file" << filename; + Error() << "Trade::TgaImporter::openFile(): cannot open file" << filename; close(); } @@ -77,7 +77,7 @@ ImageData2D* TgaImporter::doImage2D(UnsignedInt) { std::streampos filesize = in->tellg(); in->seekg(0, std::istream::beg); if(filesize < std::streampos(sizeof(TgaHeader))) { - Error() << "Trade::TgaImporter::TgaImporter::image2D(): the file is too short:" << filesize << "bytes"; + Error() << "Trade::TgaImporter::image2D(): the file is too short:" << filesize << "bytes"; return nullptr; } @@ -91,7 +91,7 @@ ImageData2D* TgaImporter::doImage2D(UnsignedInt) { /* Image format */ ImageFormat format; if(header.colorMapType != 0) { - Error() << "Trade::TgaImporter::TgaImporter::image2D(): paletted files are not supported"; + Error() << "Trade::TgaImporter::image2D(): paletted files are not supported"; return nullptr; } @@ -113,7 +113,7 @@ ImageData2D* TgaImporter::doImage2D(UnsignedInt) { #endif break; default: - Error() << "Trade::TgaImporter::TgaImporter::image2D(): unsupported color bits-per-pixel:" << header.bpp; + Error() << "Trade::TgaImporter::image2D(): unsupported color bits-per-pixel:" << header.bpp; return nullptr; } @@ -126,13 +126,13 @@ ImageData2D* TgaImporter::doImage2D(UnsignedInt) { format = ImageFormat::Red; #endif if(header.bpp != 8) { - Error() << "Trade::TgaImporter::TgaImporter::image2D(): unsupported grayscale bits-per-pixel:" << header.bpp; + Error() << "Trade::TgaImporter::image2D(): unsupported grayscale bits-per-pixel:" << header.bpp; return nullptr; } /* Compressed files */ } else { - Error() << "Trade::TgaImporter::TgaImporter::image2D(): unsupported (compressed?) image type:" << header.imageType; + Error() << "Trade::TgaImporter::image2D(): unsupported (compressed?) image type:" << header.imageType; return nullptr; }