summaryrefslogtreecommitdiff
path: root/include/FLAC/format.h
diff options
context:
space:
mode:
authorJosh Coalson <jcoalson@users.sourceforce.net>2004-12-30 03:41:19 +0000
committerJosh Coalson <jcoalson@users.sourceforce.net>2004-12-30 03:41:19 +0000
commit2de1124e364a4612c00a806d89923ced6869e3a6 (patch)
tree9b9e8ff1895ca3a41c43df078cc064935e161e95 /include/FLAC/format.h
parente40480d30073174e753628a3ffe93ce18cb9d216 (diff)
downloadflac-2de1124e364a4612c00a806d89923ced6869e3a6.tar.gz
add vorbiscomment validation functions to format.c and test code; validate name part of vorbiscomment in metadata and metadata++ interfaces
Diffstat (limited to 'include/FLAC/format.h')
-rw-r--r--include/FLAC/format.h47
1 files changed, 46 insertions, 1 deletions
diff --git a/include/FLAC/format.h b/include/FLAC/format.h
index 96bbbe04..1effad34 100644
--- a/include/FLAC/format.h
+++ b/include/FLAC/format.h
@@ -747,7 +747,6 @@ extern FLAC_API const unsigned FLAC__STREAM_METADATA_LENGTH_LEN; /**< == 24 (bit
*
*****************************************************************************/
-/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */
/** Tests that a sample rate is valid for FLAC. Since the rules for valid
* sample rates are slightly complex, they are encapsulated in this function.
*
@@ -758,6 +757,52 @@ extern FLAC_API const unsigned FLAC__STREAM_METADATA_LENGTH_LEN; /**< == 24 (bit
*/
FLAC_API FLAC__bool FLAC__format_sample_rate_is_valid(unsigned sample_rate);
+/** Check a Vorbis comment entry name to see if it conforms to the Vorbis
+ * comment specification.
+ *
+ * Vorbis comment names must be composed only of characters from
+ * [0x20-0x3C,0x3E-0x7D].
+ *
+ * \param name A NUL-terminated string to be checked.
+ * \assert
+ * \code name != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if entry name is illegal, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_name_is_legal(const char *name);
+
+/** Check a Vorbis comment entry value to see if it conforms to the Vorbis
+ * comment specification.
+ *
+ * Vorbis comment values must be valid UTF-8 sequences.
+ *
+ * \param value A string to be checked.
+ * \param length A the length of \a value in bytes. May be
+ * \c (unsigned)(-1) to indicate that \a value is a plain
+ * UTF-8 NUL-terminated string.
+ * \assert
+ * \code value != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if entry name is illegal, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_value_is_legal(const FLAC__byte *value, unsigned length);
+
+/** Check a Vorbis comment entry to see if it conforms to the Vorbis
+ * comment specification.
+ *
+ * Vorbis comment entries must be of the form 'name=value', and 'name' and
+ * 'value' must be legal according to
+ * FLAC__format_vorbiscomment_entry_name_is_legal() and
+ * FLAC__format_vorbiscomment_entry_value_is_legal() respectively.
+ *
+ * \param value A string to be checked.
+ * \assert
+ * \code value != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if entry name is illegal, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_is_legal(const FLAC__byte *entry, unsigned length);
+
/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */
/** Check a seek table to see if it conforms to the FLAC specification.
* See the format specification for limits on the contents of the