add vorbiscomment validation functions to format.c and test code; validate name part of vorbiscomment in metadata and metadata++ interfaces

This commit is contained in:
Josh Coalson
2004-12-30 03:41:19 +00:00
parent e40480d300
commit 2de1124e36
14 changed files with 466 additions and 42 deletions

View File

@@ -1018,14 +1018,15 @@ bool test_metadata_object_vorbiscomment()
printf("OK\n");
printf("testing VorbisComment::set_vendor_string()... ");
if(!block.set_vendor_string(entry1))
if(!block.set_vendor_string((const FLAC__byte *)"mame0"))
return die_("returned false");
printf("OK\n");
vorbiscomment_.data.vorbis_comment.vendor_string.entry[0] = 'm';
printf("testing VorbisComment::get_vendor_string()... ");
if(block.get_vendor_string().get_field_name_length() != vorbiscomment_.data.vorbis_comment.vendor_string.length)
if(strlen((const char *)block.get_vendor_string()) != vorbiscomment_.data.vorbis_comment.vendor_string.length)
return die_("length mismatch");
if(0 != memcmp(block.get_vendor_string().get_field_name(), vorbiscomment_.data.vorbis_comment.vendor_string.entry, vorbiscomment_.data.vorbis_comment.vendor_string.length))
if(0 != memcmp(block.get_vendor_string(), vorbiscomment_.data.vorbis_comment.vendor_string.entry, vorbiscomment_.data.vorbis_comment.vendor_string.length))
return die_("value mismatch");
printf("OK\n");