clang-tidy: manual clang-tidy fixes
clang-tidy has issues applying these. Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
ae66ecec0d
commit
a20ace20fc
@ -123,7 +123,7 @@ class EXIV2API BmffImage : public Image {
|
||||
@warning This function should only be called by readMetadata()
|
||||
*/
|
||||
long boxHandler(std::ostream& out, Exiv2::PrintStructureOption option, const long pbox_end, int depth);
|
||||
[[nodiscard]] std::string indent(int i) const {
|
||||
[[nodiscard]] static std::string indent(int i) {
|
||||
return std::string(2 * i, ' ');
|
||||
}
|
||||
|
||||
|
||||
@ -109,14 +109,14 @@ struct ConstSliceBase : SliceBase {
|
||||
/*!
|
||||
* Obtain a constant iterator to the first element in the slice.
|
||||
*/
|
||||
const_iterator cbegin() const noexcept {
|
||||
[[nodiscard]] const_iterator cbegin() const noexcept {
|
||||
return storage_.unsafeGetIteratorAt(begin_);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Obtain a constant iterator to the first beyond the slice.
|
||||
*/
|
||||
const_iterator cend() const noexcept {
|
||||
[[nodiscard]] const_iterator cend() const noexcept {
|
||||
return storage_.unsafeGetIteratorAt(end_);
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ struct ConstSliceBase : SliceBase {
|
||||
* mutable_slice_base.
|
||||
*/
|
||||
template <typename slice_type>
|
||||
slice_type subSlice(size_t begin, size_t end) const {
|
||||
[[nodiscard]] slice_type subSlice(size_t begin, size_t end) const {
|
||||
this->rangeCheck(begin);
|
||||
// end == size() is a legal value, since end is the first
|
||||
// element beyond the slice
|
||||
@ -219,8 +219,8 @@ struct MutableSliceBase : public ConstSliceBase<storage_type, data_type> {
|
||||
* the appropriate `slice<const T>` and call its `subSlice() const`,
|
||||
* which returns the correct type.
|
||||
*/
|
||||
ConstSliceBase<storage_type, const data_type> to_const_base() const noexcept {
|
||||
return ConstSliceBase<storage_type, const data_type>(this->storage_.data_, this->begin_, this->end_);
|
||||
[[nodiscard]] ConstSliceBase<storage_type, const data_type> to_const_base() const noexcept {
|
||||
return {this->storage_.data_, this->begin_, this->end_};
|
||||
}
|
||||
|
||||
using base_type = ConstSliceBase<storage_type, data_type>;
|
||||
@ -281,11 +281,11 @@ struct ContainerStorage {
|
||||
*
|
||||
* @throw whatever container::at() throws
|
||||
*/
|
||||
const value_type& unsafeAt(size_t index) const {
|
||||
[[nodiscard]] const value_type& unsafeAt(size_t index) const {
|
||||
return data_.at(index);
|
||||
}
|
||||
|
||||
value_type& unsafeAt(size_t index) {
|
||||
[[nodiscard]] value_type& unsafeAt(size_t index) {
|
||||
return data_.at(index);
|
||||
}
|
||||
|
||||
@ -295,19 +295,19 @@ struct ContainerStorage {
|
||||
*
|
||||
* @throw whatever container::begin() and std::advance() throw
|
||||
*/
|
||||
iterator unsafeGetIteratorAt(size_t index) {
|
||||
[[nodiscard]] iterator unsafeGetIteratorAt(size_t index) {
|
||||
// we are screwed if the container got changed => try to catch it
|
||||
assert(index <= data_.size());
|
||||
|
||||
iterator it = data_.begin();
|
||||
auto it = data_.begin();
|
||||
std::advance(it, index);
|
||||
return it;
|
||||
}
|
||||
|
||||
const_iterator unsafeGetIteratorAt(size_t index) const {
|
||||
[[nodiscard]] const_iterator unsafeGetIteratorAt(size_t index) const {
|
||||
assert(index <= data_.size());
|
||||
|
||||
const_iterator it = data_.begin();
|
||||
auto it = data_.begin();
|
||||
std::advance(it, index);
|
||||
return it;
|
||||
}
|
||||
@ -346,11 +346,11 @@ struct PtrSliceStorage {
|
||||
*
|
||||
* @throw nothing
|
||||
*/
|
||||
value_type& unsafeAt(size_t index) noexcept {
|
||||
[[nodiscard]] value_type& unsafeAt(size_t index) noexcept {
|
||||
return data_[index];
|
||||
}
|
||||
|
||||
const value_type& unsafeAt(size_t index) const noexcept {
|
||||
[[nodiscard]] const value_type& unsafeAt(size_t index) const noexcept {
|
||||
return data_[index];
|
||||
}
|
||||
|
||||
@ -360,11 +360,11 @@ struct PtrSliceStorage {
|
||||
*
|
||||
* @throw nothing
|
||||
*/
|
||||
iterator unsafeGetIteratorAt(size_t index) noexcept {
|
||||
[[nodiscard]] iterator unsafeGetIteratorAt(size_t index) noexcept {
|
||||
return data_ + index;
|
||||
}
|
||||
|
||||
const_iterator unsafeGetIteratorAt(size_t index) const noexcept {
|
||||
[[nodiscard]] const_iterator unsafeGetIteratorAt(size_t index) const noexcept {
|
||||
return data_ + index;
|
||||
}
|
||||
|
||||
@ -462,7 +462,7 @@ struct Slice : public Internal::MutableSliceBase<Internal::ContainerStorage, con
|
||||
* Constructs a new constant subSlice. Behaves otherwise exactly like
|
||||
* the non-const version.
|
||||
*/
|
||||
Slice<const container> subSlice(size_t begin, size_t end) const {
|
||||
[[nodiscard]] Slice<const container> subSlice(size_t begin, size_t end) const {
|
||||
return this->to_const_base().template subSlice<Slice<const container>>(begin, end);
|
||||
}
|
||||
};
|
||||
@ -534,7 +534,7 @@ struct Slice<T*> : public Internal::MutableSliceBase<Internal::PtrSliceStorage,
|
||||
return Internal::MutableSliceBase<Internal::PtrSliceStorage, T*>::template subSlice<Slice<T*>>(begin, end);
|
||||
}
|
||||
|
||||
Slice<const T*> subSlice(size_t begin, size_t end) const {
|
||||
[[nodiscard]] Slice<const T*> subSlice(size_t begin, size_t end) const {
|
||||
return this->to_const_base().template subSlice<Slice<const T*>>(begin, end);
|
||||
}
|
||||
};
|
||||
|
||||
@ -1251,9 +1251,8 @@ class ValueType : public Value {
|
||||
if (static_cast<decltype(v)>(std::numeric_limits<I>::min()) <= v &&
|
||||
v <= static_cast<decltype(v)>(std::numeric_limits<I>::max())) {
|
||||
return static_cast<I>(std::round(v));
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//! Utility for toInt64, toUint32, etc.
|
||||
|
||||
@ -371,13 +371,12 @@ class CiffDirectory : public CiffComponent {
|
||||
void doPrint(std::ostream& os, ByteOrder byteOrder, const std::string& prefix) const override;
|
||||
|
||||
//! See base class comment. A directory is empty if it has no components.
|
||||
bool doEmpty() const override;
|
||||
[[nodiscard]] bool doEmpty() const override;
|
||||
|
||||
// See base class comment
|
||||
[[nodiscard]] CiffComponent* doFindComponent(uint16_t crwTagId, uint16_t crwDir) const override;
|
||||
//@}
|
||||
|
||||
private:
|
||||
// DATA
|
||||
Components components_; //!< List of components in this dir
|
||||
UniquePtr m_; // used by recursive doAdd
|
||||
@ -495,14 +494,14 @@ struct CrwMapping {
|
||||
//@{
|
||||
//! Default constructor
|
||||
CrwMapping(uint16_t crwTagId, uint16_t crwDir, uint32_t size, uint16_t tag, Internal::IfdId ifdId,
|
||||
const CrwDecodeFct& toExif, const CrwEncodeFct& fromExif) :
|
||||
CrwDecodeFct toExif, CrwEncodeFct fromExif) :
|
||||
crwTagId_(crwTagId),
|
||||
crwDir_(crwDir),
|
||||
size_(size),
|
||||
tag_(tag),
|
||||
ifdId_(ifdId),
|
||||
toExif_(toExif),
|
||||
fromExif_(fromExif) {
|
||||
toExif_(std::move(toExif)),
|
||||
fromExif_(std::move(fromExif)) {
|
||||
}
|
||||
//@}
|
||||
|
||||
@ -633,7 +632,6 @@ class CrwMap {
|
||||
//! Encode the thumbnail image
|
||||
static void encode0x2008(const Image& image, const CrwMapping* pCrwMapping, CiffHeader* pHead);
|
||||
|
||||
private:
|
||||
// DATA
|
||||
static const CrwMapping crwMapping_[]; //!< Metadata conversion table
|
||||
static const CrwSubDir crwSubDir_[]; //!< Ciff directory hierarchy
|
||||
|
||||
@ -48,7 +48,7 @@ struct binaryToStringHelper;
|
||||
template <typename T>
|
||||
std::ostream& operator<<(std::ostream& stream, const binaryToStringHelper<T>& binToStr) {
|
||||
for (size_t i = 0; i < binToStr.buf_.size(); ++i) {
|
||||
int c = static_cast<int>(binToStr.buf_.at(i));
|
||||
auto c = static_cast<int>(binToStr.buf_.at(i));
|
||||
const bool bTrailingNull = c == 0 && i == binToStr.buf_.size() - 1;
|
||||
if (!bTrailingNull) {
|
||||
if (c < ' ' || c >= 127) {
|
||||
|
||||
@ -25,7 +25,6 @@ class PngChunk {
|
||||
*/
|
||||
enum TxtChunkType { tEXt_Chunk = 0, zTXt_Chunk = 1, iTXt_Chunk = 2 };
|
||||
|
||||
public:
|
||||
/*!
|
||||
@brief Decode PNG IHDR chunk data from a data buffer
|
||||
\em data and return image size to \em outWidth and \em outHeight.
|
||||
|
||||
@ -1101,6 +1101,20 @@ class TiffIfdMakernote : public TiffComponent {
|
||||
~TiffIfdMakernote() override;
|
||||
//@}
|
||||
|
||||
/*!
|
||||
@name NOT implemented
|
||||
|
||||
Implementing the copy constructor and assignment operator will require
|
||||
cloning the header, i.e., clone() functionality on the MnHeader
|
||||
hierarchy.
|
||||
*/
|
||||
//@{
|
||||
//! Copy constructor.
|
||||
TiffIfdMakernote(const TiffIfdMakernote&) = delete;
|
||||
//! Assignment operator.
|
||||
TiffIfdMakernote& operator=(const TiffIfdMakernote&) = delete;
|
||||
//@}
|
||||
|
||||
//! @name Manipulators
|
||||
//@{
|
||||
/*!
|
||||
@ -1213,20 +1227,6 @@ class TiffIfdMakernote : public TiffComponent {
|
||||
[[nodiscard]] size_t doSizeImage() const override;
|
||||
//@}
|
||||
|
||||
/*!
|
||||
@name NOT implemented
|
||||
|
||||
Implementing the copy constructor and assignment operator will require
|
||||
cloning the header, i.e., clone() functionality on the MnHeader
|
||||
hierarchy.
|
||||
*/
|
||||
//@{
|
||||
//! Copy constructor.
|
||||
TiffIfdMakernote(const TiffIfdMakernote&) = delete;
|
||||
//! Assignment operator.
|
||||
TiffIfdMakernote& operator=(const TiffIfdMakernote&) = delete;
|
||||
//@}
|
||||
|
||||
private:
|
||||
// DATA
|
||||
MnHeader* pHeader_; //!< Makernote header
|
||||
|
||||
@ -115,7 +115,7 @@ class TiffHeader : public TiffHeaderBase {
|
||||
//! @name Creators
|
||||
//@{
|
||||
//! Default constructor
|
||||
TiffHeader(ByteOrder byteOrder = littleEndian, uint32_t offset = 0x00000008, bool hasImageTags = true);
|
||||
explicit TiffHeader(ByteOrder byteOrder = littleEndian, uint32_t offset = 0x00000008, bool hasImageTags = true);
|
||||
//! Destructor
|
||||
~TiffHeader() override = default;
|
||||
//@}
|
||||
@ -371,13 +371,12 @@ class OffsetWriter {
|
||||
//! Data structure for the offset list.
|
||||
struct OffsetData {
|
||||
//! Default constructor
|
||||
OffsetData() {
|
||||
}
|
||||
OffsetData() = default;
|
||||
//! Constructor
|
||||
OffsetData(uint32_t origin, ByteOrder byteOrder) : origin_(origin), byteOrder_(byteOrder) {
|
||||
}
|
||||
// DATA
|
||||
uint32_t origin_{0}; //!< Origin address
|
||||
uint32_t origin_{}; //!< Origin address
|
||||
uint32_t target_{}; //!< Target address
|
||||
ByteOrder byteOrder_{littleEndian}; //!< Byte order to use to encode target address
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user