diff --git a/src/basicio.cpp b/src/basicio.cpp index 8a179518..5e9ddd72 100644 --- a/src/basicio.cpp +++ b/src/basicio.cpp @@ -67,14 +67,7 @@ namespace fs = std::filesystem; #define mode_t unsigned short -// Platform specific headers for handling extended attributes (xattr) -#if defined(__APPLE__) -# include -#endif - #if defined(__MINGW__) || (defined(WIN32) && !defined(__CYGWIN__)) -// Windows doesn't provide nlink_t -using nlink_t = short; # include # include #endif @@ -145,8 +138,6 @@ namespace Exiv2 { int switchMode(OpMode opMode); //! stat wrapper for internal use int stat(StructStat& buf) const; - //! copy extended attributes (xattr) from another file - void copyXattrFrom(const FileIo& src); // NOT IMPLEMENTED Impl(const Impl& rhs) = delete; //!< Copy constructor Impl& operator=(const Impl& rhs) = delete; //!< Assignment @@ -227,53 +218,6 @@ namespace Exiv2 { return ret; } // FileIo::Impl::stat -#if defined(__APPLE__) - void FileIo::Impl::copyXattrFrom(const FileIo& src) -#else - void FileIo::Impl::copyXattrFrom(const FileIo&) -#endif - { -#if defined(__APPLE__) - ssize_t namebufSize = ::listxattr(src.p_->path_.c_str(), 0, 0, 0); - if (namebufSize < 0) { - throw Error(kerCallFailed, src.p_->path_, strError(), "listxattr"); - } - if (namebufSize == 0) { - // No extended attributes in source file - return; - } - char* namebuf = new char[namebufSize]; - if (::listxattr(src.p_->path_.c_str(), namebuf, namebufSize, 0) != namebufSize) { - throw Error(kerCallFailed, src.p_->path_, strError(), "listxattr"); - } - for (ssize_t namebufPos = 0; namebufPos < namebufSize;) { - const char *name = namebuf + namebufPos; - namebufPos += strlen(name) + 1; - const ssize_t valueSize = ::getxattr(src.p_->path_.c_str(), name, 0, 0, 0, 0); - if (valueSize < 0) { - throw Error(kerCallFailed, src.p_->path_, strError(), "getxattr"); - } - char* value = new char[valueSize]; - if (::getxattr(src.p_->path_.c_str(), name, value, valueSize, 0, 0) != valueSize) { - throw Error(kerCallFailed, src.p_->path_, strError(), "getxattr"); - } -// #906. Mountain Lion 'sandbox' terminates the app when we call setxattr -#ifndef __APPLE__ -#ifdef EXIV2_DEBUG_MESSAGES - EXV_DEBUG << "Copying xattr \"" << name << "\" with value size " << valueSize << "\n"; -#endif - if (::setxattr(path_.c_str(), name, value, valueSize, 0, 0) != 0) { - throw Error(kerCallFailed, path_, strError(), "setxattr"); - } - delete [] value; -#endif - } - delete [] namebuf; -#else - // No xattr support for this platform. -#endif - } // FileIo::Impl::copyXattrFrom - FileIo::FileIo(const std::string& path) : p_(new Impl(path)) {