Updated project/solution files.
[LameXP.git] / etc / Patches / FAAD-v2.7-CVS20161111-UTF8+Flush+BuildFixes.V3.diff
blob8ba4e94329d7a36f66c4b0ce89c6d3c492377cd3
1 frontend/audio.c | 11 +++++-
2 frontend/faad.sln | 16 ++++----
3 frontend/main.c | 89 ++++++++++++++++++++++++++++++++---------
4 frontend/unicode_support.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++
5 frontend/unicode_support.h | 21 ++++++++++
6 include/neaacdec.h | 6 +--
7 libfaad/common.h | 4 +-
8 libfaad/decoder.c | 6 +--
9 libfaad/lt_predict.c | 2 +-
10 libfaad/output.c | 36 ++++++++---------
11 10 files changed, 233 insertions(+), 56 deletions(-)
13 diff --git a/frontend/audio.c b/frontend/audio.c
14 index 9ab7a2a..20f92a2 100644
15 --- a/frontend/audio.c
16 +++ b/frontend/audio.c
17 @@ -39,11 +39,14 @@
18 #include <stdint.h>
20 #include "audio.h"
21 +#include "unicode_support.h"
24 audio_file *open_audio_file(char *infile, int samplerate, int channels,
25 int outputFormat, int fileType, long channelMask)
27 + wchar_t *fileNameW;
29 audio_file *aufile = malloc(sizeof(audio_file));
31 aufile->outputFormat = outputFormat;
32 @@ -80,7 +83,13 @@ audio_file *open_audio_file(char *infile, int samplerate, int channels,
33 aufile->toStdio = 1;
34 } else {
35 aufile->toStdio = 0;
36 - aufile->sndfile = fopen(infile, "wb");
37 + aufile->sndfile = NULL;
38 + fileNameW = utf8_to_utf16(infile);
39 + if(fileNameW)
40 + {
41 + aufile->sndfile = _wfopen(fileNameW, L"wb");
42 + free(fileNameW);
43 + }
46 if (aufile->sndfile == NULL)
47 diff --git a/frontend/faad.sln b/frontend/faad.sln
48 index a47200b..ddbea6d 100644
49 --- a/frontend/faad.sln
50 +++ b/frontend/faad.sln
51 @@ -1,15 +1,13 @@
52 
53 -Microsoft Visual Studio Solution File, Format Version 9.00
54 -# Visual Studio 2005
55 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "faad", "faad.vcproj", "{2BD8CBB3-DFC9-4A6A-9B7A-07ED749BED58}"
56 - ProjectSection(ProjectDependencies) = postProject
57 - {F470BB4A-7675-4D6A-B310-41F33AC6F987} = {F470BB4A-7675-4D6A-B310-41F33AC6F987}
58 - {BC3EFE27-9015-4C9C-AD3C-72B3B7ED2114} = {BC3EFE27-9015-4C9C-AD3C-72B3B7ED2114}
59 - EndProjectSection
60 +Microsoft Visual Studio Solution File, Format Version 12.00
61 +# Visual Studio 14
62 +VisualStudioVersion = 14.0.25420.1
63 +MinimumVisualStudioVersion = 10.0.40219.1
64 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "faad", "faad.vcxproj", "{2BD8CBB3-DFC9-4A6A-9B7A-07ED749BED58}"
65 EndProject
66 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaad", "..\libfaad\libfaad.vcproj", "{BC3EFE27-9015-4C9C-AD3C-72B3B7ED2114}"
67 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaad", "..\libfaad\libfaad.vcxproj", "{BC3EFE27-9015-4C9C-AD3C-72B3B7ED2114}"
68 EndProject
69 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mp4ff", "..\common\mp4ff\mp4ff.vcproj", "{F470BB4A-7675-4D6A-B310-41F33AC6F987}"
70 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mp4ff", "..\common\mp4ff\mp4ff.vcxproj", "{F470BB4A-7675-4D6A-B310-41F33AC6F987}"
71 EndProject
72 Global
73 GlobalSection(SolutionConfigurationPlatforms) = preSolution
74 diff --git a/frontend/main.c b/frontend/main.c
75 index f943d9d..e4294d0 100644
76 --- a/frontend/main.c
77 +++ b/frontend/main.c
78 @@ -44,11 +44,13 @@
79 #include <stdlib.h>
80 #include <string.h>
81 #include <getopt.h>
82 +#include <io.h>
84 #include <neaacdec.h>
85 #include <mp4ff.h>
87 #include "audio.h"
88 +#include "unicode_support.h"
90 #ifndef min
91 #define min(a,b) ( (a) < (b) ? (a) : (b) )
92 @@ -71,6 +73,8 @@ static void faad_fprintf(FILE *stream, const char *fmt, ...)
93 vfprintf(stream, fmt, ap);
95 va_end(ap);
97 + fflush(stream);
101 @@ -450,7 +454,7 @@ static int decodeAACfile(char *aacfile, char *sndfile, char *adts_fn, int to_std
102 NeAACDecFrameInfo frameInfo;
103 NeAACDecConfigurationPtr config;
105 - char percents[200];
106 + char percents[300];
107 int percent, old_percent = -1;
108 int bread, fileread;
109 int header_type = 0;
110 @@ -463,11 +467,19 @@ static int decodeAACfile(char *aacfile, char *sndfile, char *adts_fn, int to_std
112 aac_buffer b;
114 + wchar_t *fileNameW;
116 memset(&b, 0, sizeof(aac_buffer));
118 if (adts_out)
120 - adtsFile = fopen(adts_fn, "wb");
121 + adtsFile = NULL;
122 + fileNameW = utf8_to_utf16(adts_fn);
123 + if(fileNameW)
125 + adtsFile = _wfopen(fileNameW, L"wb");
126 + free(fileNameW);
128 if (adtsFile == NULL)
130 faad_fprintf(stderr, "Error opening file: %s\n", adts_fn);
131 @@ -477,20 +489,26 @@ static int decodeAACfile(char *aacfile, char *sndfile, char *adts_fn, int to_std
133 if (0 == strcmp(aacfile, "-"))
135 - b.infile = stdin;
136 + b.infile = stdin;
137 #ifdef _WIN32
138 setmode(fileno(stdin), O_BINARY);
139 #endif
141 - } else
143 + else
145 - b.infile = fopen(aacfile, "rb");
146 - if (b.infile == NULL)
148 - /* unable to open file */
149 - faad_fprintf(stderr, "Error opening file: %s\n", aacfile);
150 - return 1;
152 + b.infile = NULL;
153 + fileNameW = utf8_to_utf16(aacfile);
154 + if(fileNameW)
156 + b.infile = _wfopen(fileNameW, L"rb");
157 + free(fileNameW);
159 + if (b.infile == NULL)
161 + /* unable to open file */
162 + faad_fprintf(stderr, "Error opening file: %s\n", aacfile);
163 + return 1;
167 retval = fseek(b.infile, 0, SEEK_END);
168 @@ -715,7 +733,7 @@ static int decodeAACfile(char *aacfile, char *sndfile, char *adts_fn, int to_std
169 if (percent > old_percent)
171 old_percent = percent;
172 - sprintf(percents, "%d%% decoding %s.", percent, aacfile);
173 + _snprintf_s(percents, 300, _TRUNCATE, "[%d%%] decoding %s.", percent, aacfile);
174 faad_fprintf(stderr, "%s\r", percents);
175 #ifdef _WIN32
176 SetConsoleTitle(percents);
177 @@ -817,7 +835,7 @@ static int decodeMP4file(char *mp4file, char *sndfile, char *adts_fn, int to_std
178 unsigned char *buffer;
179 int buffer_size;
181 - char percents[200];
182 + char percents[300];
183 int percent, old_percent = -1;
185 int first_time = 1;
186 @@ -828,6 +846,7 @@ static int decodeMP4file(char *mp4file, char *sndfile, char *adts_fn, int to_std
187 unsigned int framesize;
188 unsigned long timescale;
190 + wchar_t *fileNameW;
192 /* initialise the callback structure */
193 mp4ff_callback_t *mp4cb = malloc(sizeof(mp4ff_callback_t));
194 @@ -837,7 +856,14 @@ static int decodeMP4file(char *mp4file, char *sndfile, char *adts_fn, int to_std
195 return 1;
198 - mp4File = fopen(mp4file, "rb");
199 + mp4File = NULL;
200 + fileNameW = utf8_to_utf16(mp4file);
201 + if(fileNameW)
203 + mp4File = _wfopen(fileNameW, L"rb");
204 + free(fileNameW);
207 mp4cb->read = read_callback;
208 mp4cb->seek = seek_callback;
209 mp4cb->user_data = mp4File;
210 @@ -854,7 +880,13 @@ static int decodeMP4file(char *mp4file, char *sndfile, char *adts_fn, int to_std
212 if (adts_out)
214 - adtsFile = fopen(adts_fn, "wb");
215 + adtsFile = NULL;
216 + fileNameW = utf8_to_utf16(adts_fn);
217 + if(fileNameW)
219 + adtsFile = _wfopen(fileNameW, L"wb");
220 + free(fileNameW);
222 if (adtsFile == NULL)
224 faad_fprintf(stderr, "Error opening file: %s\n", adts_fn);
225 @@ -1060,7 +1092,7 @@ static int decodeMP4file(char *mp4file, char *sndfile, char *adts_fn, int to_std
226 if (percent > old_percent)
228 old_percent = percent;
229 - sprintf(percents, "%d%% decoding %s.", percent, mp4file);
230 + _snprintf_s(percents, 300, _TRUNCATE, "[%d%%] decoding %s.", percent, mp4file);
231 faad_fprintf(stderr, "%s\r", percents);
232 #ifdef _WIN32
233 SetConsoleTitle(percents);
234 @@ -1098,7 +1130,7 @@ static int decodeMP4file(char *mp4file, char *sndfile, char *adts_fn, int to_std
235 return frameInfo.error;
238 -int main(int argc, char *argv[])
239 +int faad_main(int argc, char *argv[])
241 int result;
242 int infoOnly = 0;
243 @@ -1122,6 +1154,7 @@ int main(int argc, char *argv[])
244 unsigned char header[8];
245 float length = 0;
246 FILE *hMP4File;
247 + wchar_t *fileNameW;
249 /* System dependant types */
250 #ifdef _WIN32
251 @@ -1352,7 +1385,13 @@ int main(int argc, char *argv[])
252 } else {
254 mp4file = 0;
255 - hMP4File = fopen(aacFileName, "rb");
256 + hMP4File = NULL;
257 + fileNameW = utf8_to_utf16(aacFileName);
258 + if(fileNameW)
260 + hMP4File = _wfopen(fileNameW, L"rb");
261 + free(fileNameW);
263 if (!hMP4File)
265 faad_fprintf(stderr, "Error opening file: %s\n", aacFileName);
266 @@ -1415,3 +1454,15 @@ int main(int argc, char *argv[])
268 return 0;
271 +int wmain(int argc, wchar_t **argv_utf16)
273 + int result = 0;
274 + char **argv_utf8 = NULL;
276 + init_commandline_arguments_utf8(argc, &argv_utf8, argv_utf16);
277 + result = faad_main(argc, argv_utf8);
278 + free_commandline_arguments_utf8(argc, &argv_utf8);
280 + return result;
282 diff --git a/frontend/unicode_support.c b/frontend/unicode_support.c
283 new file mode 100644
284 index 0000000..21ecd5c
285 --- /dev/null
286 +++ b/frontend/unicode_support.c
287 @@ -0,0 +1,98 @@
288 +#include "unicode_support.h"
290 +#include <stdio.h>
291 +#include <windows.h>
293 +char *utf16_to_utf8(const wchar_t *input)
295 + char *Buffer;
296 + int BuffSize, Result;
298 + BuffSize = WideCharToMultiByte(CP_UTF8, 0, input, -1, NULL, 0, NULL, NULL);
299 + Buffer = (char*) malloc(sizeof(char) * BuffSize);
301 + if(!Buffer)
303 + fprintf(stderr, "Error in utf16_to_utf8: Memory allocation failed!\n");
304 + return NULL;
307 + Result = WideCharToMultiByte(CP_UTF8, 0, input, -1, Buffer, BuffSize, NULL, NULL);
308 + return ((Result > 0) && (Result <= BuffSize)) ? Buffer : NULL;
311 +wchar_t *utf8_to_utf16(const char *input)
313 + wchar_t *Buffer;
314 + int BuffSize, Result;
316 + BuffSize = MultiByteToWideChar(CP_UTF8, 0, input, -1, NULL, 0);
317 + Buffer = (wchar_t*) malloc(sizeof(wchar_t) * BuffSize);
319 + if(!Buffer)
321 + fprintf(stderr, "Error in utf8_to_utf16: Memory allocation failed!\n");
322 + return NULL;
325 + Result = MultiByteToWideChar(CP_UTF8, 0, input, -1, Buffer, BuffSize);
326 + return ((Result > 0) && (Result <= BuffSize)) ? Buffer : NULL;
329 +void init_commandline_arguments_utf8(int argc, char ***argv_utf8, wchar_t **argv_utf16)
331 + int i = 0;
333 + *argv_utf8 = (char**) malloc(argc * sizeof(char*));
334 + if(!(*argv_utf8))
336 + fprintf(stderr, "Error in init_commandline_arguments_utf8: Memory allocation failed!\n");
337 + exit(-1);
340 + for(i = 0; i < argc; i++)
342 + (*argv_utf8)[i] = utf16_to_utf8(argv_utf16[i]);
343 + if(!(*argv_utf8)[i])
345 + fprintf(stderr, "Error in init_commandline_arguments_utf8: Memory allocation failed!\n");
346 + exit(-1);
351 +void free_commandline_arguments_utf8(int argc, char ***argv_utf8)
353 + int i = 0;
355 + if(*argv_utf8 != NULL)
357 + for(i = 0; i < argc; i++)
359 + if((*argv_utf8)[i] != NULL)
361 + free((*argv_utf8)[i]);
362 + (*argv_utf8)[i] = NULL;
365 + free(*argv_utf8);
366 + *argv_utf8 = NULL;
370 +FILE *fopen_utf8(const char *filename_utf8, const char *mode_utf8)
372 + FILE *ret = NULL;
373 + wchar_t *filename_utf16 = utf8_to_utf16(filename_utf8);
374 + wchar_t *mode_utf16 = utf8_to_utf16(mode_utf8);
376 + if(filename_utf16 && mode_utf16)
378 + ret = _wfopen(filename_utf16, mode_utf16);
381 + if(filename_utf16) free(filename_utf16);
382 + if(mode_utf16) free(mode_utf16);
384 + return ret;
386 diff --git a/frontend/unicode_support.h b/frontend/unicode_support.h
387 new file mode 100644
388 index 0000000..cc13fd9
389 --- /dev/null
390 +++ b/frontend/unicode_support.h
391 @@ -0,0 +1,21 @@
392 +#ifndef UNICODE_SUPPORT_H_INCLUDED
393 +#define UNICODE_SUPPORT_H_INCLUDED
395 +#include <ctype.h>
396 +#include <stdio.h>
397 +#include <stdlib.h>
399 +#ifdef __cplusplus
400 +extern "C" {
401 +#endif
403 +char *utf16_to_utf8(const wchar_t *input);
404 +wchar_t *utf8_to_utf16(const char *input);
405 +void init_commandline_arguments_utf8(int argc, char ***argv_utf8, wchar_t **argv_utf16);
406 +void free_commandline_arguments_utf8(int argc, char ***argv_utf8);
407 +FILE *fopen_utf8(const char *filename_utf8, const char *mode_utf8);
409 +#ifdef __cplusplus
411 +#endif
412 +#endif
413 \ No newline at end of file
414 diff --git a/include/neaacdec.h b/include/neaacdec.h
415 index 610a00b..7904175 100644
416 --- a/include/neaacdec.h
417 +++ b/include/neaacdec.h
418 @@ -202,7 +202,7 @@ typedef struct NeAACDecFrameInfo
419 unsigned char ps;
420 } NeAACDecFrameInfo;
422 -char NEAACDECAPI *NeAACDecGetErrorMessage(unsigned char errcode);
423 +char* NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode);
425 unsigned long NEAACDECAPI NeAACDecGetCapabilities(void);
427 @@ -235,12 +235,12 @@ void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, long frame);
429 void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder);
431 -void NEAACDECAPI *NeAACDecDecode(NeAACDecHandle hDecoder,
432 +void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder,
433 NeAACDecFrameInfo *hInfo,
434 unsigned char *buffer,
435 unsigned long buffer_size);
437 -void NEAACDECAPI *NeAACDecDecode2(NeAACDecHandle hDecoder,
438 +void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder,
439 NeAACDecFrameInfo *hInfo,
440 unsigned char *buffer,
441 unsigned long buffer_size,
442 diff --git a/libfaad/common.h b/libfaad/common.h
443 index 897a0f0..74f4a56 100644
444 --- a/libfaad/common.h
445 +++ b/libfaad/common.h
446 @@ -316,7 +316,7 @@ char *strchr(), *strrchr();
447 #if defined(_WIN32) && !defined(_WIN64) && !defined(__MINGW32__)
448 #ifndef HAVE_LRINTF
449 #define HAS_LRINTF
450 - static INLINE int lrintf(float f)
451 + static INLINE int FAAD_lrintf(float f)
453 int i;
454 __asm
455 @@ -332,7 +332,7 @@ char *strchr(), *strrchr();
456 #ifndef HAVE_LRINTF
457 #define HAS_LRINTF
458 // from http://www.stereopsis.com/FPU.html
459 - static INLINE int lrintf(float f)
460 + static INLINE int FAAD_lrintf(float f)
462 int i;
463 __asm__ __volatile__ (
464 diff --git a/libfaad/decoder.c b/libfaad/decoder.c
465 index 42bbc84..67feb9d 100644
466 --- a/libfaad/decoder.c
467 +++ b/libfaad/decoder.c
468 @@ -64,7 +64,7 @@ static void create_channel_config(NeAACDecStruct *hDecoder,
469 NeAACDecFrameInfo *hInfo);
472 -char NEAACDECAPI *NeAACDecGetErrorMessage(unsigned char errcode)
473 +char* NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode)
475 if (errcode >= NUM_ERROR_MESSAGES)
476 return NULL;
477 @@ -790,7 +790,7 @@ static void create_channel_config(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *h
481 -void NEAACDECAPI *NeAACDecDecode(NeAACDecHandle hpDecoder,
482 +void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hpDecoder,
483 NeAACDecFrameInfo *hInfo,
484 unsigned char *buffer,
485 unsigned long buffer_size)
486 @@ -799,7 +799,7 @@ void NEAACDECAPI *NeAACDecDecode(NeAACDecHandle hpDecoder,
487 return aac_frame_decode(hDecoder, hInfo, buffer, buffer_size, NULL, 0);
490 -void NEAACDECAPI *NeAACDecDecode2(NeAACDecHandle hpDecoder,
491 +void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hpDecoder,
492 NeAACDecFrameInfo *hInfo,
493 unsigned char *buffer,
494 unsigned long buffer_size,
495 diff --git a/libfaad/lt_predict.c b/libfaad/lt_predict.c
496 index 2be18ae..aa02fb0 100644
497 --- a/libfaad/lt_predict.c
498 +++ b/libfaad/lt_predict.c
499 @@ -166,7 +166,7 @@ static INLINE int16_t real_to_int16(real_t sig_in)
500 return -32768;
503 - return lrintf(sig_in);
504 + return FAAD_lrintf(sig_in);
506 #endif
508 diff --git a/libfaad/output.c b/libfaad/output.c
509 index 4245627..1aeb747 100644
510 --- a/libfaad/output.c
511 +++ b/libfaad/output.c
512 @@ -103,7 +103,7 @@ static void to_PCM_16bit(NeAACDecStruct *hDecoder, real_t **input,
514 CLIP(inp, 32767.0f, -32768.0f);
516 - (*sample_buffer)[i] = (int16_t)lrintf(inp);
517 + (*sample_buffer)[i] = (int16_t)FAAD_lrintf(inp);
519 break;
520 case CONV(2,0):
521 @@ -116,8 +116,8 @@ static void to_PCM_16bit(NeAACDecStruct *hDecoder, real_t **input,
523 CLIP(inp0, 32767.0f, -32768.0f);
525 - (*sample_buffer)[(i*2)+0] = (int16_t)lrintf(inp0);
526 - (*sample_buffer)[(i*2)+1] = (int16_t)lrintf(inp0);
527 + (*sample_buffer)[(i*2)+0] = (int16_t)FAAD_lrintf(inp0);
528 + (*sample_buffer)[(i*2)+1] = (int16_t)FAAD_lrintf(inp0);
530 } else {
531 ch = hDecoder->internal_channel[0];
532 @@ -130,8 +130,8 @@ static void to_PCM_16bit(NeAACDecStruct *hDecoder, real_t **input,
533 CLIP(inp0, 32767.0f, -32768.0f);
534 CLIP(inp1, 32767.0f, -32768.0f);
536 - (*sample_buffer)[(i*2)+0] = (int16_t)lrintf(inp0);
537 - (*sample_buffer)[(i*2)+1] = (int16_t)lrintf(inp1);
538 + (*sample_buffer)[(i*2)+0] = (int16_t)FAAD_lrintf(inp0);
539 + (*sample_buffer)[(i*2)+1] = (int16_t)FAAD_lrintf(inp1);
542 break;
543 @@ -144,7 +144,7 @@ static void to_PCM_16bit(NeAACDecStruct *hDecoder, real_t **input,
545 CLIP(inp, 32767.0f, -32768.0f);
547 - (*sample_buffer)[(i*channels)+ch] = (int16_t)lrintf(inp);
548 + (*sample_buffer)[(i*channels)+ch] = (int16_t)FAAD_lrintf(inp);
551 break;
552 @@ -169,7 +169,7 @@ static void to_PCM_24bit(NeAACDecStruct *hDecoder, real_t **input,
553 inp *= 256.0f;
554 CLIP(inp, 8388607.0f, -8388608.0f);
556 - (*sample_buffer)[i] = (int32_t)lrintf(inp);
557 + (*sample_buffer)[i] = (int32_t)FAAD_lrintf(inp);
559 break;
560 case CONV(2,0):
561 @@ -183,8 +183,8 @@ static void to_PCM_24bit(NeAACDecStruct *hDecoder, real_t **input,
562 inp0 *= 256.0f;
563 CLIP(inp0, 8388607.0f, -8388608.0f);
565 - (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
566 - (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp0);
567 + (*sample_buffer)[(i*2)+0] = (int32_t)FAAD_lrintf(inp0);
568 + (*sample_buffer)[(i*2)+1] = (int32_t)FAAD_lrintf(inp0);
570 } else {
571 ch = hDecoder->internal_channel[0];
572 @@ -199,8 +199,8 @@ static void to_PCM_24bit(NeAACDecStruct *hDecoder, real_t **input,
573 CLIP(inp0, 8388607.0f, -8388608.0f);
574 CLIP(inp1, 8388607.0f, -8388608.0f);
576 - (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
577 - (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp1);
578 + (*sample_buffer)[(i*2)+0] = (int32_t)FAAD_lrintf(inp0);
579 + (*sample_buffer)[(i*2)+1] = (int32_t)FAAD_lrintf(inp1);
582 break;
583 @@ -214,7 +214,7 @@ static void to_PCM_24bit(NeAACDecStruct *hDecoder, real_t **input,
584 inp *= 256.0f;
585 CLIP(inp, 8388607.0f, -8388608.0f);
587 - (*sample_buffer)[(i*channels)+ch] = (int32_t)lrintf(inp);
588 + (*sample_buffer)[(i*channels)+ch] = (int32_t)FAAD_lrintf(inp);
591 break;
592 @@ -239,7 +239,7 @@ static void to_PCM_32bit(NeAACDecStruct *hDecoder, real_t **input,
593 inp *= 65536.0f;
594 CLIP(inp, 2147483647.0f, -2147483648.0f);
596 - (*sample_buffer)[i] = (int32_t)lrintf(inp);
597 + (*sample_buffer)[i] = (int32_t)FAAD_lrintf(inp);
599 break;
600 case CONV(2,0):
601 @@ -253,8 +253,8 @@ static void to_PCM_32bit(NeAACDecStruct *hDecoder, real_t **input,
602 inp0 *= 65536.0f;
603 CLIP(inp0, 2147483647.0f, -2147483648.0f);
605 - (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
606 - (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp0);
607 + (*sample_buffer)[(i*2)+0] = (int32_t)FAAD_lrintf(inp0);
608 + (*sample_buffer)[(i*2)+1] = (int32_t)FAAD_lrintf(inp0);
610 } else {
611 ch = hDecoder->internal_channel[0];
612 @@ -269,8 +269,8 @@ static void to_PCM_32bit(NeAACDecStruct *hDecoder, real_t **input,
613 CLIP(inp0, 2147483647.0f, -2147483648.0f);
614 CLIP(inp1, 2147483647.0f, -2147483648.0f);
616 - (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
617 - (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp1);
618 + (*sample_buffer)[(i*2)+0] = (int32_t)FAAD_lrintf(inp0);
619 + (*sample_buffer)[(i*2)+1] = (int32_t)FAAD_lrintf(inp1);
622 break;
623 @@ -284,7 +284,7 @@ static void to_PCM_32bit(NeAACDecStruct *hDecoder, real_t **input,
624 inp *= 65536.0f;
625 CLIP(inp, 2147483647.0f, -2147483648.0f);
627 - (*sample_buffer)[(i*channels)+ch] = (int32_t)lrintf(inp);
628 + (*sample_buffer)[(i*channels)+ch] = (int32_t)FAAD_lrintf(inp);
631 break;