コード例 #1
0
ファイル: findfirs.c プロジェクト: XVilka/owp4v1copy
   void __dos_finddata_cvt( struct find_t *findbuf, struct _finddata_t *fileinfo )
  #endif
 #endif
/******************************************************************************/
{
    /*** Handle attributes ***/
    fileinfo->attrib = findbuf->attrib;

    /*** Handle the timestamps ***/
  #ifdef __WATCOM_LFN__
    if( IS_LFN( findbuf ) && CRTIME_OF( findbuf ) ) {
        fileinfo->time_create = _d2ttime( CRDATE_OF( findbuf ), CRTIME_OF( findbuf ) );
        fileinfo->time_access = _d2ttime( ACDATE_OF( findbuf ), ACTIME_OF( findbuf ) );
    } else {
  #endif
        fileinfo->time_create = -1L;
        fileinfo->time_access = -1L;
  #ifdef __WATCOM_LFN__
    }
  #endif
    fileinfo->time_write = _d2ttime( findbuf->wr_date, findbuf->wr_time );
    /*** Handle the file size ***/
  #ifdef __INT64__
    U64Set( (unsigned_64 *)&fileinfo->size, findbuf->size, 0 );
  #else
    fileinfo->size = findbuf->size;
  #endif

    /*** Handle the file name ***/
    __F_NAME(strcpy,wcscpy)( fileinfo->name, findbuf->name );
}
コード例 #2
0
ファイル: 386setcc.c プロジェクト: Azarien/open-watcom-v2
static  instruction     *SetToConst( block *blk, signed_64 *pcons ) {
/*******************************************************************/

    instruction *ins;
    instruction *next;
    name        *op;

    for( ins = blk->ins.hd.next; ins->head.opcode == OP_NOP; ) {
        ins = ins->head.next;
    }
    if( ins->head.opcode != OP_MOV )
        return( NULL );
    if( _IsFloating( ins->type_class ) )
        return( NULL );
    for( next = ins->head.next; next->head.opcode == OP_NOP; ) {
        next = next->head.next;
    }
    if( next->head.opcode != OP_BLOCK )
        return( NULL );
    op = ins->operands[0];
    if( op->n.class != N_CONSTANT || op->c.const_type != CONS_ABSOLUTE ) {
        return( NULL );
    }
    U64Set( pcons, op->c.lo.int_value, op->c.hi.int_value );
    return( ins );
}
コード例 #3
0
ファイル: findfirs.c プロジェクト: XVilka/owp4v1copy
   void __nt_finddata_cvt( WIN32_FIND_DATA *ffb, struct _finddata_t *fileinfo )
  #endif
 #endif
/******************************************************************************/
{
    WORD        d;
    WORD        t;

    /*** Convert attributes ***/
    fileinfo->attrib = 0;
    if( ffb->dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE ) {
        fileinfo->attrib |= _A_ARCH;
    }
    if( ffb->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) {
        fileinfo->attrib |= _A_SUBDIR;
    }
    if( ffb->dwFileAttributes & FILE_ATTRIBUTE_HIDDEN ) {
        fileinfo->attrib |= _A_HIDDEN;
    }
    if( ffb->dwFileAttributes & FILE_ATTRIBUTE_NORMAL ) {
        fileinfo->attrib |= _A_NORMAL;
    }
    if( ffb->dwFileAttributes & FILE_ATTRIBUTE_READONLY ) {
        fileinfo->attrib |= _A_RDONLY;
    }
    if( ffb->dwFileAttributes & FILE_ATTRIBUTE_SYSTEM ) {
        fileinfo->attrib |= _A_SYSTEM;
    }

    /*** Handle the timestamps ***/
    __MakeDOSDT( &ffb->ftCreationTime, &d, &t );
    fileinfo->time_create = _d2ttime( d, t );
    __MakeDOSDT( &ffb->ftLastAccessTime, &d, &t );
    fileinfo->time_access = _d2ttime( d, t );
    __MakeDOSDT( &ffb->ftLastWriteTime, &d, &t );
    fileinfo->time_write = _d2ttime( d, t );

    /*** Handle the file size ***/
  #ifdef __INT64__
    U64Set( (unsigned_64 *)&fileinfo->size, ffb->nFileSizeLow, ffb->nFileSizeHigh );
  #else
    fileinfo->size = ffb->nFileSizeLow;
  #endif

    /*** Handle the file name ***/
    __F_NAME(strcpy,wcscpy)( fileinfo->name, ffb->cFileName );
}
コード例 #4
0
ファイル: __lseek.c プロジェクト: ABratovic/open-watcom-v2
_WCRTLINK __int64 __lseeki64( int handle, __int64 offset, int origin )
{
#if defined( __NT__ ) || defined( __OS2__ ) || defined( __LINUX__ )
    __int64         pos;

    __handle_check( handle, -1 );

  #if defined( __OS2__ )
    {
    #if !defined( _M_I86 )
        APIRET          rc;

        if( __os2_DosSetFilePtrL != NULL ) {
            rc = __os2_DosSetFilePtrL( handle, offset, origin, &pos );
            if( rc != 0 ) {
                return( __set_errno_dos( rc ) );
            }
        } else {
    #endif
            if( offset > LONG_MAX || offset < LONG_MIN ) {
                __set_errno( EINVAL );
                return( -1LL );
            }
            pos = (unsigned long)__lseek( handle, offset, origin );
            if( pos == INVALID_SET_FILE_POINTER ) {
                pos = -1LL;
            }
    #if !defined( _M_I86 )
        }
    #endif
    }
  #elif defined( __NT__ )
    {
        DWORD           rc;
        LONG            offset_hi;
        int             error;
    
        offset_hi = HIDWORD( offset );
        rc = SetFilePointer( __getOSHandle( handle ), LODWORD( offset ), &offset_hi, origin );
        if( rc == INVALID_SET_FILE_POINTER ) {  // this might be OK so
            error = GetLastError();             // check for sure JBS 04-nov-99
            if( error != NO_ERROR ) {
                return( __set_errno_dos( error ) );
            }
        }
        U64Set( (unsigned_64 *)&pos, rc, offset_hi );
    }
  #elif defined( __LINUX__ )
    if( _llseek( handle, LODWORD( offset ), HIDWORD( offset ), &pos, origin ) ) {
        pos = -1LL;
    }
  #endif
    return( pos );
#else
    long            pos;

    if( offset > LONG_MAX || offset < LONG_MIN ) {
        __set_errno( EINVAL );
        return( -1LL );
    }
    pos = __lseek( handle, offset, origin );
    if( pos == INVALID_SET_FILE_POINTER ) {
        return( -1LL );
    }
    return( (unsigned long)pos );
#endif
}