minor formatting

This commit is contained in:
Josh Coalson
2002-08-27 05:46:11 +00:00
parent 427048f0c1
commit 765ff502c7
35 changed files with 433 additions and 433 deletions

View File

@@ -125,27 +125,27 @@ static void init_metadata_blocks_()
*/
/* min/max_framesize and md5sum don't get written at first, so we have to leave them 0 */
streaminfo_.is_last = false;
streaminfo_.type = FLAC__METADATA_TYPE_STREAMINFO;
streaminfo_.length = FLAC__STREAM_METADATA_STREAMINFO_LENGTH;
streaminfo_.data.stream_info.min_blocksize = 576;
streaminfo_.data.stream_info.max_blocksize = 576;
streaminfo_.data.stream_info.min_framesize = 0;
streaminfo_.data.stream_info.max_framesize = 0;
streaminfo_.data.stream_info.sample_rate = 44100;
streaminfo_.data.stream_info.channels = 1;
streaminfo_.data.stream_info.bits_per_sample = 8;
streaminfo_.data.stream_info.total_samples = 0;
streaminfo_.is_last = false;
streaminfo_.type = FLAC__METADATA_TYPE_STREAMINFO;
streaminfo_.length = FLAC__STREAM_METADATA_STREAMINFO_LENGTH;
streaminfo_.data.stream_info.min_blocksize = 576;
streaminfo_.data.stream_info.max_blocksize = 576;
streaminfo_.data.stream_info.min_framesize = 0;
streaminfo_.data.stream_info.max_framesize = 0;
streaminfo_.data.stream_info.sample_rate = 44100;
streaminfo_.data.stream_info.channels = 1;
streaminfo_.data.stream_info.bits_per_sample = 8;
streaminfo_.data.stream_info.total_samples = 0;
memset(streaminfo_.data.stream_info.md5sum, 0, 16);
padding_.is_last = false;
padding_.type = FLAC__METADATA_TYPE_PADDING;
padding_.length = 1234;
padding_.is_last = false;
padding_.type = FLAC__METADATA_TYPE_PADDING;
padding_.length = 1234;
seektable_.is_last = false;
seektable_.type = FLAC__METADATA_TYPE_SEEKTABLE;
seektable_.is_last = false;
seektable_.type = FLAC__METADATA_TYPE_SEEKTABLE;
seektable_.data.seek_table.num_points = 2;
seektable_.length = seektable_.data.seek_table.num_points * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH;
seektable_.length = seektable_.data.seek_table.num_points * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH;
seektable_.data.seek_table.points = malloc_or_die_(seektable_.data.seek_table.num_points * sizeof(FLAC__StreamMetadata_SeekPoint));
seektable_.data.seek_table.points[0].sample_number = 0;
seektable_.data.seek_table.points[0].stream_offset = 0;
@@ -154,16 +154,16 @@ static void init_metadata_blocks_()
seektable_.data.seek_table.points[1].stream_offset = 1000;
seektable_.data.seek_table.points[1].frame_samples = streaminfo_.data.stream_info.min_blocksize;
application1_.is_last = false;
application1_.type = FLAC__METADATA_TYPE_APPLICATION;
application1_.length = 8;
application1_.is_last = false;
application1_.type = FLAC__METADATA_TYPE_APPLICATION;
application1_.length = 8;
memcpy(application1_.data.application.id, "\xfe\xdc\xba\x98", 4);
application1_.data.application.data = malloc_or_die_(4);
memcpy(application1_.data.application.data, "\xf0\xe1\xd2\xc3", 4);
application2_.is_last = false;
application2_.type = FLAC__METADATA_TYPE_APPLICATION;
application2_.length = 4;
application2_.is_last = false;
application2_.type = FLAC__METADATA_TYPE_APPLICATION;
application2_.length = 4;
memcpy(application2_.data.application.id, "\x76\x54\x32\x10", 4);
application2_.data.application.data = 0;
@@ -206,7 +206,7 @@ static FLAC__bool generate_file_()
num_expected_ = 5;
if(!file_utils__generate_flacfile(flacfilename_, &flacfilesize_, 512 * 1024, &streaminfo_, expected_metadata_sequence_, num_expected_))
return die_("creating the encoded file");
return die_("creating the encoded file");
return true;
}
@@ -227,21 +227,21 @@ static FLAC__StreamDecoderReadStatus stream_decoder_read_callback_(const FLAC__S
if(feof(dcd->file))
return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
else if(*bytes > 0) {
unsigned bytes_read = fread(buffer, 1, *bytes, dcd->file);
if(bytes_read == 0) {
if(feof(dcd->file))
return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
else
return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
}
else {
*bytes = bytes_read;
return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
}
}
else
return FLAC__STREAM_DECODER_READ_STATUS_ABORT; /* abort to avoid a deadlock */
else if(*bytes > 0) {
unsigned bytes_read = fread(buffer, 1, *bytes, dcd->file);
if(bytes_read == 0) {
if(feof(dcd->file))
return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
else
return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
}
else {
*bytes = bytes_read;
return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
}
}
else
return FLAC__STREAM_DECODER_READ_STATUS_ABORT; /* abort to avoid a deadlock */
}
static FLAC__StreamDecoderWriteStatus stream_decoder_write_callback_(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
@@ -258,13 +258,13 @@ static FLAC__StreamDecoderWriteStatus stream_decoder_write_callback_(const FLAC_
if(dcd->error_occurred)
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
if(
(frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER && frame->header.number.frame_number == 0) ||
(frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER && frame->header.number.sample_number == 0)
) {
printf("content... ");
fflush(stdout);
}
if(
(frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER && frame->header.number.frame_number == 0) ||
(frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER && frame->header.number.sample_number == 0)
) {
printf("content... ");
fflush(stdout);
}
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}

View File

@@ -118,27 +118,27 @@ static void init_metadata_blocks_()
*/
/* min/max_framesize and md5sum don't get written at first, so we have to leave them 0 */
streaminfo_.is_last = false;
streaminfo_.type = FLAC__METADATA_TYPE_STREAMINFO;
streaminfo_.length = FLAC__STREAM_METADATA_STREAMINFO_LENGTH;
streaminfo_.data.stream_info.min_blocksize = 576;
streaminfo_.data.stream_info.max_blocksize = 576;
streaminfo_.data.stream_info.min_framesize = 0;
streaminfo_.data.stream_info.max_framesize = 0;
streaminfo_.data.stream_info.sample_rate = 44100;
streaminfo_.data.stream_info.channels = 1;
streaminfo_.data.stream_info.bits_per_sample = 8;
streaminfo_.data.stream_info.total_samples = 0;
streaminfo_.is_last = false;
streaminfo_.type = FLAC__METADATA_TYPE_STREAMINFO;
streaminfo_.length = FLAC__STREAM_METADATA_STREAMINFO_LENGTH;
streaminfo_.data.stream_info.min_blocksize = 576;
streaminfo_.data.stream_info.max_blocksize = 576;
streaminfo_.data.stream_info.min_framesize = 0;
streaminfo_.data.stream_info.max_framesize = 0;
streaminfo_.data.stream_info.sample_rate = 44100;
streaminfo_.data.stream_info.channels = 1;
streaminfo_.data.stream_info.bits_per_sample = 8;
streaminfo_.data.stream_info.total_samples = 0;
memset(streaminfo_.data.stream_info.md5sum, 0, 16);
padding_.is_last = false;
padding_.type = FLAC__METADATA_TYPE_PADDING;
padding_.length = 1234;
padding_.is_last = false;
padding_.type = FLAC__METADATA_TYPE_PADDING;
padding_.length = 1234;
seektable_.is_last = false;
seektable_.type = FLAC__METADATA_TYPE_SEEKTABLE;
seektable_.is_last = false;
seektable_.type = FLAC__METADATA_TYPE_SEEKTABLE;
seektable_.data.seek_table.num_points = 2;
seektable_.length = seektable_.data.seek_table.num_points * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH;
seektable_.length = seektable_.data.seek_table.num_points * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH;
seektable_.data.seek_table.points = malloc_or_die_(seektable_.data.seek_table.num_points * sizeof(FLAC__StreamMetadata_SeekPoint));
seektable_.data.seek_table.points[0].sample_number = 0;
seektable_.data.seek_table.points[0].stream_offset = 0;
@@ -147,22 +147,22 @@ static void init_metadata_blocks_()
seektable_.data.seek_table.points[1].stream_offset = 1000;
seektable_.data.seek_table.points[1].frame_samples = streaminfo_.data.stream_info.min_blocksize;
application1_.is_last = false;
application1_.type = FLAC__METADATA_TYPE_APPLICATION;
application1_.length = 8;
application1_.is_last = false;
application1_.type = FLAC__METADATA_TYPE_APPLICATION;
application1_.length = 8;
memcpy(application1_.data.application.id, "\xfe\xdc\xba\x98", 4);
application1_.data.application.data = malloc_or_die_(4);
memcpy(application1_.data.application.data, "\xf0\xe1\xd2\xc3", 4);
application2_.is_last = false;
application2_.type = FLAC__METADATA_TYPE_APPLICATION;
application2_.length = 4;
application2_.is_last = false;
application2_.type = FLAC__METADATA_TYPE_APPLICATION;
application2_.length = 4;
memcpy(application2_.data.application.id, "\x76\x54\x32\x10", 4);
application2_.data.application.data = 0;
vorbiscomment_.is_last = true;
vorbiscomment_.type = FLAC__METADATA_TYPE_VORBIS_COMMENT;
vorbiscomment_.length = (4 + 8) + 4 + (4 + 5) + (4 + 0);
vorbiscomment_.is_last = true;
vorbiscomment_.type = FLAC__METADATA_TYPE_VORBIS_COMMENT;
vorbiscomment_.length = (4 + 8) + 4 + (4 + 5) + (4 + 0);
vorbiscomment_.data.vorbis_comment.vendor_string.length = 8;
vorbiscomment_.data.vorbis_comment.vendor_string.entry = malloc_or_die_(8);
memcpy(vorbiscomment_.data.vorbis_comment.vendor_string.entry, "flac 1.x", 8);

View File

@@ -319,7 +319,7 @@ static FLAC__bool generate_file_()
return die_("priming our metadata");
if(!file_utils__generate_flacfile(flacfile_, 0, 512 * 1024, &streaminfo, metadata, 1))
return die_("creating the encoded file");
return die_("creating the encoded file");
free(vorbiscomment.data.vorbis_comment.vendor_string.entry);
@@ -377,7 +377,7 @@ static FLAC__bool test_file_(const char *filename, void (*metadata_callback)(con
static FLAC__bool change_stats_(const char *filename, FLAC__bool read_only)
{
if(!file_utils__change_stats(filename, read_only))
return die_("during file_utils__change_stats()");
return die_("during file_utils__change_stats()");
return true;
}
@@ -592,7 +592,7 @@ static FLAC__bool test_level_1_()
if(!test_file_(flacfile_, decoder_metadata_callback_compare_))
return false;
printf("SV[P]PP\tprev\n");
if(!FLAC__metadata_simple_iterator_prev(iterator))
return die_("iterator ended early\n");

View File

@@ -69,7 +69,7 @@ static FLAC__bool check_seektable_(const FLAC__StreamMetadata *block, unsigned n
if(block->length != expected_length) {
printf("FAILED, bad length, expected %u, got %u\n", expected_length, block->length);
return false;
}
}
if(block->data.seek_table.num_points != num_points) {
printf("FAILED, expected %u point, got %u\n", num_points, block->data.seek_table.num_points);
return false;
@@ -93,14 +93,14 @@ static void entry_new_(FLAC__StreamMetadata_VorbisComment_Entry *entry, const ch
{
entry->length = strlen(field);
entry->entry = (FLAC__byte*)malloc(entry->length);
FLAC__ASSERT(0 != entry->entry);
FLAC__ASSERT(0 != entry->entry);
memcpy(entry->entry, field, entry->length);
}
static void entry_clone_(FLAC__StreamMetadata_VorbisComment_Entry *entry)
{
FLAC__byte *x = (FLAC__byte*)malloc(entry->length);
FLAC__ASSERT(0 != x);
FLAC__ASSERT(0 != x);
memcpy(x, entry->entry, entry->length);
entry->entry = x;
}
@@ -206,7 +206,7 @@ FLAC__bool test_metadata_object()
if(block->length != expected_length) {
printf("FAILED, bad length, expected %u, got %u\n", expected_length, block->length);
return false;
}
}
printf("OK\n");
printf("testing FLAC__metadata_object_clone()... ");
@@ -237,7 +237,7 @@ FLAC__bool test_metadata_object()
if(block->length != expected_length) {
printf("FAILED, bad length, expected %u, got %u\n", expected_length, block->length);
return false;
}
}
printf("OK\n");
printf("testing FLAC__metadata_object_clone()... ");
@@ -268,7 +268,7 @@ FLAC__bool test_metadata_object()
if(block->length != expected_length) {
printf("FAILED, bad length, expected %u, got %u\n", expected_length, block->length);
return false;
}
}
printf("OK\n");
printf("testing FLAC__metadata_object_clone()... ");
@@ -539,7 +539,7 @@ FLAC__bool test_metadata_object()
if(!check_seektable_(block, seekpoints, seekpoint_array))
return false;
{
{
FLAC__uint64 nums[2] = { 3, 7 };
seekpoint_array[seekpoints++].sample_number = nums[0];
seekpoint_array[seekpoints++].sample_number = nums[1];
@@ -612,7 +612,7 @@ FLAC__bool test_metadata_object()
if(block->length != expected_length) {
printf("FAILED, bad length, expected %u, got %u\n", expected_length, block->length);
return false;
}
}
printf("OK\n");
printf("testing FLAC__metadata_object_clone()... ");

View File

@@ -31,35 +31,35 @@ FLAC__bool compare_block_data_streaminfo_(const FLAC__StreamMetadata_StreamInfo
if(blockcopy->min_blocksize != block->min_blocksize) {
printf("FAILED, min_blocksize mismatch, expected %u, got %u\n", block->min_blocksize, blockcopy->min_blocksize);
return false;
}
}
if(blockcopy->max_blocksize != block->max_blocksize) {
printf("FAILED, max_blocksize mismatch, expected %u, got %u\n", block->max_blocksize, blockcopy->max_blocksize);
return false;
}
}
if(blockcopy->min_framesize != block->min_framesize) {
printf("FAILED, min_framesize mismatch, expected %u, got %u\n", block->min_framesize, blockcopy->min_framesize);
return false;
}
}
if(blockcopy->max_framesize != block->max_framesize) {
printf("FAILED, max_framesize mismatch, expected %u, got %u\n", block->max_framesize, blockcopy->max_framesize);
return false;
}
}
if(blockcopy->sample_rate != block->sample_rate) {
printf("FAILED, sample_rate mismatch, expected %u, got %u\n", block->sample_rate, blockcopy->sample_rate);
return false;
}
}
if(blockcopy->channels != block->channels) {
printf("FAILED, channels mismatch, expected %u, got %u\n", block->channels, blockcopy->channels);
return false;
}
}
if(blockcopy->bits_per_sample != block->bits_per_sample) {
printf("FAILED, bits_per_sample mismatch, expected %u, got %u\n", block->bits_per_sample, blockcopy->bits_per_sample);
return false;
}
}
if(blockcopy->total_samples != block->total_samples) {
printf("FAILED, total_samples mismatch, expected %llu, got %llu\n", block->total_samples, blockcopy->total_samples);
return false;
}
}
if(0 != memcmp(blockcopy->md5sum, block->md5sum, sizeof(block->md5sum))) {
printf("FAILED, md5sum mismatch, expected %02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X, got %02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X\n",
(unsigned)block->md5sum[0],
@@ -96,7 +96,7 @@ FLAC__bool compare_block_data_streaminfo_(const FLAC__StreamMetadata_StreamInfo
(unsigned)blockcopy->md5sum[15]
);
return false;
}
}
return true;
}
@@ -125,7 +125,7 @@ FLAC__bool compare_block_data_application_(const FLAC__StreamMetadata_Applicatio
(unsigned)blockcopy->id[3]
);
return false;
}
}
if(0 == block->data || 0 == blockcopy->data) {
if(block->data != blockcopy->data) {
printf("FAILED, data mismatch (%s's data pointer is null)\n", 0==block->data?"original":"copy");
@@ -155,7 +155,7 @@ FLAC__bool compare_block_data_seektable_(const FLAC__StreamMetadata_SeekTable *b
if(blockcopy->num_points != block->num_points) {
printf("FAILED, num_points mismatch, expected %u, got %u\n", block->num_points, blockcopy->num_points);
return false;
}
}
for(i = 0; i < block->num_points; i++) {
if(blockcopy->points[i].sample_number != block->points[i].sample_number) {
printf("FAILED, points[%u].sample_number mismatch, expected %llu, got %llu\n", i, block->points[i].sample_number, blockcopy->points[i].sample_number);
@@ -179,7 +179,7 @@ FLAC__bool compare_block_data_vorbiscomment_(const FLAC__StreamMetadata_VorbisCo
if(blockcopy->vendor_string.length != block->vendor_string.length) {
printf("FAILED, vendor_string.length mismatch, expected %u, got %u\n", block->vendor_string.length, blockcopy->vendor_string.length);
return false;
}
}
if(0 == block->vendor_string.entry || 0 == blockcopy->vendor_string.entry) {
if(block->vendor_string.entry != blockcopy->vendor_string.entry) {
printf("FAILED, vendor_string.entry mismatch\n");
@@ -189,11 +189,11 @@ FLAC__bool compare_block_data_vorbiscomment_(const FLAC__StreamMetadata_VorbisCo
else if(0 != memcmp(blockcopy->vendor_string.entry, block->vendor_string.entry, block->vendor_string.length)) {
printf("FAILED, vendor_string.entry mismatch\n");
return false;
}
}
if(blockcopy->num_comments != block->num_comments) {
printf("FAILED, num_comments mismatch, expected %u, got %u\n", block->num_comments, blockcopy->num_comments);
return false;
}
}
for(i = 0; i < block->num_comments; i++) {
if(blockcopy->comments[i].length != block->comments[i].length) {
printf("FAILED, comments[%u].length mismatch, expected %u, got %u\n", i, block->comments[i].length, blockcopy->comments[i].length);
@@ -220,15 +220,15 @@ FLAC__bool compare_block_(const FLAC__StreamMetadata *block, const FLAC__StreamM
if(blockcopy->type != block->type) {
printf("FAILED, type mismatch, expected %s, got %s\n", FLAC__MetadataTypeString[block->type], FLAC__MetadataTypeString[blockcopy->type]);
return false;
}
}
if(blockcopy->is_last != block->is_last) {
printf("FAILED, is_last mismatch, expected %u, got %u\n", (unsigned)block->is_last, (unsigned)blockcopy->is_last);
return false;
}
}
if(blockcopy->length != block->length) {
printf("FAILED, length mismatch, expected %u, got %u\n", block->length, blockcopy->length);
return false;
}
}
switch(block->type) {
case FLAC__METADATA_TYPE_STREAMINFO:
return compare_block_data_streaminfo_(&block->data.stream_info, &blockcopy->data.stream_info);