misc sonarlint stuff
Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
89d7798f1d
commit
71dc04ebb1
@ -14,4 +14,4 @@ namespace Util {
|
||||
bool strtol(const char* nptr, int64_t& n);
|
||||
} // namespace Util
|
||||
|
||||
#endif // #ifndef UTILS_HPP_
|
||||
#endif // APP_UTILS_HPP_
|
||||
|
||||
@ -149,7 +149,14 @@ int main(int argc, char* const argv[]) {
|
||||
std::cerr << params.progname() << ": " << _("Only one file is allowed when extracting to stdout") << std::endl;
|
||||
returnCode = EXIT_FAILURE;
|
||||
} else {
|
||||
int w = filesCount > 9 ? filesCount > 99 ? 3 : 2 : 1;
|
||||
int w = [=]() {
|
||||
if (filesCount > 9) {
|
||||
if (filesCount > 99)
|
||||
return 3;
|
||||
return 2;
|
||||
}
|
||||
return 1;
|
||||
}();
|
||||
int n = 1;
|
||||
for (const auto& file : params.files_) {
|
||||
// If extracting to stdout then ignore verbose
|
||||
@ -1038,19 +1045,15 @@ int Params::getopt(int argc, char* const Argv[]) {
|
||||
std::cerr << progname() << ": " << _("At least one file is required\n");
|
||||
rc = 1;
|
||||
}
|
||||
if (rc == 0 && !cmdFiles_.empty()) {
|
||||
// Parse command files
|
||||
if (!parseCmdFiles(modifyCmds_, cmdFiles_)) {
|
||||
std::cerr << progname() << ": " << _("Error parsing -m option arguments\n");
|
||||
rc = 1;
|
||||
}
|
||||
// Parse command files
|
||||
if (rc == 0 && !cmdFiles_.empty() && !parseCmdFiles(modifyCmds_, cmdFiles_)) {
|
||||
std::cerr << progname() << ": " << _("Error parsing -m option arguments\n");
|
||||
rc = 1;
|
||||
}
|
||||
if (rc == 0 && !cmdLines_.empty()) {
|
||||
// Parse command lines
|
||||
if (!parseCmdLines(modifyCmds_, cmdLines_)) {
|
||||
std::cerr << progname() << ": " << _("Error parsing -M option arguments\n");
|
||||
rc = 1;
|
||||
}
|
||||
// Parse command lines
|
||||
if (rc == 0 && !cmdLines_.empty() && !parseCmdLines(modifyCmds_, cmdLines_)) {
|
||||
std::cerr << progname() << ": " << _("Error parsing -M option arguments\n");
|
||||
rc = 1;
|
||||
}
|
||||
if (rc == 0 && (!cmdFiles_.empty() || !cmdLines_.empty())) {
|
||||
// We'll set them again, after reading the file
|
||||
@ -1060,15 +1063,15 @@ int Params::getopt(int argc, char* const Argv[]) {
|
||||
std::cerr << progname() << ": " << _("-l option can only be used with extract or insert actions\n");
|
||||
rc = 1;
|
||||
}
|
||||
if (!suffix_.empty() && !(action_ == Action::insert)) {
|
||||
if (!suffix_.empty() && action_ != Action::insert) {
|
||||
std::cerr << progname() << ": " << _("-S option can only be used with insert action\n");
|
||||
rc = 1;
|
||||
}
|
||||
if (timestamp_ && !(action_ == Action::rename)) {
|
||||
if (timestamp_ && action_ != Action::rename) {
|
||||
std::cerr << progname() << ": " << _("-t option can only be used with rename action\n");
|
||||
rc = 1;
|
||||
}
|
||||
if (timestampOnly_ && !(action_ == Action::rename)) {
|
||||
if (timestampOnly_ && action_ != Action::rename) {
|
||||
std::cerr << progname() << ": " << _("-T option can only be used with rename action\n");
|
||||
rc = 1;
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ int Getopt::getopt(int argc, char* const argv[], const std::string& optstring) {
|
||||
progname_ = fs::path(argv[0]).filename().string();
|
||||
Util::optind = 0; // reset the Util::Getopt scanner
|
||||
|
||||
for (; !errcnt_;) {
|
||||
while (!errcnt_) {
|
||||
int c = Util::getopt(argc, argv, optstring.c_str());
|
||||
if (c == -1) {
|
||||
break;
|
||||
|
||||
@ -141,7 +141,7 @@ class EXIV2API BmffImage : public Image {
|
||||
std::string boxName(uint32_t box);
|
||||
static bool superBox(uint32_t box);
|
||||
static bool fullBox(uint32_t box);
|
||||
static std::string uuidName(Exiv2::DataBuf& uuid);
|
||||
static std::string uuidName(const Exiv2::DataBuf& uuid);
|
||||
|
||||
}; // class BmffImage
|
||||
|
||||
|
||||
@ -79,9 +79,13 @@ std::string BmffImage::toAscii(uint32_t n) {
|
||||
std::string result;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
char c = p[isBigEndianPlatform() ? i : (3 - i)];
|
||||
result += (32 <= c && c < 127) ? c // only allow 7-bit printable ascii
|
||||
: c == 0 ? '_' // show 0 as _
|
||||
: '.'; // others .
|
||||
result += [c]() {
|
||||
if (32 <= c && c < 127)
|
||||
return c; // only allow 7-bit printable ascii
|
||||
if (c == 0)
|
||||
return '_'; // show 0 as _
|
||||
return '.'; // others .
|
||||
}();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -141,7 +145,7 @@ uint32_t BmffImage::pixelHeight() const {
|
||||
return pixelHeight_;
|
||||
}
|
||||
|
||||
std::string BmffImage::uuidName(Exiv2::DataBuf& uuid) {
|
||||
std::string BmffImage::uuidName(const Exiv2::DataBuf& uuid) {
|
||||
const char* uuidCano = "\x85\xC0\xB6\x87\x82\xF\x11\xE0\x81\x11\xF4\xCE\x46\x2B\x6A\x48";
|
||||
const char* uuidXmp = "\xBE\x7A\xCF\xCB\x97\xA9\x42\xE8\x9C\x71\x99\x94\x91\xE3\xAF\xAC";
|
||||
const char* uuidCanp = "\xEA\xF4\x2B\x5E\x1C\x98\x4B\x88\xB9\xFB\xB7\xDC\x40\x6E\x4D\x16";
|
||||
|
||||
@ -12,8 +12,8 @@
|
||||
07-Mar-04, ahu: isolated as a separate component<BR>
|
||||
12-Aug-06, dc: started updating all tags
|
||||
*/
|
||||
#ifndef CANONMN_INT_HPP_
|
||||
#define CANONMN_INT_HPP_
|
||||
#ifndef EXIV2_CANONMN_INT_HPP
|
||||
#define EXIV2_CANONMN_INT_HPP
|
||||
|
||||
// *****************************************************************************
|
||||
// included header files
|
||||
@ -201,4 +201,4 @@ float canonEv(int64_t val);
|
||||
|
||||
} // namespace Exiv2::Internal
|
||||
|
||||
#endif // #ifndef CANONMN_INT_HPP_
|
||||
#endif // EXIV2_CANONMN_INT_HPP
|
||||
|
||||
@ -9,8 +9,8 @@
|
||||
Specification</a> by Evan Hunter.
|
||||
@date 30-Oct-13, ahu: created
|
||||
*/
|
||||
#ifndef CASIOMN_INT_HPP_
|
||||
#define CASIOMN_INT_HPP_
|
||||
#ifndef EXIV2_CASIOMN_INT_HPP
|
||||
#define EXIV2_CASIOMN_INT_HPP
|
||||
|
||||
// *****************************************************************************
|
||||
// included header files
|
||||
@ -57,4 +57,4 @@ class Casio2MakerNote {
|
||||
|
||||
} // namespace Exiv2::Internal
|
||||
|
||||
#endif // #ifndef CasioMN_INT_HPP_
|
||||
#endif // EXIV2_CASIOMN_INT_HPP
|
||||
|
||||
@ -1276,7 +1276,7 @@ std::string Converter::computeExifDigest(bool tiff) {
|
||||
MD5Final(digest, &context);
|
||||
res << ';';
|
||||
res << std::setw(2) << std::setfill('0') << std::hex << std::uppercase;
|
||||
for (auto&& i : digest) {
|
||||
for (const auto& i : digest) {
|
||||
res << static_cast<int>(i);
|
||||
}
|
||||
return res.str();
|
||||
|
||||
@ -7,8 +7,8 @@
|
||||
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
|
||||
@date 23-Apr-08, ahu: created
|
||||
*/
|
||||
#ifndef CR2IMAGE_INT_HPP_
|
||||
#define CR2IMAGE_INT_HPP_
|
||||
#ifndef EXIV2_CR2HEADER_INT_HPP
|
||||
#define EXIV2_CR2HEADER_INT_HPP
|
||||
|
||||
// *****************************************************************************
|
||||
// included header files
|
||||
@ -55,4 +55,4 @@ class Cr2Header : public TiffHeaderBase {
|
||||
|
||||
} // namespace Exiv2::Internal
|
||||
|
||||
#endif // #ifndef CR2IMAGE_INT_HPP_
|
||||
#endif // EXIV2_CR2HEADER_INT_HPP
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#ifndef CRWIMAGE_INT_HPP_
|
||||
#define CRWIMAGE_INT_HPP_
|
||||
#ifndef EXIV2_CRWIMAGE_INT_HPP
|
||||
#define EXIV2_CRWIMAGE_INT_HPP
|
||||
|
||||
// *****************************************************************************
|
||||
// included header files
|
||||
@ -656,4 +656,4 @@ DataBuf packIfdId(const ExifData& exifData, IfdId ifdId, ByteOrder byteOrder);
|
||||
|
||||
} // namespace Exiv2::Internal
|
||||
|
||||
#endif // #ifndef CRWIMAGE_INT_HPP_
|
||||
#endif // EXIV2_CRWIMAGE_INT_HPP
|
||||
|
||||
@ -828,7 +828,7 @@ void readWriteEpsMetadata(BasicIo& io, std::string& xmpPacket, NativePreviewList
|
||||
if (useFlexibleEmbedding) {
|
||||
positions.push_back(xmpPos);
|
||||
}
|
||||
for (auto&& [r, s] : removableEmbeddings) {
|
||||
for (const auto& [r, s] : removableEmbeddings) {
|
||||
positions.push_back(r);
|
||||
}
|
||||
std::sort(positions.begin(), positions.end());
|
||||
@ -842,7 +842,7 @@ void readWriteEpsMetadata(BasicIo& io, std::string& xmpPacket, NativePreviewList
|
||||
const uint32_t posEpsNew = posTemp(tempIo);
|
||||
size_t prevPos = posEps;
|
||||
size_t prevSkipPos = prevPos;
|
||||
for (auto&& pos : positions) {
|
||||
for (const auto& pos : positions) {
|
||||
if (pos == prevPos)
|
||||
continue;
|
||||
#ifdef DEBUG
|
||||
@ -937,7 +937,7 @@ void readWriteEpsMetadata(BasicIo& io, std::string& xmpPacket, NativePreviewList
|
||||
}
|
||||
if (!useFlexibleEmbedding) {
|
||||
// remove preceding embedding(s)
|
||||
for (auto&& [p, s] : removableEmbeddings) {
|
||||
for (const auto& [p, s] : removableEmbeddings) {
|
||||
if (pos == p) {
|
||||
skipPos = s;
|
||||
#ifdef DEBUG
|
||||
|
||||
@ -201,7 +201,7 @@ Protocol fileProtocol(const std::string& path) {
|
||||
} prots[] = {{"http://", pHttp, true}, {"https://", pHttps, true}, {"ftp://", pFtp, true},
|
||||
{"sftp://", pSftp, true}, {"file://", pFileUri, true}, {"data://", pDataUri, true},
|
||||
{"-", pStdin, false}};
|
||||
for (auto&& prot : prots) {
|
||||
for (const auto& prot : prots) {
|
||||
if (result != pFile)
|
||||
break;
|
||||
|
||||
|
||||
@ -177,7 +177,7 @@ int Exiv2::http(Exiv2::Dictionary& request, Exiv2::Dictionary& response, std::st
|
||||
const char* NO_PROXY = getenv(NO_PROXI);
|
||||
const char* no_proxy = getenv(no_proxi);
|
||||
bool bNoProxy = NO_PROXY || no_proxy;
|
||||
std::string no_prox = std::string(bNoProxy ? (no_proxy ? no_proxy : NO_PROXY) : "");
|
||||
auto no_prox = std::string(bNoProxy ? (no_proxy ? no_proxy : NO_PROXY) : "");
|
||||
Exiv2::Dictionary noProxy = stringToDict(no_prox + ",localhost,127.0.0.1");
|
||||
|
||||
// if the server is on the no_proxy list ... ignore the proxy!
|
||||
@ -214,7 +214,7 @@ int Exiv2::http(Exiv2::Dictionary& request, Exiv2::Dictionary& response, std::st
|
||||
// convert unknown servername into IP address
|
||||
// http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=/rzab6/rzab6uafinet.htm
|
||||
if (serv_addr.sin_addr.s_addr == static_cast<unsigned long>(INADDR_NONE)) {
|
||||
struct hostent* host = gethostbyname(servername_p);
|
||||
auto host = gethostbyname(servername_p);
|
||||
if (!host)
|
||||
return error(errors, "no such host", servername_p);
|
||||
memcpy(&serv_addr.sin_addr, host->h_addr, sizeof(serv_addr.sin_addr));
|
||||
@ -300,7 +300,7 @@ int Exiv2::http(Exiv2::Dictionary& request, Exiv2::Dictionary& response, std::st
|
||||
break;
|
||||
}
|
||||
result = atoi(firstSpace);
|
||||
char* c = strchr(h, C);
|
||||
auto c = strchr(h, C);
|
||||
char* first_newline = strchr(h, N);
|
||||
while (c && first_newline && c < first_newline && h < buffer + body) {
|
||||
std::string key(h);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#ifndef MAKERNOTE_INT_HPP_
|
||||
#define MAKERNOTE_INT_HPP_
|
||||
#ifndef EXIV2_MAKERNOTE_INT_HPP
|
||||
#define EXIV2_MAKERNOTE_INT_HPP
|
||||
|
||||
// *****************************************************************************
|
||||
// included header files
|
||||
@ -700,4 +700,4 @@ DataBuf nikonCrypt(uint16_t tag, const byte* pData, size_t size, TiffComponent*
|
||||
|
||||
} // namespace Exiv2::Internal
|
||||
|
||||
#endif // #ifndef MAKERNOTE_INT_HPP_
|
||||
#endif // EXIV2_MAKERNOTE_INT_HPP
|
||||
|
||||
Loading…
Reference in New Issue
Block a user