changeset 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 c199c1f23921
files ChangeLog src/madplug/decoder.c src/madplug/input.c src/madplug/plugin.c
diffstat 4 files changed, 29 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Mar 06 15:43:15 2007 -0800
+++ b/ChangeLog	Tue Mar 06 22:08:18 2007 -0800
@@ -1,3 +1,13 @@
+2007-03-06 23:43:15 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
+  revision [1674]
+  - revert r1664 as it breaks too much
+  
+  trunk/src/madplug/decoder.c |    4 ++--
+  trunk/src/madplug/input.c   |    5 +++--
+  trunk/src/madplug/plugin.c  |   17 ++++++++---------
+  3 files changed, 13 insertions(+), 13 deletions(-)
+
+
 2007-03-06 14:53:31 +0000  Giacomo Lozito <james@develia.org>
   revision [1672]
   aosd: do not use str_to_utf8
--- a/src/madplug/decoder.c	Tue Mar 06 15:43:15 2007 -0800
+++ b/src/madplug/decoder.c	Tue Mar 06 22:08:18 2007 -0800
@@ -195,7 +195,7 @@
 
     while (1) {
         remainder = stream.bufend - stream.next_frame;
-
+	
         /*
            if (remainder >= BUFFER_SIZE)
            {
@@ -208,10 +208,8 @@
                              BUFFER_SIZE - remainder);
 
         if (len <= 0) {
-#ifdef DEBUG
             g_message("scan_file: len <= 0 abort.");
-#endif
-            break;
+            return 0;
         }
 
         mad_stream_buffer(&stream, buffer, len + remainder);
--- a/src/madplug/input.c	Tue Mar 06 15:43:15 2007 -0800
+++ b/src/madplug/input.c	Tue Mar 06 22:08:18 2007 -0800
@@ -557,9 +557,8 @@
     /* simply read to data from the file */
     len = vfs_fread(buffer, 1, buffer_size, info->infile); //vfs_fread returns num of elements.
 
-    if(len == 0){
-	    if(info->playback)
-		    info->playback->eof = TRUE;
+    if(len == 0 && info->playback){
+        info->playback->eof = TRUE;
     }
 
 #ifdef DEBUG
--- 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;