v0.27.3
Robin Mills 12 years ago
parent 3f5e82bcc5
commit cc8953be16

@ -264,7 +264,7 @@ namespace Exiv2 {
#else #else
void FileIo::Impl::copyXattrFrom(const FileIo&) void FileIo::Impl::copyXattrFrom(const FileIo&)
#endif #endif
{ {
#if defined(__APPLE__) #if defined(__APPLE__)
# if defined(EXV_UNICODE_PATH) # if defined(EXV_UNICODE_PATH)
# error No xattr API for MacOS X with unicode support # error No xattr API for MacOS X with unicode support
@ -292,13 +292,15 @@ namespace Exiv2 {
if (::getxattr(src.p_->path_.c_str(), name, value, sizeof(value), 0, 0) != valueSize) { if (::getxattr(src.p_->path_.c_str(), name, value, sizeof(value), 0, 0) != valueSize) {
throw Error(2, src.p_->path_, strError(), "getxattr"); throw Error(2, src.p_->path_, strError(), "getxattr");
} }
#ifdef DEBUG // #906. Mountain Lion 'sandbox' terminates the app when we call setxattr
#ifndef __APPLE__
#ifdef DEBUG
EXV_DEBUG << "Copying xattr \"" << name << "\" with value size " << valueSize << "\n"; EXV_DEBUG << "Copying xattr \"" << name << "\" with value size " << valueSize << "\n";
#endif #endif
if (::setxattr(path_.c_str(), name, value, valueSize, 0, 0) != 0) { if (::setxattr(path_.c_str(), name, value, valueSize, 0, 0) != 0) {
throw Error(2, path_, strError(), "setxattr"); throw Error(2, path_, strError(), "setxattr");
} }
} #endif
#else #else
// No xattr support for this platform. // No xattr support for this platform.
#endif #endif
@ -541,7 +543,7 @@ namespace Exiv2 {
int ret = p_->stat(buf); int ret = p_->stat(buf);
#if defined WIN32 && !defined __CYGWIN__ #if defined WIN32 && !defined __CYGWIN__
DWORD nlink = p_->winNumberOfLinks(); DWORD nlink = p_->winNumberOfLinks();
#else #else
nlink_t nlink = buf.st_nlink; nlink_t nlink = buf.st_nlink;
#endif #endif
@ -823,26 +825,26 @@ namespace Exiv2 {
} }
#if defined(_MSC_VER) #if defined(_MSC_VER)
int FileIo::seek( uint64_t offset, Position pos ) int FileIo::seek( uint64_t offset, Position pos )
{ {
assert(p_->fp_ != 0); assert(p_->fp_ != 0);
int fileSeek = 0; int fileSeek = 0;
switch (pos) { switch (pos) {
case BasicIo::cur: fileSeek = SEEK_CUR; break; case BasicIo::cur: fileSeek = SEEK_CUR; break;
case BasicIo::beg: fileSeek = SEEK_SET; break; case BasicIo::beg: fileSeek = SEEK_SET; break;
case BasicIo::end: fileSeek = SEEK_END; break; case BasicIo::end: fileSeek = SEEK_END; break;
} }
if (p_->switchMode(Impl::opSeek) != 0) return 1; if (p_->switchMode(Impl::opSeek) != 0) return 1;
#ifdef _WIN64 #ifdef _WIN64
return _fseeki64(p_->fp_, offset, fileSeek); return _fseeki64(p_->fp_, offset, fileSeek);
#else #else
return std::fseek(p_->fp_,static_cast<long>(offset), fileSeek); return std::fseek(p_->fp_,static_cast<long>(offset), fileSeek);
#endif #endif
} }
#else #else
int FileIo::seek(long offset, Position pos) int FileIo::seek(long offset, Position pos)
{ {
assert(p_->fp_ != 0); assert(p_->fp_ != 0);
@ -1132,23 +1134,23 @@ namespace Exiv2 {
} }
#if defined(_MSC_VER) #if defined(_MSC_VER)
int MemIo::seek( uint64_t offset, Position pos ) int MemIo::seek( uint64_t offset, Position pos )
{ {
uint64_t newIdx = 0; uint64_t newIdx = 0;
switch (pos) { switch (pos) {
case BasicIo::cur: newIdx = p_->idx_ + offset; break; case BasicIo::cur: newIdx = p_->idx_ + offset; break;
case BasicIo::beg: newIdx = offset; break; case BasicIo::beg: newIdx = offset; break;
case BasicIo::end: newIdx = p_->size_ + offset; break; case BasicIo::end: newIdx = p_->size_ + offset; break;
} }
if ( /*newIdx < 0 || */ newIdx > static_cast<uint64_t>(p_->size_) ) return 1; if ( /*newIdx < 0 || */ newIdx > static_cast<uint64_t>(p_->size_) ) return 1;
p_->idx_ = static_cast<long>(newIdx); //not very sure about this. need more test!! - note by Shawn fly2xj@gmail.com //TODO p_->idx_ = static_cast<long>(newIdx); //not very sure about this. need more test!! - note by Shawn fly2xj@gmail.com //TODO
p_->eof_ = false; p_->eof_ = false;
return 0; return 0;
} }
#else #else
int MemIo::seek(long offset, Position pos) int MemIo::seek(long offset, Position pos)
{ {
long newIdx = 0; long newIdx = 0;

Loading…
Cancel
Save