clang-tidy: use concat namespaces

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2022-03-04 00:22:47 -08:00
parent 118aa78aa0
commit a5c094b85f
23 changed files with 96 additions and 147 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -7,47 +7,42 @@
#include <cstring>
#include <cstdio>
namespace Exiv2
{
namespace Internal
namespace Exiv2::Internal {
std::string stringFormat(const char* format, ...)
{
std::string stringFormat(const char* format, ...)
{
std::string result;
std::vector<char> 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<size_t>(rc);
} while (buffer.size() <= need);
std::string result;
std::vector<char> 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<size_t>(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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 {

View File

@ -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

View File

@ -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<TiffBinaryElement>(tag, group);
}
} // namespace Internal
} // namespace Exiv2
} // namespace Exiv2::Internal
// *****************************************************************************
// local definitions

View File

@ -15,8 +15,7 @@
#define EXV_SIMPLE_BINARY_ARRAY(arrayCfg) (newTiffBinaryArray1<&arrayCfg>)
#define EXV_COMPLEX_BINARY_ARRAY(arraySet, cfgSelFct) (newTiffBinaryArray2<arraySet, EXV_COUNTOF(arraySet), cfgSelFct>)
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

View File

@ -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