Logo Search packages:      
Sourcecode: virtualbox-ose version File versions

static KFOFF krdrFileTell ( PKRDR  pRdr  )  [static]

Definition at line 884 of file kRdrFile.cpp.

References KRDRFILE::File, and KRDRFILE::off.

{
    PKRDRFILE pRdrFile = (PKRDRFILE)pRdr;

    /*
     * If the offset is undefined, try figure out what it is.
     */
    if (pRdrFile->off == -1)
    {
#if K_OS == K_OS_DARWIN \
 || K_OS == K_OS_FREEBSD \
 || K_OS == K_OS_LINUX \
 || K_OS == K_OS_NETBSD \
 || K_OS == K_OS_OPENBSD \
 || K_OS == K_OS_SOLARIS
        pRdrFile->off = kHlpSys_lseek(pRdrFile->File, SEEK_CUR, 0);
        if (pRdrFile->off < 0)
            pRdrFile->off = -1;

#elif K_OS == K_OS_OS2
        ULONG ulNew;
        APIRET rc = DosSetFilePtr(pRdrFile->File, 0, FILE_CURRENT, &ulNew);
        if (rc)
            return -1;
        pRdrFile->off = ulNew;

#elif K_OS == K_OS_WINDOWS
        LONG offHigh = 0;
        LONG offLow;
        int rc;

        SetLastError(0);
        offLow = SetFilePointer(pRdrFile->File, 0, &offHigh, FILE_CURRENT);
        rc = GetLastError();
        if (rc)
            return -1;
        pRdrFile->off = ((KFOFF)offHigh << 32) | offLow;

#else
# error "port me."
#endif
    }
    return pRdrFile->off;
}


Generated by  Doxygen 1.6.0   Back to index