static int ReadBuffer( FileStack * stack ) /****************************************/ { PhysFileInfo *phys; int numread; int error; int inchar; phys = &(stack->Current->Physical); if( !phys->IsOpen ) { error = OpenPhysicalFile( phys ); if( error ) return( TRUE ); } if( CmdLineParms.NoPreprocess ) { numread = RcRead( phys->Handle, stack->Buffer, stack->BufferSize ); } else { for( numread = 0; numread < stack->BufferSize; numread++ ) { inchar = PP_Char(); if( inchar == EOF ) { break; } *( stack->Buffer + numread ) = (char)inchar; } } stack->NextChar = stack->Buffer; stack->EofChar = stack->Buffer + numread; /* may be past end of buffer */ return( FALSE ); } /* ReadBuffer */
static RcStatus readDBRanges( WResFileID fp ) { int ret; ret = RcRead( fp, &charInfo.begchars, 256 ); if( ret != 256 ) { if( ret == -1 ) { return( RS_READ_ERROR ); } else { return( RS_READ_INCMPLT ); } } return( RS_OK ); }
static RcStatus readDBTable( int fp ) { int ret; int size; size = charInfo.header.num_entries * sizeof( uint_16 ); charInfo.entries = RcMemMalloc( size ); ret = RcRead( fp, charInfo.entries, size ); if( ret != size ) { if( ret == -1 ) { return( RS_READ_ERROR ); } else { return( RS_READ_INCMPLT ); } } return( RS_OK ); }
static RcStatus readFontInfo( int handle, FontInfo *info, int *err_code ) /***********************************************************************/ { int numread; numread = RcRead( handle, info, sizeof( FontInfo ) ); if( numread != sizeof( FontInfo ) ) { *err_code = errno; if( numread == -1 ) { return( RS_READ_ERROR ); } else { return( RS_READ_INCMPLT ); } } return( RS_OK ); }
static RcStatus readDBIndex( WResFileID fp ) { int ret; int size; size = charInfo.header.num_indices * sizeof( DBIndexEntry ); charInfo.index = RcMemMalloc( size ); ret = RcRead( fp, charInfo.index, size ); if( ret != size ) { if( ret == -1 ) { return( RS_READ_ERROR ); } else { return( RS_READ_INCMPLT ); } } return( RS_OK ); }
static RcStatus readDBHeader( WResFileID fp ) { int ret; ret = RcRead( fp, &charInfo.header, sizeof( DBTableHeader ) ); if( ret != sizeof( DBTableHeader ) ) { if( ret == -1 ) { return( RS_READ_ERROR ); } else { return( RS_READ_INCMPLT ); } } if( charInfo.header.sig[0] != DB_TABLE_SIG_1 || charInfo.header.sig[1] != DB_TABLE_SIG_2 ) { return( RS_BAD_FILE_FMT ); } if( charInfo.header.ver != DB_TABLE_VER ) { return( RS_WRONG_VER ); } return( RS_OK ); }