Commit fec4a779 authored by Josh Coalson's avatar Josh Coalson
Browse files

fix bug: %ll doesn't work for MSVC, use %I64 instead

parent f45b2a85
......@@ -234,12 +234,11 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients(const FLAC__int32 data[],
sumo += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*history);
#if defined _MSC_VER
if(sumo > 2147483647I64 || sumo < -2147483648I64)
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);
#else
if(sumo > 2147483647ll || sumo < -2147483648ll)
#endif
{
fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients: OVERFLOW, i=%u, j=%u, c=%d, d=%d, sumo=%lld\n",i,j,qlp_coeff[j],*history,sumo);
}
#endif
#endif
}
*(residual++) = *(data++) - (sum >> lp_quantization);
......@@ -317,12 +316,11 @@ void FLAC__lpc_restore_signal(const FLAC__int32 residual[], unsigned data_len, c
sumo += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*history);
#if defined _MSC_VER
if(sumo > 2147483647I64 || sumo < -2147483648I64)
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);
#else
if(sumo > 2147483647ll || sumo < -2147483648ll)
#endif
{
fprintf(stderr,"FLAC__lpc_restore_signal: OVERFLOW, i=%u, j=%u, c=%d, d=%d, sumo=%lld\n",i,j,qlp_coeff[j],*history,sumo);
}
#endif
#endif
}
*(data++) = *(residual++) + (sum >> lp_quantization);
......
......@@ -547,7 +547,11 @@ void write_metadata(const char *filename, FLAC__StreamMetadata *block, unsigned
PPR; printf(" sample_rate: %u Hz\n", block->data.stream_info.sample_rate);
PPR; printf(" channels: %u\n", block->data.stream_info.channels);
PPR; printf(" bits-per-sample: %u\n", block->data.stream_info.bits_per_sample);
#ifdef _MSC_VER
PPR; printf(" total samples: %I64u\n", block->data.stream_info.total_samples);
#else
PPR; printf(" total samples: %llu\n", block->data.stream_info.total_samples);
#endif
PPR; printf(" MD5 signature: ");
for(i = 0; i < 16; i++) {
printf("%02x", (unsigned)block->data.stream_info.md5sum[i]);
......@@ -574,10 +578,14 @@ void write_metadata(const char *filename, FLAC__StreamMetadata *block, unsigned
PPR; printf(" seek points: %u\n", block->data.seek_table.num_points);
for(i = 0; i < block->data.seek_table.num_points; i++) {
if(block->data.seek_table.points[i].sample_number != FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER) {
PPR; printf(" point %d: sample_number=%llu, stream_offset=%llu, 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);
#ifdef _MSC_VER
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);
#else
PPR; printf(" point %u: sample_number=%llu, stream_offset=%llu, 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);
#endif
}
else {
PPR; printf(" point %d: PLACEHOLDER\n", i);
PPR; printf(" point %u: PLACEHOLDER\n", i);
}
}
break;
......@@ -592,7 +600,11 @@ void write_metadata(const char *filename, FLAC__StreamMetadata *block, unsigned
break;
case FLAC__METADATA_TYPE_CUESHEET:
PPR; printf(" media catalog number: %s\n", block->data.cue_sheet.media_catalog_number);
#ifdef _MSC_VER
PPR; printf(" lead-in: %I64u\n", block->data.cue_sheet.lead_in);
#else
PPR; printf(" lead-in: %llu\n", block->data.cue_sheet.lead_in);
#endif
PPR; printf(" is CD: %s\n", block->data.cue_sheet.is_cd? "true":"false");
PPR; printf(" number of tracks: %u\n", block->data.cue_sheet.num_tracks);
for(i = 0; i < block->data.cue_sheet.num_tracks; i++) {
......@@ -600,7 +612,11 @@ void write_metadata(const char *filename, FLAC__StreamMetadata *block, unsigned
const FLAC__bool is_last = (i == block->data.cue_sheet.num_tracks-1);
const FLAC__bool is_leadout = is_last && track->num_indices == 0;
PPR; printf(" track[%u]\n", i);
#ifdef _MSC_VER
PPR; printf(" offset: %I64u\n", track->offset);
#else
PPR; printf(" offset: %llu\n", track->offset);
#endif
if(is_last) {
PPR; printf(" number: %u (%s)\n", (unsigned)track->number, is_leadout? "LEAD-OUT" : "INVALID");
}
......@@ -615,7 +631,11 @@ void write_metadata(const char *filename, FLAC__StreamMetadata *block, unsigned
for(j = 0; j < track->num_indices; j++) {
const FLAC__StreamMetadata_CueSheet_Index *index = track->indices+j;
PPR; printf(" index[%u]\n", j);
#ifdef _MSC_VER
PPR; printf(" offset: %I64u\n", index->offset);
#else
PPR; printf(" offset: %llu\n", index->offset);
#endif
PPR; printf(" number: %u\n", (unsigned)index->number);
}
}
......
......@@ -145,7 +145,11 @@ FLAC__bool import_cs_from(const char *filename, FLAC__StreamMetadata **cuesheet,
for(track = 0; track < cs->num_tracks; track++) {
const FLAC__StreamMetadata_CueSheet_Track *tr = cs->tracks+track;
for(index = 0; index < tr->num_indices; index++) {
#ifdef _MSC_VER
sprintf(spec, "%I64u;", tr->offset + tr->indices[index].offset);
#else
sprintf(spec, "%llu;", tr->offset + tr->indices[index].offset);
#endif
local_strcat(seekpoint_specification, spec);
}
}
......
......@@ -70,7 +70,11 @@ FLAC__bool do_shorthand_operation__streaminfo(const char *filename, FLAC__bool p
printf("%u\n", block->data.stream_info.bits_per_sample);
break;
case OP__SHOW_TOTAL_SAMPLES:
#ifdef _MSC_VER
printf("%I64u\n", block->data.stream_info.total_samples);
#else
printf("%llu\n", block->data.stream_info.total_samples);
#endif
break;
case OP__SET_MD5SUM:
memcpy(block->data.stream_info.md5sum, operation->argument.streaminfo_md5.value, 16);
......
......@@ -546,10 +546,19 @@ void grabbag__cuesheet_emit(FILE *file, const FLAC__StreamMetadata *cuesheet, co
fprintf(file, "%02u:%02u:%02u\n", m, s, f);
}
else
#ifdef _MSC_VER
fprintf(file, "%I64u\n", track->offset + index->offset);
#else
fprintf(file, "%llu\n", track->offset + index->offset);
#endif
}
}
#ifdef _MSC_VER
fprintf(file, "REM FLAC__lead-in %I64u\n", cs->lead_in);
fprintf(file, "REM FLAC__lead-out %u %I64u\n", (unsigned)cs->tracks[track_num].number, cs->tracks[track_num].offset);
#else
fprintf(file, "REM FLAC__lead-in %llu\n", cs->lead_in);
fprintf(file, "REM FLAC__lead-out %u %llu\n", (unsigned)cs->tracks[track_num].number, cs->tracks[track_num].offset);
#endif
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment