Author: stefan2
Date: Fri Jul 12 22:15:52 2013
New Revision: 1502712

URL: http://svn.apache.org/r1502712
Log:
Cherrypick merge c1442910,1443171 from the fsfs-format7 branch
to /trunk and resolve a trivial tree conflict.
This move svn__(de)compress from libsvn_delta to libsvn_subr and
makes the API slightly more symmetric by using stringbuf for in and
out parameters.

Added:
    subversion/trunk/subversion/libsvn_subr/compress.c
      - copied unchanged from r1461851, 
subversion/branches/fsfs-format7/subversion/libsvn_subr/compress.c
Modified:
    subversion/trunk/   (props changed)
    subversion/trunk/configure.ac
    subversion/trunk/subversion/include/private/svn_delta_private.h
    subversion/trunk/subversion/include/private/svn_subr_private.h
    subversion/trunk/subversion/include/svn_error_codes.h
    subversion/trunk/subversion/libsvn_delta/svndiff.c
    subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
    subversion/trunk/subversion/svn_private_config.hw

Propchange: subversion/trunk/
------------------------------------------------------------------------------
  Merged /subversion/branches/fsfs-format7:r1438982,1461851

Modified: subversion/trunk/configure.ac
URL: 
http://svn.apache.org/viewvc/subversion/trunk/configure.ac?rev=1502712&r1=1502711&r2=1502712&view=diff
==============================================================================
--- subversion/trunk/configure.ac (original)
+++ subversion/trunk/configure.ac Fri Jul 12 22:15:52 2013
@@ -733,6 +733,26 @@ AH_BOTTOM([
 #define gettext(x) (x)
 #define dgettext(domain, x) (x)
 #endif
+
+/* compiler hints */
+#if defined(__GNUC__) && (__GNUC__ >= 3)
+# define SVN__PREDICT_FALSE(x) (__builtin_expect(x, 0))
+# define SVN__PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
+#else
+# define SVN__PREDICT_FALSE(x)
+# define SVN__PREDICT_TRUE(x)
+#endif
+
+#if defined(SVN_DEBUG)
+# define SVN__FORCE_INLINE
+# define SVN__PREVENT_INLINE
+#elif defined(__GNUC__)
+# define SVN__FORCE_INLINE __attribute__ ((always_inline))
+# define SVN__PREVENT_INLINE __attribute__ ((noinline))
+#else
+# define SVN__FORCE_INLINE
+# define SVN__PREVENT_INLINE
+#endif
 ])
 
 dnl Used to simulate makefile conditionals.

Modified: subversion/trunk/subversion/include/private/svn_delta_private.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_delta_private.h?rev=1502712&r1=1502711&r2=1502712&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_delta_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_delta_private.h Fri Jul 12 
22:15:52 2013
@@ -101,26 +101,6 @@ svn_delta__delta_from_editor(const svn_d
                              struct svn_delta__extra_baton *exb,
                              apr_pool_t *pool);
 
-/**
- * Get the data from IN, compress it according to the specified
- * COMPRESSION_LEVEL and write the result to OUT.
- * SVN_DELTA_COMPRESSION_LEVEL_NONE is valid for COMPRESSION_LEVEL.
- */
-svn_error_t *
-svn__compress(svn_string_t *in,
-              svn_stringbuf_t *out,
-              int compression_level);
-
-/**
- * Get the compressed data from IN, decompress it and write the result to
- * OUT.  Return an error if the decompressed size is larger than LIMIT.
- */
-svn_error_t *
-svn__decompress(svn_string_t *in,
-                svn_stringbuf_t *out,
-                apr_size_t limit);
-
-
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: subversion/trunk/subversion/include/private/svn_subr_private.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_subr_private.h?rev=1502712&r1=1502711&r2=1502712&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_subr_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_subr_private.h Fri Jul 12 
22:15:52 2013
@@ -333,6 +333,84 @@ svn_version__at_least(svn_version_t *ver
 
 /** @} */
 
+/**
+ * @defgroup svn_compress Data (de-)compression API
+ * @{
+ */
+
+/* This is at least as big as the largest size of an integer that
+   svn__encode_uint() can generate; it is sufficient for creating buffers
+   for it to write into.  This assumes that integers are at most 64 bits,
+   and so 10 bytes (with 7 bits of information each) are sufficient to
+   represent them. */
+#define SVN__MAX_ENCODED_UINT_LEN 10
+
+/* Compression method parameters for svn__encode_uint. */
+
+/* No compression (but a length prefix will still be added to the buffer) */
+#define SVN__COMPRESSION_NONE         0
+
+/* Fastest, least effective compression method & level provided by zlib. */
+#define SVN__COMPRESSION_ZLIB_MIN     1
+
+/* Default compression method & level provided by zlib. */
+#define SVN__COMPRESSION_ZLIB_DEFAULT 5
+
+/* Slowest, best compression method & level provided by zlib. */
+#define SVN__COMPRESSION_ZLIB_MAX     9
+
+/* Encode VAL into the buffer P using the variable-length 7b/8b unsigned
+   integer format.  Return the incremented value of P after the
+   encoded bytes have been written.  P must point to a buffer of size
+   at least SVN__MAX_ENCODED_UINT_LEN.
+
+   This encoding uses the high bit of each byte as a continuation bit
+   and the other seven bits as data bits.  High-order data bits are
+   encoded first, followed by lower-order bits, so the value can be
+   reconstructed by concatenating the data bits from left to right and
+   interpreting the result as a binary number.  Examples (brackets
+   denote byte boundaries, spaces are for clarity only):
+
+           1 encodes as [0 0000001]
+          33 encodes as [0 0100001]
+         129 encodes as [1 0000001] [0 0000001]
+        2000 encodes as [1 0001111] [0 1010000]
+*/
+unsigned char *
+svn__encode_uint(unsigned char *p, apr_uint64_t val);
+
+/* Decode an unsigned 7b/8b-encoded integer into *VAL and return a pointer
+   to the byte after the integer.  The bytes to be decoded live in the
+   range [P..END-1].  If these bytes do not contain a whole encoded
+   integer, return NULL; in this case *VAL is undefined.
+
+   See the comment for svn__encode_uint() earlier in this file for more
+   detail on the encoding format.  */
+const unsigned char *
+svn__decode_uint(apr_uint64_t *val,
+                 const unsigned char *p,
+                 const unsigned char *end);
+
+/* Get the data from IN, compress it according to the specified
+ * COMPRESSION_METHOD and write the result to OUT.
+ * SVN__COMPRESSION_NONE is valid for COMPRESSION_METHOD.
+ */
+svn_error_t *
+svn__compress(svn_stringbuf_t *in,
+              svn_stringbuf_t *out,
+              int compression_method);
+
+/* Get the compressed data from IN, decompress it and write the result to
+ * OUT.  Return an error if the decompressed size is larger than LIMIT.
+ */
+svn_error_t *
+svn__decompress(svn_stringbuf_t *in,
+                svn_stringbuf_t *out,
+                apr_size_t limit);
+
+/** @} */
+
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: subversion/trunk/subversion/include/svn_error_codes.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_error_codes.h?rev=1502712&r1=1502711&r2=1502712&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_error_codes.h (original)
+++ subversion/trunk/subversion/include/svn_error_codes.h Fri Jul 12 22:15:52 
2013
@@ -233,6 +233,11 @@ SVN_ERROR_START
              SVN_ERR_BAD_CATEGORY_START + 15,
              "Invalid atomic")
 
+  /** @since New in 1.9. */
+  SVN_ERRDEF(SVN_ERR_BAD_COMPRESSION_METHOD,
+             SVN_ERR_BAD_CATEGORY_START + 16,
+             "Invalid compression method")
+
   /* xml errors */
 
   SVN_ERRDEF(SVN_ERR_XML_ATTRIB_NOT_FOUND,

Modified: subversion/trunk/subversion/libsvn_delta/svndiff.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_delta/svndiff.c?rev=1502712&r1=1502711&r2=1502712&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_delta/svndiff.c (original)
+++ subversion/trunk/subversion/libsvn_delta/svndiff.c Fri Jul 12 22:15:52 2013
@@ -29,21 +29,11 @@
 #include "delta.h"
 #include "svn_pools.h"
 #include "svn_private_config.h"
-#include <zlib.h>
 
 #include "private/svn_error_private.h"
 #include "private/svn_delta_private.h"
-
-/* The zlib compressBound function was not exported until 1.2.0. */
-#if ZLIB_VERNUM >= 0x1200
-#define svnCompressBound(LEN) compressBound(LEN)
-#else
-#define svnCompressBound(LEN) ((LEN) + ((LEN) >> 12) + ((LEN) >> 14) + 11)
-#endif
-
-/* For svndiff1, address/instruction/new data under this size will not
-   be compressed using zlib as a secondary compressor.  */
-#define MIN_COMPRESS_SIZE 512
+#include "private/svn_subr_private.h"
+#include "private/svn_string_private.h"
 
 /* ----- Text delta to svndiff ----- */
 
@@ -58,139 +48,31 @@ struct encoder_baton {
   apr_pool_t *pool;
 };
 
-/* This is at least as big as the largest size of an integer that
-   encode_int can generate; it is sufficient for creating buffers for
-   it to write into.  This assumes that integers are at most 64 bits,
-   and so 10 bytes (with 7 bits of information each) are sufficient to
-   represent them. */
-#define MAX_ENCODED_INT_LEN 10
 /* This is at least as big as the largest size for a single instruction. */
-#define MAX_INSTRUCTION_LEN (2*MAX_ENCODED_INT_LEN+1)
+#define MAX_INSTRUCTION_LEN (2*SVN__MAX_ENCODED_UINT_LEN+1)
 /* This is at least as big as the largest possible instructions
    section: in theory, the instructions could be SVN_DELTA_WINDOW_SIZE
    1-byte copy-from-source instructions (though this is very unlikely). */
 #define MAX_INSTRUCTION_SECTION_LEN (SVN_DELTA_WINDOW_SIZE*MAX_INSTRUCTION_LEN)
 
-/* Encode VAL into the buffer P using the variable-length svndiff
-   integer format.  Return the incremented value of P after the
-   encoded bytes have been written.  P must point to a buffer of size
-   at least MAX_ENCODED_INT_LEN.
-
-   This encoding uses the high bit of each byte as a continuation bit
-   and the other seven bits as data bits.  High-order data bits are
-   encoded first, followed by lower-order bits, so the value can be
-   reconstructed by concatenating the data bits from left to right and
-   interpreting the result as a binary number.  Examples (brackets
-   denote byte boundaries, spaces are for clarity only):
-
-           1 encodes as [0 0000001]
-          33 encodes as [0 0100001]
-         129 encodes as [1 0000001] [0 0000001]
-        2000 encodes as [1 0001111] [0 1010000]
-*/
-static unsigned char *
-encode_int(unsigned char *p, svn_filesize_t val)
-{
-  int n;
-  svn_filesize_t v;
-  unsigned char cont;
-
-  SVN_ERR_ASSERT_NO_RETURN(val >= 0);
-
-  /* Figure out how many bytes we'll need.  */
-  v = val >> 7;
-  n = 1;
-  while (v > 0)
-    {
-      v = v >> 7;
-      n++;
-    }
-
-  SVN_ERR_ASSERT_NO_RETURN(n <= MAX_ENCODED_INT_LEN);
-
-  /* Encode the remaining bytes; n is always the number of bytes
-     coming after the one we're encoding.  */
-  while (--n >= 0)
-    {
-      cont = ((n > 0) ? 0x1 : 0x0) << 7;
-      *p++ = (unsigned char)(((val >> (n * 7)) & 0x7f) | cont);
-    }
-
-  return p;
-}
-
 
 /* Append an encoded integer to a string.  */
 static void
 append_encoded_int(svn_stringbuf_t *header, svn_filesize_t val)
 {
-  unsigned char buf[MAX_ENCODED_INT_LEN], *p;
+  unsigned char buf[SVN__MAX_ENCODED_UINT_LEN], *p;
 
-  p = encode_int(buf, val);
+  SVN_ERR_ASSERT_NO_RETURN(val >= 0);
+  p = svn__encode_uint(buf, (apr_uint64_t)val);
   svn_stringbuf_appendbytes(header, (const char *)buf, p - buf);
 }
 
-/* If IN is a string that is >= MIN_COMPRESS_SIZE and the COMPRESSION_LEVEL
-   is not SVN_DELTA_COMPRESSION_LEVEL_NONE, zlib compress it and places the
-   result in OUT, with an integer prepended specifying the original size.
-   If IN is < MIN_COMPRESS_SIZE, or if the compressed version of IN was no
-   smaller than the original IN, OUT will be a copy of IN with the size
-   prepended as an integer. */
-static svn_error_t *
-zlib_encode(const char *data,
-            apr_size_t len,
-            svn_stringbuf_t *out,
-            int compression_level)
-{
-  unsigned long endlen;
-  apr_size_t intlen;
-
-  svn_stringbuf_setempty(out);
-  append_encoded_int(out, len);
-  intlen = out->len;
-
-  /* Compression initialization overhead is considered to large for
-     short buffers.  Also, if we don't actually want to compress data,
-     ZLIB will produce an output no shorter than the input.  Hence,
-     the DATA would directly appended to OUT, so we can do that directly
-     without calling ZLIB before. */
-  if (   (len < MIN_COMPRESS_SIZE)
-      || (compression_level == SVN_DELTA_COMPRESSION_LEVEL_NONE))
-    {
-      svn_stringbuf_appendbytes(out, data, len);
-    }
-  else
-    {
-      int zerr;
-
-      svn_stringbuf_ensure(out, svnCompressBound(len) + intlen);
-      endlen = out->blocksize;
-
-      zerr = compress2((unsigned char *)out->data + intlen, &endlen,
-                       (const unsigned char *)data, len,
-                       compression_level);
-      if (zerr != Z_OK)
-        return svn_error_trace(svn_error__wrap_zlib(
-                                 zerr, "compress2",
-                                 _("Compression of svndiff data failed")));
-
-      /* Compression didn't help :(, just append the original text */
-      if (endlen >= len)
-        {
-          svn_stringbuf_appendbytes(out, data, len);
-          return SVN_NO_ERROR;
-        }
-      out->len = endlen + intlen;
-      out->data[out->len] = 0;
-    }
-  return SVN_NO_ERROR;
-}
-
 static svn_error_t *
 send_simple_insertion_window(svn_txdelta_window_t *window,
                              struct encoder_baton *eb)
 {
-  unsigned char headers[4 + 5 * MAX_ENCODED_INT_LEN + MAX_INSTRUCTION_LEN];
+  unsigned char headers[4 + 5 * SVN__MAX_ENCODED_UINT_LEN
+                          + MAX_INSTRUCTION_LEN];
   unsigned char ibuf[MAX_INSTRUCTION_LEN];
   unsigned char *header_current;
   apr_size_t header_len;
@@ -226,16 +108,17 @@ send_simple_insertion_window(svn_txdelta
   else
     {
       ibuf[0] = (0x2 << 6);
-      ip_len = encode_int(ibuf + 1, window->tview_len) - ibuf;
+      ip_len = svn__encode_uint(ibuf + 1, window->tview_len) - ibuf;
     }
 
   /* encode the window header.  Please note that the source window may
    * have content despite not being used for deltification. */
-  header_current = encode_int(header_current, window->sview_offset);
-  header_current = encode_int(header_current, window->sview_len);
-  header_current = encode_int(header_current, window->tview_len);
+  header_current = svn__encode_uint(header_current,
+                                    (apr_uint64_t)window->sview_offset);
+  header_current = svn__encode_uint(header_current, window->sview_len);
+  header_current = svn__encode_uint(header_current, window->tview_len);
   header_current[0] = (unsigned char)ip_len;  /* 1 instruction */
-  header_current = encode_int(&header_current[1], len);
+  header_current = svn__encode_uint(&header_current[1], len);
 
   /* append instructions (1 to a handful of bytes) */
   for (i = 0; i < ip_len; ++i)
@@ -319,9 +202,9 @@ window_handler(svn_txdelta_window_t *win
       if (op->length >> 6 == 0)
         *ip++ |= (unsigned char)op->length;
       else
-        ip = encode_int(ip + 1, op->length);
+        ip = svn__encode_uint(ip + 1, op->length);
       if (op->action_code != svn_txdelta_new)
-        ip = encode_int(ip, op->offset);
+        ip = svn__encode_uint(ip, op->offset);
       svn_stringbuf_appendbytes(instructions, (const char *)ibuf, ip - ibuf);
     }
 
@@ -331,20 +214,20 @@ window_handler(svn_txdelta_window_t *win
   append_encoded_int(header, window->tview_len);
   if (eb->version == 1)
     {
-      SVN_ERR(zlib_encode(instructions->data, instructions->len,
-                          i1, eb->compression_level));
+      SVN_ERR(svn__compress(instructions, i1, eb->compression_level));
       instructions = i1;
     }
   append_encoded_int(header, instructions->len);
   if (eb->version == 1)
     {
-      svn_stringbuf_t *temp = svn_stringbuf_create_empty(pool);
-      svn_string_t *tempstr = svn_string_create_empty(pool);
-      SVN_ERR(zlib_encode(window->new_data->data, window->new_data->len,
-                          temp, eb->compression_level));
-      tempstr->data = temp->data;
-      tempstr->len = temp->len;
-      newdata = tempstr;
+      svn_stringbuf_t *compressed = svn_stringbuf_create_empty(pool);
+      svn_stringbuf_t *original = svn_stringbuf_create_empty(pool);
+      original->data = (char *)window->new_data->data; /* won't be modified */
+      original->len = window->new_data->len;
+      original->blocksize = window->new_data->len + 1;
+
+      SVN_ERR(svn__compress(original, compressed, eb->compression_level));
+      newdata = svn_stringbuf__morph_into_string(compressed);
     }
   else
     newdata = window->new_data;
@@ -453,128 +336,32 @@ struct decode_baton
 };
 
 
-/* Decode an svndiff-encoded integer into *VAL and return a pointer to
-   the byte after the integer.  The bytes to be decoded live in the
-   range [P..END-1].  If these bytes do not contain a whole encoded
-   integer, return NULL; in this case *VAL is undefined.
-
-   See the comment for encode_int() earlier in this file for more detail on
-   the encoding format.  */
+/* Wrapper aroung svn__deencode_uint taking a file size as *VAL. */
 static const unsigned char *
 decode_file_offset(svn_filesize_t *val,
                    const unsigned char *p,
                    const unsigned char *end)
 {
-  svn_filesize_t temp = 0;
-
-  if (p + MAX_ENCODED_INT_LEN < end)
-    end = p + MAX_ENCODED_INT_LEN;
-  /* Decode bytes until we're done.  */
-  while (p < end)
-    {
-      /* Don't use svn_filesize_t here, because this might be 64 bits
-       * on 32 bit targets. Optimizing compilers may or may not be
-       * able to reduce that to the effective code below. */
-      unsigned int c = *p++;
-
-      temp = (temp << 7) | (c & 0x7f);
-      if (c < 0x80)
-      {
-        *val = temp;
-        return p;
-      }
-    }
+  apr_uint64_t temp = 0;
+  const unsigned char *result = svn__decode_uint(&temp, p, end);
+  *val = (svn_filesize_t)temp;
 
-  return NULL;
+  return result;
 }
 
-
 /* Same as above, only decode into a size variable. */
 static const unsigned char *
 decode_size(apr_size_t *val,
             const unsigned char *p,
             const unsigned char *end)
 {
-  apr_size_t temp = 0;
-
-  if (p + MAX_ENCODED_INT_LEN < end)
-    end = p + MAX_ENCODED_INT_LEN;
-  /* Decode bytes until we're done.  */
-  while (p < end)
-    {
-      apr_size_t c = *p++;
-
-      temp = (temp << 7) | (c & 0x7f);
-      if (c < 0x80)
-      {
-        *val = temp;
-        return p;
-      }
-    }
-
-  return NULL;
-}
-
-/* Decode the possibly-zlib compressed string of length INLEN that is in
-   IN, into OUT.  We expect an integer is prepended to IN that specifies
-   the original size, and that if encoded size == original size, that the
-   remaining data is not compressed.
-   In that case, we will simply return pointer into IN as data pointer for
-   OUT, COPYLESS_ALLOWED has been set.  The, the caller is expected not to
-   modify the contents of OUT.
-   An error is returned if the decoded length exceeds the given LIMIT.
- */
-static svn_error_t *
-zlib_decode(const unsigned char *in, apr_size_t inLen, svn_stringbuf_t *out,
-            apr_size_t limit)
-{
-  apr_size_t len;
-  const unsigned char *oldplace = in;
-
-  /* First thing in the string is the original length.  */
-  in = decode_size(&len, in, in + inLen);
-  if (in == NULL)
-    return svn_error_create(SVN_ERR_SVNDIFF_INVALID_COMPRESSED_DATA, NULL,
-                            _("Decompression of svndiff data failed: no 
size"));
-  if (len > limit)
-    return svn_error_create(SVN_ERR_SVNDIFF_INVALID_COMPRESSED_DATA, NULL,
-                            _("Decompression of svndiff data failed: "
-                              "size too large"));
-  /* We need to subtract the size of the encoded original length off the
-   *      still remaining input length.  */
-  inLen -= (in - oldplace);
-  if (inLen == len)
-    {
-      svn_stringbuf_ensure(out, len);
-      memcpy(out->data, in, len);
-      out->data[len] = 0;
-      out->len = len;
-
-      return SVN_NO_ERROR;
-    }
-  else
-    {
-      unsigned long zlen = len;
-      int zerr;
-
-      svn_stringbuf_ensure(out, len);
-      zerr = uncompress((unsigned char *)out->data, &zlen, in, inLen);
-      if (zerr != Z_OK)
-        return svn_error_trace(svn_error__wrap_zlib(
-                                 zerr, "uncompress",
-                                 _("Decompression of svndiff data failed")));
-
-      /* Zlib should not produce something that has a different size than the
-         original length we stored. */
-      if (zlen != len)
-        return svn_error_create(SVN_ERR_SVNDIFF_INVALID_COMPRESSED_DATA,
-                                NULL,
-                                _("Size of uncompressed data "
-                                  "does not match stored original length"));
-      out->data[zlen] = 0;
-      out->len = zlen;
-    }
-  return SVN_NO_ERROR;
+  apr_uint64_t temp = 0;
+  const unsigned char *result = svn__decode_uint(&temp, p, end);
+  if (temp > APR_SIZE_MAX)
+    return NULL;
+  
+  *val = (apr_size_t)temp;
+  return result;
 }
 
 /* Decode an instruction into OP, returning a pointer to the text
@@ -695,6 +482,21 @@ count_and_verify_instructions(int *ninst
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+zlib_decode(const unsigned char *in, apr_size_t inLen, svn_stringbuf_t *out,
+            apr_size_t limit)
+{
+  /* construct a fake string buffer as parameter to svn__decompress.
+     This is fine as that function never writes to it. */
+  svn_stringbuf_t compressed;
+  compressed.pool = NULL;
+  compressed.data = (char *)in;
+  compressed.len = inLen;
+  compressed.blocksize = inLen + 1;
+  
+  return svn__decompress(&compressed, out, limit);
+}
+
 /* Given the five integer fields of a window header and a pointer to
    the remainder of the window contents, fill in a delta window
    structure *WINDOW.  New allocations will be performed in POOL;
@@ -847,7 +649,7 @@ write_handler(void *baton,
       if (tview_len > SVN_DELTA_WINDOW_SIZE ||
           sview_len > SVN_DELTA_WINDOW_SIZE ||
           /* for svndiff1, newlen includes the original length */
-          newlen > SVN_DELTA_WINDOW_SIZE + MAX_ENCODED_INT_LEN ||
+          newlen > SVN_DELTA_WINDOW_SIZE + SVN__MAX_ENCODED_UINT_LEN ||
           inslen > MAX_INSTRUCTION_SECTION_LEN)
         return svn_error_create(SVN_ERR_SVNDIFF_CORRUPT_WINDOW, NULL,
                                 _("Svndiff contains a too-large window"));
@@ -1029,7 +831,7 @@ read_window_header(svn_stream_t *stream,
   if (*tview_len > SVN_DELTA_WINDOW_SIZE ||
       *sview_len > SVN_DELTA_WINDOW_SIZE ||
       /* for svndiff1, newlen includes the original length */
-      *newlen > SVN_DELTA_WINDOW_SIZE + MAX_ENCODED_INT_LEN ||
+      *newlen > SVN_DELTA_WINDOW_SIZE + SVN__MAX_ENCODED_UINT_LEN ||
       *inslen > MAX_INSTRUCTION_SECTION_LEN)
     return svn_error_create(SVN_ERR_SVNDIFF_CORRUPT_WINDOW, NULL,
                             _("Svndiff contains a too-large window"));
@@ -1086,18 +888,3 @@ svn_txdelta_skip_svndiff_window(apr_file
 }
 
 
-svn_error_t *
-svn__compress(svn_string_t *in,
-              svn_stringbuf_t *out,
-              int compression_level)
-{
-  return zlib_encode(in->data, in->len, out, compression_level);
-}
-
-svn_error_t *
-svn__decompress(svn_string_t *in,
-                svn_stringbuf_t *out,
-                apr_size_t limit)
-{
-  return zlib_decode((const unsigned char*)in->data, in->len, out, limit);
-}

Modified: subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c?rev=1502712&r1=1502711&r2=1502712&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Fri Jul 12 22:15:52 2013
@@ -3759,10 +3759,9 @@ parse_packed_revprops(svn_fs_t *fs,
 
   /* decompress (even if the data is only "stored", there is still a
    * length header to remove) */
-  svn_string_t *compressed
-      = svn_stringbuf__morph_into_string(revprops->packed_revprops);
   svn_stringbuf_t *uncompressed = svn_stringbuf_create_empty(pool);
-  SVN_ERR(svn__decompress(compressed, uncompressed, APR_SIZE_MAX));
+  SVN_ERR(svn__decompress(revprops->packed_revprops, uncompressed,
+                          APR_SIZE_MAX));
 
   /* read first revision number and number of revisions in the pack */
   stream = svn_stream_from_stringbuf(uncompressed, scratch_pool);
@@ -4159,7 +4158,7 @@ repack_revprops(svn_fs_t *fs,
   SVN_ERR(svn_stream_close(stream));
 
   /* compress / store the data */
-  SVN_ERR(svn__compress(svn_stringbuf__morph_into_string(uncompressed),
+  SVN_ERR(svn__compress(uncompressed,
                         compressed,
                         ffd->compress_packed_revprops
                           ? SVN_DELTA_COMPRESSION_LEVEL_DEFAULT
@@ -10035,8 +10034,7 @@ copy_revprops(const char *pack_file_dir,
   SVN_ERR(svn_stream_close(pack_stream));
 
   /* compress the content (or just store it for COMPRESSION_LEVEL 0) */
-  SVN_ERR(svn__compress(svn_stringbuf__morph_into_string(uncompressed),
-                        compressed, compression_level));
+  SVN_ERR(svn__compress(uncompressed, compressed, compression_level));
 
   /* write the pack file content to disk */
   stream = svn_stream_from_aprfile2(pack_file, FALSE, scratch_pool);

Modified: subversion/trunk/subversion/svn_private_config.hw
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn_private_config.hw?rev=1502712&r1=1502711&r2=1502712&view=diff
==============================================================================
--- subversion/trunk/subversion/svn_private_config.hw (original)
+++ subversion/trunk/subversion/svn_private_config.hw Fri Jul 12 22:15:52 2013
@@ -101,6 +101,21 @@
 #define dgettext(domain, x) (x)
 #endif
 
+/* compiler hints as supported by MS VC */
+#if defined(SVN_DEBUG)
+# define SVN__FORCE_INLINE
+# define SVN__PREVENT_INLINE
+#elif define(_MSC_VER)
+# define SVN__FORCE_INLINE __forceinline
+# define SVN__PREVENT_INLINE __declspec(noinline)
+#else
+# define SVN__FORCE_INLINE
+# define SVN__PREVENT_INLINE
+#endif
+
+#define SVN__PREDICT_TRUE
+#define SVN__PREDICT_FALSE
+
 #endif /* SVN_PRIVATE_CONFIG_HW */
 
 /* Inclusion of Berkeley DB header */


Reply via email to