aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/tag.c16
-rw-r--r--src/utils.c7
-rw-r--r--src/utils.h2
3 files changed, 8 insertions, 17 deletions
diff --git a/src/tag.c b/src/tag.c
index cb0508aed..dfccb1b7d 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -125,9 +125,9 @@ struct tag *tag_ape_load(const char *file)
struct {
unsigned char id[8];
- unsigned char version[4];
- unsigned char length[4];
- unsigned char tagCount[4];
+ uint32_t version;
+ uint32_t length;
+ uint32_t tagCount;
unsigned char flags[4];
unsigned char reserved[8];
} footer;
@@ -166,11 +166,11 @@ struct tag *tag_ape_load(const char *file)
goto fail;
if (memcmp(footer.id, "APETAGEX", sizeof(footer.id)) != 0)
goto fail;
- if (readLEuint32(footer.version) != 2000)
+ if (GUINT32_FROM_LE(footer.version) != 2000)
goto fail;
/* find beginning of ape tag */
- tagLen = readLEuint32(footer.length);
+ tagLen = GUINT32_FROM_LE(footer.length);
if (tagLen < sizeof(footer))
goto fail;
if (fseek(fp, size - tagLen, SEEK_SET))
@@ -185,13 +185,13 @@ struct tag *tag_ape_load(const char *file)
goto fail;
/* read tags */
- tagCount = readLEuint32(footer.tagCount);
+ tagCount = GUINT32_FROM_LE(footer.tagCount);
p = buffer;
while (tagCount-- && tagLen > 10) {
- size = readLEuint32((unsigned char *)p);
+ size = GUINT32_FROM_LE(*(const uint32_t *)p);
p += 4;
tagLen -= 4;
- flags = readLEuint32((unsigned char *)p);
+ flags = GUINT32_FROM_LE(*(const uint32_t *)p);
p += 4;
tagLen -= 4;
diff --git a/src/utils.c b/src/utils.c
index 923407f69..bb5107bb6 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -75,13 +75,6 @@ int ipv6Supported(void)
#endif
}
-unsigned long readLEuint32(const unsigned char *p)
-{
- return ((unsigned long)p[0] << 0) |
- ((unsigned long)p[1] << 8) |
- ((unsigned long)p[2] << 16) | ((unsigned long)p[3] << 24);
-}
-
mpd_malloc char *xstrdup(const char *s)
{
char *ret = strdup(s);
diff --git a/src/utils.h b/src/utils.h
index 225332e2f..64fac0ded 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -37,8 +37,6 @@ void my_usleep(long usec);
int ipv6Supported(void);
-unsigned long readLEuint32(const unsigned char *p);
-
/* trivial functions, keep them inlined */
static inline void xclose(int fd)
{