You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2014/02/20 20:46:01 UTC

svn commit: r1570330 - /subversion/trunk/subversion/libsvn_repos/log.c

Author: breser
Date: Thu Feb 20 19:46:01 2014
New Revision: 1570330

URL: http://svn.apache.org/r1570330
Log:
Always treat negative limits passed to log as no limit.

Currently our API doesn't document what our behavior is in this case.  In
practice our behavior is that negative limits are treated as unlimited.
But they are treated this way due to the quirks of the types we're using and
C's comparision rules.  We check for truth of limit (which means not zero) and
then compare our calculated number of logs we will send (stored in an
apr_uint64_t) with the limit (stored in an int).  When comparing an unsinged
integer to a signed integer the signed value is automatically cast to unsigned
by C.  In this case it also widens the value to a 64-bit unsigned int.  Which
means the negative limit becomes a very large limit that's impossible to reach
due to our current revision number limits.  However, if we ever fix that this
code could end up in a situation where negative limits behave as some rather
large limit.

* subversion/libsvn-repos/log.c
  (svn_repos_get_logs5): Only apply positive limits.

Modified:
    subversion/trunk/subversion/libsvn_repos/log.c

Modified: subversion/trunk/subversion/libsvn_repos/log.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/log.c?rev=1570330&r1=1570329&r2=1570330&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/log.c (original)
+++ subversion/trunk/subversion/libsvn_repos/log.c Thu Feb 20 19:46:01 2014
@@ -2527,7 +2527,7 @@ svn_repos_get_logs5(svn_repos_t *repos,
         }
 
       send_count = end - start + 1;
-      if (limit && send_count > limit)
+      if (limit > 0 && send_count > limit)
         send_count = limit;
       for (i = 0; i < send_count; ++i)
         {