• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ RcError函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中RcError函数的典型用法代码示例。如果您正苦于以下问题:C++ RcError函数的具体用法?C++ RcError怎么用?C++ RcError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了RcError函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ChangeTmpToOutFile

static int ChangeTmpToOutFile( const char * tmpfile, const char * outfile )
/**************************************************************************/
{
    int     fileerror;      /* error while deleting or renaming */

    /* remove the old copy of the output file */
    fileerror = remove( outfile );
    if( fileerror ) {
        if( errno == ENOENT ) {
            /* ignore the error if it says that the file doesn't exist */
            errno = 0;
        } else {
            RcError( ERR_RENAMEING_TMP_FILE, tmpfile, outfile,
                        strerror( errno ) );
            remove( tmpfile );
            UnregisterTmpFile( tmpfile );
            return( TRUE );
        }
    }
    /* rename the temp file to the output file */
    fileerror = rename( tmpfile, outfile );
    if( fileerror ) {
        RcError( ERR_RENAMEING_TMP_FILE, tmpfile, outfile,
                        strerror( errno ) );
        remove( tmpfile );
        UnregisterTmpFile( tmpfile );
        return( TRUE );
    }

    return( FALSE );
} /* ChangeTmpToOutFile */
开发者ID:jossk,项目名称:open-watcom-v2,代码行数:31,代码来源:rcio.c


示例2: AddBitmapResource

static void AddBitmapResource( WResID * name, ResMemFlags flags,
                            const char * filename )
/**************************************************************/
{
    BitmapFileHeader    head;
    WResFileID          handle;
    RcStatus            ret;
    int                 err_code;

    handle = RcIoOpenInput( filename, O_RDONLY | O_BINARY );
    if( handle == NIL_HANDLE)
        goto FILE_OPEN_ERROR;

    ret = readBitmapFileHeader( handle, &head, &err_code );
    if( ret != RS_OK )
        goto READ_HEADER_ERROR;

    if( head.Type != BITMAP_MAGIC )
        goto NOT_BITMAP_ERROR;

    ret = copyBitmap( &head, handle, name, flags, &err_code );
    if( ret != RS_OK )
        goto COPY_BITMAP_ERROR;

    RCCLOSE( handle );

    return;


FILE_OPEN_ERROR:
    RcError( ERR_CANT_OPEN_FILE, filename, strerror( errno ) );
    ErrorHasOccured = true;
    RCFREE( name );
    return;

READ_HEADER_ERROR:
    ReportCopyError( ret, ERR_READING_BITMAP, filename, err_code );
    ErrorHasOccured = true;
    RCFREE( name );
    RCCLOSE( handle );
    return;

NOT_BITMAP_ERROR:
    RcError( ERR_NOT_BITMAP_FILE, filename );
    ErrorHasOccured = true;
    RCFREE( name );
    RCCLOSE( handle );
    return;

COPY_BITMAP_ERROR:
    ReportCopyError( ret, ERR_READING_BITMAP, filename, err_code );
    ErrorHasOccured = true;
    RCCLOSE( handle );
    return;
}
开发者ID:MikeyG,项目名称:open-watcom-v2,代码行数:55,代码来源:semsnglw.c


示例3: RcIoPushInputFile

extern int RcIoPushInputFile( char * filename )
/*********************************************/
{
    int                 error;

    if( InStack.Current == InStack.Stack + MAX_INCLUDE_DEPTH - 1 ) {
        RcError( ERR_RCINCLUDE_TOO_DEEP, MAX_INCLUDE_DEPTH );
        return( TRUE );
    }

    SetPhysFileOffset( &(InStack) );

    InStack.Current++;

    /* set up the logical file info */
    RcIoSetLogicalFileInfo( 1, filename );

    /* set up the physical file info */
    error = OpenNewPhysicalFile( &(InStack.Current->Physical), filename );
    if( error ) {
        InStack.Current--;
    } else {
        error = ReadBuffer( &(InStack) );
    }

    return( error );
} /* RcIoPushInputFile */
开发者ID:jossk,项目名称:open-watcom-v2,代码行数:27,代码来源:rcio.c


示例4: SemOS2AddDlgincResource

extern void SemOS2AddDlgincResource( WResID *name, char *filename )
/*****************************************************************/
{
    ResLocation loc;
    int         error, err_code;

    loc.start = SemStartResource();
    error = ResWriteString( filename, FALSE, CurrResFile.handle );
    if( error ) {
        err_code = LastWresErr();
        goto OutputWriteError;
    }
    loc.len = SemEndResource( loc.start );
    SemAddResourceFree( name, WResIDFromNum( OS2_RT_DLGINCLUDE ),
                        MEMFLAG_DISCARDABLE | MEMFLAG_MOVEABLE | MEMFLAG_PURE,
                        loc );
    RcMemFree( filename );
    return;

OutputWriteError:
    RcError( ERR_WRITTING_RES_FILE, CurrResFile.filename,
             strerror( err_code ) );
    ErrorHasOccured = TRUE;
    RcMemFree( filename );
    return;
}
开发者ID:Ukusbobra,项目名称:open-watcom-v2,代码行数:26,代码来源:sem2diag.c


示例5: SemOS2WriteHelpSubTable

void SemOS2WriteHelpSubTable( WResID * name, int numWords,
                                     ResMemFlags flags,
                                     FullHelpSubTableOS2 * helptable )
/********************************************************************/
{
    ResLocation     loc;
    bool            error;
    int             err_code;

    if( !ErrorHasOccured ) {
        loc.start = SemStartResource();
        if( helptable != NULL ) {
            helptable->numWords = numWords;
        }
        error = SemOS2WriteHelpSubTableEntries( helptable, CurrResFile.handle );
        if( error ) {
            err_code = LastWresErr();
            goto OutputWriteError;
        }
        loc.len = SemEndResource( loc.start );
        SemAddResourceFree( name, WResIDFromNum( OS2_RT_HELPSUBTABLE ), flags, loc );
    } else {
        RCFREE( name );
    }

    SemOS2FreeHelpSubTable( helptable );
    return;

OutputWriteError:
    RcError( ERR_WRITTING_RES_FILE, CurrResFile.filename, strerror( err_code ) );
    ErrorHasOccured = true;
    SemOS2FreeHelpSubTable( helptable );
    return;

}
开发者ID:NoSuchProcess,项目名称:open-watcom-v2,代码行数:35,代码来源:semhelp2.c


示例6: SemWriteRawDataItem

void SemWriteRawDataItem( RawDataItem item )
/******************************************/
{
    uint_16     num16;
    uint_32     num32;
    bool        error;

    if( item.IsString ) {
        int     len = item.StrLen;

        if( item.WriteNull ) {
            ++len;
        }
        if( ResWriteStringLen( item.Item.String, item.LongItem, CurrResFile.handle, len ) ) {
            RcError( ERR_WRITTING_RES_FILE, CurrResFile.filename, LastWresErrStr() );
            ErrorHasOccured = true;
        }
        if( item.TmpStr ) {
            RCFREE( item.Item.String );
        }
    } else {
        if( !item.LongItem ) {
            if( (int_32)item.Item.Num < 0 ) {
                if( (int_32)item.Item.Num < SHRT_MIN ) {
                    RcWarning( ERR_RAW_DATA_TOO_SMALL, item.Item.Num, SHRT_MIN );
                }
            } else {
                if( item.Item.Num > USHRT_MAX ) {
                    RcWarning( ERR_RAW_DATA_TOO_BIG, item.Item.Num, USHRT_MAX );
                }
            }
        }
        if( !ErrorHasOccured ) {
            if( !item.LongItem ) {
                num16 = item.Item.Num;
                error = ResWriteUint16( &(num16), CurrResFile.handle );
            } else {
                num32 = item.Item.Num;
                error = ResWriteUint32( &(num32), CurrResFile.handle );
            }
            if( error ) {
                RcError( ERR_WRITTING_RES_FILE, CurrResFile.filename, LastWresErrStr() );
                ErrorHasOccured = true;
            }
        }
    }
}
开发者ID:MikeyG,项目名称:open-watcom-v2,代码行数:47,代码来源:semraw.c


示例7: ReportCopyError

void ReportCopyError( RcStatus status, int read_msg, const char *filename, int err_code )
{
    switch( status ) {
    case RS_READ_ERROR:
        RcError( read_msg, filename, strerror( err_code ) );
        break;
    case RS_READ_INCMPLT:
        RcError( ERR_UNEXPECTED_EOF, filename );
        break;
    case RS_WRITE_ERROR:
        RcError( ERR_WRITTING_RES_FILE, CurrResFile.filename, strerror( err_code ) );
        break;
    default:
        RcError( ERR_INTERNAL, INTERR_UNKNOWN_RCSTATUS );
        break;
    }
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:17,代码来源:semutil.c


示例8: OpenPhysicalFile

static int OpenPhysicalFile( PhysFileInfo * phys )
/************************************************/
{
    if( !phys->IsOpen ) {
        phys->Handle = RcIoOpenInput( phys->Filename, O_RDONLY | O_TEXT );
        if( phys->Handle == NIL_HANDLE ) {
            RcError( ERR_CANT_OPEN_FILE, phys->Filename, strerror( errno ) );
            return( TRUE );
        }
        phys->IsOpen = TRUE;
        if( RcSeek( phys->Handle, phys->Offset, SEEK_SET ) == -1 ) {
            RcError( ERR_READING_FILE, phys->Filename, strerror( errno ) );
            return( TRUE );
        }
    }

    return( FALSE );
} /* OpenPhysicalFile */
开发者ID:jossk,项目名称:open-watcom-v2,代码行数:18,代码来源:rcio.c


示例9: resource

/* The OS/2 dialog templates present us with a problem because the
   template items contain a number of offsets that are not known until
   the template is processed; this means we cannot just start spitting
   the data into a file. Instead we build an in-memory image of the
   resource (the size must be < 64K) and then dump the entire resource
   into the file - which certainly shouldn't hurt performance either.
*/
extern void SemOS2WriteDialogTemplate( WResID *name, ResMemFlags flags,
                                       uint_32 codepage,
                                       FullDiagCtrlListOS2 *ctrls )
/*********************************************************************/
{
    ResLocation              loc;
    int                      err_code;
    int                      error;
    int                      size;
    DialogHeaderOS2          *head = NULL;
    char                     *tmpl;
    char                     *ptr;

    size = sizeof( DialogHeaderOS2 ) + SemOS2CalcControlSize( ctrls );
    if( size > 65536 ) {
        // TODO: Error, template is too big
    }

    tmpl = RcMemMalloc( size );

    head = (DialogHeaderOS2 *)tmpl;
    InitOS2DialogBoxHeader( head, codepage );
    head->Size = size;
    ptr = tmpl + sizeof( DialogHeaderOS2 );

    // Create the DLGTITEM array in memory
    ptr = SemOS2BuildTemplateArray( ptr, ctrls );

    // Dump all other data into memory and update the offsets
    SemOS2DumpTemplateData( tmpl, ptr, ctrls );

    // Write the resource to file
    loc.start = SemStartResource();

    error = ResOS2WriteDlgTemplate( tmpl, size, CurrResFile.handle );
    if( error ) {
        err_code = LastWresErr();
        goto OutputWriteError;
    }

    RcMemFree( tmpl );

    loc.len = SemEndResource( loc.start );
    SemAddResourceFree( name, WResIDFromNum( OS2_RT_DIALOG ), flags, loc );

    SemOS2FreeDiagCtrlList( ctrls );

    return;

OutputWriteError:
    RcError( ERR_WRITTING_RES_FILE, CurrResFile.filename,
                strerror( err_code )  );
    ErrorHasOccured = TRUE;
    SemOS2FreeDiagCtrlList( ctrls );
    return;
} /* SemOS2WriteDialogTemplate */
开发者ID:Ukusbobra,项目名称:open-watcom-v2,代码行数:63,代码来源:sem2diag.c


示例10: myCopyExeData

static bool myCopyExeData( ExeFileInfo *inexe, ExeFileInfo *outexe, uint_32 length )
{
    switch( CopyExeData( inexe->Handle, outexe->Handle, length ) ) {
    case RS_OK:
    case RS_PARAM_ERROR:
        return( false );
    case RS_READ_ERROR:
        RcError( ERR_READING_EXE, inexe->name, strerror( errno ) );
        break;
    case RS_READ_INCMPLT:
        RcError( ERR_UNEXPECTED_EOF, inexe->name );
        break;
    case RS_WRITE_ERROR:
        RcError( ERR_WRITTING_FILE, outexe->name, strerror( errno ) );
        break;
    default:
        RcError( ERR_INTERNAL, INTERR_UNKNOWN_RCSTATUS );
        break;
    }
    return( true );
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:21,代码来源:exeseg.c



注:本文中的RcError函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Read函数代码示例发布时间:2022-05-30
下一篇:
C++ Ray函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap