diff src/madplug/plugin.c @ 789:354c69a939bc trunk

[svn] revising vfs_fread() check code. - check vfs handle code has been restored to original position. - accidentally removed substitution to ret has been restored. - in audmad_is_our_fd(), check code just puts log message instead of return. please let me know if log message would be put upon proper mp3 file. - in scan_file(), check code returns if vfs_fread() fails. this fixes open audio with bogus parameters problem.
author yaz
date Tue, 06 Mar 2007 22:08:18 -0800
parents 2461b711162b
children d200de50a1fc
line wrap: on
line diff
--- a/src/madplug/plugin.c	Tue Mar 06 15:43:15 2007 -0800
+++ b/src/madplug/plugin.c	Tue Mar 06 22:08:18 2007 -0800
@@ -235,13 +235,17 @@
         (!strcasecmp("flac", ext) || !strcasecmp("mpc", ext) ||
          !strcasecmp("tta", ext)  || !strcasecmp("ogg", ext) ||
          !strcasecmp("wma", ext) )
-			 )
-        return FALSE;
+        )
+        return 0;
 
-    if (fin == NULL)
-        return FALSE;
+    if (fin == NULL) {
+        g_message("fin = NULL");
+        return 0;
+    }
 
-    vfs_fread(buf, 1, 4, fin);
+    if(vfs_fread(buf, 1, 4, fin) == 0) {
+        g_message("vfs_fread failed @1 %s", g_filename_to_utf8(filename, -1, NULL, NULL, NULL));
+    }
 
     check = mp3_head_convert(buf);
 
@@ -252,7 +256,9 @@
     else if (memcmp(buf, "RIFF", 4) == 0)
     {
         vfs_fseek(fin, 4, SEEK_CUR);
-        vfs_fread(buf, 1, 4, fin);
+        if(vfs_fread(buf, 1, 4, fin) == 0) {
+            g_message("vfs_fread failed @2 %s", g_filename_to_utf8(filename, -1, NULL, NULL, NULL));
+        }
 
         if (memcmp(buf, "RMP3", 4) == 0)
             return 1;
@@ -260,10 +266,9 @@
 
     while (!mp3_head_check(check))
     {
-        ret = vfs_fread(tmp, 1, 4096, fin);
-        if (ret == 0)
-            return 0;
-
+        if((ret = vfs_fread(tmp, 1, 4096, fin)) == 0){
+            g_message("vfs_fread failed @3 %s", g_filename_to_utf8(filename, -1, NULL, NULL, NULL));
+        }
         for (i = 0; i < ret; i++)
         {
             check <<= 8;