Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow building Exiv2 0.27 with C++17 compiler #2743

Open
wants to merge 1 commit into
base: 0.27-maintenance
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions include/exiv2/basicio.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ namespace Exiv2 {
class EXIV2API BasicIo {
public:
//! BasicIo auto_ptr type
#ifdef EXV_NO_AUTO_PTR
typedef std::unique_ptr<BasicIo> AutoPtr;
#else
typedef std::auto_ptr<BasicIo> AutoPtr;
#endif

//! Seek starting positions
enum Position { beg, cur, end };
Expand Down Expand Up @@ -521,7 +525,11 @@ namespace Exiv2 {

// Pimpl idiom
class Impl;
#ifdef EXV_NO_AUTO_PTR
std::unique_ptr<Impl> p_;
#else
std::auto_ptr<Impl> p_;
#endif

}; // class FileIo

Expand Down Expand Up @@ -721,7 +729,11 @@ namespace Exiv2 {

// Pimpl idiom
class Impl;
#ifdef EXV_NO_AUTO_PTR
std::unique_ptr<Impl> p_;
#else
std::auto_ptr<Impl> p_;
#endif

}; // class MemIo

Expand Down
7 changes: 7 additions & 0 deletions include/exiv2/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,11 @@ typedef int pid_t;
using auto_ptr = std::unique_ptr<T>;
#endif

#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
# define EXV_NO_AUTO_PTR
# define EXV_NO_AUTO_PTR_MOVE(x) std::move(x)
#else
# define EXV_NO_AUTO_PTR_MOVE(x) (x)
#endif

#endif // _CONFIG_H_
4 changes: 4 additions & 0 deletions include/exiv2/datasets.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,11 @@ namespace Exiv2 {
class EXIV2API IptcKey : public Key {
public:
//! Shortcut for an %IptcKey auto pointer.
#ifdef EXV_NO_AUTO_PTR
typedef std::unique_ptr<IptcKey> AutoPtr;
#else
typedef std::auto_ptr<IptcKey> AutoPtr;
#endif

//! @name Creators
//@{
Expand Down
4 changes: 4 additions & 0 deletions include/exiv2/image.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ namespace Exiv2 {
class EXIV2API Image {
public:
//! Image auto_ptr type
#ifdef EXV_NO_AUTO_PTR
typedef std::unique_ptr<Image> AutoPtr;
#else
typedef std::auto_ptr<Image> AutoPtr;
#endif

//! @name Creators
//@{
Expand Down
4 changes: 4 additions & 0 deletions include/exiv2/metadatum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ namespace Exiv2 {
class EXIV2API Key {
public:
//! Shortcut for a %Key auto pointer.
#ifdef EXV_NO_AUTO_PTR
typedef std::unique_ptr<Key> AutoPtr;
#else
typedef std::auto_ptr<Key> AutoPtr;
#endif

//! @name Creators
//@{
Expand Down
8 changes: 8 additions & 0 deletions include/exiv2/properties.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,11 @@ namespace Exiv2 {
{
public:
//! Shortcut for an %XmpKey auto pointer.
#ifdef EXV_NO_AUTO_PTR
typedef std::unique_ptr<XmpKey> AutoPtr;
#else
typedef std::auto_ptr<XmpKey> AutoPtr;
#endif

//! @name Creators
//@{
Expand Down Expand Up @@ -294,7 +298,11 @@ namespace Exiv2 {
private:
// Pimpl idiom
struct Impl;
#ifdef EXV_NO_AUTO_PTR
std::unique_ptr<Impl> p_;
#else
std::auto_ptr<Impl> p_;
#endif

}; // class XmpKey

Expand Down
8 changes: 8 additions & 0 deletions include/exiv2/tags.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ namespace Exiv2 {
class EXIV2API ExifKey : public Key {
public:
//! Shortcut for an %ExifKey auto pointer.
#ifdef EXV_NO_AUTO_PTR
typedef std::unique_ptr<ExifKey> AutoPtr;
#else
typedef std::auto_ptr<ExifKey> AutoPtr;
#endif

//! @name Creators
//@{
Expand Down Expand Up @@ -214,7 +218,11 @@ namespace Exiv2 {
private:
// Pimpl idiom
struct Impl;
#ifdef EXV_NO_AUTO_PTR
std::unique_ptr<Impl> p_;
#else
std::auto_ptr<Impl> p_;
#endif

}; // class ExifKey

Expand Down
52 changes: 52 additions & 0 deletions include/exiv2/value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ namespace Exiv2 {
class EXIV2API Value {
public:
//! Shortcut for a %Value auto pointer.
#ifdef EXV_NO_AUTO_PTR
typedef std::unique_ptr<Value> AutoPtr;
#else
typedef std::auto_ptr<Value> AutoPtr;
#endif

//! @name Creators
//@{
Expand Down Expand Up @@ -253,7 +257,11 @@ namespace Exiv2 {
class EXIV2API DataValue : public Value {
public:
//! Shortcut for a %DataValue auto pointer.
#ifdef EXV_NO_AUTO_PTR
typedef std::unique_ptr<DataValue> AutoPtr;
#else
typedef std::auto_ptr<DataValue> AutoPtr;
#endif

explicit DataValue(TypeId typeId =undefined);

Expand Down Expand Up @@ -335,7 +343,11 @@ namespace Exiv2 {
class EXIV2API StringValueBase : public Value {
public:
//! Shortcut for a %StringValueBase auto pointer.
#ifdef EXV_NO_AUTO_PTR
typedef std::unique_ptr<StringValueBase> AutoPtr;
#else
typedef std::auto_ptr<StringValueBase> AutoPtr;
#endif

//! @name Creators
//@{
Expand Down Expand Up @@ -417,7 +429,11 @@ namespace Exiv2 {
class EXIV2API StringValue : public StringValueBase {
public:
//! Shortcut for a %StringValue auto pointer.
#ifdef EXV_NO_AUTO_PTR
typedef std::unique_ptr<StringValue> AutoPtr;
#else
typedef std::auto_ptr<StringValue> AutoPtr;
#endif

//! @name Creators
//@{
Expand Down Expand Up @@ -449,7 +465,11 @@ namespace Exiv2 {
class EXIV2API AsciiValue : public StringValueBase {
public:
//! Shortcut for a %AsciiValue auto pointer.
#ifdef EXV_NO_AUTO_PTR
typedef std::unique_ptr<AsciiValue> AutoPtr;
#else
typedef std::auto_ptr<AsciiValue> AutoPtr;
#endif

//! @name Creators
//@{
Expand Down Expand Up @@ -537,7 +557,11 @@ namespace Exiv2 {
}; // class CharsetInfo

//! Shortcut for a %CommentValue auto pointer.
#ifdef EXV_NO_AUTO_PTR
typedef std::unique_ptr<CommentValue> AutoPtr;
#else
typedef std::auto_ptr<CommentValue> AutoPtr;
#endif

//! @name Creators
//@{
Expand Down Expand Up @@ -624,7 +648,11 @@ namespace Exiv2 {
class EXIV2API XmpValue : public Value {
public:
//! Shortcut for a %XmpValue auto pointer.
#ifdef EXV_NO_AUTO_PTR
typedef std::unique_ptr<XmpValue> AutoPtr;
#else
typedef std::auto_ptr<XmpValue> AutoPtr;
#endif

//! XMP array types.
enum XmpArrayType { xaNone, xaAlt, xaBag, xaSeq };
Expand Down Expand Up @@ -715,7 +743,11 @@ namespace Exiv2 {
class EXIV2API XmpTextValue : public XmpValue {
public:
//! Shortcut for a %XmpTextValue auto pointer.
#ifdef EXV_NO_AUTO_PTR
typedef std::unique_ptr<XmpTextValue> AutoPtr;
#else
typedef std::auto_ptr<XmpTextValue> AutoPtr;
#endif

//! @name Creators
//@{
Expand Down Expand Up @@ -797,7 +829,11 @@ namespace Exiv2 {
class EXIV2API XmpArrayValue : public XmpValue {
public:
//! Shortcut for a %XmpArrayValue auto pointer.
#ifdef EXV_NO_AUTO_PTR
typedef std::unique_ptr<XmpArrayValue> AutoPtr;
#else
typedef std::auto_ptr<XmpArrayValue> AutoPtr;
#endif

//! @name Creators
//@{
Expand Down Expand Up @@ -890,7 +926,11 @@ namespace Exiv2 {
class EXIV2API LangAltValue : public XmpValue {
public:
//! Shortcut for a %LangAltValue auto pointer.
#ifdef EXV_NO_AUTO_PTR
typedef std::unique_ptr<LangAltValue> AutoPtr;
#else
typedef std::auto_ptr<LangAltValue> AutoPtr;
#endif

//! @name Creators
//@{
Expand Down Expand Up @@ -978,7 +1018,11 @@ namespace Exiv2 {
class EXIV2API DateValue : public Value {
public:
//! Shortcut for a %DateValue auto pointer.
#ifdef EXV_NO_AUTO_PTR
typedef std::unique_ptr<DateValue> AutoPtr;
#else
typedef std::auto_ptr<DateValue> AutoPtr;
#endif

//! @name Creators
//@{
Expand Down Expand Up @@ -1079,7 +1123,11 @@ namespace Exiv2 {
class EXIV2API TimeValue : public Value {
public:
//! Shortcut for a %TimeValue auto pointer.
#ifdef EXV_NO_AUTO_PTR
typedef std::unique_ptr<TimeValue> AutoPtr;
#else
typedef std::auto_ptr<TimeValue> AutoPtr;
#endif

//! @name Creators
//@{
Expand Down Expand Up @@ -1235,7 +1283,11 @@ namespace Exiv2 {
class ValueType : public Value {
public:
//! Shortcut for a %ValueType\<T\> auto pointer.
#ifdef EXV_NO_AUTO_PTR
typedef std::unique_ptr<ValueType<T> > AutoPtr;
#else
typedef std::auto_ptr<ValueType<T> > AutoPtr;
#endif

//! @name Creators
//@{
Expand Down
4 changes: 4 additions & 0 deletions include/exiv2/xmp_exiv2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,11 @@ namespace Exiv2 {
private:
// Pimpl idiom
struct Impl;
#ifdef EXV_NO_AUTO_PTR
std::unique_ptr<Impl> p_;
#else
std::auto_ptr<Impl> p_;
#endif

}; // class Xmpdatum

Expand Down
6 changes: 5 additions & 1 deletion src/actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,11 @@ namespace Action {
Task* t = i->second;
return t->clone();
}
#ifdef EXV_NO_AUTO_PTR
return Task::AutoPtr(nullptr);
#else
return Task::AutoPtr(0);
#endif
} // TaskFactory::create

Print::~Print()
Expand Down Expand Up @@ -1987,7 +1991,7 @@ namespace {
if ( bStdin ) Params::instance().getStdin(stdIn);
Exiv2::BasicIo::AutoPtr ioStdin = Exiv2::BasicIo::AutoPtr(new Exiv2::MemIo(stdIn.pData_,stdIn.size_));

Exiv2::Image::AutoPtr sourceImage = bStdin ? Exiv2::ImageFactory::open(ioStdin) : Exiv2::ImageFactory::open(source);
Exiv2::Image::AutoPtr sourceImage = bStdin ? Exiv2::ImageFactory::open(EXV_NO_AUTO_PTR_MOVE(ioStdin)) : Exiv2::ImageFactory::open(source);
assert(sourceImage.get() != 0);
sourceImage->readMetadata();

Expand Down
Loading
Loading