1 diff -ruN flac/include/share/alloc.h flac.new/include/share/alloc.h
2 --- flac/include/share/alloc.h 2007-09-12 07:32:21.000000000 +0200
3 +++ flac.new/include/share/alloc.h 2009-08-23 12:33:30.000000000 +0200
7 #include <limits.h> /* for SIZE_MAX */
8 -#if !defined _MSC_VER && !defined __MINGW32__ && !defined __EMX__
9 +#if !defined _MSC_VER && !defined __EMX__
10 #include <stdint.h> /* for SIZE_MAX in case limits.h didn't get it */
12 #include <stdlib.h> /* for size_t, malloc(), etc */
13 diff -ruN flac/src/flac/analyze.c flac.new/src/flac/analyze.c
14 --- flac/src/flac/analyze.c 2007-05-25 21:34:48.000000000 +0200
15 +++ flac.new/src/flac/analyze.c 2009-08-23 12:33:09.000000000 +0200
17 unsigned i, channel, partitions;
19 /* do the human-readable part first */
22 fprintf(fout, "frame=%u\toffset=%I64u\tbits=%u\tblocksize=%u\tsample_rate=%u\tchannels=%u\tchannel_assignment=%s\n", frame_number, frame_offset, frame_bytes*8, frame->header.blocksize, frame->header.sample_rate, channels, FLAC__ChannelAssignmentString[frame->header.channel_assignment]);
24 fprintf(fout, "frame=%u\toffset=%llu\tbits=%u\tblocksize=%u\tsample_rate=%u\tchannels=%u\tchannel_assignment=%s\n", frame_number, (unsigned long long)frame_offset, frame_bytes*8, frame->header.blocksize, frame->header.sample_rate, channels, FLAC__ChannelAssignmentString[frame->header.channel_assignment]);
25 diff -ruN flac/src/libFLAC/lpc.c flac.new/src/libFLAC/lpc.c
26 --- flac/src/libFLAC/lpc.c 2007-09-04 20:15:03.000000000 +0200
27 +++ flac.new/src/libFLAC/lpc.c 2009-08-23 12:33:09.000000000 +0200
29 for(j = 0; j < order; j++) {
30 sum += qlp_coeff[j] * (*(--history));
31 sumo += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*history);
33 +#if defined __MSVCRT__
34 if(sumo > 2147483647I64 || sumo < -2147483648I64)
35 fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients: OVERFLOW, i=%u, j=%u, c=%d, d=%d, sumo=%I64d\n",i,j,qlp_coeff[j],*history,sumo);
38 for(j = 0; j < order; j++)
39 sum += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*(--history));
40 if(FLAC__bitmath_silog2_wide(sum >> lp_quantization) > 32) {
42 +#if defined __MSVCRT__
43 fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients_wide: OVERFLOW, i=%u, sum=%I64d\n", i, sum >> lp_quantization);
45 fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients_wide: OVERFLOW, i=%u, sum=%lld\n", i, (long long)(sum >> lp_quantization));
49 if(FLAC__bitmath_silog2_wide((FLAC__int64)(*data) - (sum >> lp_quantization)) > 32) {
51 +#if defined __MSVCRT__
52 fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients_wide: OVERFLOW, i=%u, data=%d, sum=%I64d, residual=%I64d\n", i, *data, sum >> lp_quantization, (FLAC__int64)(*data) - (sum >> lp_quantization));
54 fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients_wide: OVERFLOW, i=%u, data=%d, sum=%lld, residual=%lld\n", i, *data, (long long)(sum >> lp_quantization), (long long)((FLAC__int64)(*data) - (sum >> lp_quantization)));
56 for(j = 0; j < order; j++) {
57 sum += qlp_coeff[j] * (*(--history));
58 sumo += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*history);
60 +#if defined __MSVCRT__
61 if(sumo > 2147483647I64 || sumo < -2147483648I64)
62 fprintf(stderr,"FLAC__lpc_restore_signal: OVERFLOW, i=%u, j=%u, c=%d, d=%d, sumo=%I64d\n",i,j,qlp_coeff[j],*history,sumo);
65 for(j = 0; j < order; j++)
66 sum += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*(--history));
67 if(FLAC__bitmath_silog2_wide(sum >> lp_quantization) > 32) {
70 fprintf(stderr,"FLAC__lpc_restore_signal_wide: OVERFLOW, i=%u, sum=%I64d\n", i, sum >> lp_quantization);
72 fprintf(stderr,"FLAC__lpc_restore_signal_wide: OVERFLOW, i=%u, sum=%lld\n", i, (long long)(sum >> lp_quantization));
76 if(FLAC__bitmath_silog2_wide((FLAC__int64)(*r) + (sum >> lp_quantization)) > 32) {
79 fprintf(stderr,"FLAC__lpc_restore_signal_wide: OVERFLOW, i=%u, residual=%d, sum=%I64d, data=%I64d\n", i, *r, sum >> lp_quantization, (FLAC__int64)(*r) + (sum >> lp_quantization));
81 fprintf(stderr,"FLAC__lpc_restore_signal_wide: OVERFLOW, i=%u, residual=%d, sum=%lld, data=%lld\n", i, *r, (long long)(sum >> lp_quantization), (long long)((FLAC__int64)(*r) + (sum >> lp_quantization)));
82 diff -ruN flac/src/metaflac/operations.c flac.new/src/metaflac/operations.c
83 --- flac/src/metaflac/operations.c 2007-09-11 06:23:29.000000000 +0200
84 +++ flac.new/src/metaflac/operations.c 2009-08-23 12:33:09.000000000 +0200
86 PPR; printf(" sample_rate: %u Hz\n", block->data.stream_info.sample_rate);
87 PPR; printf(" channels: %u\n", block->data.stream_info.channels);
88 PPR; printf(" bits-per-sample: %u\n", block->data.stream_info.bits_per_sample);
91 PPR; printf(" total samples: %I64u\n", block->data.stream_info.total_samples);
93 PPR; printf(" total samples: %llu\n", (unsigned long long)block->data.stream_info.total_samples);
95 PPR; printf(" seek points: %u\n", block->data.seek_table.num_points);
96 for(i = 0; i < block->data.seek_table.num_points; i++) {
97 if(block->data.seek_table.points[i].sample_number != FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER) {
100 PPR; printf(" point %u: sample_number=%I64u, stream_offset=%I64u, frame_samples=%u\n", i, block->data.seek_table.points[i].sample_number, block->data.seek_table.points[i].stream_offset, block->data.seek_table.points[i].frame_samples);
102 PPR; printf(" point %u: sample_number=%llu, stream_offset=%llu, frame_samples=%u\n", i, (unsigned long long)block->data.seek_table.points[i].sample_number, (unsigned long long)block->data.seek_table.points[i].stream_offset, block->data.seek_table.points[i].frame_samples);
105 case FLAC__METADATA_TYPE_CUESHEET:
106 PPR; printf(" media catalog number: %s\n", block->data.cue_sheet.media_catalog_number);
109 PPR; printf(" lead-in: %I64u\n", block->data.cue_sheet.lead_in);
111 PPR; printf(" lead-in: %llu\n", (unsigned long long)block->data.cue_sheet.lead_in);
113 const FLAC__bool is_last = (i == block->data.cue_sheet.num_tracks-1);
114 const FLAC__bool is_leadout = is_last && track->num_indices == 0;
115 PPR; printf(" track[%u]\n", i);
118 PPR; printf(" offset: %I64u\n", track->offset);
120 PPR; printf(" offset: %llu\n", (unsigned long long)track->offset);
122 for(j = 0; j < track->num_indices; j++) {
123 const FLAC__StreamMetadata_CueSheet_Index *index = track->indices+j;
124 PPR; printf(" index[%u]\n", j);
127 PPR; printf(" offset: %I64u\n", index->offset);
129 PPR; printf(" offset: %llu\n", (unsigned long long)index->offset);
130 diff -ruN flac/src/metaflac/operations_shorthand_cuesheet.c flac.new/src/metaflac/operations_shorthand_cuesheet.c
131 --- flac/src/metaflac/operations_shorthand_cuesheet.c 2007-07-25 04:36:59.000000000 +0200
132 +++ flac.new/src/metaflac/operations_shorthand_cuesheet.c 2009-08-23 12:33:09.000000000 +0200
134 for(track = 0; track < cs->num_tracks; track++) {
135 const FLAC__StreamMetadata_CueSheet_Track *tr = cs->tracks+track;
136 for(index = 0; index < tr->num_indices; index++) {
139 sprintf(spec, "%I64u;", tr->offset + tr->indices[index].offset);
141 sprintf(spec, "%llu;", (unsigned long long)(tr->offset + tr->indices[index].offset));
146 -#if defined _MSC_VER || defined __MINGW32__
147 +#if defined __MSVCRT__
148 _snprintf(ref, reflen, "\"%s\" FLAC", filename);
150 snprintf(ref, reflen, "\"%s\" FLAC", filename);
151 diff -ruN flac/src/metaflac/operations_shorthand_streaminfo.c flac.new/src/metaflac/operations_shorthand_streaminfo.c
152 --- flac/src/metaflac/operations_shorthand_streaminfo.c 2007-07-25 04:36:59.000000000 +0200
153 +++ flac.new/src/metaflac/operations_shorthand_streaminfo.c 2009-08-23 12:33:09.000000000 +0200
155 printf("%u\n", block->data.stream_info.bits_per_sample);
157 case OP__SHOW_TOTAL_SAMPLES:
160 printf("%I64u\n", block->data.stream_info.total_samples);
162 printf("%llu\n", (unsigned long long)block->data.stream_info.total_samples);
163 diff -ruN flac/src/share/grabbag/cuesheet.c flac.new/src/share/grabbag/cuesheet.c
164 --- flac/src/share/grabbag/cuesheet.c 2007-07-31 00:29:24.000000000 +0200
165 +++ flac.new/src/share/grabbag/cuesheet.c 2009-08-23 12:33:09.000000000 +0200
168 static FLAC__bool local__cuesheet_parse_(FILE *file, const char **error_message, unsigned *last_line_read, FLAC__StreamMetadata *cuesheet, FLAC__bool is_cdda, FLAC__uint64 lead_out_offset)
170 -#if defined _MSC_VER || defined __MINGW32__ || defined __EMX__
171 +#if defined __MSVCRT__ || defined __EMX__
172 #define FLAC__STRCASECMP stricmp
174 #define FLAC__STRCASECMP strcasecmp
176 fprintf(file, "%02u:%02u:%02u\n", m, s, f);
181 fprintf(file, "%I64u\n", track->offset + index->offset);
183 fprintf(file, "%llu\n", (unsigned long long)(track->offset + index->offset));
190 fprintf(file, "REM FLAC__lead-in %I64u\n", cs->lead_in);
191 fprintf(file, "REM FLAC__lead-out %u %I64u\n", (unsigned)cs->tracks[track_num].number, cs->tracks[track_num].offset);
193 diff -ruN flac/src/test_libFLAC/encoders.c flac.new/src/test_libFLAC/encoders.c
194 --- flac/src/test_libFLAC/encoders.c 2007-08-01 00:39:39.000000000 +0200
195 +++ flac.new/src/test_libFLAC/encoders.c 2009-08-23 12:33:09.000000000 +0200
198 printf("testing FLAC__stream_encoder_get_total_samples_estimate()... ");
199 if(FLAC__stream_encoder_get_total_samples_estimate(encoder) != streaminfo_.data.stream_info.total_samples) {
202 printf("FAILED, expected %I64u, got %I64u\n", streaminfo_.data.stream_info.total_samples, FLAC__stream_encoder_get_total_samples_estimate(encoder));
204 printf("FAILED, expected %llu, got %llu\n", (unsigned long long)streaminfo_.data.stream_info.total_samples, (unsigned long long)FLAC__stream_encoder_get_total_samples_estimate(encoder));
205 diff -ruN flac/src/test_libFLAC/metadata_object.c flac.new/src/test_libFLAC/metadata_object.c
206 --- flac/src/test_libFLAC/metadata_object.c 2007-09-11 06:48:59.000000000 +0200
207 +++ flac.new/src/test_libFLAC/metadata_object.c 2009-08-23 12:33:09.000000000 +0200
211 if(from->offset != to->offset) {
214 printf("FAILED, track offset mismatch, expected %I64u, got %I64u\n", to->offset, from->offset);
216 printf("FAILED, track offset mismatch, expected %llu, got %llu\n", (unsigned long long)to->offset, (unsigned long long)from->offset);
219 for(i = 0; i < to->num_indices; i++) {
220 if(from->indices[i].offset != to->indices[i].offset) {
223 printf("FAILED, track indices[%u].offset mismatch, expected %I64u, got %I64u\n", i, to->indices[i].offset, from->indices[i].offset);
225 printf("FAILED, track indices[%u].offset mismatch, expected %llu, got %llu\n", i, (unsigned long long)to->indices[i].offset, (unsigned long long)from->indices[i].offset);
228 for(i = 0; i < n; i++) {
229 if(from[i].sample_number != to[i].sample_number) {
232 printf("FAILED, point[%u].sample_number mismatch, expected %I64u, got %I64u\n", i, to[i].sample_number, from[i].sample_number);
234 printf("FAILED, point[%u].sample_number mismatch, expected %llu, got %llu\n", i, (unsigned long long)to[i].sample_number, (unsigned long long)from[i].sample_number);
238 if(from[i].stream_offset != to[i].stream_offset) {
241 printf("FAILED, point[%u].stream_offset mismatch, expected %I64u, got %I64u\n", i, to[i].stream_offset, from[i].stream_offset);
243 printf("FAILED, point[%u].stream_offset mismatch, expected %llu, got %llu\n", i, (unsigned long long)to[i].stream_offset, (unsigned long long)from[i].stream_offset);
244 diff -ruN flac/src/test_libFLAC++/encoders.cpp flac.new/src/test_libFLAC++/encoders.cpp
245 --- flac/src/test_libFLAC++/encoders.cpp 2007-08-01 00:41:55.000000000 +0200
246 +++ flac.new/src/test_libFLAC++/encoders.cpp 2009-08-23 12:33:09.000000000 +0200
249 printf("testing get_total_samples_estimate()... ");
250 if(encoder->get_total_samples_estimate() != streaminfo_.data.stream_info.total_samples) {
253 printf("FAILED, expected %I64u, got %I64u\n", streaminfo_.data.stream_info.total_samples, encoder->get_total_samples_estimate());
255 printf("FAILED, expected %llu, got %llu\n", (unsigned long long)streaminfo_.data.stream_info.total_samples, (unsigned long long)encoder->get_total_samples_estimate());
256 diff -ruN flac/src/test_libs_common/metadata_utils.c flac.new/src/test_libs_common/metadata_utils.c
257 --- flac/src/test_libs_common/metadata_utils.c 2007-02-02 07:27:17.000000000 +0100
258 +++ flac.new/src/test_libs_common/metadata_utils.c 2009-08-23 12:33:09.000000000 +0200
262 if(blockcopy->total_samples != block->total_samples) {
265 printf("FAILED, total_samples mismatch, expected %I64u, got %I64u\n", block->total_samples, blockcopy->total_samples);
267 printf("FAILED, total_samples mismatch, expected %llu, got %llu\n", (unsigned long long)block->total_samples, (unsigned long long)blockcopy->total_samples);
270 for(i = 0; i < block->num_points; i++) {
271 if(blockcopy->points[i].sample_number != block->points[i].sample_number) {
274 printf("FAILED, points[%u].sample_number mismatch, expected %I64u, got %I64u\n", i, block->points[i].sample_number, blockcopy->points[i].sample_number);
276 printf("FAILED, points[%u].sample_number mismatch, expected %llu, got %llu\n", i, (unsigned long long)block->points[i].sample_number, (unsigned long long)blockcopy->points[i].sample_number);
280 if(blockcopy->points[i].stream_offset != block->points[i].stream_offset) {
283 printf("FAILED, points[%u].stream_offset mismatch, expected %I64u, got %I64u\n", i, block->points[i].stream_offset, blockcopy->points[i].stream_offset);
285 printf("FAILED, points[%u].stream_offset mismatch, expected %llu, got %llu\n", i, (unsigned long long)block->points[i].stream_offset, (unsigned long long)blockcopy->points[i].stream_offset);
289 if(blockcopy->lead_in != block->lead_in) {
292 printf("FAILED, lead_in mismatch, expected %I64u, got %I64u\n", block->lead_in, blockcopy->lead_in);
294 printf("FAILED, lead_in mismatch, expected %llu, got %llu\n", (unsigned long long)block->lead_in, (unsigned long long)blockcopy->lead_in);
297 for(i = 0; i < block->num_tracks; i++) {
298 if(blockcopy->tracks[i].offset != block->tracks[i].offset) {
301 printf("FAILED, tracks[%u].offset mismatch, expected %I64u, got %I64u\n", i, block->tracks[i].offset, blockcopy->tracks[i].offset);
303 printf("FAILED, tracks[%u].offset mismatch, expected %llu, got %llu\n", i, (unsigned long long)block->tracks[i].offset, (unsigned long long)blockcopy->tracks[i].offset);
306 for(j = 0; j < block->tracks[i].num_indices; j++) {
307 if(blockcopy->tracks[i].indices[j].offset != block->tracks[i].indices[j].offset) {
310 printf("FAILED, tracks[%u].indices[%u].offset mismatch, expected %I64u, got %I64u\n", i, j, block->tracks[i].indices[j].offset, blockcopy->tracks[i].indices[j].offset);
312 printf("FAILED, tracks[%u].indices[%u].offset mismatch, expected %llu, got %llu\n", i, j, (unsigned long long)block->tracks[i].indices[j].offset, (unsigned long long)blockcopy->tracks[i].indices[j].offset);
313 diff -ruN flac/src/test_seeking/main.c flac.new/src/test_seeking/main.c
314 --- flac/src/test_seeking/main.c 2007-09-11 09:32:03.000000000 +0200
315 +++ flac.new/src/test_seeking/main.c 2009-08-23 12:33:09.000000000 +0200
320 -#if defined _MSC_VER || defined __MINGW32__
321 +#if defined __MSVCRT__
324 #include <sys/time.h>
327 FLAC__ASSERT(frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER); /* decoder guarantees this */
331 printf("frame@%I64u(%u)... ", frame->header.number.sample_number, frame->header.blocksize);
333 printf("frame@%llu(%u)... ", (unsigned long long)frame->header.number.sample_number, frame->header.blocksize);
335 return die_s_("expected FLAC__STREAM_DECODER_END_OF_STREAM", decoder);
340 printf("file's total_samples is %I64u\n", decoder_client_data.total_samples);
342 printf("file's total_samples is %llu\n", (unsigned long long)decoder_client_data.total_samples);
344 pos = (FLAC__uint64)(local_rand_() % n);
349 printf("#%u:seek(%I64u)... ", i, pos);
351 printf("#%u:seek(%llu)... ", i, (unsigned long long)pos);