diff --git a/src/canonmn_int.cpp b/src/canonmn_int.cpp index 879a449d..ce7cf9fd 100644 --- a/src/canonmn_int.cpp +++ b/src/canonmn_int.cpp @@ -28,8 +28,7 @@ // ***************************************************************************** // class member definitions -namespace Exiv2 { - namespace Internal { +namespace Exiv2::Internal { //! OffOn, multiple tags constexpr TagDetails canonOffOn[] = { @@ -3082,5 +3081,4 @@ namespace Exiv2 { return sign * (val + frac) / 32.0F; } - } // namespace Internal -} // namespace Exiv2 +} // namespace Exiv2::Internal diff --git a/src/casiomn_int.cpp b/src/casiomn_int.cpp index c8866ad6..bfbbc207 100644 --- a/src/casiomn_int.cpp +++ b/src/casiomn_int.cpp @@ -21,8 +21,7 @@ // ***************************************************************************** // class member definitions -namespace Exiv2 { - namespace Internal { +namespace Exiv2::Internal { //! RecordingMode, tag 0x0001 constexpr TagDetails casioRecordingMode[] = { @@ -575,5 +574,4 @@ namespace Exiv2 { return os; } - } // namespace Internal -} // namespace Exiv2 +} // namespace Exiv2::Internal diff --git a/src/cr2header_int.cpp b/src/cr2header_int.cpp index a340c214..2f490a40 100644 --- a/src/cr2header_int.cpp +++ b/src/cr2header_int.cpp @@ -2,8 +2,7 @@ #include "cr2header_int.hpp" -namespace Exiv2 { - namespace Internal { +namespace Exiv2::Internal { Cr2Header::Cr2Header(ByteOrder byteOrder) : TiffHeaderBase(42, 16, byteOrder, 0x00000010), offset2_(0x00000000) @@ -65,5 +64,4 @@ namespace Exiv2 { return isTiffImageTag(tag, group); } - } // namespace Internal -} // namespace Exiv2 +} // namespace Exiv2::Internal diff --git a/src/crwimage_int.cpp b/src/crwimage_int.cpp index 0f8bfac5..72cae16d 100644 --- a/src/crwimage_int.cpp +++ b/src/crwimage_int.cpp @@ -70,8 +70,7 @@ namespace { } } // namespace -namespace Exiv2 { - namespace Internal { +namespace Exiv2::Internal { /* Mapping table used to decode and encode CIFF tags to/from Exif tags. Only @@ -1194,5 +1193,4 @@ namespace Exiv2 { return buf; } - } // namespace Internal -} // namespace Exiv2 +} // namespace Exiv2::Internal diff --git a/src/fujimn_int.cpp b/src/fujimn_int.cpp index 4e887718..7821eddc 100644 --- a/src/fujimn_int.cpp +++ b/src/fujimn_int.cpp @@ -23,8 +23,7 @@ // ***************************************************************************** // class member definitions -namespace Exiv2 { - namespace Internal { +namespace Exiv2::Internal { //! OffOn, multiple tags constexpr TagDetails fujiOffOn[] = { @@ -373,5 +372,4 @@ namespace Exiv2 { return tagInfo_; } - } // namespace Internal -} // namespace Exiv2 +} // namespace Exiv2::Internal diff --git a/src/image_int.cpp b/src/image_int.cpp index e16a1676..deccb560 100644 --- a/src/image_int.cpp +++ b/src/image_int.cpp @@ -7,47 +7,42 @@ #include #include -namespace Exiv2 -{ - namespace Internal +namespace Exiv2::Internal { + std::string stringFormat(const char* format, ...) { - std::string stringFormat(const char* format, ...) - { - std::string result; - std::vector buffer; - size_t need = std::strlen(format)*8; // initial guess - int rc = -1; - - // vsnprintf writes at most size (2nd parameter) bytes (including \0) - // returns the number of bytes required for the formatted string excluding \0 - // the following loop goes through: - // one iteration (if 'need' was large enough for the for formatted string) - // or two iterations (after the first call to vsnprintf we know the required length) - do { - buffer.resize(need + 1); - va_list args; // variable arg list - va_start(args, format); // args start after format - rc = vsnprintf(&buffer[0], buffer.size(), format, args); - va_end(args); // free the args - assert(rc >= 0); // rc < 0 => we have made an error in the format string - if (rc > 0) - need = static_cast(rc); - } while (buffer.size() <= need); + std::string result; + std::vector buffer; + size_t need = std::strlen(format) * 8; // initial guess + int rc = -1; + // vsnprintf writes at most size (2nd parameter) bytes (including \0) + // returns the number of bytes required for the formatted string excluding \0 + // the following loop goes through: + // one iteration (if 'need' was large enough for the for formatted string) + // or two iterations (after the first call to vsnprintf we know the required length) + do { + buffer.resize(need + 1); + va_list args; // variable arg list + va_start(args, format); // args start after format + rc = vsnprintf(&buffer[0], buffer.size(), format, args); + va_end(args); // free the args + assert(rc >= 0); // rc < 0 => we have made an error in the format string if (rc > 0) - result = std::string(&buffer[0], need); - return result; - } + need = static_cast(rc); + } while (buffer.size() <= need); - std::string indent(int32_t d) - { - std::string result; - if (d > 0) - while (d--) - result += " "; - return result; - } + if (rc > 0) + result = std::string(&buffer[0], need); + return result; + } - } // namespace Internal + std::string indent(int32_t d) + { + std::string result; + if (d > 0) + while (d--) + result += " "; + return result; + } -} // namespace Exiv2 +} // namespace Exiv2::Internal diff --git a/src/makernote_int.cpp b/src/makernote_int.cpp index 709901c9..10707a78 100644 --- a/src/makernote_int.cpp +++ b/src/makernote_int.cpp @@ -59,16 +59,15 @@ namespace { // ***************************************************************************** // class member definitions -namespace Exiv2 { - namespace Internal { +namespace Exiv2::Internal { - // Function first looks for a config file in current working directory - // on Win the file should be named "exiv2.ini" - // on Lin the file should be named ".exiv2" - // If not found in cwd, we return the default path - // which is the user profile path on win and the home dir on linux - std::string getExiv2ConfigPath() - { + // Function first looks for a config file in current working directory + // on Win the file should be named "exiv2.ini" + // on Lin the file should be named ".exiv2" + // If not found in cwd, we return the default path + // which is the user profile path on win and the home dir on linux + std::string getExiv2ConfigPath() + { #if defined(_MSC_VER) || defined(__MINGW__) std::string inifile("exiv2.ini"); #else @@ -90,7 +89,7 @@ namespace Exiv2 { currentPath = std::string(pw ? pw->pw_dir : ""); #endif return (currentPath / inifile).string(); - } + } std::string readExiv2Config(const std::string& section, const std::string& value, const std::string& def) { @@ -1232,8 +1231,7 @@ namespace Exiv2 { } return -1; } - } // namespace Internal -} // namespace Exiv2 +} // namespace Exiv2::Internal // ***************************************************************************** // local definitions diff --git a/src/minoltamn_int.cpp b/src/minoltamn_int.cpp index 2bd70c86..5841786f 100644 --- a/src/minoltamn_int.cpp +++ b/src/minoltamn_int.cpp @@ -20,8 +20,7 @@ // ***************************************************************************** // class member definitions -namespace Exiv2 { - namespace Internal { +namespace Exiv2::Internal { // -- Standard Minolta Makernotes tags --------------------------------------------------------------- @@ -2471,5 +2470,4 @@ namespace Exiv2 { return EXV_PRINT_TAG(minoltaSonyZoneMatching)(os, value, metadata); } - } // namespace Internal -} // namespace Exiv2 +} // namespace Exiv2::Internal diff --git a/src/nikonmn_int.cpp b/src/nikonmn_int.cpp index 6729d62e..460f1b91 100644 --- a/src/nikonmn_int.cpp +++ b/src/nikonmn_int.cpp @@ -22,8 +22,7 @@ // ***************************************************************************** // class member definitions -namespace Exiv2 { - namespace Internal { +namespace Exiv2::Internal { //! OffOn, multiple tags constexpr TagDetails nikonOffOn[] = { @@ -3256,5 +3255,4 @@ fmountlens[] = { return os; } - } // namespace Internal -} // namespace Exiv2 +} // namespace Exiv2::Internal diff --git a/src/olympusmn_int.cpp b/src/olympusmn_int.cpp index 9f796cc1..decf3ea5 100644 --- a/src/olympusmn_int.cpp +++ b/src/olympusmn_int.cpp @@ -19,8 +19,7 @@ // ***************************************************************************** // class member definitions -namespace Exiv2 { - namespace Internal { +namespace Exiv2::Internal { //! OffOn, multiple tags constexpr TagDetails olympusOffOn[] = { @@ -1666,5 +1665,4 @@ value, const ExifData* metadata) return os << v; } // OlympusMakerNote::print0x0308 - } // namespace Internal -} // namespace Exiv2 +} // namespace Exiv2::Internal diff --git a/src/orfimage_int.cpp b/src/orfimage_int.cpp index a0cf92e3..e5d917bb 100644 --- a/src/orfimage_int.cpp +++ b/src/orfimage_int.cpp @@ -2,8 +2,7 @@ #include "orfimage_int.hpp" -namespace Exiv2 { - namespace Internal { +namespace Exiv2::Internal { OrfHeader::OrfHeader(ByteOrder byteOrder) : TiffHeaderBase(0x4f52, 8, byteOrder, 0x00000008), @@ -53,5 +52,4 @@ namespace Exiv2 { return buf; } - } // namespace Internal -} // namespace Exiv2 +} // namespace Exiv2::Internal diff --git a/src/panasonicmn_int.cpp b/src/panasonicmn_int.cpp index 58413960..1bcbde5c 100644 --- a/src/panasonicmn_int.cpp +++ b/src/panasonicmn_int.cpp @@ -16,8 +16,7 @@ // ***************************************************************************** // class member definitions -namespace Exiv2 { - namespace Internal { +namespace Exiv2::Internal { //! Quality, tag 0x0001 constexpr TagDetails panasonicQuality[] = { @@ -735,5 +734,4 @@ namespace Exiv2 { return tagInfoRaw_; } - } // namespace Internal -} // namespace Exiv2 +} // namespace Exiv2::Internal diff --git a/src/pentaxmn_int.cpp b/src/pentaxmn_int.cpp index 4234ecde..99b0958c 100644 --- a/src/pentaxmn_int.cpp +++ b/src/pentaxmn_int.cpp @@ -15,8 +15,7 @@ // ***************************************************************************** // class member definitions -namespace Exiv2 { - namespace Internal { +namespace Exiv2::Internal { //! ShootingMode, tag 0x0001 constexpr TagDetails pentaxShootingMode[] = { @@ -1685,5 +1684,4 @@ namespace Exiv2 { return tagInfo_; } - } // namespace Internal -} // namespace Exiv2 +} // namespace Exiv2::Internal diff --git a/src/pngchunk_int.cpp b/src/pngchunk_int.cpp index e74004b8..8648cece 100644 --- a/src/pngchunk_int.cpp +++ b/src/pngchunk_int.cpp @@ -43,31 +43,28 @@ namespace // ***************************************************************************** // class member definitions -namespace Exiv2 -{ - namespace Internal +namespace Exiv2::Internal { + void PngChunk::decodeIHDRChunk(const DataBuf& data, uint32_t* outWidth, uint32_t* outHeight) { - void PngChunk::decodeIHDRChunk(const DataBuf& data, uint32_t* outWidth, uint32_t* outHeight) - { - assert(data.size() >= 8); + assert(data.size() >= 8); - // Extract image width and height from IHDR chunk. + // Extract image width and height from IHDR chunk. - *outWidth = data.read_uint32(0, bigEndian); - *outHeight = data.read_uint32(4, bigEndian); - } + *outWidth = data.read_uint32(0, bigEndian); + *outHeight = data.read_uint32(4, bigEndian); + } - void PngChunk::decodeTXTChunk(Image* pImage, const DataBuf& data, TxtChunkType type) - { - DataBuf key = keyTXTChunk(data); - DataBuf arr = parseTXTChunk(data, key.size(), type); + void PngChunk::decodeTXTChunk(Image* pImage, const DataBuf& data, TxtChunkType type) + { + DataBuf key = keyTXTChunk(data); + DataBuf arr = parseTXTChunk(data, key.size(), type); #ifdef EXIV2_DEBUG_MESSAGES std::cout << "Exiv2::PngChunk::decodeTXTChunk: TXT chunk data: " << std::string(arr.c_str(), arr.size()) << std::endl; #endif parseChunkContent(pImage, key.c_data(), key.size(), arr); - } + } DataBuf PngChunk::decodeTXTChunk(const DataBuf& data, TxtChunkType type) { @@ -632,6 +629,5 @@ namespace Exiv2 } // PngChunk::writeRawProfile - } // namespace Internal -} // namespace Exiv2 +} // namespace Exiv2::Internal #endif // ifdef EXV_HAVE_LIBZ diff --git a/src/rw2image_int.cpp b/src/rw2image_int.cpp index 6f16227b..112ab8be 100644 --- a/src/rw2image_int.cpp +++ b/src/rw2image_int.cpp @@ -2,8 +2,7 @@ #include "rw2image_int.hpp" -namespace Exiv2 { - namespace Internal { +namespace Exiv2::Internal { Rw2Header::Rw2Header() : TiffHeaderBase(0x0055, 24, littleEndian, 0x00000018) @@ -16,5 +15,4 @@ namespace Exiv2 { return {}; } - } // namespace Internal -} // namespace Exiv2 +} // namespace Exiv2::Internal diff --git a/src/samsungmn_int.cpp b/src/samsungmn_int.cpp index ef230fce..417068f8 100644 --- a/src/samsungmn_int.cpp +++ b/src/samsungmn_int.cpp @@ -16,8 +16,7 @@ // ***************************************************************************** // class member definitions -namespace Exiv2 { - namespace Internal { +namespace Exiv2::Internal { //! LensType, tag 0xa003 constexpr TagDetails samsung2LensType[] = { @@ -179,5 +178,4 @@ namespace Exiv2 { return tagInfoPw_; } - } // namespace Internal -} // namespace Exiv2 +} // namespace Exiv2::Internal diff --git a/src/sigmamn_int.cpp b/src/sigmamn_int.cpp index 7bddc45d..a57246ab 100644 --- a/src/sigmamn_int.cpp +++ b/src/sigmamn_int.cpp @@ -16,8 +16,7 @@ // ***************************************************************************** // class member definitions -namespace Exiv2 { - namespace Internal { +namespace Exiv2::Internal { // Sigma (Foveon) MakerNote Tag Info constexpr TagInfo SigmaMakerNote::tagInfo_[] = { @@ -141,5 +140,4 @@ namespace Exiv2 { return os; } - } // namespace Internal -} // namespace Exiv2 +} // namespace Exiv2::Internal diff --git a/src/sonymn_int.cpp b/src/sonymn_int.cpp index 3ec0a3b4..b7c60e46 100644 --- a/src/sonymn_int.cpp +++ b/src/sonymn_int.cpp @@ -20,8 +20,7 @@ // ***************************************************************************** // class member definitions -namespace Exiv2 { - namespace Internal { +namespace Exiv2::Internal { // -- Standard Sony Makernotes tags --------------------------------------------------------------- @@ -1358,5 +1357,4 @@ namespace Exiv2 { return sonyTagCipher(tag,bytes,size,object,false); } - } // namespace Internal -} // namespace Exiv2 +} // namespace Exiv2::Internal diff --git a/src/tags.cpp b/src/tags.cpp index 7e91153d..3ab23aa9 100644 --- a/src/tags.cpp +++ b/src/tags.cpp @@ -66,8 +66,7 @@ namespace Exiv2 { } // namespace Exiv2 -namespace Exiv2 { - namespace Internal { +namespace Exiv2::Internal { bool TagVocabulary::operator==(const std::string& key) const { @@ -80,8 +79,7 @@ namespace Exiv2 { N_("Unknown tag"), ifdIdNotSet, sectionIdNotSet, asciiString, -1, printValue}; - } // namespace Internal -} // namespace Exiv2 +} // namespace Exiv2::Internal namespace Exiv2 { diff --git a/src/tags_int.cpp b/src/tags_int.cpp index bf4944e2..bc4cbe91 100644 --- a/src/tags_int.cpp +++ b/src/tags_int.cpp @@ -37,8 +37,7 @@ namespace { } } // namespace -namespace Exiv2 { - namespace Internal { +namespace Exiv2::Internal { //! List of all known Exif groups. Important: Group name (3rd column) must be unique! constexpr GroupInfo groupInfo[] = { @@ -3296,5 +3295,4 @@ namespace Exiv2 { return ii->tagList_(); } - } // namespace Internal -} // namespace Exiv2 +} // namespace Exiv2::Internal diff --git a/src/tiffcomposite_int.cpp b/src/tiffcomposite_int.cpp index 6e8a17cd..290b1060 100644 --- a/src/tiffcomposite_int.cpp +++ b/src/tiffcomposite_int.cpp @@ -26,8 +26,7 @@ namespace { // ***************************************************************************** // class member definitions -namespace Exiv2 { - namespace Internal { +namespace Exiv2::Internal { bool TiffMappingInfo::operator==(const TiffMappingInfo::Key& key) const { @@ -1883,8 +1882,7 @@ namespace Exiv2 { return std::make_unique(tag, group); } - } // namespace Internal -} // namespace Exiv2 +} // namespace Exiv2::Internal // ***************************************************************************** // local definitions diff --git a/src/tiffimage_int.cpp b/src/tiffimage_int.cpp index 305357b8..67d0d292 100644 --- a/src/tiffimage_int.cpp +++ b/src/tiffimage_int.cpp @@ -15,8 +15,7 @@ #define EXV_SIMPLE_BINARY_ARRAY(arrayCfg) (newTiffBinaryArray1<&arrayCfg>) #define EXV_COMPLEX_BINARY_ARRAY(arraySet, cfgSelFct) (newTiffBinaryArray2) -namespace Exiv2 { - namespace Internal { +namespace Exiv2::Internal { //! Constant for non-encrypted binary arrays constexpr CryptFct notEncrypted = nullptr; @@ -2440,5 +2439,4 @@ namespace Exiv2 { } } - } // namespace Internal -} // namespace Exiv2 +} // namespace Exiv2::Internal diff --git a/src/tiffvisitor_int.cpp b/src/tiffvisitor_int.cpp index 72a944fe..fd3f4323 100644 --- a/src/tiffvisitor_int.cpp +++ b/src/tiffvisitor_int.cpp @@ -57,8 +57,7 @@ namespace { // ***************************************************************************** // class member definitions -namespace Exiv2 { - namespace Internal { +namespace Exiv2::Internal { TiffVisitor::TiffVisitor() { @@ -1699,5 +1698,4 @@ namespace Exiv2 { } // TiffReader::visitBinaryElement - } // namespace Internal -} // namespace Exiv2 +} // namespace Exiv2::Internal