Changeset 442


Ignore:
Timestamp:
03/31/09 14:24:41 (16 years ago)
Author:
Seed
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libmpc/trunk/mpcgain/mpcgain.c

    r440 r442  
    4444#define MPCGAIN_MAJOR 0
    4545#define MPCGAIN_MINOR 9
    46 #define MPCGAIN_BUILD 2
     46#define MPCGAIN_BUILD 3
    4747
    4848#define _cat(a,b,c) #a"."#b"."#c
     
    270270                r.count = 8;
    271271
    272                 size = mpc_bits_get_block(&r, &b);
    273 
    274                 while (memcmp(b.key, "RG", 2) != 0 ) {
     272                for(;;) {
     273                        size = mpc_bits_get_block(&r, &b);
     274                        if (mpc_check_key(b.key) != MPC_STATUS_OK) break;
     275
     276                        if (memcmp(b.key, "RG", 2) == 0) break;
    275277                        header_pos[j] += b.size + size;
    276278                        fseek(file, header_pos[j], SEEK_SET);
     
    278280                        r.buff = buffer;
    279281                        r.count = 8;
    280                         size = mpc_bits_get_block(&r, &b);
    281                 }
    282 
     282                }
     283
     284                if (memcmp(b.key, "RG", 2) != 0 || b.size < 9) { //check for the loop above having aborted without finding the packet we want to update
     285                        fprintf(stderr, "Unsupported file format or corrupted file : %s\n", argv[j + 1]);
     286                        fclose(file);
     287                        continue;
     288                }
    283289                header_pos[j] += size;
    284290
Note: See TracChangeset for help on using the changeset viewer.