Esempio n. 1
0
uint_fast64_t _PDCLIB_ftell64( FILE * stream )
{
  _PDCLIB_flockfile( stream );
  uint_fast64_t pos = _PDCLIB_ftell64_unlocked( stream );
  _PDCLIB_funlockfile( stream );
  return pos;
}
Esempio n. 2
0
long int _PDCLIB_ftell_unlocked( FILE * stream )
{
    uint_fast64_t off64 = _PDCLIB_ftell64_unlocked( stream );

    if ( off64 > LONG_MAX )
    {
        /* integer overflow */
        errno = ERANGE;
        return -1;
    }
    return off64;
}
Esempio n. 3
0
int _PDCLIB_fseek_unlocked( FILE * stream, long loffset, int whence )
{
    _PDCLIB_int64_t offset = loffset;
    if ( stream->status & _PDCLIB_FWRITE )
    {
        if ( _PDCLIB_flushbuffer( stream ) == EOF )
        {
            return EOF;
        }
    }
    stream->status &= ~ _PDCLIB_EOFFLAG;
    if ( stream->status & _PDCLIB_FRW )
    {
        stream->status &= ~ ( _PDCLIB_FREAD | _PDCLIB_FWRITE );
    }

    if ( whence == SEEK_CUR )
    {
        whence  = SEEK_SET;
        offset += _PDCLIB_ftell64_unlocked( stream );
    }

    return ( _PDCLIB_seek( stream, offset, whence ) != EOF ) ? 0 : EOF;
}