Skip to content

Commit 48f848f

Browse files
committed
clang-tidy: remove const params in decls
Found with readability-avoid-const-params-in-decls Signed-off-by: Rosen Penev <[email protected]>
1 parent 2e721a7 commit 48f848f

13 files changed

+72
-72
lines changed

include/exiv2/bmffimage.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class EXIV2API BmffImage : public Image {
122122
@return address of next box
123123
@warning This function should only be called by readMetadata()
124124
*/
125-
long boxHandler(std::ostream& out, Exiv2::PrintStructureOption option, const long pbox_end, int depth);
125+
long boxHandler(std::ostream& out, Exiv2::PrintStructureOption option, long pbox_end, int depth);
126126
[[nodiscard]] static std::string indent(int i) {
127127
return std::string(2 * i, ' ');
128128
}

include/exiv2/photoshop.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ struct EXIV2API Photoshop {
4747
/// @return 0 if successful;<BR>
4848
/// 3 if no data for psTag was found in pPsData;<BR>
4949
/// -2 if the pPsData buffer does not contain valid data.
50-
static int locateIrb(const byte* pPsData, size_t sizePsData, uint16_t psTag, const byte** record,
51-
uint32_t* const sizeHdr, uint32_t* const sizeData);
50+
static int locateIrb(const byte* pPsData, size_t sizePsData, uint16_t psTag, const byte** record, uint32_t* sizeHdr,
51+
uint32_t* sizeData);
5252

5353
/// @brief Forwards to locateIrb() with \em psTag = \em iptc_
54-
static int locateIptcIrb(const byte* pPsData, size_t sizePsData, const byte** record, uint32_t* const sizeHdr,
55-
uint32_t* const sizeData);
54+
static int locateIptcIrb(const byte* pPsData, size_t sizePsData, const byte** record, uint32_t* sizeHdr,
55+
uint32_t* sizeData);
5656

5757
/// @brief Forwards to locatePreviewIrb() with \em psTag = \em preview_
58-
static int locatePreviewIrb(const byte* pPsData, size_t sizePsData, const byte** record, uint32_t* const sizeHdr,
59-
uint32_t* const sizeData);
58+
static int locatePreviewIrb(const byte* pPsData, size_t sizePsData, const byte** record, uint32_t* sizeHdr,
59+
uint32_t* sizeData);
6060

6161
/// @brief Set the new IPTC IRB, keeps existing IRBs but removes the IPTC block if there is no new IPTC data to write.
6262
/// @param pPsData Existing IRB buffer

src/bmffimage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ std::string BmffImage::uuidName(Exiv2::DataBuf& uuid) {
153153
}
154154

155155
long BmffImage::boxHandler(std::ostream& out /* = std::cout*/, Exiv2::PrintStructureOption option /* = kpsNone */,
156-
const long pbox_end, int depth) {
156+
long pbox_end, int depth) {
157157
long address = io_->tell();
158158
// never visit a box twice!
159159
if (depth == 0)

src/iptc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,8 @@ int IptcParser::decode(IptcData& iptcData, const byte* pData, size_t size) {
363363
#ifdef EXIV2_DEBUG_MESSAGES
364364
std::cerr << "IptcParser::decode, size = " << size << "\n";
365365
#endif
366-
const byte* pRead = pData;
367-
const byte* const pEnd = pData + size;
366+
auto pRead = pData;
367+
const auto pEnd = pData + size;
368368
iptcData.clear();
369369

370370
uint16_t record = 0;

src/makernote_int.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ namespace fs = std::filesystem;
3737
namespace {
3838
// Todo: Can be generalized further - get any tag as a string/long/...
3939
//! Get the Value for a tag within a particular group
40-
const Exiv2::Value* getExifValue(Exiv2::Internal::TiffComponent* const pRoot, const uint16_t& tag,
40+
const Exiv2::Value* getExifValue(Exiv2::Internal::TiffComponent* pRoot, const uint16_t& tag,
4141
const Exiv2::Internal::IfdId& group);
4242
//! Get the model name from tag Exif.Image.Model
4343
std::string getExifModel(Exiv2::Internal::TiffComponent* pRoot);
@@ -884,7 +884,7 @@ constexpr auto nikonArrayIdx = std::array{
884884
NikonArrayIdx{0x00b7, "0101", 84, 1, NA}, // tag 0xb7 in sample image metadata for each version
885885
};
886886

887-
int nikonSelector(uint16_t tag, const byte* pData, size_t size, TiffComponent* const /*pRoot*/) {
887+
int nikonSelector(uint16_t tag, const byte* pData, size_t size, TiffComponent* /*pRoot*/) {
888888
if (size < 4)
889889
return -1;
890890

@@ -896,7 +896,7 @@ int nikonSelector(uint16_t tag, const byte* pData, size_t size, TiffComponent* c
896896
return it->idx_;
897897
}
898898

899-
DataBuf nikonCrypt(uint16_t tag, const byte* pData, size_t size, TiffComponent* const pRoot) {
899+
DataBuf nikonCrypt(uint16_t tag, const byte* pData, size_t size, TiffComponent* pRoot) {
900900
DataBuf buf;
901901

902902
if (size < 4)
@@ -938,7 +938,7 @@ DataBuf nikonCrypt(uint16_t tag, const byte* pData, size_t size, TiffComponent*
938938
return buf;
939939
}
940940

941-
int sonyCsSelector(uint16_t /*tag*/, const byte* /*pData*/, size_t /*size*/, TiffComponent* const pRoot) {
941+
int sonyCsSelector(uint16_t /*tag*/, const byte* /*pData*/, size_t /*size*/, TiffComponent* pRoot) {
942942
std::string model = getExifModel(pRoot);
943943
if (model.empty())
944944
return -1;
@@ -948,7 +948,7 @@ int sonyCsSelector(uint16_t /*tag*/, const byte* /*pData*/, size_t /*size*/, Tif
948948
}
949949
return idx;
950950
}
951-
int sony2010eSelector(uint16_t /*tag*/, const byte* /*pData*/, size_t /*size*/, TiffComponent* const pRoot) {
951+
int sony2010eSelector(uint16_t /*tag*/, const byte* /*pData*/, size_t /*size*/, TiffComponent* pRoot) {
952952
static constexpr auto models = std::array{
953953
"SLT-A58", "SLT-A99", "ILCE-3000", "ILCE-3500", "NEX-3N", "NEX-5R", "NEX-5T",
954954
"NEX-6", "VG30E", "VG900", "DSC-RX100", "DSC-RX1", "DSC-RX1R", "DSC-HX300",
@@ -957,14 +957,14 @@ int sony2010eSelector(uint16_t /*tag*/, const byte* /*pData*/, size_t /*size*/,
957957
return std::find(models.begin(), models.end(), getExifModel(pRoot)) != models.end() ? 0 : -1;
958958
}
959959

960-
int sony2FpSelector(uint16_t /*tag*/, const byte* /*pData*/, size_t /*size*/, TiffComponent* const pRoot) {
960+
int sony2FpSelector(uint16_t /*tag*/, const byte* /*pData*/, size_t /*size*/, TiffComponent* pRoot) {
961961
// Not valid for models beginning
962962
std::string model = getExifModel(pRoot);
963963
const std::array strs{"SLT-", "HV", "ILCA-"};
964964
return std::any_of(strs.begin(), strs.end(), [&model](auto& m) { return startsWith(model, m); }) ? -1 : 0;
965965
}
966966

967-
int sonyMisc2bSelector(uint16_t /*tag*/, const byte* /*pData*/, size_t /*size*/, TiffComponent* const pRoot) {
967+
int sonyMisc2bSelector(uint16_t /*tag*/, const byte* /*pData*/, size_t /*size*/, TiffComponent* pRoot) {
968968
// From Exiftool: https://github.com/exiftool/exiftool/blob/master/lib/Image/ExifTool/Sony.pm
969969
// > First byte must be 9 or 12 or 13 or 15 or 16 and 4th byte must be 2 (deciphered)
970970

@@ -991,7 +991,7 @@ int sonyMisc2bSelector(uint16_t /*tag*/, const byte* /*pData*/, size_t /*size*/,
991991
}
992992
return -1;
993993
}
994-
int sonyMisc3cSelector(uint16_t /*tag*/, const byte* /*pData*/, size_t /*size*/, TiffComponent* const pRoot) {
994+
int sonyMisc3cSelector(uint16_t /*tag*/, const byte* /*pData*/, size_t /*size*/, TiffComponent* pRoot) {
995995
// From Exiftool (Tag 9400c): https://github.com/exiftool/exiftool/blob/master/lib/Image/ExifTool/Sony.pm
996996
// > first byte decoded: 62, 48, 215, 28, 106 respectively
997997

@@ -1023,7 +1023,7 @@ int sonyMisc3cSelector(uint16_t /*tag*/, const byte* /*pData*/, size_t /*size*/,
10231023
// *****************************************************************************
10241024
// local definitions
10251025
namespace {
1026-
const Exiv2::Value* getExifValue(Exiv2::Internal::TiffComponent* const pRoot, const uint16_t& tag,
1026+
const Exiv2::Value* getExifValue(Exiv2::Internal::TiffComponent* pRoot, const uint16_t& tag,
10271027
const Exiv2::Internal::IfdId& group) {
10281028
Exiv2::Internal::TiffFinder finder(tag, group);
10291029
if (!pRoot)
@@ -1033,7 +1033,7 @@ const Exiv2::Value* getExifValue(Exiv2::Internal::TiffComponent* const pRoot, co
10331033
return (!te || !te->pValue()) ? nullptr : te->pValue();
10341034
}
10351035

1036-
std::string getExifModel(Exiv2::Internal::TiffComponent* const pRoot) {
1036+
std::string getExifModel(Exiv2::Internal::TiffComponent* pRoot) {
10371037
// Lookup the Exif.Image.Model tag
10381038
const auto value = getExifValue(pRoot, 0x0110, Exiv2::Internal::ifd0Id);
10391039
return (!value || value->count() == 0) ? std::string("") : std::string(value->toString());

src/makernote_int.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ TiffComponent* newCasio2Mn2(uint16_t tag, IfdId group, IfdId mnGroup);
623623
@param pRoot Pointer to the root component of the TIFF tree.
624624
@return An index into the array set, -1 if no match was found.
625625
*/
626-
int sonyCsSelector(uint16_t tag, const byte* pData, size_t size, TiffComponent* const pRoot);
626+
int sonyCsSelector(uint16_t tag, const byte* pData, size_t size, TiffComponent* pRoot);
627627

628628
/*!
629629
@brief Function to select cfg + def of the Sony 2010 Miscellaneous Information complex binary array.
@@ -634,7 +634,7 @@ int sonyCsSelector(uint16_t tag, const byte* pData, size_t size, TiffComponent*
634634
@param pRoot Pointer to the root component of the TIFF tree.
635635
@return An index into the array set, -1 if no match was found.
636636
*/
637-
int sony2010eSelector(uint16_t tag, const byte* pData, size_t size, TiffComponent* const pRoot);
637+
int sony2010eSelector(uint16_t tag, const byte* pData, size_t size, TiffComponent* pRoot);
638638

639639
/*!
640640
@brief Function to select cfg + def of the Sony2Fp (tag 9402) complex binary array.
@@ -645,7 +645,7 @@ int sony2010eSelector(uint16_t tag, const byte* pData, size_t size, TiffComponen
645645
@param pRoot Pointer to the root component of the TIFF tree.
646646
@return An index into the array set, -1 if no match was found.
647647
*/
648-
int sony2FpSelector(uint16_t tag, const byte* pData, size_t size, TiffComponent* const pRoot);
648+
int sony2FpSelector(uint16_t tag, const byte* pData, size_t size, TiffComponent* pRoot);
649649

650650
/*!
651651
@brief Function to select cfg + def of the SonyMisc2b (tag 9404b) complex binary array.
@@ -656,7 +656,7 @@ int sony2FpSelector(uint16_t tag, const byte* pData, size_t size, TiffComponent*
656656
@param pRoot Pointer to the root component of the TIFF tree.
657657
@return An index into the array set, -1 if no match was found.
658658
*/
659-
int sonyMisc2bSelector(uint16_t tag, const byte* pData, size_t size, TiffComponent* const pRoot);
659+
int sonyMisc2bSelector(uint16_t tag, const byte* pData, size_t size, TiffComponent* pRoot);
660660

661661
/*!
662662
@brief Function to select cfg + def of the SonyMisc3c (tag 9400) complex binary array.
@@ -667,7 +667,7 @@ int sonyMisc2bSelector(uint16_t tag, const byte* pData, size_t size, TiffCompone
667667
@param pRoot Pointer to the root component of the TIFF tree.
668668
@return An index into the array set, -1 if no match was found.
669669
*/
670-
int sonyMisc3cSelector(uint16_t tag, const byte* pData, size_t size, TiffComponent* const pRoot);
670+
int sonyMisc3cSelector(uint16_t tag, const byte* pData, size_t size, TiffComponent* pRoot);
671671

672672
/*!
673673
@brief Function to select cfg + def of a Nikon complex binary array.
@@ -678,7 +678,7 @@ int sonyMisc3cSelector(uint16_t tag, const byte* pData, size_t size, TiffCompone
678678
@param pRoot Pointer to the root component of the TIFF tree.
679679
@return An index into the array set, -1 if no match was found.
680680
*/
681-
int nikonSelector(uint16_t tag, const byte* pData, size_t size, TiffComponent* const pRoot);
681+
int nikonSelector(uint16_t tag, const byte* pData, size_t size, TiffComponent* pRoot);
682682

683683
/*!
684684
@brief Encrypt and decrypt Nikon data.
@@ -696,7 +696,7 @@ int nikonSelector(uint16_t tag, const byte* pData, size_t size, TiffComponent* c
696696
@return En/decrypted data. Ownership of the memory is passed to the caller.
697697
The buffer may be empty in case no decryption was needed.
698698
*/
699-
DataBuf nikonCrypt(uint16_t tag, const byte* pData, size_t size, TiffComponent* const pRoot);
699+
DataBuf nikonCrypt(uint16_t tag, const byte* pData, size_t size, TiffComponent* pRoot);
700700

701701
} // namespace Exiv2::Internal
702702

src/photoshop.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ bool Photoshop::valid(const byte* pPsData, size_t sizePsData) {
3131
// Todo: Generalised from JpegBase::locateIptcData without really understanding
3232
// the format (in particular the header). So it remains to be confirmed
3333
// if this also makes sense for psTag != Photoshop::iptc
34-
int Photoshop::locateIrb(const byte* pPsData, size_t sizePsData, uint16_t psTag, const byte** record,
35-
uint32_t* const sizeHdr, uint32_t* const sizeData) {
34+
int Photoshop::locateIrb(const byte* pPsData, size_t sizePsData, uint16_t psTag, const byte** record, uint32_t* sizeHdr,
35+
uint32_t* sizeData) {
3636
if (sizePsData < 12) {
3737
return 3;
3838
}
@@ -102,13 +102,13 @@ int Photoshop::locateIrb(const byte* pPsData, size_t sizePsData, uint16_t psTag,
102102
return 3;
103103
}
104104

105-
int Photoshop::locateIptcIrb(const byte* pPsData, size_t sizePsData, const byte** record, uint32_t* const sizeHdr,
106-
uint32_t* const sizeData) {
105+
int Photoshop::locateIptcIrb(const byte* pPsData, size_t sizePsData, const byte** record, uint32_t* sizeHdr,
106+
uint32_t* sizeData) {
107107
return locateIrb(pPsData, sizePsData, iptc_, record, sizeHdr, sizeData);
108108
}
109109

110-
int Photoshop::locatePreviewIrb(const byte* pPsData, size_t sizePsData, const byte** record, uint32_t* const sizeHdr,
111-
uint32_t* const sizeData) {
110+
int Photoshop::locatePreviewIrb(const byte* pPsData, size_t sizePsData, const byte** record, uint32_t* sizeHdr,
111+
uint32_t* sizeData) {
112112
return locateIrb(pPsData, sizePsData, preview_, record, sizeHdr, sizeData);
113113
}
114114

@@ -153,7 +153,7 @@ DataBuf Photoshop::setIptcIrb(const byte* pPsData, size_t sizePsData, const Iptc
153153

154154
// Write existing stuff after record, skip the current and all remaining IPTC blocks
155155
size_t pos = sizeFront;
156-
long nextSizeData = Safe::add<long>(static_cast<long>(sizePsData), -static_cast<long>(pos));
156+
auto nextSizeData = Safe::add<long>(static_cast<long>(sizePsData), -static_cast<long>(pos));
157157
enforce(nextSizeData >= 0, ErrorCode::kerCorruptedMetadata);
158158
while (0 == Photoshop::locateIptcIrb(pPsData + pos, nextSizeData, &record, &sizeHdr, &sizeIptc)) {
159159
const auto newPos = static_cast<size_t>(record - pPsData);

src/sonymn_int.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,7 @@ const TagInfo* SonyMakerNote::tagList2010e() {
10461046
}
10471047

10481048
// https://github.com/Exiv2/exiv2/pull/906#issuecomment-504338797
1049-
static DataBuf sonyTagCipher(uint16_t /* tag */, const byte* bytes, size_t size, TiffComponent* const /*object*/,
1049+
static DataBuf sonyTagCipher(uint16_t /* tag */, const byte* bytes, size_t size, TiffComponent* /*object*/,
10501050
bool bDecipher) {
10511051
DataBuf b(bytes, size); // copy the data
10521052

@@ -1071,10 +1071,10 @@ static DataBuf sonyTagCipher(uint16_t /* tag */, const byte* bytes, size_t size,
10711071
return b;
10721072
}
10731073

1074-
DataBuf sonyTagDecipher(uint16_t tag, const byte* bytes, size_t size, TiffComponent* const object) {
1074+
DataBuf sonyTagDecipher(uint16_t tag, const byte* bytes, size_t size, TiffComponent* object) {
10751075
return sonyTagCipher(tag, bytes, size, object, true);
10761076
}
1077-
DataBuf sonyTagEncipher(uint16_t tag, const byte* bytes, size_t size, TiffComponent* const object) {
1077+
DataBuf sonyTagEncipher(uint16_t tag, const byte* bytes, size_t size, TiffComponent* object) {
10781078
return sonyTagCipher(tag, bytes, size, object, false);
10791079
}
10801080

src/sonymn_int.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ class SonyMakerNote {
7878

7979
}; // class SonyMakerNote
8080

81-
DataBuf sonyTagDecipher(uint16_t, const byte*, size_t, TiffComponent* const);
82-
DataBuf sonyTagEncipher(uint16_t, const byte*, size_t, TiffComponent* const);
81+
DataBuf sonyTagDecipher(uint16_t, const byte*, size_t, TiffComponent*);
82+
DataBuf sonyTagEncipher(uint16_t, const byte*, size_t, TiffComponent*);
8383

8484
} // namespace Exiv2::Internal
8585

src/tiffcomposite_int.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ bool TiffBinaryArray::initialize(IfdId group) {
395395
return false;
396396
}
397397

398-
bool TiffBinaryArray::initialize(TiffComponent* const pRoot) {
398+
bool TiffBinaryArray::initialize(TiffComponent* pRoot) {
399399
if (!cfgSelFct_)
400400
return true; // Not a complex array
401401

@@ -437,17 +437,17 @@ uint32_t TiffBinaryArray::addElement(uint32_t idx, const ArrayDef& def) {
437437
return sz;
438438
} // TiffBinaryArray::addElement
439439

440-
TiffComponent* TiffComponent::addPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* const pRoot,
440+
TiffComponent* TiffComponent::addPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* pRoot,
441441
TiffComponent::UniquePtr object) {
442442
return doAddPath(tag, tiffPath, pRoot, std::move(object));
443443
} // TiffComponent::addPath
444444

445-
TiffComponent* TiffComponent::doAddPath(uint16_t /*tag*/, TiffPath& /*tiffPath*/, TiffComponent* const /*pRoot*/,
445+
TiffComponent* TiffComponent::doAddPath(uint16_t /*tag*/, TiffPath& /*tiffPath*/, TiffComponent* /*pRoot*/,
446446
TiffComponent::UniquePtr /*object*/) {
447447
return this;
448448
} // TiffComponent::doAddPath
449449

450-
TiffComponent* TiffDirectory::doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* const pRoot,
450+
TiffComponent* TiffDirectory::doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* pRoot,
451451
TiffComponent::UniquePtr object) {
452452
tiffPath.pop();
453453
const TiffPathItem tpi = tiffPath.top();
@@ -491,7 +491,7 @@ TiffComponent* TiffDirectory::doAddPath(uint16_t tag, TiffPath& tiffPath, TiffCo
491491
return tc->addPath(tag, tiffPath, pRoot, std::move(object));
492492
} // TiffDirectory::doAddPath
493493

494-
TiffComponent* TiffSubIfd::doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* const pRoot,
494+
TiffComponent* TiffSubIfd::doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* pRoot,
495495
TiffComponent::UniquePtr object) {
496496
const TiffPathItem tpi1 = tiffPath.top();
497497
tiffPath.pop();
@@ -520,7 +520,7 @@ TiffComponent* TiffSubIfd::doAddPath(uint16_t tag, TiffPath& tiffPath, TiffCompo
520520
return tc->addPath(tag, tiffPath, pRoot, std::move(object));
521521
} // TiffSubIfd::doAddPath
522522

523-
TiffComponent* TiffMnEntry::doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* const pRoot,
523+
TiffComponent* TiffMnEntry::doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* pRoot,
524524
TiffComponent::UniquePtr object) {
525525
const TiffPathItem tpi1 = tiffPath.top();
526526
tiffPath.pop();
@@ -537,12 +537,12 @@ TiffComponent* TiffMnEntry::doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComp
537537
return mn_->addPath(tag, tiffPath, pRoot, std::move(object));
538538
} // TiffMnEntry::doAddPath
539539

540-
TiffComponent* TiffIfdMakernote::doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* const pRoot,
540+
TiffComponent* TiffIfdMakernote::doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* pRoot,
541541
TiffComponent::UniquePtr object) {
542542
return ifd_.addPath(tag, tiffPath, pRoot, std::move(object));
543543
}
544544

545-
TiffComponent* TiffBinaryArray::doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* const pRoot,
545+
TiffComponent* TiffBinaryArray::doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* pRoot,
546546
TiffComponent::UniquePtr object) {
547547
pRoot_ = pRoot;
548548
if (tiffPath.size() == 1) {

0 commit comments

Comments
 (0)