修复 c++ 17下auto_ptr错误

v0.27.3
Matthew 9 months ago
parent ada86be02b
commit 1d3009d723

@ -9,8 +9,11 @@ project(exiv2 # use TWEAK to categorize the build
# 0.27.3.29 = RC2 Not for release # 0.27.3.29 = RC2 Not for release
LANGUAGES CXX C LANGUAGES CXX C
) )
set(CMAKE_CXX_STANDARD 14)
include(cmake/mainSetup.cmake REQUIRED) include(cmake/mainSetup.cmake REQUIRED)
# options and their default values # options and their default values
option( BUILD_SHARED_LIBS "Build exiv2lib as a shared library" ON ) option( BUILD_SHARED_LIBS "Build exiv2lib as a shared library" ON )
option( EXIV2_ENABLE_XMP "Build with XMP metadata support" ON ) option( EXIV2_ENABLE_XMP "Build with XMP metadata support" ON )

@ -13,7 +13,7 @@ if (EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(NO_OUTPUT_DIRS KEEP_RPATHS TARGETS) conan_basic_setup(NO_OUTPUT_DIRS KEEP_RPATHS TARGETS)
endif() endif()
find_package(Threads REQUIRED) # find_package(Threads REQUIRED)
if( EXIV2_ENABLE_PNG ) if( EXIV2_ENABLE_PNG )
find_package( ZLIB REQUIRED ) find_package( ZLIB REQUIRED )

@ -30,7 +30,7 @@
#include "types.hpp" #include "types.hpp"
// + standard includes // + standard includes
#include <memory> // for std::auto_ptr #include <memory> // for Auto_Ptr
// The way to handle data from stdin or data uri path. If EXV_XPATH_MEMIO = 1, // The way to handle data from stdin or data uri path. If EXV_XPATH_MEMIO = 1,
// it uses MemIo. Otherwises, it uses FileIo. // it uses MemIo. Otherwises, it uses FileIo.
@ -55,7 +55,7 @@ namespace Exiv2 {
class EXIV2API BasicIo { class EXIV2API BasicIo {
public: public:
//! BasicIo auto_ptr type //! BasicIo auto_ptr type
typedef std::auto_ptr<BasicIo> AutoPtr; typedef Auto_Ptr<BasicIo> AutoPtr;
//! Seek starting positions //! Seek starting positions
enum Position { beg, cur, end }; enum Position { beg, cur, end };
@ -521,7 +521,7 @@ namespace Exiv2 {
// Pimpl idiom // Pimpl idiom
class Impl; class Impl;
std::auto_ptr<Impl> p_; Auto_Ptr<Impl> p_;
}; // class FileIo }; // class FileIo
@ -721,7 +721,7 @@ namespace Exiv2 {
// Pimpl idiom // Pimpl idiom
class Impl; class Impl;
std::auto_ptr<Impl> p_; Auto_Ptr<Impl> p_;
}; // class MemIo }; // class MemIo

@ -275,7 +275,7 @@ namespace Exiv2 {
class EXIV2API IptcKey : public Key { class EXIV2API IptcKey : public Key {
public: public:
//! Shortcut for an %IptcKey auto pointer. //! Shortcut for an %IptcKey auto pointer.
typedef std::auto_ptr<IptcKey> AutoPtr; typedef Auto_Ptr<IptcKey> AutoPtr;
//! @name Creators //! @name Creators
//@{ //@{

@ -81,7 +81,7 @@ namespace Exiv2 {
class EXIV2API Image { class EXIV2API Image {
public: public:
//! Image auto_ptr type //! Image auto_ptr type
typedef std::auto_ptr<Image> AutoPtr; typedef Auto_Ptr<Image> AutoPtr;
//! @name Creators //! @name Creators
//@{ //@{

@ -55,7 +55,7 @@ namespace Exiv2 {
class EXIV2API Key { class EXIV2API Key {
public: public:
//! Shortcut for a %Key auto pointer. //! Shortcut for a %Key auto pointer.
typedef std::auto_ptr<Key> AutoPtr; typedef Auto_Ptr<Key> AutoPtr;
//! @name Creators //! @name Creators
//@{ //@{

@ -242,7 +242,7 @@ namespace Exiv2 {
{ {
public: public:
//! Shortcut for an %XmpKey auto pointer. //! Shortcut for an %XmpKey auto pointer.
typedef std::auto_ptr<XmpKey> AutoPtr; typedef Auto_Ptr<XmpKey> AutoPtr;
//! @name Creators //! @name Creators
//@{ //@{
@ -305,7 +305,7 @@ namespace Exiv2 {
private: private:
// Pimpl idiom // Pimpl idiom
struct Impl; struct Impl;
std::auto_ptr<Impl> p_; Auto_Ptr<Impl> p_;
}; // class XmpKey }; // class XmpKey

@ -148,7 +148,7 @@ namespace Exiv2 {
class EXIV2API ExifKey : public Key { class EXIV2API ExifKey : public Key {
public: public:
//! Shortcut for an %ExifKey auto pointer. //! Shortcut for an %ExifKey auto pointer.
typedef std::auto_ptr<ExifKey> AutoPtr; typedef Auto_Ptr<ExifKey> AutoPtr;
//! @name Creators //! @name Creators
//@{ //@{
@ -222,7 +222,7 @@ namespace Exiv2 {
private: private:
// Pimpl idiom // Pimpl idiom
struct Impl; struct Impl;
std::auto_ptr<Impl> p_; Auto_Ptr<Impl> p_;
}; // class ExifKey }; // class ExifKey

@ -42,6 +42,125 @@
#include <algorithm> #include <algorithm>
#include <sstream> #include <sstream>
template<class _Ty>
class Auto_Ptr;
template<class _Ty>
struct Auto_Ptr_ref
{ // proxy reference for auto_ptr copying
explicit Auto_Ptr_ref(_Ty * _Right)
: _Ref(_Right)
{ // construct from generic pointer to auto_ptr ptr
}
_Ty * _Ref; // generic pointer to auto_ptr ptr
};
template<class _Ty>
class Auto_Ptr
{ // wrap an object pointer to ensure destruction
public:
typedef _Ty element_type;
explicit Auto_Ptr(_Ty * _Ptr = nullptr) noexcept
: _Myptr(_Ptr)
{ // construct from object pointer
}
Auto_Ptr(Auto_Ptr& _Right) noexcept
: _Myptr(_Right.release())
{ // construct by assuming pointer from _Right auto_ptr
}
Auto_Ptr(Auto_Ptr_ref<_Ty> _Right) noexcept
{ // construct by assuming pointer from _Right auto_ptr_ref
_Ty * _Ptr = _Right._Ref;
_Right._Ref = nullptr; // release old
_Myptr = _Ptr; // reset this
}
template<class _Other>
operator Auto_Ptr<_Other>() noexcept
{ // convert to compatible auto_ptr
return (Auto_Ptr<_Other>(*this));
}
template<class _Other>
operator Auto_Ptr_ref<_Other>() noexcept
{ // convert to compatible auto_ptr_ref
_Other * _Cvtptr = _Myptr; // test implicit conversion
Auto_Ptr_ref<_Other> _Ans(_Cvtptr);
_Myptr = nullptr; // pass ownership to auto_ptr_ref
return (_Ans);
}
template<class _Other>
Auto_Ptr& operator=(Auto_Ptr<_Other>& _Right) noexcept
{ // assign compatible _Right (assume pointer)
reset(_Right.release());
return (*this);
}
template<class _Other>
Auto_Ptr(Auto_Ptr<_Other>& _Right) noexcept
: _Myptr(_Right.release())
{ // construct by assuming pointer from _Right
}
Auto_Ptr& operator=(Auto_Ptr& _Right) noexcept
{ // assign compatible _Right (assume pointer)
reset(_Right.release());
return (*this);
}
Auto_Ptr& operator=(Auto_Ptr_ref<_Ty> _Right) noexcept
{ // assign compatible _Right._Ref (assume pointer)
_Ty * _Ptr = _Right._Ref;
_Right._Ref = 0; // release old
reset(_Ptr); // set new
return (*this);
}
~Auto_Ptr() noexcept
{ // destroy the object
delete _Myptr;
}
_Ty& operator*() const noexcept
{ // return designated value
return (*get());
}
_Ty * operator->() const noexcept
{ // return pointer to class object
return (get());
}
_Ty * get() const noexcept
{ // return wrapped pointer
return (_Myptr);
}
_Ty * release() noexcept
{ // return wrapped pointer and give up ownership
_Ty * _Tmp = _Myptr;
_Myptr = nullptr;
return (_Tmp);
}
void reset(_Ty * _Ptr = nullptr)
{ // destroy designated object and store new pointer
if (_Ptr != _Myptr)
delete _Myptr;
_Myptr = _Ptr;
}
private:
_Ty * _Myptr; // the wrapped object pointer
};
#ifdef _MSC_VER #ifdef _MSC_VER
// Visual Studio 2010 and later has stdint.h // Visual Studio 2010 and later has stdint.h
# if _MSC_VER >= _MSC_VER_2010 # if _MSC_VER >= _MSC_VER_2010
@ -213,7 +332,7 @@ namespace Exiv2 {
DataBuf(const byte* pData, long size); DataBuf(const byte* pData, long size);
/*! /*!
@brief Copy constructor. Transfers the buffer to the newly created @brief Copy constructor. Transfers the buffer to the newly created
object similar to std::auto_ptr, i.e., the original object is object similar to Auto_Ptr, i.e., the original object is
modified. modified.
*/ */
DataBuf(DataBuf& rhs); DataBuf(DataBuf& rhs);
@ -225,7 +344,7 @@ namespace Exiv2 {
//@{ //@{
/*! /*!
@brief Assignment operator. Transfers the buffer and releases the @brief Assignment operator. Transfers the buffer and releases the
buffer at the original object similar to std::auto_ptr, i.e., buffer at the original object similar to Auto_Ptr, i.e.,
the original object is modified. the original object is modified.
*/ */
DataBuf& operator=(DataBuf& rhs); DataBuf& operator=(DataBuf& rhs);
@ -255,7 +374,7 @@ namespace Exiv2 {
@name Conversions @name Conversions
Special conversions with auxiliary type to enable copies Special conversions with auxiliary type to enable copies
and assignments, similar to those used for std::auto_ptr. and assignments, similar to those used for Auto_Ptr.
See http://www.josuttis.com/libbook/auto_ptr.html for a discussion. See http://www.josuttis.com/libbook/auto_ptr.html for a discussion.
*/ */
//@{ //@{

@ -42,6 +42,8 @@
#include <cstring> #include <cstring>
#include <climits> #include <climits>
// ***************************************************************************** // *****************************************************************************
// namespace extensions // namespace extensions
namespace Exiv2 { namespace Exiv2 {
@ -60,7 +62,8 @@ namespace Exiv2 {
class EXIV2API Value { class EXIV2API Value {
public: public:
//! Shortcut for a %Value auto pointer. //! Shortcut for a %Value auto pointer.
typedef std::auto_ptr<Value> AutoPtr;
typedef Auto_Ptr<Value> AutoPtr;
//! @name Creators //! @name Creators
//@{ //@{
@ -262,7 +265,7 @@ namespace Exiv2 {
class EXIV2API DataValue : public Value { class EXIV2API DataValue : public Value {
public: public:
//! Shortcut for a %DataValue auto pointer. //! Shortcut for a %DataValue auto pointer.
typedef std::auto_ptr<DataValue> AutoPtr; typedef Auto_Ptr<DataValue> AutoPtr;
explicit DataValue(TypeId typeId =undefined); explicit DataValue(TypeId typeId =undefined);
@ -344,7 +347,7 @@ namespace Exiv2 {
class EXIV2API StringValueBase : public Value { class EXIV2API StringValueBase : public Value {
public: public:
//! Shortcut for a %StringValueBase auto pointer. //! Shortcut for a %StringValueBase auto pointer.
typedef std::auto_ptr<StringValueBase> AutoPtr; typedef Auto_Ptr<StringValueBase> AutoPtr;
//! @name Creators //! @name Creators
//@{ //@{
@ -426,7 +429,7 @@ namespace Exiv2 {
class EXIV2API StringValue : public StringValueBase { class EXIV2API StringValue : public StringValueBase {
public: public:
//! Shortcut for a %StringValue auto pointer. //! Shortcut for a %StringValue auto pointer.
typedef std::auto_ptr<StringValue> AutoPtr; typedef Auto_Ptr<StringValue> AutoPtr;
//! @name Creators //! @name Creators
//@{ //@{
@ -458,7 +461,7 @@ namespace Exiv2 {
class EXIV2API AsciiValue : public StringValueBase { class EXIV2API AsciiValue : public StringValueBase {
public: public:
//! Shortcut for a %AsciiValue auto pointer. //! Shortcut for a %AsciiValue auto pointer.
typedef std::auto_ptr<AsciiValue> AutoPtr; typedef Auto_Ptr<AsciiValue> AutoPtr;
//! @name Creators //! @name Creators
//@{ //@{
@ -546,7 +549,7 @@ namespace Exiv2 {
}; // class CharsetInfo }; // class CharsetInfo
//! Shortcut for a %CommentValue auto pointer. //! Shortcut for a %CommentValue auto pointer.
typedef std::auto_ptr<CommentValue> AutoPtr; typedef Auto_Ptr<CommentValue> AutoPtr;
//! @name Creators //! @name Creators
//@{ //@{
@ -633,7 +636,7 @@ namespace Exiv2 {
class EXIV2API XmpValue : public Value { class EXIV2API XmpValue : public Value {
public: public:
//! Shortcut for a %XmpValue auto pointer. //! Shortcut for a %XmpValue auto pointer.
typedef std::auto_ptr<XmpValue> AutoPtr; typedef Auto_Ptr<XmpValue> AutoPtr;
//! XMP array types. //! XMP array types.
enum XmpArrayType { xaNone, xaAlt, xaBag, xaSeq }; enum XmpArrayType { xaNone, xaAlt, xaBag, xaSeq };
@ -724,7 +727,7 @@ namespace Exiv2 {
class EXIV2API XmpTextValue : public XmpValue { class EXIV2API XmpTextValue : public XmpValue {
public: public:
//! Shortcut for a %XmpTextValue auto pointer. //! Shortcut for a %XmpTextValue auto pointer.
typedef std::auto_ptr<XmpTextValue> AutoPtr; typedef Auto_Ptr<XmpTextValue> AutoPtr;
//! @name Creators //! @name Creators
//@{ //@{
@ -806,7 +809,7 @@ namespace Exiv2 {
class EXIV2API XmpArrayValue : public XmpValue { class EXIV2API XmpArrayValue : public XmpValue {
public: public:
//! Shortcut for a %XmpArrayValue auto pointer. //! Shortcut for a %XmpArrayValue auto pointer.
typedef std::auto_ptr<XmpArrayValue> AutoPtr; typedef Auto_Ptr<XmpArrayValue> AutoPtr;
//! @name Creators //! @name Creators
//@{ //@{
@ -899,7 +902,7 @@ namespace Exiv2 {
class EXIV2API LangAltValue : public XmpValue { class EXIV2API LangAltValue : public XmpValue {
public: public:
//! Shortcut for a %LangAltValue auto pointer. //! Shortcut for a %LangAltValue auto pointer.
typedef std::auto_ptr<LangAltValue> AutoPtr; typedef Auto_Ptr<LangAltValue> AutoPtr;
//! @name Creators //! @name Creators
//@{ //@{
@ -987,7 +990,7 @@ namespace Exiv2 {
class EXIV2API DateValue : public Value { class EXIV2API DateValue : public Value {
public: public:
//! Shortcut for a %DateValue auto pointer. //! Shortcut for a %DateValue auto pointer.
typedef std::auto_ptr<DateValue> AutoPtr; typedef Auto_Ptr<DateValue> AutoPtr;
//! @name Creators //! @name Creators
//@{ //@{
@ -1088,7 +1091,7 @@ namespace Exiv2 {
class EXIV2API TimeValue : public Value { class EXIV2API TimeValue : public Value {
public: public:
//! Shortcut for a %TimeValue auto pointer. //! Shortcut for a %TimeValue auto pointer.
typedef std::auto_ptr<TimeValue> AutoPtr; typedef Auto_Ptr<TimeValue> AutoPtr;
//! @name Creators //! @name Creators
//@{ //@{
@ -1244,7 +1247,7 @@ namespace Exiv2 {
class ValueType : public Value { class ValueType : public Value {
public: public:
//! Shortcut for a %ValueType\<T\> auto pointer. //! Shortcut for a %ValueType\<T\> auto pointer.
typedef std::auto_ptr<ValueType<T> > AutoPtr; typedef Auto_Ptr<ValueType<T> > AutoPtr;
//! @name Creators //! @name Creators
//@{ //@{

@ -153,7 +153,7 @@ namespace Exiv2 {
private: private:
// Pimpl idiom // Pimpl idiom
struct Impl; struct Impl;
std::auto_ptr<Impl> p_; Auto_Ptr<Impl> p_;
}; // class Xmpdatum }; // class Xmpdatum

@ -201,7 +201,7 @@ if (NOT MSVC)
target_link_libraries( exiv2lib PRIVATE psapi ws2_32 shell32 ) target_link_libraries( exiv2lib PRIVATE psapi ws2_32 shell32 )
endif() endif()
target_link_libraries( exiv2lib PRIVATE Threads::Threads) # target_link_libraries( exiv2lib PRIVATE Threads::Threads)
else() else()
target_link_libraries( exiv2lib PRIVATE psapi ws2_32 shell32 ) target_link_libraries( exiv2lib PRIVATE psapi ws2_32 shell32 )
endif() endif()

@ -1989,19 +1989,19 @@ namespace {
static CRITICAL_SECTION cs; static CRITICAL_SECTION cs;
#else #else
/* Unix/Linux/Cygwin/macOS */ /* Unix/Linux/Cygwin/macOS */
#include <pthread.h> #include <mutex>
/* This is the critical section object (statically allocated). */ /* This is the critical section object (statically allocated). */
#if defined(__APPLE__) #if defined(__APPLE__)
#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER) #if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
static pthread_mutex_t cs = PTHREAD_RECURSIVE_MUTEX_INITIALIZER; static std::mutex cs;
#else #else
static pthread_mutex_t cs = PTHREAD_MUTEX_INITIALIZER; static std::mutex cs;
#endif #endif
#else #else
#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) #if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
static pthread_mutex_t cs = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; static std::mutex cs;
#else #else
static pthread_mutex_t cs = PTHREAD_MUTEX_INITIALIZER; static std::mutex cs;
#endif #endif
#endif #endif
#endif #endif
@ -2020,7 +2020,7 @@ namespace {
DWORD pid = ::GetProcessId(process); DWORD pid = ::GetProcessId(process);
#else #else
pid_t pid = ::getpid(); pid_t pid = ::getpid();
pthread_mutex_lock( &cs ); cs.lock();
std::string tmp = "/tmp/"; std::string tmp = "/tmp/";
#endif #endif
char sCount[13]; char sCount[13];
@ -2032,7 +2032,7 @@ namespace {
#if defined(_MSC_VER) || defined(__MINGW__) #if defined(_MSC_VER) || defined(__MINGW__)
LeaveCriticalSection(&cs); LeaveCriticalSection(&cs);
#else #else
pthread_mutex_unlock( &cs ); cs.unlock();
#endif #endif
return result; return result;

@ -65,7 +65,7 @@ namespace Action {
class Task { class Task {
public: public:
//! Shortcut for an auto pointer. //! Shortcut for an auto pointer.
typedef std::auto_ptr<Task> AutoPtr; typedef Auto_Ptr<Task> AutoPtr;
//! Virtual destructor. //! Virtual destructor.
virtual ~Task(); virtual ~Task();
//! Virtual copy construction. //! Virtual copy construction.
@ -149,7 +149,7 @@ namespace Action {
public: public:
virtual ~Print(); virtual ~Print();
virtual int run(const std::string& path); virtual int run(const std::string& path);
typedef std::auto_ptr<Print> AutoPtr; typedef Auto_Ptr<Print> AutoPtr;
AutoPtr clone() const; AutoPtr clone() const;
//! Print the Jpeg comment //! Print the Jpeg comment
@ -204,7 +204,7 @@ namespace Action {
public: public:
virtual ~Rename(); virtual ~Rename();
virtual int run(const std::string& path); virtual int run(const std::string& path);
typedef std::auto_ptr<Rename> AutoPtr; typedef Auto_Ptr<Rename> AutoPtr;
AutoPtr clone() const; AutoPtr clone() const;
private: private:
@ -216,7 +216,7 @@ namespace Action {
public: public:
virtual ~Adjust(); virtual ~Adjust();
virtual int run(const std::string& path); virtual int run(const std::string& path);
typedef std::auto_ptr<Adjust> AutoPtr; typedef Auto_Ptr<Adjust> AutoPtr;
AutoPtr clone() const; AutoPtr clone() const;
private: private:
@ -239,7 +239,7 @@ namespace Action {
public: public:
virtual ~Erase(); virtual ~Erase();
virtual int run(const std::string& path); virtual int run(const std::string& path);
typedef std::auto_ptr<Erase> AutoPtr; typedef Auto_Ptr<Erase> AutoPtr;
AutoPtr clone() const; AutoPtr clone() const;
/*! /*!
@ -281,7 +281,7 @@ namespace Action {
public: public:
virtual ~Extract(); virtual ~Extract();
virtual int run(const std::string& path); virtual int run(const std::string& path);
typedef std::auto_ptr<Extract> AutoPtr; typedef Auto_Ptr<Extract> AutoPtr;
AutoPtr clone() const; AutoPtr clone() const;
/*! /*!
@ -320,7 +320,7 @@ namespace Action {
public: public:
virtual ~Insert(); virtual ~Insert();
virtual int run(const std::string& path); virtual int run(const std::string& path);
typedef std::auto_ptr<Insert> AutoPtr; typedef Auto_Ptr<Insert> AutoPtr;
AutoPtr clone() const; AutoPtr clone() const;
/*! /*!
@ -361,7 +361,7 @@ namespace Action {
public: public:
virtual ~Modify(); virtual ~Modify();
virtual int run(const std::string& path); virtual int run(const std::string& path);
typedef std::auto_ptr<Modify> AutoPtr; typedef Auto_Ptr<Modify> AutoPtr;
AutoPtr clone() const; AutoPtr clone() const;
Modify() {} Modify() {}
//! Apply modification commands to the \em pImage, return 0 if successful. //! Apply modification commands to the \em pImage, return 0 if successful.
@ -394,7 +394,7 @@ namespace Action {
public: public:
virtual ~FixIso(); virtual ~FixIso();
virtual int run(const std::string& path); virtual int run(const std::string& path);
typedef std::auto_ptr<FixIso> AutoPtr; typedef Auto_Ptr<FixIso> AutoPtr;
AutoPtr clone() const; AutoPtr clone() const;
private: private:
@ -412,7 +412,7 @@ namespace Action {
public: public:
virtual ~FixCom(); virtual ~FixCom();
virtual int run(const std::string& path); virtual int run(const std::string& path);
typedef std::auto_ptr<FixCom> AutoPtr; typedef Auto_Ptr<FixCom> AutoPtr;
AutoPtr clone() const; AutoPtr clone() const;
private: private:

@ -183,7 +183,7 @@ namespace Exiv2 {
ed.end()); ed.end());
} }
std::auto_ptr<TiffHeaderBase> header(new Cr2Header(byteOrder)); Auto_Ptr<TiffHeaderBase> header(new Cr2Header(byteOrder));
OffsetWriter offsetWriter; OffsetWriter offsetWriter;
offsetWriter.setOrigin(OffsetWriter::cr2RawIfdOffset, Cr2Header::offset2addr(), byteOrder); offsetWriter.setOrigin(OffsetWriter::cr2RawIfdOffset, Cr2Header::offset2addr(), byteOrder);
return TiffParserWorker::encode(io, return TiffParserWorker::encode(io,

@ -91,7 +91,7 @@ namespace Exiv2 {
class CiffComponent { class CiffComponent {
public: public:
//! CiffComponent auto_ptr type //! CiffComponent auto_ptr type
typedef std::auto_ptr<CiffComponent> AutoPtr; typedef Auto_Ptr<CiffComponent> AutoPtr;
//! Container type to hold all metadata //! Container type to hold all metadata
typedef std::vector<CiffComponent*> Components; typedef std::vector<CiffComponent*> Components;
@ -435,7 +435,7 @@ namespace Exiv2 {
class CiffHeader { class CiffHeader {
public: public:
//! CiffHeader auto_ptr type //! CiffHeader auto_ptr type
typedef std::auto_ptr<CiffHeader> AutoPtr; typedef Auto_Ptr<CiffHeader> AutoPtr;
//! @name Creators //! @name Creators
//@{ //@{

@ -80,7 +80,7 @@ namespace {
class Thumbnail { class Thumbnail {
public: public:
//! Shortcut for a %Thumbnail auto pointer. //! Shortcut for a %Thumbnail auto pointer.
typedef std::auto_ptr<Thumbnail> AutoPtr; typedef Auto_Ptr<Thumbnail> AutoPtr;
//! @name Creators //! @name Creators
//@{ //@{
@ -123,7 +123,7 @@ namespace {
class TiffThumbnail : public Thumbnail { class TiffThumbnail : public Thumbnail {
public: public:
//! Shortcut for a %TiffThumbnail auto pointer. //! Shortcut for a %TiffThumbnail auto pointer.
typedef std::auto_ptr<TiffThumbnail> AutoPtr; typedef Auto_Ptr<TiffThumbnail> AutoPtr;
//! @name Manipulators //! @name Manipulators
//@{ //@{
@ -147,7 +147,7 @@ namespace {
class JpegThumbnail : public Thumbnail { class JpegThumbnail : public Thumbnail {
public: public:
//! Shortcut for a %JpegThumbnail auto pointer. //! Shortcut for a %JpegThumbnail auto pointer.
typedef std::auto_ptr<JpegThumbnail> AutoPtr; typedef Auto_Ptr<JpegThumbnail> AutoPtr;
//! @name Manipulators //! @name Manipulators
//@{ //@{
@ -192,8 +192,8 @@ namespace Exiv2 {
template<typename T> template<typename T>
Exiv2::Exifdatum& setValue(Exiv2::Exifdatum& exifDatum, const T& value) Exiv2::Exifdatum& setValue(Exiv2::Exifdatum& exifDatum, const T& value)
{ {
std::auto_ptr<Exiv2::ValueType<T> > v Auto_Ptr<Exiv2::ValueType<T> > v
= std::auto_ptr<Exiv2::ValueType<T> >(new Exiv2::ValueType<T>); = Auto_Ptr<Exiv2::ValueType<T> >(new Exiv2::ValueType<T>);
v->value_.push_back(value); v->value_.push_back(value);
exifDatum.value_ = v; exifDatum.value_ = v;
return exifDatum; return exifDatum;
@ -726,7 +726,7 @@ namespace Exiv2 {
// Encode and check if the result fits into a JPEG Exif APP1 segment // Encode and check if the result fits into a JPEG Exif APP1 segment
MemIo mio1; MemIo mio1;
std::auto_ptr<TiffHeaderBase> header(new TiffHeader(byteOrder, 0x00000008, false)); Auto_Ptr<TiffHeaderBase> header(new TiffHeader(byteOrder, 0x00000008, false));
WriteMethod wm = TiffParserWorker::encode(mio1, WriteMethod wm = TiffParserWorker::encode(mio1,
pData, pData,
size, size,

@ -938,7 +938,7 @@ namespace Exiv2 {
Image::AutoPtr ImageFactory::create(int type, Image::AutoPtr ImageFactory::create(int type,
const std::string& path) const std::string& path)
{ {
std::auto_ptr<FileIo> fileIo(new FileIo(path)); Auto_Ptr<FileIo> fileIo(new FileIo(path));
// Create or overwrite the file, then close it // Create or overwrite the file, then close it
if (fileIo->open("w+b") != 0) { if (fileIo->open("w+b") != 0) {
throw Error(kerFileOpenFailed, path, "w+b", strError()); throw Error(kerFileOpenFailed, path, "w+b", strError());
@ -954,7 +954,7 @@ namespace Exiv2 {
Image::AutoPtr ImageFactory::create(int type, Image::AutoPtr ImageFactory::create(int type,
const std::wstring& wpath) const std::wstring& wpath)
{ {
std::auto_ptr<FileIo> fileIo(new FileIo(wpath)); Auto_Ptr<FileIo> fileIo(new FileIo(wpath));
// Create or overwrite the file, then close it // Create or overwrite the file, then close it
if (fileIo->open("w+b") != 0) { if (fileIo->open("w+b") != 0) {
throw WError(kerFileOpenFailed, wpath, "w+b", strError().c_str()); throw WError(kerFileOpenFailed, wpath, "w+b", strError().c_str());

@ -195,7 +195,7 @@ namespace Exiv2 {
ed.end()); ed.end());
} }
std::auto_ptr<TiffHeaderBase> header(new OrfHeader(byteOrder)); Auto_Ptr<TiffHeaderBase> header(new OrfHeader(byteOrder));
return TiffParserWorker::encode(io, return TiffParserWorker::encode(io,
pData, pData,
size, size,

@ -93,7 +93,7 @@ namespace {
virtual ~Loader() {} virtual ~Loader() {}
//! Loader auto pointer //! Loader auto pointer
typedef std::auto_ptr<Loader> AutoPtr; typedef Auto_Ptr<Loader> AutoPtr;
//! Create a Loader subclass for requested id //! Create a Loader subclass for requested id
static AutoPtr create(PreviewId id, const Image &image); static AutoPtr create(PreviewId id, const Image &image);

@ -174,7 +174,7 @@ namespace Exiv2 {
class TiffComponent { class TiffComponent {
public: public:
//! TiffComponent auto_ptr type //! TiffComponent auto_ptr type
typedef std::auto_ptr<TiffComponent> AutoPtr; typedef Auto_Ptr<TiffComponent> AutoPtr;
//! Container type to hold all metadata //! Container type to hold all metadata
typedef std::vector<TiffComponent*> Components; typedef std::vector<TiffComponent*> Components;

@ -105,7 +105,7 @@ namespace Exiv2 {
Use TiffComponent::AutoPtr, it is not used in this declaration only Use TiffComponent::AutoPtr, it is not used in this declaration only
to reduce dependencies. to reduce dependencies.
*/ */
typedef std::auto_ptr<TiffComponent> (*NewTiffCompFct)(uint16_t tag, IfdId group); typedef Auto_Ptr<TiffComponent> (*NewTiffCompFct)(uint16_t tag, IfdId group);
//! Stack to hold a path from the TIFF root element to a TIFF entry //! Stack to hold a path from the TIFF root element to a TIFF entry
typedef std::stack<TiffPathItem> TiffPath; typedef std::stack<TiffPathItem> TiffPath;

@ -292,7 +292,7 @@ namespace Exiv2 {
ed.end()); ed.end());
} }
std::auto_ptr<TiffHeaderBase> header(new TiffHeader(byteOrder)); Auto_Ptr<TiffHeaderBase> header(new TiffHeader(byteOrder));
return TiffParserWorker::encode(io, return TiffParserWorker::encode(io,
pData, pData,
size, size,

@ -1675,9 +1675,9 @@ namespace Exiv2 {
) )
{ {
// Create standard TIFF header if necessary // Create standard TIFF header if necessary
std::auto_ptr<TiffHeaderBase> ph; Auto_Ptr<TiffHeaderBase> ph;
if (!pHeader) { if (!pHeader) {
ph = std::auto_ptr<TiffHeaderBase>(new TiffHeader); ph = Auto_Ptr<TiffHeaderBase>(new TiffHeader);
pHeader = ph.get(); pHeader = ph.get();
} }
TiffComponent::AutoPtr rootDir = parse(pData, size, root, pHeader); TiffComponent::AutoPtr rootDir = parse(pData, size, root, pHeader);

@ -256,7 +256,7 @@ namespace Exiv2 {
component creation function. If the pointer that is returned component creation function. If the pointer that is returned
is 0, then the TIFF entry should be ignored. is 0, then the TIFF entry should be ignored.
*/ */
static std::auto_ptr<TiffComponent> create(uint32_t extendedTag, static Auto_Ptr<TiffComponent> create(uint32_t extendedTag,
IfdId group); IfdId group);
/*! /*!
@brief Get the path, i.e., a list of extended tag and group pairs, from @brief Get the path, i.e., a list of extended tag and group pairs, from
@ -349,7 +349,7 @@ namespace Exiv2 {
composite structure. If \em pData is 0 or \em size composite structure. If \em pData is 0 or \em size
is 0, the return value is a 0 pointer. is 0, the return value is a 0 pointer.
*/ */
static std::auto_ptr<TiffComponent> parse( static Auto_Ptr<TiffComponent> parse(
const byte* pData, const byte* pData,
uint32_t size, uint32_t size,
uint32_t root, uint32_t root,

Loading…
Cancel
Save