shithub: aacenc

Download patch

ref: 0aa622c5d192141edd5cd06c0030e9f97b9bdda6
parent: ecc7960876df1f97120519c43b73b10090292a0e
author: Krzysztof Nikiel <knik@users.sourceforge.net>
date: Fri Aug 25 17:31:22 EDT 2017

fixed stdin fseek bug

--- a/frontend/input.c
+++ b/frontend/input.c
@@ -116,7 +116,14 @@
   fprintf(stderr, "%s: file format not supported\n", name);
 }
 
+static void seekcur(FILE *f, int ofs)
+{
+    int cnt;
 
+    for (cnt = 0; cnt < ofs; cnt++)
+        fgetc(f);
+}
+
 static int seekchunk(FILE *f, riffsub_t *riffsub, char *name)
 {
  int skipped;
@@ -133,7 +140,7 @@
    if (!memcmp(&(riffsub->label), name, 4))
      return 1;
 
-   fseek(f, riffsub->len, SEEK_CUR);
+   seekcur(f, riffsub->len);
  }
 
  return 0;
@@ -191,7 +198,7 @@
    if (fread(&wave, 1, fmtsize, wave_f) != fmtsize)
         return NULL;
 
-    fseek(wave_f, riffsub.len - fmtsize, SEEK_CUR);
+    seekcur(wave_f, riffsub.len - fmtsize);
 
     if (!seekchunk(wave_f, &riffsub, datal))
       return NULL;