changeset 521:72515e5313cf trunk

[svn] - refinements for getc/ungetc in curl
author giacomo
date Mon, 22 Jan 2007 12:21:31 -0800
parents 8f1785471613
children 2d3fad6a3842
files ChangeLog src/curl/curl.c
diffstat 2 files changed, 21 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Jan 22 10:36:50 2007 -0800
+++ b/ChangeLog	Mon Jan 22 12:21:31 2007 -0800
@@ -1,3 +1,17 @@
+2007-01-22 18:36:50 +0000  Giacomo Lozito <james@develia.org>
+  revision [1126]
+  - add missing inclusion of audacious/strings.h where necessary
+  trunk/src/amidi-plug/amidi-plug.c |    6 +++---
+  trunk/src/cue/cuesheet.c          |    1 +
+  trunk/src/flac112/plugin.c        |    1 +
+  trunk/src/flac113/fileinfo.c      |    3 ++-
+  trunk/src/mpg123/fileinfo.c       |    5 +++--
+  trunk/src/mpg123/mpg123.c         |   11 ++++++-----
+  trunk/src/tta/aud-tta.c           |    4 ++--
+  trunk/src/wma/wma.c               |   12 ++++++------
+  8 files changed, 24 insertions(+), 19 deletions(-)
+
+
 2007-01-22 18:32:03 +0000  Giacomo Lozito <james@develia.org>
   revision [1124]
   - re-add code that was accidentally removed after merge of getc/ungetc implementation
--- a/src/curl/curl.c	Mon Jan 22 10:36:50 2007 -0800
+++ b/src/curl/curl.c	Mon Jan 22 12:21:31 2007 -0800
@@ -588,6 +588,7 @@
       uc = GPOINTER_TO_INT(handle->stream_stack->data);
       handle->stream_stack = g_slist_delete_link( handle->stream_stack , handle->stream_stack );
       memcpy( ptr + ret , &uc , 1 );
+      handle->rd_abs++;
       ret++;
     }
   }
@@ -649,6 +650,7 @@
   {
     uc = GPOINTER_TO_INT(handle->stream_stack->data);
     handle->stream_stack = g_slist_delete_link( handle->stream_stack , handle->stream_stack );
+    handle->rd_abs++;
     return uc;
   }
   else if (curl_vfs_fread_impl(&uc, 1, 1, stream) != 1)
@@ -665,7 +667,10 @@
 
   handle->stream_stack = g_slist_prepend( handle->stream_stack , GINT_TO_POINTER(c) );
   if ( handle->stream_stack != NULL )
+  {
+    handle->rd_abs--;
     return c;
+  }
   else
     return EOF;
 }
@@ -759,20 +764,14 @@
 curl_vfs_ftell_impl(VFSFile * file)
 {
   CurlHandle *handle = file->handle;
-  if ( handle->stream_stack != NULL )
-    return handle->rd_abs - g_slist_length( handle->stream_stack );
-  else
-    return handle->rd_abs;
+  return handle->rd_abs;
 }
 
 gboolean
 curl_vfs_feof_impl(VFSFile * file)
 {
   CurlHandle *handle = file->handle;
-  if ( handle->stream_stack != NULL )
-    return (handle->rd_abs - g_slist_length( handle->stream_stack )) == handle->length;
-  else
-    return handle->rd_abs == handle->length;
+  return handle->rd_abs == handle->length;
 }
 
 gint