Exemplo n.º 1
0
bool QFile::at( Offset pos )
{
    if ( !isOpen() ) {
#if defined(QT_CHECK_STATE)
	qWarning( "QFile::at: File is not open" );
#endif
	return FALSE;
    }
    if ( isSequentialAccess() )
	return FALSE;
    bool ok;
    if ( isRaw() ) {
	off_t l = ::lseek( fd, pos, SEEK_SET );
	ok = ( l != -1 );
	pos = (Offset)l;
    } else {					// buffered file
#if defined(QT_LARGEFILE_SUPPORT)
	ok = ( ::fseeko(fh, pos, SEEK_SET) == 0 );
#else
	ok = ( ::fseek(fh, pos, SEEK_SET) == 0 );
#endif
    }
    if ( ok )
#if defined(QT_LARGEFILE_SUPPORT) && !defined(QT_ABI_QT4)
	ioIndex = pos > UINT_MAX ? UINT_MAX : (Offset)pos;
#else
	ioIndex = (Offset)pos;
#endif
#if defined(QT_CHECK_RANGE)
    else
Exemplo n.º 2
0
bool QIODevice::atEnd() const
{
    if ( isSequentialAccess() || isTranslated() ) {
	QIODevice* that = (QIODevice*)this;
	int c = that->getch();
	bool result = c < 0;
	that->ungetch(c);
	return result;
    } else {
	return at() == (int)size();
    }
}
Exemplo n.º 3
0
bool QFileHack::open ( int m ) {
    bool ret;

#ifdef __linux__
    m |= IO_Async; //On linux, set O_NONBLOCK, opens CD-ROMs faster
#endif
    ret=TQFile::open(m);
    if (ret && isSequentialAccess() ) {
        setType(IO_Direct);
    }
    return ret;
}
Exemplo n.º 4
0
bool QIODevice::atEnd() const
{
    if ( isSequentialAccess() || isTranslated() ) {
	QIODevice* that = (QIODevice*)this;
        const int oldStatus = ioSt;
	int c = that->getch();
	bool result = c < 0;
	that->ungetch(c);
        if (ioSt != oldStatus)
            that->ioSt = oldStatus;
	return result;
    } else {
	return at() == size();
    }
}