本文整理汇总了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 */
示例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;
}
示例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 */
示例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;
}
示例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;
}
示例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;
}
}
}
}
示例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;
}
}
示例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 */
示例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 */
示例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 );
}