Ignore:
Timestamp:
11/02/08 01:21:42 (15 years ago)
Author:
r2d
Message:

changes to make mpcchap build with msvc

File:
1 edited

Legend:

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

    r411 r414  
    3838
    3939#ifdef _MSC_VER
    40 #define atoll _atoi64
     40# include <io.h>
     41# define atoll          _atoi64
     42# define ftruncate      chsize
     43# define strcasecmp stricmp
    4144#endif
    4245
     
    6669        struct stat stbuf;
    6770        FILE * in_file;
    68         int chap_pos, end_pos, chap_size, i;
     71        int chap_pos, end_pos, chap_size, i, nchap;
     72        char * tmp_buff;
     73        dictionary * dict;
    6974
    7075        chap_pos = (demux->chap_pos >> 3) + si->header_position;
     
    7378
    7479        stat(mpc_file, &stbuf);
    75         char * tmp_buff = malloc(stbuf.st_size - chap_pos - chap_size);
     80        tmp_buff = malloc(stbuf.st_size - chap_pos - chap_size);
    7681        in_file = fopen( mpc_file, "r+b" );
    7782        fseek(in_file, chap_pos + chap_size, SEEK_SET);
     
    7984        fseek(in_file, chap_pos, SEEK_SET);
    8085
    81         dictionary * dict = iniparser_load(chap_file);
    82 
    83         int nchap = iniparser_getnsec(dict);
     86        dict = iniparser_load(chap_file);
     87
     88        nchap = iniparser_getnsec(dict);
    8489        for (i = 0; i < nchap; i++) {
    85                 int j, nitem, ntags = 0, tag_len = 0;
     90                int j, nitem, ntags = 0, tag_len = 0, offset_size;
    8691                mpc_uint16_t gain = 0, peak = 0;
    87                 char * chap_sec = iniparser_getsecname(dict, i);
     92                char * chap_sec = iniparser_getsecname(dict, i), block_header[12] = "CT", sample_offset[10];
    8893                mpc_int64_t chap_pos = atoll(chap_sec);
    8994
     
    112117                }
    113118                if (ntags > 0) tag_len += 24 + ntags * 9;
    114                 char block_header[12] = "CT";
    115                 char sample_offset[10];
    116                 int offset_size = encodeSize(chap_pos, sample_offset, MPC_FALSE);
     119               
     120                offset_size = encodeSize(chap_pos, sample_offset, MPC_FALSE);
    117121                tag_len = encodeSize(tag_len + 4 + offset_size + 2, block_header + 2, MPC_TRUE);
    118122                fwrite(block_header, 1, tag_len + 2, in_file);
     
    143147        FILE * in_file;
    144148        int chap_pos, end_pos, chap_size, i;
     149        char * tmp_buff;
    145150
    146151        if (0 == (cd = cf_parse(chap_file, &format))) {
     
    154159
    155160        stat(mpc_file, &stbuf);
    156         char * tmp_buff = malloc(stbuf.st_size - chap_pos - chap_size);
     161        tmp_buff = malloc(stbuf.st_size - chap_pos - chap_size);
    157162        in_file = fopen( mpc_file, "r+b" );
    158163        fseek(in_file, chap_pos + chap_size, SEEK_SET);
     
    162167        nchap = cd_get_ntrack(cd);
    163168        for (i = 1; i <= nchap; i++) {
    164                 int j, nitem = 0, tag_len = 0, key_len, item_len;
     169                char track_buf[16], block_header[12] = "CT", sample_offset[10];
     170                int j, nitem = 0, tag_len = 0, key_len, item_len, offset_size;
    165171                Track * track;
    166172                Cdtext *cdtext;
     173                mpc_int64_t chap_pos;
    167174
    168175                track = cd_get_track (cd, i);
     
    170177
    171178                // position du chapitre
    172                 mpc_int64_t chap_pos = (mpc_int64_t) si->sample_freq * track_get_start (track) / 75;
     179                chap_pos = (mpc_int64_t) si->sample_freq * track_get_start (track) / 75;
    173180
    174181                if (chap_pos > si->samples - si->beg_silence)
     
    178185                Init_Tags();
    179186
    180                 char track_buf[16];
    181187                sprintf(track_buf, "%i/%i", i, nchap);
    182188                key_len = 5;
     
    199205
    200206                tag_len += 24 + nitem * 9;
    201                 char block_header[12] = "CT";
    202                 char sample_offset[10];
    203                 int offset_size = encodeSize(chap_pos, sample_offset, MPC_FALSE);
     207                offset_size = encodeSize(chap_pos, sample_offset, MPC_FALSE);
    204208                tag_len = encodeSize(tag_len + 4 + offset_size + 2, block_header + 2, MPC_TRUE);
    205209                fwrite(block_header, 1, tag_len + 2, in_file);
     
    262266        mpc_status err;
    263267        FILE * test_file;
     268        int chap_nb;
    264269
    265270        if (argc != 3)
     
    281286        }
    282287
    283         int chap_nb = mpc_demux_chap_nb(demux);
     288        chap_nb = mpc_demux_chap_nb(demux);
    284289
    285290        test_file = fopen(chap_file, "rb" );
Note: See TracChangeset for help on using the changeset viewer.