Remove dead code: copyXattrFrom
This commit is contained in:
parent
c0b663b7ea
commit
1d243ed40e
@ -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 <sys/xattr.h>
|
||||
#endif
|
||||
|
||||
#if defined(__MINGW__) || (defined(WIN32) && !defined(__CYGWIN__))
|
||||
// Windows doesn't provide nlink_t
|
||||
using nlink_t = short;
|
||||
# include <windows.h>
|
||||
# include <io.h>
|
||||
#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))
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user