[easytag] Improve const use in FLAC and Ogg tagging
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag] Improve const use in FLAC and Ogg tagging
- Date: Wed, 25 May 2016 18:58:09 +0000 (UTC)
commit b99d6c73f170524aec7f175c6f278b72639ff3bd
Author: David King <amigadave amigadave com>
Date: Wed May 25 20:53:54 2016 +0200
Improve const use in FLAC and Ogg tagging
src/tags/flac_tag.c | 6 +++++-
src/tags/ogg_tag.c | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/tags/flac_tag.c b/src/tags/flac_tag.c
index e811753..1b02e29 100644
--- a/src/tags/flac_tag.c
+++ b/src/tags/flac_tag.c
@@ -618,6 +618,8 @@ vc_block_append_other_tag (FLAC__StreamMetadata *vc_block,
field.entry = (FLAC__byte *)tag;
field.length = strlen (tag);
+ /* Safe to pass const data, if the last argument (copy) is true, according
+ * to the FLAC API reference. */
if (!FLAC__metadata_object_vorbiscomment_append_comment (vc_block, field,
true))
{
@@ -1029,10 +1031,12 @@ flac_tag_write_file_tag (const ET_File *ETFile,
/* Picture data. */
data = g_bytes_get_data (pic->bytes, &data_size);
+ /* Safe to pass const data, if the last argument (copy) is
+ * TRUE, according the the FLAC API reference. */
FLAC__metadata_object_picture_set_data (picture_block,
(FLAC__byte *)data,
(FLAC__uint32)data_size,
- TRUE);
+ true);
if (!FLAC__metadata_object_picture_is_legal (picture_block,
&violation))
diff --git a/src/tags/ogg_tag.c b/src/tags/ogg_tag.c
index 0bf751c..7856e74 100644
--- a/src/tags/ogg_tag.c
+++ b/src/tags/ogg_tag.c
@@ -1096,7 +1096,7 @@ ogg_tag_write_file_tag (const ET_File *ETFile,
/* Adding MIME string and its length. */
convert_to_byte_array (strlen (mime), array);
add_to_guchar_str (ustring, &ustring_len, array, 4);
- add_to_guchar_str (ustring, &ustring_len, (guchar *)mime,
+ add_to_guchar_str (ustring, &ustring_len, (const guchar *)mime,
strlen (mime));
/* Adding picture description. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]