shithub: aacenc

Download patch

ref: 78d0f91c2d524c289765220888da44deb67eefc4
parent: bdafb62cadb654173ad6768977ea7451448f2918
author: Fabian Greffrath <fabian@greffrath.com>
date: Mon Sep 30 08:58:26 EDT 2019

input.c: change bufi to a char pointer

This should fix MSVC complaining because it isn't defined how
far the pointer should be advanced when compiling the code as C++.

Thanks @vividos!

--- a/frontend/input.c
+++ b/frontend/input.c
@@ -228,7 +228,7 @@
     }
   }
 
-  sndf = malloc(sizeof(*sndf));
+  sndf = (pcmfile_t*)malloc(sizeof(*sndf));
   memset(sndf, 0, sizeof(*sndf));
   sndf->f = wave_f;
 
@@ -266,7 +266,7 @@
 static void chan_remap(int32_t *buf, int channels, int blocks, int *map)
 {
   int i;
-  int32_t *tmp = malloc(channels * sizeof(int32_t));
+  int32_t *tmp = (int32_t*)malloc(channels * sizeof(int32_t));
 
   for (i = 0; i < blocks; i++)
   {
@@ -283,13 +283,13 @@
 {
   size_t cnt;
   size_t isize;
-  void *bufi;
+  char *bufi;
 
   if ((sndf->samplebytes > 4) || (sndf->samplebytes < 1))
     return 0;
 
   isize = num * sndf->samplebytes;
-  bufi = (buf + num);
+  bufi = (char*)(buf + num);
   bufi -= isize;
   isize = fread(bufi, 1, isize, sndf->f);
   isize /= sndf->samplebytes;
@@ -316,7 +316,7 @@
       {
       case 1:
           {
-              uint8_t *in = bufi;
+              uint8_t *in = (uint8_t*)bufi;
               uint8_t s = in[cnt];
 
               buf[cnt] = ((float)s - 128.0) * (float)256;
@@ -324,7 +324,7 @@
           break;
       case 2:
           {
-              int16_t *in = bufi;
+              int16_t *in = (int16_t*)bufi;
               int16_t s = in[cnt];
 #ifdef WORDS_BIGENDIAN
               if (!sndf->bigendian)
@@ -339,7 +339,7 @@
       case 3:
           {
               int s;
-              uint8_t *in = bufi;
+              uint8_t *in = (uint8_t*)bufi;
               in += 3 * cnt;
 
               if (!sndf->bigendian)
@@ -356,7 +356,7 @@
         break;
       case 4:
           {
-              int32_t *in = bufi;
+              int32_t *in = (int32_t*)bufi;
               int s = in[cnt];
 #ifdef WORDS_BIGENDIAN
               if (!sndf->bigendian)