aboutsummaryrefslogtreecommitdiffstats
path: root/src/tag
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-16 21:09:19 +0200
committerMax Kellermann <max@duempel.org>2013-10-16 22:09:44 +0200
commit5e26e2ab1dadb1e4176d5a4cac03100a7d21c22f (patch)
treefccf16ec9b798ab06913250073e003b2830d2817 /src/tag
parent08eca827b659f2becc872c151919948b5a9ffe4d (diff)
downloadmpd-5e26e2ab1dadb1e4176d5a4cac03100a7d21c22f.tar.gz
mpd-5e26e2ab1dadb1e4176d5a4cac03100a7d21c22f.tar.xz
mpd-5e26e2ab1dadb1e4176d5a4cac03100a7d21c22f.zip
system/ByteOrder: new library for byte ordering / endianess
Replacing GLib macros.
Diffstat (limited to 'src/tag')
-rw-r--r--src/tag/Aiff.cxx5
-rw-r--r--src/tag/ApeLoader.cxx11
-rw-r--r--src/tag/Riff.cxx5
3 files changed, 12 insertions, 9 deletions
diff --git a/src/tag/Aiff.cxx b/src/tag/Aiff.cxx
index 51622fec7..4135565f7 100644
--- a/src/tag/Aiff.cxx
+++ b/src/tag/Aiff.cxx
@@ -20,6 +20,7 @@
#include "config.h" /* must be first for large file support */
#include "Aiff.hxx"
#include "util/Domain.hxx"
+#include "system/ByteOrder.hxx"
#include "Log.hxx"
#include <glib.h>
@@ -65,7 +66,7 @@ aiff_seek_id3(FILE *file)
size_t size = fread(&header, sizeof(header), 1, file);
if (size != 1 ||
memcmp(header.id, "FORM", 4) != 0 ||
- GUINT32_FROM_BE(header.size) > (uint32_t)st.st_size ||
+ FromBE32(header.size) > (uint32_t)st.st_size ||
(memcmp(header.format, "AIFF", 4) != 0 &&
memcmp(header.format, "AIFC", 4) != 0))
/* not a AIFF file */
@@ -79,7 +80,7 @@ aiff_seek_id3(FILE *file)
if (size != 1)
return 0;
- size = GUINT32_FROM_BE(chunk.size);
+ size = FromBE32(chunk.size);
if (size > G_MAXINT32)
/* too dangerous, bail out: possible integer
underflow when casting to off_t */
diff --git a/src/tag/ApeLoader.cxx b/src/tag/ApeLoader.cxx
index dfbdb4ef3..19f4d06d4 100644
--- a/src/tag/ApeLoader.cxx
+++ b/src/tag/ApeLoader.cxx
@@ -19,6 +19,7 @@
#include "config.h"
#include "ApeLoader.hxx"
+#include "system/ByteOrder.hxx"
#include <glib.h>
@@ -44,11 +45,11 @@ ape_scan_internal(FILE *fp, ApeTagCallback callback)
if (fseek(fp, -(long)sizeof(footer), SEEK_END) ||
fread(&footer, 1, sizeof(footer), fp) != sizeof(footer) ||
memcmp(footer.id, "APETAGEX", sizeof(footer.id)) != 0 ||
- GUINT32_FROM_LE(footer.version) != 2000)
+ FromLE32(footer.version) != 2000)
return false;
/* find beginning of ape tag */
- size_t remaining = GUINT32_FROM_LE(footer.length);
+ size_t remaining = FromLE32(footer.length);
if (remaining <= sizeof(footer) + 10 ||
/* refuse to load more than one megabyte of tag data */
remaining > 1024 * 1024 ||
@@ -66,13 +67,13 @@ ape_scan_internal(FILE *fp, ApeTagCallback callback)
}
/* read tags */
- unsigned n = GUINT32_FROM_LE(footer.count);
+ unsigned n = FromLE32(footer.count);
const char *p = buffer;
while (n-- && remaining > 10) {
- size_t size = GUINT32_FROM_LE(*(const uint32_t *)p);
+ size_t size = FromLE32(*(const uint32_t *)p);
p += 4;
remaining -= 4;
- unsigned long flags = GUINT32_FROM_LE(*(const uint32_t *)p);
+ unsigned long flags = FromLE32(*(const uint32_t *)p);
p += 4;
remaining -= 4;
diff --git a/src/tag/Riff.cxx b/src/tag/Riff.cxx
index d756ebc30..3728d281c 100644
--- a/src/tag/Riff.cxx
+++ b/src/tag/Riff.cxx
@@ -20,6 +20,7 @@
#include "config.h" /* must be first for large file support */
#include "Riff.hxx"
#include "util/Domain.hxx"
+#include "system/ByteOrder.hxx"
#include "Log.hxx"
#include <glib.h>
@@ -65,7 +66,7 @@ riff_seek_id3(FILE *file)
size_t size = fread(&header, sizeof(header), 1, file);
if (size != 1 ||
memcmp(header.id, "RIFF", 4) != 0 ||
- GUINT32_FROM_LE(header.size) > (uint32_t)st.st_size)
+ FromLE32(header.size) > (uint32_t)st.st_size)
/* not a RIFF file */
return 0;
@@ -77,7 +78,7 @@ riff_seek_id3(FILE *file)
if (size != 1)
return 0;
- size = GUINT32_FROM_LE(chunk.size);
+ size = FromLE32(chunk.size);
if (size > G_MAXINT32)
/* too dangerous, bail out: possible integer
underflow when casting to off_t */