static int CompareHeaders( FILE *fp1, FILE *fp2 ) /***********************************************/ { int error; int retcode; WResHeader header1; WResHeader header2; error = WResReadHeaderRecord( &header1, fp1 ); if( error ) { return( -1 ); } error = WResReadHeaderRecord( &header2, fp2 ); if( error ) { return( -1 ); } retcode = 0; if( header1.NumResources != header2.NumResources ) { if( !(CmdLineParms.Quiet || CmdLineParms.NoCounts) ) { puts( "The number of resources differ." ); } retcode = 1; } if( header1.NumTypes != header2.NumTypes) { if( !(CmdLineParms.Quiet || CmdLineParms.NoCounts) ) { puts( "The number of types differ." ); } retcode = 1; } return( retcode ); }
static int readWResDir( WResFileID handle, WResDir currdir, void *fileinfo ) { WResHeader head; WResExtHeader ext_head; int error; off_t seekpos; /* read the header and check that it is valid */ error = WResReadHeaderRecord( &head, handle ); if( !error ) { if( head.Magic[0] != WRESMAGIC0 || head.Magic[1] != WRESMAGIC1 ) { error = TRUE; WRES_ERROR( WRS_BAD_SIG ); } } if( !error ) { if( head.WResVer > WRESVERSION ) { error = TRUE; WRES_ERROR( WRS_BAD_VERSION ); } } if( !error ) { if( head.WResVer >= 1 ) { /* * seek to the extended header and read it */ seekpos = WRESSEEK( handle, sizeof( head ), SEEK_CUR ); error = (seekpos == -1L); if( error ) { WRES_ERROR( WRS_SEEK_FAILED ); } else { error = WResReadExtHeader( &ext_head, handle ); } } else { ext_head.TargetOS = WRES_OS_WIN16; } } /* set up the initial info for the directory and seek to it's start */ if( !error ) { currdir->NumResources = head.NumResources; currdir->NumTypes = head.NumTypes; currdir->TargetOS = ext_head.TargetOS; seekpos = (* WRESSEEK) ( handle, head.DirOffset, SEEK_SET ); if( seekpos == -1L ) { error = TRUE; WRES_ERROR( WRS_SEEK_FAILED ); } } /* read in the list of types (and the resources) */ if( !error ) { error = readTypeList( handle, currdir, head.WResVer, fileinfo ); } return( error ); } /* readWResDir */