subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1348841 - in /subversion/trunk/subversion: libsvn_ra_neon/merge.c libsvn_ra_svn/marshal.c libsvn_subr/base64.c libsvn_subr/path.c libsvn_subr/skel.c libsvn_subr/stream.c libsvn_subr/string.c libsvn_subr/temp_serializer.c
Date Mon, 11 Jun 2012 13:35:31 GMT
Author: stefan2
Date: Mon Jun 11 13:35:31 2012
New Revision: 1348841

URL: http://svn.apache.org/viewvc?rev=1348841&view=rev
Log:
Update callers to svn_stringbuf_ensure() to no longer
add one byte to make room for the terminating NUL
as this is already being taken care of by the called function.

* subversion/libsvn_ra_neon/merge.c
  (svn_ra_neon__assemble_locktoken_body): remove extra +1
* subversion/libsvn_ra_svn/marshal.c
  (read_string): ditto
* subversion/libsvn_subr/base64.c
  (decode_bytes): ditto
* subversion/libsvn_subr/path.c
  (illegal_path_escape): ditto
* subversion/libsvn_subr/skel.c
  (unparse): ditto
* subversion/libsvn_subr/stream.c
  (stream_readline_chunky): ditto
* subversion/libsvn_subr/string.c
  (svn_stringbuf_set, svn_stringbuf_appendbytes): ditto
* subversion/libsvn_subr/temp_serializer.c
  (align_buffer_end): ditto

Modified:
    subversion/trunk/subversion/libsvn_ra_neon/merge.c
    subversion/trunk/subversion/libsvn_ra_svn/marshal.c
    subversion/trunk/subversion/libsvn_subr/base64.c
    subversion/trunk/subversion/libsvn_subr/path.c
    subversion/trunk/subversion/libsvn_subr/skel.c
    subversion/trunk/subversion/libsvn_subr/stream.c
    subversion/trunk/subversion/libsvn_subr/string.c
    subversion/trunk/subversion/libsvn_subr/temp_serializer.c

Modified: subversion/trunk/subversion/libsvn_ra_neon/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_neon/merge.c?rev=1348841&r1=1348840&r2=1348841&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_neon/merge.c (original)
+++ subversion/trunk/subversion/libsvn_ra_neon/merge.c Mon Jun 11 13:35:31 2012
@@ -627,7 +627,7 @@ svn_error_t * svn_ra_neon__assemble_lock
 
   buf_size += SVN_LEN(SVN_LOCK_TOKEN_LIST_CLOSE);
 
-  svn_stringbuf_ensure(lockbuf, buf_size + 1);
+  svn_stringbuf_ensure(lockbuf, buf_size);
 
   /* Now append all the temporary hash's keys and values into the
      stringbuf.  This is better than doing apr_pstrcat() in a loop,

Modified: subversion/trunk/subversion/libsvn_ra_svn/marshal.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/marshal.c?rev=1348841&r1=1348840&r2=1348841&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_svn/marshal.c (original)
+++ subversion/trunk/subversion/libsvn_ra_svn/marshal.c Mon Jun 11 13:35:31 2012
@@ -699,7 +699,7 @@ static svn_error_t *read_string(svn_ra_s
               ? len
               : SUSPICIOUSLY_HUGE_STRING_SIZE_THRESHOLD;
 
-      svn_stringbuf_ensure(stringbuf, stringbuf->len + readbuf_len + 1);
+      svn_stringbuf_ensure(stringbuf, stringbuf->len + readbuf_len);
       dest = stringbuf->data + stringbuf->len;
     }
 

Modified: subversion/trunk/subversion/libsvn_subr/base64.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/base64.c?rev=1348841&r1=1348840&r2=1348841&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/base64.c (original)
+++ subversion/trunk/subversion/libsvn_subr/base64.c Mon Jun 11 13:35:31 2012
@@ -415,9 +415,9 @@ decode_bytes(svn_stringbuf_t *str, const
      (*inbuflen+len) is encoded data length
      (*inbuflen+len)/4 is the number of complete 4-bytes sets
      (*inbuflen+len)/4*3 is the number of decoded bytes
-     (*inbuflen+len)/4*3+1 is the number of decoded bytes plus a null
+     svn_stringbuf_ensure will add an additional byte for the terminating 0.
   */
-  svn_stringbuf_ensure(str, str->len + ((*inbuflen + len) / 4) * 3 + 1);
+  svn_stringbuf_ensure(str, str->len + ((*inbuflen + len) / 4) * 3);
 
   while ( !*done && p < end )
     {

Modified: subversion/trunk/subversion/libsvn_subr/path.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/path.c?rev=1348841&r1=1348840&r2=1348841&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/path.c (original)
+++ subversion/trunk/subversion/libsvn_subr/path.c Mon Jun 11 13:35:31 2012
@@ -1168,8 +1168,8 @@ illegal_path_escape(const char *path, ap
         svn_stringbuf_appendbytes(retstr, path + copied,
                                   i - copied);
 
-      /* Make sure buffer is big enough for '\' 'N' 'N' 'N' null */
-      svn_stringbuf_ensure(retstr, retstr->len + 5);
+      /* Make sure buffer is big enough for '\' 'N' 'N' 'N' (and NUL) */
+      svn_stringbuf_ensure(retstr, retstr->len + 4);
       /*### The backslash separator doesn't work too great with Windows,
          but it's what we'll use for consistency with invalid utf8
          formatting (until someone has a better idea) */

Modified: subversion/trunk/subversion/libsvn_subr/skel.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/skel.c?rev=1348841&r1=1348840&r2=1348841&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/skel.c (original)
+++ subversion/trunk/subversion/libsvn_subr/skel.c Mon Jun 11 13:35:31 2012
@@ -501,7 +501,7 @@ unparse(const svn_skel_t *skel, svn_stri
 
           /* Make sure we have room for the length, the space, and the
              atom's contents.  */
-          svn_stringbuf_ensure(str, str->len + length_len + 1 + skel->len + 1);
+          svn_stringbuf_ensure(str, str->len + length_len + 1 + skel->len);
           svn_stringbuf_appendbytes(str, buf, length_len);
           svn_stringbuf_appendbyte(str, ' ');
           svn_stringbuf_appendbytes(str, skel->data, skel->len);

Modified: subversion/trunk/subversion/libsvn_subr/stream.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/stream.c?rev=1348841&r1=1348840&r2=1348841&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/stream.c (original)
+++ subversion/trunk/subversion/libsvn_subr/stream.c Mon Jun 11 13:35:31 2012
@@ -380,7 +380,7 @@ stream_readline_chunky(svn_stringbuf_t *
       {
         /* Append the next chunk to the string read so far.
          */
-        svn_stringbuf_ensure(str, str->len + LINE_CHUNK_SIZE + 1);
+        svn_stringbuf_ensure(str, str->len + LINE_CHUNK_SIZE);
         numbytes = LINE_CHUNK_SIZE;
         SVN_ERR(svn_stream_read(stream, str->data + str->len, &numbytes));
         str->len += numbytes;

Modified: subversion/trunk/subversion/libsvn_subr/string.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/string.c?rev=1348841&r1=1348840&r2=1348841&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/string.c (original)
+++ subversion/trunk/subversion/libsvn_subr/string.c Mon Jun 11 13:35:31 2012
@@ -407,7 +407,7 @@ svn_stringbuf_set(svn_stringbuf_t *str, 
 {
   apr_size_t amt = strlen(value);
 
-  svn_stringbuf_ensure(str, amt + 1);
+  svn_stringbuf_ensure(str, amt);
   memcpy(str->data, value, amt + 1);
   str->len = amt;
 }
@@ -549,8 +549,8 @@ svn_stringbuf_appendbytes(svn_stringbuf_
 
   total_len = str->len + count;  /* total size needed */
 
-  /* +1 for null terminator. */
-  svn_stringbuf_ensure(str, (total_len + 1));
+  /* svn_stringbuf_ensure adds 1 for null terminator. */
+  svn_stringbuf_ensure(str, total_len);
 
   /* get address 1 byte beyond end of original bytestring */
   start_address = (str->data + str->len);

Modified: subversion/trunk/subversion/libsvn_subr/temp_serializer.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/temp_serializer.c?rev=1348841&r1=1348840&r2=1348841&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/temp_serializer.c (original)
+++ subversion/trunk/subversion/libsvn_subr/temp_serializer.c Mon Jun 11 13:35:31 2012
@@ -72,7 +72,7 @@ struct svn_temp_serializer__context_t
   source_stack_t *source;
 };
 
-/* Mmake sure the serialized data len is a multiple of the default alignment,
+/* Make sure the serialized data len is a multiple of the default alignment,
  * i.e. structures may be appended without violating member alignment
  * guarantees.
  */
@@ -83,7 +83,7 @@ align_buffer_end(svn_temp_serializer__co
   apr_size_t aligned_len = APR_ALIGN_DEFAULT(current_len);
   if (aligned_len != current_len)
     {
-      svn_stringbuf_ensure(context->buffer, aligned_len+1);
+      svn_stringbuf_ensure(context->buffer, aligned_len);
       context->buffer->len = aligned_len;
     }
 }



Mime
View raw message