From 2c524ec8df6b7f57c1ba1367479830bf9f6be6c2 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Fri, 8 Apr 2022 01:18:16 +0200 Subject: [PATCH] Fix loading wav files on big-endian architectures Fixes #1152 --- src/libespeak-ng/soundicon.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/libespeak-ng/soundicon.c b/src/libespeak-ng/soundicon.c index e2d5fd29..298c68bc 100644 --- a/src/libespeak-ng/soundicon.c +++ b/src/libespeak-ng/soundicon.c @@ -49,7 +49,6 @@ static espeak_ng_STATUS LoadSoundFile(const char *fname, int index, espeak_ng_ER { FILE *f; char *p; - int *ip; int length; char fname_temp[100]; char fname2[sizeof(path_home)+13+40]; @@ -137,8 +136,8 @@ static espeak_ng_STATUS LoadSoundFile(const char *fname, int index, espeak_ng_ER if (fname_temp[0]) remove(fname_temp); - ip = (int *)(&p[40]); - soundicon_tab[index].length = (*ip) / 2; // length in samples + length = p[40] | (p[41] << 8) | (p[42] << 16) | (p[43] << 24); + soundicon_tab[index].length = length / 2; // length in samples soundicon_tab[index].data = p; return ENS_OK; }