/** ** CLseek Library file seek ** ** @param file CLFile pointer. ** @param offset Seek position ** @param whence How to seek */ global int CLseek(CLFile *file, long offset, int whence) { int tp, ret = -1; if (file && (tp = file->cl_type) != CLF_TYPE_INVALID) { if (tp == CLF_TYPE_PLAIN) { ret = fseek(file->cl_plain, offset, whence); } #ifdef USE_ZLIB if (tp == CLF_TYPE_GZIP) { ret = gzseek(file->cl_gz, offset, whence); } #endif // USE_ZLIB #ifdef USE_BZ2LIB if (tp == CLF_TYPE_BZIP2) { bzseek(file->cl_bz, offset, whence); ret = 0; } #endif // USE_BZ2LIB #ifdef USE_ZZIPLIB if (tp == CLF_TYPE_ZZIP) { zzip_seek(file->cl_zz, offset, whence); ret = 0; } #endif // USE_ZZIPLIB } else { errno = EBADF; } return ret; }
int CFile::PImpl::seek(long offset, int whence) { int ret = -1; int tp = cl_type; if (tp != CLF_TYPE_INVALID) { if (tp == CLF_TYPE_PLAIN) { ret = fseek(cl_plain, offset, whence); } #ifdef USE_ZLIB if (tp == CLF_TYPE_GZIP) { ret = gzseek(cl_gz, offset, whence); } #endif // USE_ZLIB #ifdef USE_BZ2LIB if (tp == CLF_TYPE_BZIP2) { bzseek(cl_bz, offset, whence); ret = 0; } #endif // USE_BZ2LIB } else { errno = EBADF; } return ret; }