[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] fix progress callback for ra_svn

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Sun, 3 Aug 2008 10:37:12 +0300 (Jerusalem Daylight Time)

Stefan Küng wrote on Sun, 3 Aug 2008 at 08:50 +0200:
> new patch attached with hopefully better docstring.

Docstring looks good, but why can't we just get rid of the 'bytes_read'
and 'bytes_written' struct members? The semantics would be slightly
different than with your patch, though...

e.g. (untested)

Index: subversion/libsvn_ra_svn/ra_svn.h
===================================================================
--- subversion/libsvn_ra_svn/ra_svn.h (revision 32316)
+++ subversion/libsvn_ra_svn/ra_svn.h (working copy)
@@ -95,8 +95,6 @@ struct svn_ra_svn__session_baton_t {
   const char **tunnel_argv;
   const svn_ra_callbacks2_t *callbacks;
   void *callbacks_baton;
- apr_off_t bytes_read, bytes_written; /* apr_off_t's because that's what
- the callback interface uses */
 };
 
 /* Set a callback for blocked writes on conn. This handler may
Index: subversion/libsvn_ra_svn/client.c
===================================================================
--- subversion/libsvn_ra_svn/client.c (revision 32316)
+++ subversion/libsvn_ra_svn/client.c (working copy)
@@ -543,7 +543,6 @@ static svn_error_t *open_session(svn_ra_svn__sessi
   sess->tunnel_argv = tunnel_argv;
   sess->callbacks = callbacks;
   sess->callbacks_baton = callbacks_baton;
- sess->bytes_read = sess->bytes_written = 0;
 
   if (tunnel_argv)
     SVN_ERR(make_tunnel(tunnel_argv, &conn, pool));
Index: subversion/libsvn_ra_svn/marshal.c
===================================================================
--- subversion/libsvn_ra_svn/marshal.c (revision 32316)
+++ subversion/libsvn_ra_svn/marshal.c (working copy)
@@ -175,11 +175,9 @@ static svn_error_t *writebuf_output(svn_ra_svn_con
       if (session)
         {
           const svn_ra_callbacks2_t *cb = session->callbacks;
- session->bytes_written += count;
 
           if (cb && cb->progress_func)
- (cb->progress_func)(session->bytes_written + session->bytes_read,
- -1, cb->progress_baton, subpool);
+ (cb->progress_func)(count, -1, cb->progress_baton, subpool);
         }
     }
 
@@ -266,11 +264,9 @@ static svn_error_t *readbuf_input(svn_ra_svn_conn_
   if (session)
     {
       const svn_ra_callbacks2_t *cb = session->callbacks;
- session->bytes_read += *len;
 
       if (cb && cb->progress_func)
- (cb->progress_func)(session->bytes_read + session->bytes_written,
- -1, cb->progress_baton, pool);
+ (cb->progress_func)(*len, -1, cb->progress_baton, pool);
     }
 
   return SVN_NO_ERROR;
Index: subversion/include/svn_ra.h
===================================================================
--- subversion/include/svn_ra.h (revision 32316)
+++ subversion/include/svn_ra.h (working copy)
@@ -183,9 +183,12 @@ typedef svn_error_t *(*svn_ra_lock_callback_t)(voi
 /**
  * Callback function type for progress notification.
  *
- * @a progress is the number of bytes already transferred, @a total is
- * the total number of bytes to transfer or -1 if it's not known, @a
- * baton is the callback baton.
+ * @a progress is the number of bytes transferred since the last call
+ * of the callback funtion, @a total is the total number of bytes to
+ * transfer or -1 if it's not known, @a baton is the callback baton.
+ * The total number of bytes to transfer can either be the real total
+ * of the whole command or just the total of a known piece, e.g., a
+ * file.
  *
  * @since New in 1.3.
  */

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-08-03 09:37:33 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.