当前位置: 首页>>代码示例>>C++>>正文


C++ CAfpConnection类代码示例

本文整理汇总了C++中CAfpConnection的典型用法代码示例。如果您正苦于以下问题:C++ CAfpConnection类的具体用法?C++ CAfpConnection怎么用?C++ CAfpConnection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CAfpConnection类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: lock

// TODO - maybe check returncode!
int CAFPFile::Stat(const CURL& url, struct __stat64* buffer)
{
    CSingleLock lock(gAfpConnection);
    if (gAfpConnection.Connect(url) != CAfpConnection::AfpOk || !gAfpConnection.GetVolume())
        return -1;

    std::string strPath = gAfpConnection.GetPath(url);

    struct stat tmpBuffer = {0};
    int iResult = gAfpConnection.GetImpl()->afp_wrap_getattr(gAfpConnection.GetVolume(), strPath.c_str(), &tmpBuffer);

    if (buffer)
    {
        memset(buffer, 0, sizeof(struct __stat64));
        buffer->st_dev   = tmpBuffer.st_dev;
        buffer->st_ino   = tmpBuffer.st_ino;
        buffer->st_mode  = tmpBuffer.st_mode;
        buffer->st_nlink = tmpBuffer.st_nlink;
        buffer->st_uid   = tmpBuffer.st_uid;
        buffer->st_gid   = tmpBuffer.st_gid;
        buffer->st_rdev  = tmpBuffer.st_rdev;
        buffer->st_size  = tmpBuffer.st_size;
        buffer->st_atime = tmpBuffer.st_atime;
        buffer->st_mtime = tmpBuffer.st_mtime;
        buffer->st_ctime = tmpBuffer.st_ctime;
    }

    return iResult;
}
开发者ID:Fice,项目名称:xbmc,代码行数:30,代码来源:AFPFile.cpp

示例2: lock

bool CAFPFile::Rename(const CURL& url, const CURL& urlnew)
{
  CSingleLock lock(gAfpConnection);
  if (gAfpConnection.Connect(url) != CAfpConnection::AfpOk || !gAfpConnection.GetVolume())
    return false;

  CStdString strFile = gAfpConnection.GetPath(url);
  CStdString strFileNew = gAfpConnection.GetPath(urlnew);

  int result = gAfpConnection.GetImpl()->afp_wrap_rename(gAfpConnection.GetVolume(), strFile.c_str(), strFileNew.c_str());

  if (result != 0)
    CLog::Log(LOGERROR, "%s - Error( %s )", __FUNCTION__, strerror(errno));

  return (result == 0);
}
开发者ID:CharlieMarshall,项目名称:xbmc,代码行数:16,代码来源:AFPFile.cpp

示例3: Write

int CFileAFP::Write(const void* lpBuf, int64_t uiBufSize)
{
  CSingleLock lock(gAfpConnection);
  if (m_pFp == NULL || !gAfpConnection.GetVolume())
   return -1;

  int numberOfBytesWritten = 0;
  uid_t uid;
  gid_t gid;

  // FIXME need a better way to get server's uid/gid
  uid = getuid();
  gid = getgid();
#ifdef USE_CVS_AFPFS
  char *name = m_pFp->basename;
#else
  char *name = m_pFp->name;
  if (strlen(name) == 0)
    name = m_pFp->basename;
#endif
  numberOfBytesWritten = gAfpConnection.GetImpl()->afp_wrap_write(gAfpConnection.GetVolume(),
    name, (const char *)lpBuf, (size_t)uiBufSize, m_fileOffset, m_pFp, uid, gid);

  return numberOfBytesWritten;
}
开发者ID:Sky-git,项目名称:xbmc,代码行数:25,代码来源:FileAFP.cpp

示例4: Read

unsigned int CFileAFP::Read(void *lpBuf, int64_t uiBufSize)
{
  CSingleLock lock(gAfpConnection);
  if (m_pFp == NULL || !gAfpConnection.GetVolume())
    return 0;

  if (uiBufSize > AFP_MAX_READ_SIZE)
    uiBufSize = AFP_MAX_READ_SIZE;

#ifdef USE_CVS_AFPFS
  char *name = m_pFp->basename;
#else
  char *name = m_pFp->name;
  if (strlen(name) == 0)
    name = m_pFp->basename;

#endif
  int eof = 0;
  int bytesRead = gAfpConnection.GetImpl()->afp_wrap_read(gAfpConnection.GetVolume(),
    name, (char *)lpBuf,(size_t)uiBufSize, m_fileOffset, m_pFp, &eof);
  if (bytesRead > 0)
    m_fileOffset += bytesRead;

  if (bytesRead < 0)
  {
    CLog::Log(LOGERROR, "%s - Error( %d, %d, %s )", __FUNCTION__, bytesRead, errno, strerror(errno));
    return 0;
  }

  return (unsigned int)bytesRead;
}
开发者ID:Sky-git,项目名称:xbmc,代码行数:31,代码来源:FileAFP.cpp

示例5:

CAFPFile::CAFPFile()
    : m_fileSize(0)
    , m_fileOffset(0)
    , m_pFp(NULL)
    , m_pAfpVol(NULL)
{
    gAfpConnection.AddActiveConnection();
}
开发者ID:Fice,项目名称:xbmc,代码行数:8,代码来源:AFPFile.cpp

示例6: Close

void CFileAFP::Close()
{
  CSingleLock lock(gAfpConnection);
  if (m_pFp != NULL && gAfpConnection.GetVolume())
  {
    CLog::Log(LOGDEBUG, "CFileAFP::Close closing fd %d", m_pFp->fileid);
#ifdef USE_CVS_AFPFS
    char *name = m_pFp->basename;
#else
    char *name = m_pFp->name;
    if (strlen(name) == 0)
      name = m_pFp->basename;
#endif
    gAfpConnection.GetImpl()->afp_wrap_close(gAfpConnection.GetVolume(), name, m_pFp);
    delete m_pFp;
    m_pFp = NULL;
  }
}
开发者ID:Sky-git,项目名称:xbmc,代码行数:18,代码来源:FileAFP.cpp

示例7: Close

CAFPFile::~CAFPFile()
{
    gAfpConnection.AddIdleConnection();
    Close();
}
开发者ID:Fice,项目名称:xbmc,代码行数:5,代码来源:AFPFile.cpp


注:本文中的CAfpConnection类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。