Beispiel #1
0
WResFileOffset res_seek( WResFileID fid, WResFileOffset amount, int where )
{
    if( fid == hInstance.fid ) {
        if( where == SEEK_SET ) {
            return( lseek( WRES_FID2PH( fid ), amount + WResFileShift, where ) - WResFileShift );
        } else {
            return( lseek( WRES_FID2PH( fid ), amount, where ) );
        }
    }

    DbgAssert( where != SEEK_END );
    DbgAssert( !(where == SEEK_CUR && amount < 0) );

    if( WRES_FID2PH( fid ) == Root->outfile->handle ) {
        if( where == SEEK_CUR ) {
            unsigned long   old_pos;
            unsigned long   new_pos;

            old_pos = PosLoad();
            new_pos = old_pos + amount;
            if( new_pos > old_pos ) {
                PadLoad( (size_t)amount );
            } else {
                SeekLoad( new_pos );
            }
            return( new_pos );
        } else {
            SeekLoad( amount );
            return( amount );
        }
    } else {
        return( QLSeek( WRES_FID2PH( fid ), amount, where, "resource file" ) );
    }
}
Beispiel #2
0
static void WriteQNXRelocs( RELOC_INFO *head, unsigned lmf_type, unsigned_16 seg )
/********************************************************************************/
{
    lmf_record          record;
    unsigned_32         pos;
    unsigned_32         size;
    bool                islinear;
    unsigned            adjust;

    adjust = 0;
    record.reserved = record.spare = 0;
    record.rec_type = lmf_type;
    islinear = (lmf_type == LMF_LINEAR_FIXUP_REC);
    if( islinear ) {
        adjust = 2;
    }
    pos = PosLoad();    /* get current position */
    while( head != NULL ) {
        SeekLoad( pos + sizeof(lmf_record) );
        if( islinear ) {
            WriteLoad( &seg, sizeof(unsigned_16) );
        }
        size = DumpMaxRelocList( &head, QNX_MAX_FIXUPS - adjust ) + adjust;
        SeekLoad( pos );
        record.data_nbytes = size;
        WriteLoad( &record, sizeof( lmf_record ) );
        pos += size + sizeof( lmf_record );
    }
    SeekLoad( pos );
}
Beispiel #3
0
WResFileOffset res_tell( WResFileID fid )
{
    if( fid == hInstance.fid ) {
        return( tell( WRES_FID2PH( fid ) ) );
    }

    DbgAssert( WRES_FID2PH( fid ) == Root->outfile->handle );

    fid = fid;
    return( PosLoad() );
}