Skip to content

Commit

Permalink
clang: fix warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Rosen Penev <[email protected]>
  • Loading branch information
neheb committed Feb 4, 2025
1 parent 2174c3d commit 3678276
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 18 deletions.
2 changes: 1 addition & 1 deletion include/exiv2/basicio.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class EXIV2API BasicIo {
//! @name Creators
//@{
//! Destructor
virtual ~BasicIo() = default;
virtual ~BasicIo();
//@}

//! @name Manipulators
Expand Down
3 changes: 0 additions & 3 deletions include/exiv2/bmffimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ namespace Exiv2 {
struct Iloc {
explicit Iloc(uint32_t ID = 0, uint32_t start = 0, uint32_t length = 0) : ID_(ID), start_(start), length_(length) {
}
virtual ~Iloc() = default;
Iloc(const Iloc&) = default;
Iloc& operator=(const Iloc&) = default;

uint32_t ID_;
uint32_t start_;
Expand Down
4 changes: 2 additions & 2 deletions include/exiv2/metadatum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class EXIV2API Key {
//! @name Creators
//@{
//! Destructor
virtual ~Key() = default;
virtual ~Key();
//@}
Key(Key&&) = delete;
Key& operator=(Key&&) = delete;
Expand Down Expand Up @@ -105,7 +105,7 @@ class EXIV2API Metadatum {
//! @name Creators
//@{
//! Destructor
virtual ~Metadatum() = default;
virtual ~Metadatum();
//@}

//! @name Manipulators
Expand Down
2 changes: 2 additions & 0 deletions samples/conntest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <cstdlib>
#include <iostream>

namespace {
void httpcon(const std::string& url, bool useHttp1_0 = false) {
Exiv2::Dictionary response;
Exiv2::Dictionary request;
Expand Down Expand Up @@ -71,6 +72,7 @@ void curlcon(const std::string& url, bool useHttp1_0 = false) {
}
}
#endif
} // namespace

int main(int argc, const char** argv) {
Exiv2::XmpParser::initialize();
Expand Down
2 changes: 2 additions & 0 deletions samples/exifdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <iostream>
#include <string>

namespace {
using format_t = std::map<std::string, int>;
enum format_e { wolf, csv, json, xml };

Expand Down Expand Up @@ -144,6 +145,7 @@ std::string formatXML(Exiv2::ExifData& exifData) {
result << "</exif>" << '\n';
return result.str();
}
} // namespace

///////////////////////////////////////////////////////////////////////
int main(int argc, const char* argv[]) {
Expand Down
2 changes: 1 addition & 1 deletion samples/getopt-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <iostream>

#define Safe(x) ((x) ? (x) : "unknown")
const char* optstring = ":hVvqfbuktTFa:Y:O:D:r:p:P:d:e:i:c:m:M:l:S:g:K:n:Q:";
const auto optstring = ":hVvqfbuktTFa:Y:O:D:r:p:P:d:e:i:c:m:M:l:S:g:K:n:Q:";

// *****************************************************************************
// class Params
Expand Down
4 changes: 3 additions & 1 deletion samples/xmpsample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
#include <cmath>
#include <iostream>

bool isEqual(float a, float b) {
namespace {
[[maybe_unused]] bool isEqual(float a, float b) {
double d = std::fabs(a - b);
return d < 0.00001;
}
} // namespace

int main() try {
Exiv2::XmpParser::initialize();
Expand Down
3 changes: 3 additions & 0 deletions src/basicio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ namespace fs = std::filesystem;
#endif

namespace Exiv2 {

BasicIo::~BasicIo() = default;

void BasicIo::readOrThrow(byte* buf, size_t rcount, ErrorCode err) {
const size_t nread = read(buf, rcount);
Internal::enforce(nread == rcount, err);
Expand Down
18 changes: 9 additions & 9 deletions src/easyaccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@
namespace {
using namespace Exiv2;

/*!
@brief Search \em ed for a Metadatum specified by the \em keys.
The \em keys are searched in the order of their appearance, the
first available Metadatum is returned.
@param ed The %Exif metadata container to search
@param keys Array of keys to look for
@param count Number of elements in the array
*/
template <size_t N, const char* const (&keys)[N]>
ExifData::const_iterator findMetadatum(const ExifData& ed) {
for (const auto& k : keys) {
Expand All @@ -26,6 +17,15 @@ ExifData::const_iterator findMetadatum(const ExifData& ed) {
return ed.end();
} // findMetadatum

/*!
@brief Search \em ed for a Metadatum specified by the \em keys.
The \em keys are searched in the order of their appearance, the
first available Metadatum is returned.
@param ed The %Exif metadata container to search
@param keys Array of keys to look for
@param count Number of elements in the array
*/
ExifData::const_iterator findMetadatum(const ExifData& ed, const char* const keys[], size_t count) {
for (size_t i = 0; i < count; ++i) {
auto pos = ed.findKey(ExifKey(keys[i]));
Expand Down
2 changes: 1 addition & 1 deletion src/matroskavideo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ void MatroskaVideo::decodeFloatTags(const MatroskaTag* tag, const byte* buf) {
default:
break;
}
if (frame_rate)
if (frame_rate > 0.0)
xmpData_[internalMt->_label] = frame_rate;
} else
xmpData_[tag->_label] = "Variable Bit Rate";
Expand Down
5 changes: 5 additions & 0 deletions src/metadatum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
#include "metadatum.hpp"

namespace Exiv2 {

Key::~Key() = default;

Key::UniquePtr Key::clone() const {
return UniquePtr(clone_());
}

Metadatum::~Metadatum() = default;

std::string Metadatum::print(const ExifData* pMetadata) const {
std::ostringstream os;
write(os, pMetadata);
Expand Down

0 comments on commit 3678276

Please sign in to comment.