fix bug passing filename around
authorJosh Coalson <jcoalson@users.sourceforce.net>
Fri, 8 Nov 2002 22:15:08 +0000 (22:15 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Fri, 8 Nov 2002 22:15:08 +0000 (22:15 +0000)
src/metaflac/operations.c
src/metaflac/operations_shorthand_streaminfo.c
src/metaflac/operations_shorthand_vorbiscomment.c

index a9922de..437861c 100644 (file)
@@ -35,7 +35,7 @@ static FLAC__bool do_major_operation__remove(FLAC__Metadata_Chain *chain, const
 static FLAC__bool do_major_operation__remove_all(FLAC__Metadata_Chain *chain, const CommandLineOptions *options);
 static FLAC__bool do_shorthand_operations(const CommandLineOptions *options);
 static FLAC__bool do_shorthand_operations_on_file(const char *filename, const CommandLineOptions *options);
-static FLAC__bool do_shorthand_operation(const char *filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write, FLAC__bool utf8_convert);
+static FLAC__bool do_shorthand_operation(const char *filename, FLAC__bool prefix_with_filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write, FLAC__bool utf8_convert);
 static FLAC__bool do_shorthand_operation__add_replay_gain(char **filenames, unsigned num_files, FLAC__bool preserve_modtime);
 static FLAC__bool do_shorthand_operation__add_padding(const char *filename, FLAC__Metadata_Chain *chain, unsigned length, FLAC__bool *needs_write);
 
@@ -46,10 +46,10 @@ static void write_metadata(const char *filename, FLAC__StreamMetadata *block, un
 extern FLAC__bool do_shorthand_operation__add_seekpoints(const char *filename, FLAC__Metadata_Chain *chain, const char *specification, FLAC__bool *needs_write);
 
 /* from operations_shorthand_streaminfo.c */
-extern FLAC__bool do_shorthand_operation__streaminfo(const char *filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write);
+extern FLAC__bool do_shorthand_operation__streaminfo(const char *filename, FLAC__bool prefix_with_filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write);
 
 /* from operations_shorthand_vorbiscomment.c */
-extern FLAC__bool do_shorthand_operation__vorbis_comment(const char *filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write, FLAC__bool raw);
+extern FLAC__bool do_shorthand_operation__vorbis_comment(const char *filename, FLAC__bool prefix_with_filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write, FLAC__bool raw);
 
 FLAC__bool do_operations(const CommandLineOptions *options)
 {
@@ -268,7 +268,7 @@ FLAC__bool do_shorthand_operations_on_file(const char *filename, const CommandLi
        }
 
        for(i = 0; i < options->ops.num_operations && ok; i++) {
-               ok &= do_shorthand_operation(options->prefix_with_filename? filename : 0, chain, &options->ops.operations[i], &needs_write, options->utf8_convert);
+               ok &= do_shorthand_operation(filename, options->prefix_with_filename, chain, &options->ops.operations[i], &needs_write, options->utf8_convert);
 
                /* The following seems counterintuitive but the meaning
                 * of 'use_padding' is 'try to keep the overall metadata
@@ -294,7 +294,7 @@ FLAC__bool do_shorthand_operations_on_file(const char *filename, const CommandLi
        return ok;
 }
 
-FLAC__bool do_shorthand_operation(const char *filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write, FLAC__bool utf8_convert)
+FLAC__bool do_shorthand_operation(const char *filename, FLAC__bool prefix_with_filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write, FLAC__bool utf8_convert)
 {
        FLAC__bool ok = true;
 
@@ -317,7 +317,7 @@ FLAC__bool do_shorthand_operation(const char *filename, FLAC__Metadata_Chain *ch
                case OP__SET_CHANNELS:
                case OP__SET_BPS:
                case OP__SET_TOTAL_SAMPLES:
-                       ok = do_shorthand_operation__streaminfo(filename, chain, operation, needs_write);
+                       ok = do_shorthand_operation__streaminfo(filename, prefix_with_filename, chain, operation, needs_write);
                        break;
                case OP__SHOW_VC_VENDOR:
                case OP__SHOW_VC_FIELD:
@@ -327,7 +327,7 @@ FLAC__bool do_shorthand_operation(const char *filename, FLAC__Metadata_Chain *ch
                case OP__SET_VC_FIELD:
                case OP__IMPORT_VC_FROM:
                case OP__EXPORT_VC_TO:
-                       ok = do_shorthand_operation__vorbis_comment(filename, chain, operation, needs_write, !utf8_convert);
+                       ok = do_shorthand_operation__vorbis_comment(filename, prefix_with_filename, chain, operation, needs_write, !utf8_convert);
                        break;
                case OP__ADD_SEEKPOINT:
                        ok = do_shorthand_operation__add_seekpoints(filename, chain, operation->argument.add_seekpoint.specification, needs_write);
index 7bab5c7..3b67490 100644 (file)
@@ -22,7 +22,7 @@
 #include "FLAC/metadata.h"
 #include <string.h>
 
-FLAC__bool do_shorthand_operation__streaminfo(const char *filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write)
+FLAC__bool do_shorthand_operation__streaminfo(const char *filename, FLAC__bool prefix_with_filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write)
 {
        unsigned i;
        FLAC__bool ok = true;
@@ -39,7 +39,7 @@ FLAC__bool do_shorthand_operation__streaminfo(const char *filename, FLAC__Metada
        FLAC__ASSERT(0 != block);
        FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_STREAMINFO);
 
-       if(0 != filename)
+       if(prefix_with_filename)
                printf("%s:", filename);
 
        switch(operation->type) {
index 311497a..85170e9 100644 (file)
@@ -30,7 +30,7 @@ static FLAC__bool set_vc_field(const char *filename, FLAC__StreamMetadata *block
 static FLAC__bool import_vc_from(const char *filename, FLAC__StreamMetadata *block, const Argument_VcFilename *vc_filename, FLAC__bool *needs_write, FLAC__bool raw);
 static FLAC__bool export_vc_to(const char *filename, FLAC__StreamMetadata *block, const Argument_VcFilename *vc_filename, FLAC__bool raw);
 
-FLAC__bool do_shorthand_operation__vorbis_comment(const char *filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write, FLAC__bool raw)
+FLAC__bool do_shorthand_operation__vorbis_comment(const char *filename, FLAC__bool prefix_with_filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write, FLAC__bool raw)
 {
        FLAC__bool ok = true, found_vc_block = false;
        FLAC__StreamMetadata *block = 0;
@@ -73,10 +73,10 @@ FLAC__bool do_shorthand_operation__vorbis_comment(const char *filename, FLAC__Me
 
        switch(operation->type) {
                case OP__SHOW_VC_VENDOR:
-                       write_vc_field(filename, &block->data.vorbis_comment.vendor_string, raw, stdout);
+                       write_vc_field(prefix_with_filename? filename : 0, &block->data.vorbis_comment.vendor_string, raw, stdout);
                        break;
                case OP__SHOW_VC_FIELD:
-                       write_vc_fields(filename, operation->argument.vc_field_name.value, block->data.vorbis_comment.comments, block->data.vorbis_comment.num_comments, raw, stdout);
+                       write_vc_fields(prefix_with_filename? filename : 0, operation->argument.vc_field_name.value, block->data.vorbis_comment.comments, block->data.vorbis_comment.num_comments, raw, stdout);
                        break;
                case OP__REMOVE_VC_ALL:
                        ok = remove_vc_all(filename, block, needs_write);