From: Josh Coalson Date: Fri, 9 Sep 2005 01:58:36 +0000 (+0000) Subject: fix vorbiscomment entry validity tests to match better utf-8 checking in libFLAC X-Git-Tag: 1.2.0~509 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6847a661a0ba1c830e177867ebed3833f57b2bbd;p=platform%2Fupstream%2Fflac.git fix vorbiscomment entry validity tests to match better utf-8 checking in libFLAC --- diff --git a/src/test_libFLAC/format.c b/src/test_libFLAC/format.c index 7980e5d..0034b97 100644 --- a/src/test_libFLAC/format.c +++ b/src/test_libFLAC/format.c @@ -26,38 +26,38 @@ static struct { unsigned rate; FLAC__bool valid; } SAMPLE_RATES[] = { - { 0, false }, - { 1, true }, - { 9, true }, - { 10, true }, - { 4000, true }, - { 8000, true }, - { 11025, true }, - { 12000, true }, - { 16000, true }, - { 22050, true }, - { 24000, true }, - { 32000, true }, - { 32768, true }, - { 44100, true }, - { 48000, true }, - { 65000, true }, - { 65535, true }, - { 65536, false }, - { 65540, true }, - { 65550, true }, - { 65555, false }, - { 66000, true }, - { 66001, false }, - { 96000, true }, - { 100000, true }, - { 100001, false }, - { 192000, true }, - { 500000, true }, - { 500001, false }, - { 500010, true }, - { 700000, false }, - { 700010, false }, + { 0 , false }, + { 1 , true }, + { 9 , true }, + { 10 , true }, + { 4000 , true }, + { 8000 , true }, + { 11025 , true }, + { 12000 , true }, + { 16000 , true }, + { 22050 , true }, + { 24000 , true }, + { 32000 , true }, + { 32768 , true }, + { 44100 , true }, + { 48000 , true }, + { 65000 , true }, + { 65535 , true }, + { 65536 , false }, + { 65540 , true }, + { 65550 , true }, + { 65555 , false }, + { 66000 , true }, + { 66001 , false }, + { 96000 , true }, + { 100000 , true }, + { 100001 , false }, + { 192000 , true }, + { 500000 , true }, + { 500001 , false }, + { 500010 , true }, + { 700000 , false }, + { 700010 , false }, { 1000000, false }, { 1100000, false } }; @@ -66,13 +66,13 @@ static struct { const char *string; FLAC__bool valid; } VCENTRY_NAMES[] = { - { "", true }, - { "a", true }, - { "=", false }, - { "a=", false }, + { "" , true }, + { "a" , true }, + { "=" , false }, + { "a=" , false }, { "\x01", false }, { "\x1f", false }, - { "\x7d", true }, + { "\x7d", true }, { "\x7e", false }, { "\xff", false } }; @@ -82,53 +82,63 @@ static struct { const FLAC__byte *string; FLAC__bool valid; } VCENTRY_VALUES[] = { - { 0, (const FLAC__byte*)"", true }, - { 1, (const FLAC__byte*)"", true }, - { 1, (const FLAC__byte*)"\x01", true }, - { 1, (const FLAC__byte*)"\x7f", true }, - { 1, (const FLAC__byte*)"\x80", false }, - { 1, (const FLAC__byte*)"\x81", false }, - { 1, (const FLAC__byte*)"\xc0", false }, - { 1, (const FLAC__byte*)"\xe0", false }, - { 1, (const FLAC__byte*)"\xf0", false }, - { 2, (const FLAC__byte*)"\xc0\x41", false }, - { 2, (const FLAC__byte*)"\xc1\x41", false }, - { 2, (const FLAC__byte*)"\xc0\x85", true }, - { 2, (const FLAC__byte*)"\xc1\x85", true }, - { 2, (const FLAC__byte*)"\xe0\x41", false }, - { 2, (const FLAC__byte*)"\xe1\x41", false }, - { 2, (const FLAC__byte*)"\xe0\x85", false }, - { 2, (const FLAC__byte*)"\xe1\x85", false }, + { 0, (const FLAC__byte*)"" , true }, + { 1, (const FLAC__byte*)"" , true }, + { 1, (const FLAC__byte*)"\x01" , true }, + { 1, (const FLAC__byte*)"\x7f" , true }, + { 1, (const FLAC__byte*)"\x80" , false }, + { 1, (const FLAC__byte*)"\x81" , false }, + { 1, (const FLAC__byte*)"\xc0" , false }, + { 1, (const FLAC__byte*)"\xe0" , false }, + { 1, (const FLAC__byte*)"\xf0" , false }, + { 2, (const FLAC__byte*)"\xc0\x41" , false }, + { 2, (const FLAC__byte*)"\xc1\x41" , false }, + { 2, (const FLAC__byte*)"\xc0\x85" , false }, /* non-shortest form */ + { 2, (const FLAC__byte*)"\xc1\x85" , false }, /* non-shortest form */ + { 2, (const FLAC__byte*)"\xc2\x85" , true }, + { 2, (const FLAC__byte*)"\xe0\x41" , false }, + { 2, (const FLAC__byte*)"\xe1\x41" , false }, + { 2, (const FLAC__byte*)"\xe0\x85" , false }, + { 2, (const FLAC__byte*)"\xe1\x85" , false }, { 3, (const FLAC__byte*)"\xe0\x85\x41", false }, { 3, (const FLAC__byte*)"\xe1\x85\x41", false }, - { 3, (const FLAC__byte*)"\xe0\x85\x80", true }, - { 3, (const FLAC__byte*)"\xe1\x85\x80", true } + { 3, (const FLAC__byte*)"\xe0\x85\x80", false }, /* non-shortest form */ + { 3, (const FLAC__byte*)"\xe0\x95\x80", false }, /* non-shortest form */ + { 3, (const FLAC__byte*)"\xe0\xa5\x80", true }, + { 3, (const FLAC__byte*)"\xe1\x85\x80", true }, + { 3, (const FLAC__byte*)"\xe1\x95\x80", true }, + { 3, (const FLAC__byte*)"\xe1\xa5\x80", true } }; static struct { const FLAC__byte *string; FLAC__bool valid; } VCENTRY_VALUES_NT[] = { - { (FLAC__byte*)"", true }, - { (FLAC__byte*)"\x01", true }, - { (FLAC__byte*)"\x7f", true }, - { (FLAC__byte*)"\x80", false }, - { (FLAC__byte*)"\x81", false }, - { (FLAC__byte*)"\xc0", false }, - { (FLAC__byte*)"\xe0", false }, - { (FLAC__byte*)"\xf0", false }, - { (FLAC__byte*)"\xc0\x41", false }, - { (FLAC__byte*)"\xc1\x41", false }, - { (FLAC__byte*)"\xc0\x85", true }, - { (FLAC__byte*)"\xc1\x85", true }, - { (FLAC__byte*)"\xe0\x41", false }, - { (FLAC__byte*)"\xe1\x41", false }, - { (FLAC__byte*)"\xe0\x85", false }, - { (FLAC__byte*)"\xe1\x85", false }, - { (FLAC__byte*)"\xe0\x85\x41", false }, - { (FLAC__byte*)"\xe1\x85\x41", false }, - { (FLAC__byte*)"\xe0\x85\x80", true }, - { (FLAC__byte*)"\xe1\x85\x80", true } + { (const FLAC__byte*)"" , true }, + { (const FLAC__byte*)"\x01" , true }, + { (const FLAC__byte*)"\x7f" , true }, + { (const FLAC__byte*)"\x80" , false }, + { (const FLAC__byte*)"\x81" , false }, + { (const FLAC__byte*)"\xc0" , false }, + { (const FLAC__byte*)"\xe0" , false }, + { (const FLAC__byte*)"\xf0" , false }, + { (const FLAC__byte*)"\xc0\x41" , false }, + { (const FLAC__byte*)"\xc1\x41" , false }, + { (const FLAC__byte*)"\xc0\x85" , false }, /* non-shortest form */ + { (const FLAC__byte*)"\xc1\x85" , false }, /* non-shortest form */ + { (const FLAC__byte*)"\xc2\x85" , true }, + { (const FLAC__byte*)"\xe0\x41" , false }, + { (const FLAC__byte*)"\xe1\x41" , false }, + { (const FLAC__byte*)"\xe0\x85" , false }, + { (const FLAC__byte*)"\xe1\x85" , false }, + { (const FLAC__byte*)"\xe0\x85\x41", false }, + { (const FLAC__byte*)"\xe1\x85\x41", false }, + { (const FLAC__byte*)"\xe0\x85\x80", false }, /* non-shortest form */ + { (const FLAC__byte*)"\xe0\x95\x80", false }, /* non-shortest form */ + { (const FLAC__byte*)"\xe0\xa5\x80", true }, + { (const FLAC__byte*)"\xe1\x85\x80", true }, + { (const FLAC__byte*)"\xe1\x95\x80", true }, + { (const FLAC__byte*)"\xe1\xa5\x80", true } }; static struct { @@ -136,34 +146,39 @@ static struct { const FLAC__byte *string; FLAC__bool valid; } VCENTRIES[] = { - { 0, (const FLAC__byte*)"", false }, - { 1, (const FLAC__byte*)"a", false }, - { 1, (const FLAC__byte*)"=", true }, - { 2, (const FLAC__byte*)"a=", true }, - { 2, (const FLAC__byte*)"\x01=", false }, - { 2, (const FLAC__byte*)"\x1f=", false }, - { 2, (const FLAC__byte*)"\x7d=", true }, - { 2, (const FLAC__byte*)"\x7e=", false }, - { 2, (const FLAC__byte *)"\xff=", false }, - { 3, (const FLAC__byte*)"a=\x01", true }, - { 3, (const FLAC__byte*)"a=\x7f", true }, - { 3, (const FLAC__byte*)"a=\x80", false }, - { 3, (const FLAC__byte*)"a=\x81", false }, - { 3, (const FLAC__byte*)"a=\xc0", false }, - { 3, (const FLAC__byte*)"a=\xe0", false }, - { 3, (const FLAC__byte*)"a=\xf0", false }, - { 4, (const FLAC__byte*)"a=\xc0\x41", false }, - { 4, (const FLAC__byte*)"a=\xc1\x41", false }, - { 4, (const FLAC__byte*)"a=\xc0\x85", true }, - { 4, (const FLAC__byte*)"a=\xc1\x85", true }, - { 4, (const FLAC__byte*)"a=\xe0\x41", false }, - { 4, (const FLAC__byte*)"a=\xe1\x41", false }, - { 4, (const FLAC__byte*)"a=\xe0\x85", false }, - { 4, (const FLAC__byte*)"a=\xe1\x85", false }, + { 0, (const FLAC__byte*)"" , false }, + { 1, (const FLAC__byte*)"a" , false }, + { 1, (const FLAC__byte*)"=" , true }, + { 2, (const FLAC__byte*)"a=" , true }, + { 2, (const FLAC__byte*)"\x01=" , false }, + { 2, (const FLAC__byte*)"\x1f=" , false }, + { 2, (const FLAC__byte*)"\x7d=" , true }, + { 2, (const FLAC__byte*)"\x7e=" , false }, + { 2, (const FLAC__byte*)"\xff=" , false }, + { 3, (const FLAC__byte*)"a=\x01" , true }, + { 3, (const FLAC__byte*)"a=\x7f" , true }, + { 3, (const FLAC__byte*)"a=\x80" , false }, + { 3, (const FLAC__byte*)"a=\x81" , false }, + { 3, (const FLAC__byte*)"a=\xc0" , false }, + { 3, (const FLAC__byte*)"a=\xe0" , false }, + { 3, (const FLAC__byte*)"a=\xf0" , false }, + { 4, (const FLAC__byte*)"a=\xc0\x41" , false }, + { 4, (const FLAC__byte*)"a=\xc1\x41" , false }, + { 4, (const FLAC__byte*)"a=\xc0\x85" , false }, /* non-shortest form */ + { 4, (const FLAC__byte*)"a=\xc1\x85" , false }, /* non-shortest form */ + { 4, (const FLAC__byte*)"a=\xc2\x85" , true }, + { 4, (const FLAC__byte*)"a=\xe0\x41" , false }, + { 4, (const FLAC__byte*)"a=\xe1\x41" , false }, + { 4, (const FLAC__byte*)"a=\xe0\x85" , false }, + { 4, (const FLAC__byte*)"a=\xe1\x85" , false }, { 5, (const FLAC__byte*)"a=\xe0\x85\x41", false }, { 5, (const FLAC__byte*)"a=\xe1\x85\x41", false }, - { 5, (const FLAC__byte*)"a=\xe0\x85\x80", true }, - { 5, (const FLAC__byte*)"a=\xe1\x85\x80", true } + { 5, (const FLAC__byte*)"a=\xe0\x85\x80", false }, /* non-shortest form */ + { 5, (const FLAC__byte*)"a=\xe0\x95\x80", false }, /* non-shortest form */ + { 5, (const FLAC__byte*)"a=\xe0\xa5\x80", true }, + { 5, (const FLAC__byte*)"a=\xe1\x85\x80", true }, + { 5, (const FLAC__byte*)"a=\xe1\x95\x80", true }, + { 5, (const FLAC__byte*)"a=\xe1\xa5\x80", true } }; FLAC__bool test_format()