minor formatting
[flac.git] / src / test_libFLAC / metadata_manip.c
index a3c8671..159205b 100644 (file)
@@ -1,5 +1,5 @@
 /* test_libFLAC - Unit tester for libFLAC
- * Copyright (C) 2002  Josh Coalson
+ * Copyright (C) 2002,2003  Josh Coalson
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -21,7 +21,7 @@
 #include "FLAC/assert.h"
 #include "FLAC/file_decoder.h"
 #include "FLAC/metadata.h"
-#include "share/file_utils.h"
+#include "share/grabbag.h"
 #include <stdio.h>
 #include <stdlib.h> /* for malloc() */
 
@@ -177,7 +177,7 @@ static FLAC__bool compare_chain_(FLAC__Metadata_Chain *chain, unsigned current_p
                        return die_("getting block from iterator");
                }
 
-               if(!compare_block_(our_metadata_.blocks[i], block)) {
+               if(!mutils__compare_block(our_metadata_.blocks[i], block)) {
                        FLAC__metadata_iterator_delete(iterator);
                        return die_("metadata block mismatch");
                }
@@ -198,7 +198,7 @@ static FLAC__bool compare_chain_(FLAC__Metadata_Chain *chain, unsigned current_p
                printf("CURRENT_POSITION... ");
                fflush(stdout);
 
-               if(!compare_block_(our_metadata_.blocks[current_position], current_block))
+               if(!mutils__compare_block(our_metadata_.blocks[current_position], current_block))
                        return die_("metadata block mismatch");
        }
 
@@ -254,7 +254,7 @@ static void decoder_metadata_callback_compare_(const FLAC__FileDecoder *decoder,
                dcd->error_occurred = true;
        }
        else {
-               if(!compare_block_(our_metadata_.blocks[mc_our_block_number_], metadata)) {
+               if(!mutils__compare_block(our_metadata_.blocks[mc_our_block_number_], metadata)) {
                        (void)die_("metadata block mismatch");
                        dcd->error_occurred = true;
                }
@@ -377,8 +377,8 @@ 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(!FLAC__file_utils_change_stats(filename, read_only))
-               return die_("during FLAC__file_utils_change_stats()");
+       if(!grabbag__file_change_stats(filename, read_only))
+               return die_("during grabbag__file_change_stats()");
 
        return true;
 }
@@ -388,7 +388,7 @@ static FLAC__bool remove_file_(const char *filename)
        while(our_metadata_.num_blocks > 0)
                delete_from_our_metadata_(0);
 
-       if(!FLAC__file_utils_remove_file(filename))
+       if(!grabbag__file_remove_file(filename))
                return die_("removing file");
 
        return true;
@@ -434,6 +434,9 @@ static FLAC__bool test_level_1_()
        FLAC__byte data[1000];
        unsigned our_current_position = 0;
 
+       /* initialize 'data' to avoid Valgrind errors */
+       memset(data, 0, sizeof(data));
+
        printf("\n\n++++++ testing level 1 interface\n");
 
        /************************************************************/
@@ -482,6 +485,7 @@ static FLAC__bool test_level_1_()
                return die_("mismatch in min_blocksize");
        if(block->data.stream_info.max_blocksize != 576)
                return die_("mismatch in max_blocksize");
+       FLAC__metadata_object_delete(block);
 
        if(!FLAC__metadata_simple_iterator_next(iterator))
                return die_("forward iterator ended early");
@@ -502,6 +506,7 @@ static FLAC__bool test_level_1_()
        /* check to see if some basic data matches (c.f. generate_file_()) */
        if(block->length != 1234)
                return die_("bad PADDING length");
+       FLAC__metadata_object_delete(block);
 
        if(FLAC__metadata_simple_iterator_next(iterator))
                return die_("forward iterator returned true but should have returned false");
@@ -1090,6 +1095,9 @@ static FLAC__bool test_level_2_()
        FLAC__byte data[2000];
        unsigned our_current_position;
 
+       /* initialize 'data' to avoid Valgrind errors */
+       memset(data, 0, sizeof(data));
+
        printf("\n\n++++++ testing level 2 interface\n");
 
        printf("generate read-only file\n");