subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1469487 - /subversion/branches/fsfs-format7/subversion/libsvn_subr/packed_data.c
Date Thu, 18 Apr 2013 17:33:37 GMT
Author: stefan2
Date: Thu Apr 18 17:33:36 2013
New Revision: 1469487

URL: http://svn.apache.org/r1469487
Log:
On the fsfs-format7 branch:  When serializing signed / deltified 64 bit
integers, make sure we use the full value range.  Otherwise, some values
cannot be represented.

* subversion/libsvn_subr/packed_data.c
  (svn_packed__data_flush_buffer,
   svn_packed__data_fill_buffer): map -1 to 1, -2 to 3 etc. instead of
                                  starting at 3.

Modified:
    subversion/branches/fsfs-format7/subversion/libsvn_subr/packed_data.c

Modified: subversion/branches/fsfs-format7/subversion/libsvn_subr/packed_data.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_subr/packed_data.c?rev=1469487&r1=1469486&r2=1469487&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_subr/packed_data.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_subr/packed_data.c Thu Apr 18 17:33:36
2013
@@ -376,7 +376,7 @@ svn_packed__data_flush_buffer(svn_packed
             {
               apr_uint64_t temp = stream->buffer[i];
               apr_int64_t diff = (apr_int64_t)(temp - last_value);
-              stream->buffer[i] = diff < 0 ? 1 - 2 * diff : 2 * diff;
+              stream->buffer[i] = diff < 0 ? -1 - 2 * diff : 2 * diff;
               last_value = temp;
             }
 
@@ -390,7 +390,7 @@ svn_packed__data_flush_buffer(svn_packed
       if (!private_data->diff && private_data->is_signed)
         for (i = 0; i < stream->buffer_used; ++i)
           stream->buffer[i] = (apr_int64_t)stream->buffer[i] < 0
-                            ? 1 - 2 * stream->buffer[i]
+                            ? -1 - 2 * stream->buffer[i]
                             : 2 * stream->buffer[i];
 
       /* auto-create packed data buffer.  Give it some reasonable initial
@@ -865,7 +865,7 @@ svn_packed__data_fill_buffer(svn_packed_
           for (i = end; i > 0; --i)
             {
               apr_uint64_t temp = stream->buffer[i-1];
-              temp = (temp % 2) ? 0 - (temp - 1) / 2 : temp / 2;
+              temp = (temp % 2) ? 0 - (temp + 1) / 2 : temp / 2;
               last_value += temp;
               stream->buffer[i-1] = last_value;
             }
@@ -877,7 +877,7 @@ svn_packed__data_fill_buffer(svn_packed_
       if (!private_data->diff && private_data->is_signed)
         for (i = 0; i < end; ++i)
           stream->buffer[i] = (stream->buffer[i] % 2)
-                            ? 0 - (stream->buffer[i] - 1) / 2
+                            ? 0 - (stream->buffer[i] + 1) / 2
                             : stream->buffer[i] / 2;
     }
 



Mime
View raw message