mpg123: fix build on BE

This commit is contained in:
q66 2020-06-01 00:19:19 +02:00
parent e4686ba93d
commit 0f9d14a48a

View file

@ -0,0 +1,49 @@
From 56faaffd2d67d48ea746bdbdf3dbddc57ed342de Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 1 Jun 2020 00:17:31 +0200
Subject: [PATCH] big endian fixes from upstream
---
src/libmpg123/sample.h | 2 +-
src/libout123/hextxt.c | 5 ++---
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git src/libmpg123/sample.h src/libmpg123/sample.h
index 5a98fe0..4d244fe 100644
--- src/libmpg123/sample.h
+++ src/libmpg123/sample.h
@@ -185,7 +185,7 @@ static inline int16_t ftoi16(float x)
#ifdef WORDS_BIGENDIAN
/* Highest byte first. Drop last. */
#define DROP4BYTE(w,r) {(w)[0]=(r)[0]; (w)[1]=(r)[1]; (w)[2]=(r)[2];}
-#define ADD4BYTE(w,r) {(w)[0]=(r)[0]; (w)[1]=(r)[1]; (w)[2]=(r)[2]; (w)[3]=0}
+#define ADD4BYTE(w,r) {(w)[0]=(r)[0]; (w)[1]=(r)[1]; (w)[2]=(r)[2]; (w)[3]=0;}
#else
/* Lowest byte first, drop that. */
#define DROP4BYTE(w,r) {(w)[0]=(r)[1]; (w)[1]=(r)[2]; (w)[2]=(r)[3];}
diff --git src/libout123/hextxt.c src/libout123/hextxt.c
index 45c8134..9e9010e 100644
--- src/libout123/hextxt.c
+++ src/libout123/hextxt.c
@@ -194,7 +194,7 @@ int txt_write(out123_handle *ao, unsigned char *buf, int len)
#define CHANPRINT24(type, ptype, fmt) \
{ \
unsigned char *ff = f; \
- for(c=0; c<ao->channels; ++c) \
+ for(int c=0; c<ao->channels; ++c) \
{ \
uint32_t tmp = 0; \
tmp |= ((uint32_t)(*(ff++))) << 24; \
@@ -208,8 +208,7 @@ int txt_write(out123_handle *ao, unsigned char *buf, int len)
#define CHANPRINT24(type, ptype, fmt) \
{ \
unsigned char *ff = f; \
- int c; \
- for(c=0; c<ao->channels; ++c) \
+ for(int c=0; c<ao->channels; ++c) \
{ \
uint32_t tmp = 0; \
tmp |= ((uint32_t)(*(ff++))) << 8; \
--
2.25.1