예제 #1
0
int CompareResources( WResFileID fid1, WResDir dir1,
                        WResFileID fid2, WResDir dir2 )
/*****************************************************/
{
    int             retcode;
    int             oldretcode;
    WResDirWindow   wind1;
    WResDirWindow   wind2;

    oldretcode = 0;

    if (WResIsEmpty( dir1 )) {
        if (WResIsEmpty( dir2 )) {
            return( 0 );
        } else {
            return( 1 );
        }
    } else {
        wind1 = WResFirstResource( dir1 );
        while( !WResIsEmptyWindow( wind1 ) ) {
            /* find the window in dir2 over the same resource */
            wind2 = LookUpResource( wind1, dir2 );

            if ( !WResIsEmptyWindow( wind2 ) ) {
                /* compare the contents of the actual resource */
                retcode = CompareOneResource( fid1, wind1, fid2, wind2 );
                switch (retcode) {
                case -1:
                    return( -1 );
                    break;
                case 1:
                    if (!CmdLineParms.CheckAll) {
                        return( 1 );
                    } else {
                        oldretcode = 1;
                    }
                    break;
                }
            } else {
                if (!CmdLineParms.CheckAll) {
                    return( 1 );
                } else {
                    oldretcode = 1;
                }
            }

            wind1 = WResNextResource( wind1, dir1 );
        } /* while */
    } /* if dir is empty */

    return( oldretcode );
}
예제 #2
0
static int DumpDir( WResDir dir, WResFileID handle )
/**************************************************/
{
    int             retcode;
    bool            error;
    WResDirWindow   wind;
    uint_16         os;

    retcode = 0;

    if( WResIsEmpty( dir ) ) {
        printf( "Directory in file %s is empty\n", CmdLineParms.FileName );
    } else {
        os = WResGetTargetOS( dir );
        wind = WResFirstResource( dir );
        while( !WResIsLastResource( wind, dir ) ) {
            error = DumpResource( wind, handle, os );
            if( error ) {
                retcode = 2;
            }
            wind = WResNextResource( wind, dir );
        }
        error = DumpResource( wind, handle, os );
        if( error ) {
            retcode = 2;
        }
    }

    return( retcode );
}