BasicIo::AutoPtr FileIo::temporary() const { BasicIo::AutoPtr basicIo; Impl::StructStat buf; int ret = p_->stat(buf); #if defined WIN32 && !defined __CYGWIN__ DWORD nlink = p_->winNumberOfLinks(); #else nlink_t nlink = buf.st_nlink; #endif // If file is > 1MB and doesn't have hard links then use a file, otherwise // use a memory buffer. I.e., files with hard links always use a memory // buffer, which is a workaround to ensure that the links don't get broken. if (ret != 0 || (buf.st_size > 1048576 && nlink == 1)) { pid_t pid = ::getpid(); std::auto_ptr<FileIo> fileIo; #ifdef EXV_UNICODE_PATH if (p_->wpMode_ == Impl::wpUnicode) { std::wstring tmpname = wpath() + s2ws(toString(pid)); fileIo = std::auto_ptr<FileIo>(new FileIo(tmpname)); } else #endif { std::string tmpname = path() + toString(pid); fileIo = std::auto_ptr<FileIo>(new FileIo(tmpname)); } if (fileIo->open("w+b") != 0) { #ifdef EXV_UNICODE_PATH if (p_->wpMode_ == Impl::wpUnicode) { throw WError(10, wpath(), "w+b", strError().c_str()); } else #endif { throw Error(10, path(), "w+b", strError()); } } fileIo->p_->copyXattrFrom(*this); basicIo = fileIo; } else { basicIo.reset(new MemIo); } return basicIo; }
void FileIo::transfer(BasicIo& src) { const bool wasOpen = (fp_ != 0); const std::string lastMode(openMode_); FileIo *fileIo = dynamic_cast<FileIo*>(&src); if (fileIo) { // Optimization if src is another instance of FileIo fileIo->close(); // Check if the file can be written to, if it already exists if (open("w+b") != 0) { // Remove the (temporary) file std::remove(fileIo->path_.c_str()); throw Error(10, path_, "w+b", strError()); } close(); struct stat buf; if (::stat(path_.c_str(), &buf) == -1) { throw Error(2, path_, strError(), "stat"); } // MSVCRT rename that does not overwrite existing files if (fileExists(path_) && std::remove(path_.c_str()) != 0) { throw Error(2, path_, strError(), "std::remove"); } if (std::rename(fileIo->path_.c_str(), path_.c_str()) == -1) { throw Error(17, fileIo->path_, path_, strError()); } std::remove(fileIo->path_.c_str()); // Set original file permissions if (::chmod(path_.c_str(), buf.st_mode) == -1) { throw Error(2, fileIo->path_, strError(), "chmod"); } } else { // Generic handling, reopen both to reset to start if (open("w+b") != 0) { throw Error(10, path_, "w+b", strError()); } if (src.open() != 0) { throw Error(9, src.path(), strError()); } write(src); src.close(); } if (wasOpen) { if (open(lastMode) != 0) { throw Error(10, path_, lastMode, strError()); } } else close(); if (error() || src.error()) throw Error(18, path_, strError()); }
int Socket::listen(const SocketAddress& addr, int backlog) const { createSocket(addr); const SOCKET& socket = impl->fd; BOOL yes=1; QPID_WINSOCK_CHECK(setsockopt(socket, SOL_SOCKET, SO_REUSEADDR, (char *)&yes, sizeof(yes))); if (::bind(socket, getAddrInfo(addr).ai_addr, getAddrInfo(addr).ai_addrlen) == SOCKET_ERROR) throw Exception(QPID_MSG("Can't bind to " << addr.asString() << ": " << strError(WSAGetLastError()))); if (::listen(socket, backlog) == SOCKET_ERROR) throw Exception(QPID_MSG("Can't listen on " <<addr.asString() << ": " << strError(WSAGetLastError()))); return getLocalPort(socket); }
// // insert // String& String::insert(size_t pos, const String& s) { KEEPOLD; // // preconditions // if(pos > length()) strError("String::insert", "OutOfRange"); // // operations // if(this == &s) return insert(pos, String(s)); // insert into itself if(s.srep) doReplace(pos, 0, s.srep->str, s.srep->getLen()); // // post conditions // assert(length() == (s.length() + OLD.length())); assert(memcmp(cStr() + pos, s.cStr(), s.length()) == 0); return *this; }
bool CAirportDatabaseList::updateShareTemplateDatabase() { for (int i = 0; i < (int)m_vAirportDB.size(); i++) { CShareTemplateDatabase* pShareTemplateDatabase = m_vAirportDB.at(i); CString strSharePath(_T("")); strSharePath.Format(_T("%s\\ImportDb\\%s.mdb"),PROJMANAGER->GetAppPath(),pShareTemplateDatabase->getName()); if (PathFileExists(strSharePath)) { /*CString strPartsSourceFile(_T("")); strPartsSourceFile.Format(_T("%s\\ArctermDB\\temp\\project.mdb"),PROJMANAGER->GetAppPath()); CopyFile(strPartsSourceFile,strSharePath,FALSE);*/ AirportDatabaseConnection pConnectionPtr(strSharePath); CPartsAndShareTemplateUpdate shareTemplateDataBaseUpdater; if(!shareTemplateDataBaseUpdater.Update(&pConnectionPtr)) { CString strError(_T("")); strError.Format(_T("Update the Share Template DataBase error.")); MessageBox(NULL,strError,"Warning",MB_OK); return false; } } } return true; }
String& String::getRemove(String& s, size_t pos, size_t n) { KEEPOLD; size_t thisLen = length(); // // preconditions // if(pos > thisLen) strError("String::getRemove", "OutOfRange"); // // operations // if(n == NPOS || (pos + n) > thisLen) n = thisLen - pos; s = substr(pos, n); doReplace(pos, n, "", 0); // // post conditions // assert(length() == (OLD.length() - s.length())); assert(s == OLD.substr(pos, n)); return *this; }
String& String::getRemove(char& c, size_t pos) { KEEPOLD; // // preconditions // if(pos >= length()) strError("String::getRemove", "OutOfRange"); // // operations // c = getAtRaw(pos); doReplace(pos, 1, "", 0); // // post conditions // assert(length() == (OLD.length() - 1)); assert(OLD.getAt(pos) == c); return *this; }
int CIrcSocket::OnLayerCallback(const CAsyncSocketExLayer* pLayer, int nType, int nCode, WPARAM wParam, LPARAM lParam) { if (nType == LAYERCALLBACK_LAYERSPECIFIC) { ASSERT( pLayer ); if (pLayer == m_pProxyLayer) { switch (nCode) { case PROXYERROR_NOCONN: case PROXYERROR_REQUESTFAILED: { CString strError(GetProxyError(nCode)); if (lParam) { strError += _T(" - "); strError += (LPCSTR)lParam; } if (wParam) { CString strErrInf; if (GetErrorMessage(wParam, strErrInf, 1)) strError += _T(" - ") + strErrInf; } LogWarning(LOG_STATUSBAR, _T("IRC socket: %s"), strError); break; } default: LogWarning(LOG_STATUSBAR, _T("IRC socket: %s"), GetProxyError(nCode)); } } } return 1; }
String& String::replace(size_t pos, size_t len, const String& s) { KEEPOLD; size_t thisLen = length(); // // preconditions // if(pos > thisLen) strError("String::replace", "OutOfRange"); // // operations // if(this == &s) { // if argument string is target return replace(pos, len, String(s)); // get a copy and call it // recursively } if((pos + len) > thisLen) len = thisLen - pos; doReplace(pos, len, s.getStr(), s.length()); // // post conditions // assert(length() == (OLD.length() - len + s.length())); return *this; }
String& String::remove(size_t pos, size_t n) { KEEPOLD; size_t thisLen = length(); // // preconditions // if(pos > length()) strError("String::remove", "OutOfRange"); // // operations // if(n == NPOS || (pos + n) > thisLen) n = thisLen - pos; if(n > 0) doReplace(pos, n, "", 0); // // post conditions // assert(length() == (OLD.length() - n)); return *this; }
String::String(const char* cb, size_t n) { // // preconditions // if(cb == 0) strError("String::String", "InvalidArgument"); // // operations // if(n == NPOS) n = strlen(cb); if(n == 0) { srep = 0; } else { srep = StringRep::getNew(n, 0, cb); } // // post conditions // assert(n == 0 || srep != 0); assert(length() == n); assert(memcmp(cStr(), cb, length()) == 0); }
String& String::insert(size_t pos, char c, size_t rep) { KEEPOLD; // // preconditions // if(pos > length()) strError("String::insert", "OutOfRange"); // // operations // if(rep == 1) doReplace(pos, 0, &c, 1); else if(rep > 0) insert(pos, String(c, rep)); // // post conditions // assert(length() == (rep + OLD.length())); #ifndef NDEBUG for(int i = 0; i < rep; i++) assert(getAt(i + pos) == c); #endif /* NDEBUG */ return *this; }
int String::compare(const char* cb, size_t n) const { size_t thisLen = length(); int res; // // preconditions // if(cb == 0) strError("String::compare", "InvalidArgument"); // // operations // if(n == NPOS) n = strlen(cb); res = memcmp(getStr(), cb, thisLen > n ? n : thisLen); if(res == 0 && n != thisLen) { if(thisLen > n) res = 1; else res = -1; } return res; }
String& String::append(char c, size_t rep) { KEEPOLD; // // preconditions // if(rep == NPOS) strError("String::append", "OutOfRange"); // // operations // if(rep == 1) doReplace(length(), 0, &c, 1); else if(rep > 0) operator+=(String(c, rep)); // // post conditions // assert((OLD.length() + rep) == length()); #ifndef NDEBUG for(int i = 0; i < rep; i++) { int j = i + OLD.length(); assert(getAt(j) == c); } #endif /* NDEBUG */ return *this; }
inline void checkOverflow(size_t lower, size_t upper, const char *msg) { if(upper < lower) /* ##### E029: (col 17) symbol 'strError' has not been declared */ strError(msg, "LengthError"); }
String& String::append(const char* cb, size_t n) { KEEPOLD; // // preconditions // if(cb == 0) strError("String::append", "InvalidArgument"); // // operations // if(n == NPOS) n = strlen(cb); if(n > 0) doReplace(length(), 0, cb, n); // // post conditions // assert((OLD.length() + n) == length()); assert(memcmp(cStr() + OLD.length(), cb, n) == 0); return *this; }
String::String(char c, size_t rep) { // // preconditions // if(rep == NPOS) strError("String::String", "OutOfRange"); // // operations // if(rep == 0) { srep = 0; } else { srep = StringRep::getNew(rep); memset(srep->str, c, rep); } // // post conditions // assert(rep == 0 || srep != 0); assert(length() == rep); #ifndef NDEBUG for(int i = 0; i < rep; i++) assert(getAt(i) == c); #endif /* NDEBUG */ }
CString CHttpClient::GetLastErrorString() { CString strError("Unknown"); switch (GetLastError()) { case HTTP_ERROR_SOCKET_PREPARE_FAILED: strError.Set("Failed to prepare socket"); break; case HTTP_ERROR_INVALID_HOST: strError.Set("Invalid host"); break; case HTTP_ERROR_IOCTL_FAILED: strError.Set("IoCtl failed"); break; case HTTP_ERROR_CONNECTION_FAILED: strError.Set("Connection failed"); break; case HTTP_ERROR_SEND_FAILED: strError.Set("Send failed"); break; case HTTP_ERROR_REQUEST_TIMEOUT: strError.Set("Request timed out"); break; case HTTP_ERROR_NO_HEADER: strError.Set("No header"); break; } return strError; }
void SocketConnector::connect( boost::shared_ptr<Poller> poller, const std::string& name, const std::string& host, const std::string& port, ConnectionCodec::Factory* fact, ConnectFailedCallback failed) { // Note that the following logic does not cause a memory leak. // The allocated Socket is freed either by the AsynchConnector // upon connection failure or by the AsynchIO upon connection // shutdown. The allocated AsynchConnector frees itself when it // is no longer needed. Socket* socket = factory(); try { AsynchConnector* c = AsynchConnector::create( *socket, host, port, boost::bind(&establishedOutgoing, poller, options, &timer, _1, fact, name), boost::bind(&connectFailed, _1, _2, _3, failed)); c->start(poller); } catch (std::exception&) { // TODO: Design question - should we do the error callback and also throw? int errCode = socket->getError(); connectFailed(*socket, errCode, strError(errCode), failed); throw; } }
void XmpSidecar::readMetadata() { #ifdef DEBUG std::cerr << "Reading XMP file " << io_->path() << "\n"; #endif if (io_->open() != 0) { throw Error(9, io_->path(), strError()); } IoCloser closer(*io_); // Ensure that this is the correct image type if (!isXmpType(*io_, false)) { if (io_->error() || io_->eof()) throw Error(14); throw Error(3, "XMP"); } // Read the XMP packet from the IO stream std::string xmpPacket; const long len = 64 * 1024; byte buf[len]; long l; while ((l = io_->read(buf, len)) > 0) { xmpPacket.append(reinterpret_cast<char*>(buf), l); } if (io_->error()) throw Error(14); clearMetadata(); xmpPacket_ = xmpPacket; if (xmpPacket_.size() > 0 && XmpParser::decode(xmpData_, xmpPacket_)) { #ifndef SUPPRESS_WARNINGS EXV_WARNING << "Failed to decode XMP metadata.\n"; #endif } copyXmpToIptc(xmpData_, iptcData_); copyXmpToExif(xmpData_, exifData_); } // XmpSidecar::readMetadata
void CrwImage::readMetadata() { #ifdef DEBUG std::cerr << "Reading CRW file " << io_->path() << "\n"; #endif if (io_->open() != 0) { throw Error(9, io_->path(), strError()); } IoCloser closer(*io_); // Ensure that this is the correct image type if (!isThisType(*io_, false)) { if (io_->error() || io_->eof()) throw Error(14); throw Error(33); } clearMetadata(); // Read the image into a memory buffer long imageSize = io_->size(); DataBuf image(imageSize); io_->read(image.pData_, imageSize); if (io_->error() || io_->eof()) throw Error(14); // Parse the image RawMetadata::AutoPtr parseTree(new CiffHeader); parseTree->read(image.pData_, image.size_, 0, invalidByteOrder); #ifdef DEBUG parseTree->print(std::cerr, invalidByteOrder); #endif parseTree->extract(*this, invalidByteOrder); } // CrwImage::readMetadata
void RafImage::readMetadata() { #ifdef DEBUG std::cerr << "Reading RAF file " << io_->path() << "\n"; #endif if (io_->open() != 0) throw Error(9, io_->path(), strError()); IoCloser closer(*io_); // Ensure that this is the correct image type if (!isRafType(*io_, false)) { if (io_->error() || io_->eof()) throw Error(14); throw Error(3, "RAF"); } byte const* pData = io_->mmap(); long size = io_->size(); if (size < 88 + 4) throw Error(14); // includes the test for -1 uint32_t const start = getULong(pData + 84, bigEndian) + 12; if (static_cast<uint32_t>(size) < start) throw Error(14); clearMetadata(); ByteOrder bo = TiffParser::decode(exifData_, iptcData_, xmpData_, pData + start, size - start); exifData_["Exif.Image2.JPEGInterchangeFormat"] = getULong(pData + 84, bigEndian); exifData_["Exif.Image2.JPEGInterchangeFormatLength"] = getULong(pData + 88, bigEndian); setByteOrder(bo); } // RafImage::readMetadata
void XmpSidecar::writeMetadata() { if (io_->open() != 0) { throw Error(9, io_->path(), strError()); } IoCloser closer(*io_); if (writeXmpFromPacket() == false) { copyExifToXmp(exifData_, xmpData_); copyIptcToXmp(iptcData_, xmpData_); if (XmpParser::encode(xmpPacket_, xmpData_, XmpParser::omitPacketWrapper|XmpParser::useCompactFormat) > 1) { #ifndef SUPPRESS_WARNINGS EXV_ERROR << "Failed to encode XMP metadata.\n"; #endif } } if (xmpPacket_.size() > 0) { if (xmpPacket_.substr(0, 5) != "<?xml") { xmpPacket_ = xmlHeader + xmpPacket_; } BasicIo::AutoPtr tempIo(io_->temporary()); // may throw assert(tempIo.get() != 0); // Write XMP packet if ( tempIo->write(reinterpret_cast<const byte*>(xmpPacket_.data()), static_cast<long>(xmpPacket_.size())) != static_cast<long>(xmpPacket_.size())) throw Error(21); if (tempIo->error()) throw Error(21); io_->close(); io_->transfer(*tempIo); // may throw } } // XmpSidecar::writeMetadata
void GifImage::readMetadata() { #ifdef DEBUG std::cerr << "Exiv2::GifImage::readMetadata: Reading GIF file " << io_->path() << "\n"; #endif if (io_->open() != 0) { throw Error(9, io_->path(), strError()); } IoCloser closer(*io_); // Ensure that this is the correct image type if (!isGifType(*io_, true)) { if (io_->error() || io_->eof()) throw Error(14); throw Error(3, "GIF"); } clearMetadata(); byte buf[4]; if (io_->read(buf, sizeof(buf)) == sizeof(buf)) { pixelWidth_ = getShort(buf, littleEndian); pixelHeight_ = getShort(buf + 2, littleEndian); } } // GifImage::readMetadata
bool CKnownFileList::LoadKnownFiles() { CString fullpath = thePrefs.GetMuleDirectory(EMULE_CONFIGDIR); fullpath.Append(KNOWN_MET_FILENAME); CSafeBufferedFile file; CFileException fexp; if (!file.Open(fullpath,CFile::modeRead|CFile::osSequentialScan|CFile::typeBinary|CFile::shareDenyWrite, &fexp)){ if (fexp.m_cause != CFileException::fileNotFound){ CString strError(_T("Failed to load ") KNOWN_MET_FILENAME _T(" file")); TCHAR szError[MAX_CFEXP_ERRORMSG]; if (fexp.GetErrorMessage(szError, ARRSIZE(szError))){ strError += _T(" - "); strError += szError; } LogError(LOG_STATUSBAR, _T("%s"), strError); } return false; } setvbuf(file.m_pStream, NULL, _IOFBF, 16384); CKnownFile* pRecord = NULL; try { uint8 header = file.ReadUInt8(); if (header != MET_HEADER && header != MET_HEADER_I64TAGS){ file.Close(); LogError(LOG_STATUSBAR, GetResString(IDS_ERR_SERVERMET_BAD)); return false; } AddDebugLogLine(false, _T("Known.met file version is %u (%s support 64bit tags)"), header, (header == MET_HEADER) ? _T("doesn't") : _T("does")); UINT RecordsNumber = file.ReadUInt32(); for (UINT i = 0; i < RecordsNumber; i++) { pRecord = new CKnownFile(); if (!pRecord->LoadFromFile(&file)){ TRACE(_T("*** Failed to load entry %u (name=%s hash=%s size=%I64u parthashs=%u expected parthashs=%u) from known.met\n"), i, pRecord->GetFileName(), md4str(pRecord->GetFileHash()), pRecord->GetFileSize(), pRecord->GetHashCount(), pRecord->GetED2KPartHashCount()); delete pRecord; pRecord = NULL; continue; } SafeAddKFile(pRecord); pRecord = NULL; } file.Close(); } catch(CFileException* error){ if (error->m_cause == CFileException::endOfFile) LogError(LOG_STATUSBAR, GetResString(IDS_ERR_SERVERMET_BAD)); else{ TCHAR buffer[MAX_CFEXP_ERRORMSG]; error->GetErrorMessage(buffer, ARRSIZE(buffer)); LogError(LOG_STATUSBAR, GetResString(IDS_ERR_SERVERMET_UNKNOWN),buffer); } error->Delete(); delete pRecord; return false; } return true; }
DataBuf readFile(const std::string& path) { FileIo file(path); if (file.open("rb") != 0) { throw Error(10, path, "rb", strError()); } struct stat st; if (0 != ::stat(path.c_str(), &st)) { throw Error(2, path, strError(), "stat"); } DataBuf buf(st.st_size); long len = file.read(buf.pData_, buf.size_); if (len != buf.size_) { throw Error(2, path, strError(), "FileIo::read"); } return buf; }
long writeFile(const DataBuf& buf, const std::string& path) { FileIo file(path); if (file.open("wb") != 0) { throw Error(10, path, "wb", strError()); } return file.write(buf.pData_, buf.size_); }
int CIrcSocket::OnLayerCallback(const CAsyncSocketExLayer* pLayer, int nType, int nParam1, int nParam2) { if (nType == LAYERCALLBACK_LAYERSPECIFIC) { ASSERT( pLayer ); if (pLayer == m_pProxyLayer) { switch (nParam1) { case PROXYERROR_NOCONN:{ CString strError(_T("IRC socket: Can't connect to proxy server")); CString strErrInf; if (nParam2 && GetErrorMessage(nParam2, strErrInf)) strError += _T(" - ") + strErrInf; LogWarning(LOG_STATUSBAR, _T("%s"), strError); break; } case PROXYERROR_REQUESTFAILED:{ CString strError(_T("IRC socket: Proxy server request failed")); if (nParam2){ strError += _T(" - "); strError += (LPCSTR)nParam2; } LogWarning(LOG_STATUSBAR, _T("%s"), strError); break; } case PROXYERROR_AUTHTYPEUNKNOWN: LogWarning(LOG_STATUSBAR, _T("IRC socket: Required authentification type reported by proxy server is unknown or unsupported")); break; case PROXYERROR_AUTHFAILED: LogWarning(LOG_STATUSBAR, _T("IRC socket: Proxy server authentification failed")); break; case PROXYERROR_AUTHNOLOGON: LogWarning(LOG_STATUSBAR, _T("IRC socket: Proxy server requires authentification")); break; case PROXYERROR_CANTRESOLVEHOST: LogWarning(LOG_STATUSBAR, _T("IRC socket: Can't resolve host of proxy server")); break; default:{ LogWarning(LOG_STATUSBAR, _T("IRC socket: Proxy server error - %s"), GetProxyError(nParam1)); } } } } return 1; }
HRESULT CDSFilters::ParseInfoBuffer(TCHAR* pszBuffer) { HRESULT hr = S_OK; rapidxml::xml_document<TCHAR> doc; try { doc.parse<0>(pszBuffer); } catch(rapidxml::parse_error& error) { CString strError(error.what()); g_utility.Log(_T("RapidXml got parse error:%s"), strError); return FALSE; } rapidxml::xml_node<TCHAR>* node = doc.first_node(); if (node) node = node->first_node(_T("filter")); for(; node!=NULL; node=node->next_sibling()) { if (_tcsicmp(node->name(), _T("filter")) != 0) { continue; } DSFilterInfo* pInfo = new DSFilterInfo(); if (pInfo == NULL) { hr = E_OUTOFMEMORY; break; } rapidxml::xml_attribute<TCHAR>* attr = node->first_attribute(); for(; attr!=NULL; attr=attr->next_attribute()) { SetFilterInfo(pInfo, attr->name(), attr->value()); } rapidxml::xml_node<TCHAR>* subnode = node->first_node(); for (; subnode!=NULL; subnode=subnode->next_sibling()) { SetFilterInfo(pInfo, subnode); } if (pInfo->filtertype == FT_SOURCE) { m_source.AddTail(pInfo); } else { m_transform.AddTail(pInfo); } } return hr; }
void FileIo::Impl::copyXattrFrom(const FileIo&) #endif { #if defined(__APPLE__) # if defined(EXV_UNICODE_PATH) # error No xattr API for MacOS X with unicode support # endif const ssize_t namebufSize = ::listxattr(src.p_->path_.c_str(), 0, 0, 0); if (namebufSize < 0) { throw Error(2, src.p_->path_, strError(), "listxattr"); } if (namebufSize == 0) { // No extended attributes in source file return; } char namebuf[namebufSize]; if (::listxattr(src.p_->path_.c_str(), namebuf, sizeof(namebuf), 0) != namebufSize) { throw Error(2, 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(2, src.p_->path_, strError(), "getxattr"); } char value[valueSize]; if (::getxattr(src.p_->path_.c_str(), name, value, sizeof(value), 0, 0) != valueSize) { throw Error(2, src.p_->path_, strError(), "getxattr"); } // #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"; #endif if (::setxattr(path_.c_str(), name, value, valueSize, 0, 0) != 0) { throw Error(2, path_, strError(), "setxattr"); } #endif } #else // No xattr support for this platform. #endif } // FileIo::Impl::copyXattrFrom