Skip to content

Commit

Permalink
Merge pull request #2125 from neheb/1
Browse files Browse the repository at this point in the history
some clang-tidy
  • Loading branch information
piponazo authored Mar 6, 2022
2 parents 88b1c96 + def782f commit 206514f
Show file tree
Hide file tree
Showing 37 changed files with 273 additions and 342 deletions.
4 changes: 2 additions & 2 deletions app/actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ namespace Action {
if (dontOverwrite(thumbPath)) return 0;
if (Params::instance().verbose_) {
Exiv2::DataBuf buf = exifThumb.copy();
if (buf.size() != 0) {
if (!buf.empty()) {
std::cout << _("Writing thumbnail") << " (" << exifThumb.mimeType() << ", "
<< buf.size() << " " << _("Bytes") << ") " << _("to file") << " "
<< thumbPath << std::endl;
Expand Down Expand Up @@ -1150,7 +1150,7 @@ namespace Action {
image->readMetadata();
// clear existing profile, assign the blob and rewrite image
image->clearIccProfile();
if ( iccProfileBlob.size() ) {
if (!iccProfileBlob.empty()) {
image->setIccProfile(std::move(iccProfileBlob));
}
image->writeMetadata();
Expand Down
2 changes: 1 addition & 1 deletion app/exiv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,7 @@ void Params::getStdin(Exiv2::DataBuf& buf)
}

// copy stdinBuf to buf
if ( stdinBuf.size() ) {
if (!stdinBuf.empty()) {
buf.alloc(stdinBuf.size());
buf.copyBytes(0,stdinBuf.c_data(),buf.size());
}
Expand Down
2 changes: 1 addition & 1 deletion include/exiv2/basicio.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace Exiv2 {
class EXIV2API BasicIo {
public:
//! BasicIo auto_ptr type
typedef std::unique_ptr<BasicIo> UniquePtr;
using UniquePtr = std::unique_ptr<BasicIo>;

//! Seek starting positions
enum Position { beg, cur, end };
Expand Down
8 changes: 4 additions & 4 deletions include/exiv2/datasets.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ namespace Exiv2 {
class EXIV2API IptcKey : public Key {
public:
//! Shortcut for an %IptcKey auto pointer.
typedef std::unique_ptr<IptcKey> UniquePtr;
using UniquePtr = std::unique_ptr<IptcKey>;

//! @name Creators
//@{
Expand Down Expand Up @@ -322,10 +322,10 @@ namespace Exiv2 {
/*!
@brief typedef for string:string map
*/
typedef std::map<std::string,std::string> Dictionary;
using Dictionary = std::map<std::string, std::string>;

// *****************************************************************************
// free functions
// *****************************************************************************
// free functions

//! Output operator for dataSet
EXIV2API std::ostream& operator<<(std::ostream& os, const DataSet& dataSet);
Expand Down
8 changes: 4 additions & 4 deletions include/exiv2/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace Exiv2 {
specific way. The default handler sends the log message to
standard error.
*/
typedef void (*Handler)(int, const char*);
using Handler = void (*)(int, const char*);

//! @name Creators
//@{
Expand Down Expand Up @@ -290,10 +290,10 @@ namespace Exiv2 {
}; // class BasicError

//! Error class used for exceptions (std::string based)
typedef BasicError<char> Error;
using Error = BasicError<char>;

// *****************************************************************************
// free functions, template and inline definitions
// *****************************************************************************
// free functions, template and inline definitions

//! Return the error message for the error with code \em code.
const char* errMsg(int code);
Expand Down
6 changes: 3 additions & 3 deletions include/exiv2/exif.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ namespace Exiv2 {
}; // class ExifThumb

//! Container type to hold all metadata
typedef std::list<Exifdatum> ExifMetadata;
using ExifMetadata = std::list<Exifdatum>;

/*!
@brief A container for Exif data. This is a top-level class of the %Exiv2
Expand All @@ -371,9 +371,9 @@ namespace Exiv2 {
class EXIV2API ExifData {
public:
//! ExifMetadata iterator type
typedef ExifMetadata::iterator iterator;
using iterator = ExifMetadata::iterator;
//! ExifMetadata const iterator type
typedef ExifMetadata::const_iterator const_iterator;
using const_iterator = ExifMetadata::const_iterator;

//! @name Manipulators
//@{
Expand Down
12 changes: 5 additions & 7 deletions include/exiv2/image.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ namespace Exiv2 {
};

//! List of native previews. This is meant to be used only by the PreviewManager.
typedef std::vector<NativePreview> NativePreviewList;
using NativePreviewList = std::vector<NativePreview>;

/*!
@brief Options for printStructure
*/
typedef enum { kpsNone, kpsBasic, kpsXMP, kpsRecursive
, kpsIccProfile , kpsIptcErase
} PrintStructureOption;
enum PrintStructureOption { kpsNone, kpsBasic, kpsXMP, kpsRecursive, kpsIccProfile, kpsIptcErase };

/*!
@brief Abstract base class defining the interface for an image. This is
Expand All @@ -53,7 +51,7 @@ namespace Exiv2 {
class EXIV2API Image {
public:
//! Image auto_ptr type
typedef std::unique_ptr<Image> UniquePtr;
using UniquePtr = std::unique_ptr<Image>;

//! @name Creators
//@{
Expand Down Expand Up @@ -490,9 +488,9 @@ namespace Exiv2 {
}; // class Image

//! Type for function pointer that creates new Image instances
typedef Image::UniquePtr (*NewInstanceFct)(BasicIo::UniquePtr io, bool create);
using NewInstanceFct = Image::UniquePtr (*)(BasicIo::UniquePtr io, bool create);
//! Type for function pointer that checks image types
typedef bool (*IsThisTypeFct)(BasicIo& iIo, bool advance);
using IsThisTypeFct = bool (*)(BasicIo& iIo, bool advance);

/*!
@brief Returns an Image instance of the specified type.
Expand Down
5 changes: 2 additions & 3 deletions include/exiv2/ini.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ extern "C" {
#endif

//! @brief typedef for prototype of handler function.
typedef int (*ini_handler)(void* user, const char* section,
const char* name, const char* value);
using ini_handler = int (*)(void* user, const char* section, const char* name, const char* value);

//! Typedef for prototype of fgets-style reader function.
typedef char* (*ini_reader)(char* str, int num, void* stream);
using ini_reader = char* (*)(char* str, int num, void* stream);

/*!
@brief Parse given INI-style file. May have [section]s, name=value pairs
Expand Down
6 changes: 3 additions & 3 deletions include/exiv2/iptc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ namespace Exiv2 {
}; // class Iptcdatum

//! Container type to hold all metadata
typedef std::vector<Iptcdatum> IptcMetadata;
using IptcMetadata = std::vector<Iptcdatum>;

/*!
@brief A container for IPTC data. This is a top-level class of the %Exiv2 library.
Expand All @@ -153,9 +153,9 @@ namespace Exiv2 {
class EXIV2API IptcData {
public:
//! IptcMetadata iterator type
typedef IptcMetadata::iterator iterator;
using iterator = IptcMetadata::iterator;
//! IptcMetadata const iterator type
typedef IptcMetadata::const_iterator const_iterator;
using const_iterator = IptcMetadata::const_iterator;

// Use the compiler generated constructors and assignment operator

Expand Down
2 changes: 1 addition & 1 deletion include/exiv2/metadatum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace Exiv2 {
class EXIV2API Key {
public:
//! Shortcut for a %Key auto pointer.
typedef std::unique_ptr<Key> UniquePtr;
using UniquePtr = std::unique_ptr<Key>;

//! @name Creators
//@{
Expand Down
23 changes: 12 additions & 11 deletions include/exiv2/preview.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
// namespace extensions
namespace Exiv2 {

// *****************************************************************************
// class definitions
// *****************************************************************************
// class definitions

//! Type of preview image.
typedef int PreviewId;
using PreviewId = int;

/*!
@brief Preview image properties.
Expand All @@ -37,13 +37,14 @@ namespace Exiv2 {
};

//! Container type to hold all preview images metadata.
typedef std::vector<PreviewProperties> PreviewPropertiesList;
using PreviewPropertiesList = std::vector<PreviewProperties>;

/*!
@brief Class that holds preview image properties and data buffer.
*/
class EXIV2API PreviewImage {
friend class PreviewManager;

public:
//! @name Constructors
//@{
Expand Down Expand Up @@ -111,10 +112,10 @@ namespace Exiv2 {
//! Private constructor
PreviewImage(PreviewProperties properties, DataBuf&& data);

PreviewProperties properties_; //!< Preview image properties
DataBuf preview_; //!< Preview image data
PreviewProperties properties_; //!< Preview image properties
DataBuf preview_; //!< Preview image data

}; // class PreviewImage
}; // class PreviewImage

/*!
@brief Class for extracting preview images from image metadata.
Expand Down Expand Up @@ -142,9 +143,9 @@ namespace Exiv2 {
//@}

private:
const Image& image_;
const Image& image_;

}; // class PreviewManager
} // namespace Exiv2
}; // class PreviewManager
} // namespace Exiv2

#endif // #ifndef PREVIEW_HPP_
#endif // #ifndef PREVIEW_HPP_
4 changes: 2 additions & 2 deletions include/exiv2/properties.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ namespace Exiv2 {
*/
static void unregisterNs();
//! Type for the namespace registry
typedef std::map<std::string, XmpNsInfo> NsRegistry;
using NsRegistry = std::map<std::string, XmpNsInfo>;
/*!
@brief Get the registered namespace for a specific \em prefix from the registry.
*/
Expand All @@ -221,7 +221,7 @@ namespace Exiv2 {
{
public:
//! Shortcut for an %XmpKey auto pointer.
typedef std::unique_ptr<XmpKey> UniquePtr;
using UniquePtr = std::unique_ptr<XmpKey>;

//! @name Creators
//@{
Expand Down
Loading

0 comments on commit 206514f

Please sign in to comment.