Projects
home:hillwood:branches:Essentials
faac
faac-1.28-strict-aliasing-punning.patch
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File faac-1.28-strict-aliasing-punning.patch of Package faac
Index: faac-1.28/frontend/input.c =================================================================== --- faac-1.28.orig/frontend/input.c +++ faac-1.28/frontend/input.c @@ -270,13 +270,17 @@ static void chan_remap(int32_t *buf, int size_t wav_read_float32(pcmfile_t *sndf, float *buf, size_t num, int *map) { size_t i = 0; - unsigned char bufi[8]; + union { + unsigned char c[8]; + int i; + double d; + } bufi; if ((sndf->samplebytes > 8) || (sndf->samplebytes < 1)) return 0; while (i<num) { - if (fread(bufi, sndf->samplebytes, 1, sndf->f) != 1) + if (fread(&bufi, sndf->samplebytes, 1, sndf->f) != 1) break; if (sndf->isfloat) @@ -301,7 +305,7 @@ size_t wav_read_float32(pcmfile_t *sndf, switch (sndf->samplebytes) { case 1: /* this is endian clean */ - buf[i] = ((float)bufi[0] - 128) * (float)256; + buf[i] = ((float)bufi.c[0] - 128) * (float)256; break; case 2: @@ -312,14 +316,14 @@ size_t wav_read_float32(pcmfile_t *sndf, #endif { // swap bytes - int16_t s = ((int16_t *)bufi)[0]; + int16_t s = ((int16_t *)&bufi)[0]; s = SWAP16(s); buf[i] = (float)s; } else { // no swap - int s = ((int16_t *)bufi)[0]; + int s = ((int16_t *)&bufi)[0]; buf[i] = (float)s; } break; @@ -327,7 +331,7 @@ size_t wav_read_float32(pcmfile_t *sndf, case 3: if (!sndf->bigendian) { - int s = bufi[0] | (bufi[1] << 8) | (bufi[2] << 16); + int s = bufi.c[0] | (bufi.c[1] << 8) | (bufi.c[2] << 16); // fix sign if (s & 0x800000) @@ -337,7 +341,7 @@ size_t wav_read_float32(pcmfile_t *sndf, } else // big endian input { - int s = (bufi[0] << 16) | (bufi[1] << 8) | bufi[2]; + int s = (bufi.c[0] << 16) | (bufi.c[1] << 8) | bufi.c[2]; // fix sign if (s & 0x800000)
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.