From: Andre Noll <maan@systemlinux.org>
Date: Mon, 16 Dec 2013 17:44:12 +0000 (+0100)
Subject: aac_afh.c: Simplify atom_cmp().
X-Git-Tag: v0.5.6~81
X-Git-Url: https://git.tue.mpg.de/?a=commitdiff_plain;h=b8c3826d17840af9d994074fb4190d0ce66cbc05;p=paraslash.git

aac_afh.c: Simplify atom_cmp().

It's pointless to compare the buffer byte by byte. Just use memcmp(3)
instead.
---

diff --git a/aac_afh.c b/aac_afh.c
index 04d74e8e..5018e2f4 100644
--- a/aac_afh.c
+++ b/aac_afh.c
@@ -46,17 +46,7 @@ static int aac_find_stsz(unsigned char *buf, size_t buflen, off_t *skip)
 
 static int atom_cmp(const unsigned char *buf1, const char *buf2)
 {
-	const unsigned char *b2 = (unsigned char *)buf2;
-
-	if (buf1[0] != b2[0])
-		return 1;
-	if (buf1[1] != b2[1])
-		return 1;
-	if (buf1[2] != b2[2])
-		return 1;
-	if (buf1[3] != b2[3])
-		return 1;
-	return 0;
+	return memcmp(buf1, buf2, 4)? 1 : 0;
 }
 
 static int read_atom_header(unsigned char *buf, uint64_t *subsize, unsigned char type[5])