You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2011/05/23 15:11:10 UTC

svn commit: r1126481 - /subversion/trunk/subversion/libsvn_subr/svn_base64.c

Author: hwright
Date: Mon May 23 13:11:10 2011
New Revision: 1126481

URL: http://svn.apache.org/viewvc?rev=1126481&view=rev
Log:
Remove some integer size mismatch warnings by using size_t in places where
we calculate pointer differences.

* subversion/libsvn_subr/svn_base64.c
  (encode_baton, encode_bytes, encode_partial_group,  svn_base64_encode_string2,
   base64_from_checksum): Use size_t in place of int.

Modified:
    subversion/trunk/subversion/libsvn_subr/svn_base64.c

Modified: subversion/trunk/subversion/libsvn_subr/svn_base64.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/svn_base64.c?rev=1126481&r1=1126480&r2=1126481&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/svn_base64.c (original)
+++ subversion/trunk/subversion/libsvn_subr/svn_base64.c Mon May 23 13:11:10 2011
@@ -46,8 +46,8 @@ static const char base64tab[] = "ABCDEFG
 struct encode_baton {
   svn_stream_t *output;
   unsigned char buf[3];         /* Bytes waiting to be encoded */
-  int buflen;                   /* Number of bytes waiting */
-  int linelen;                  /* Bytes output so far on this line */
+  size_t buflen;                /* Number of bytes waiting */
+  size_t linelen;               /* Bytes output so far on this line */
   apr_pool_t *scratch_pool;
 };
 
@@ -74,7 +74,7 @@ encode_group(const unsigned char *in, ch
    STR.  Include newlines every so often if BREAK_LINES is true. */
 static void
 encode_bytes(svn_stringbuf_t *str, const void *data, apr_size_t len,
-             unsigned char *inbuf, int *inbuflen, int *linelen,
+             unsigned char *inbuf, size_t *inbuflen, size_t *linelen,
              svn_boolean_t break_lines)
 {
   char group[4];
@@ -118,7 +118,7 @@ encode_bytes(svn_stringbuf_t *str, const
    LEN must be in the range 0..2.  */
 static void
 encode_partial_group(svn_stringbuf_t *str, const unsigned char *extra,
-                     int len, int linelen, svn_boolean_t break_lines)
+                     size_t len, size_t linelen, svn_boolean_t break_lines)
 {
   unsigned char ingroup[3];
   char outgroup[4];
@@ -204,7 +204,8 @@ svn_base64_encode_string2(const svn_stri
   svn_stringbuf_t *encoded = svn_stringbuf_create("", pool);
   svn_string_t *retval = apr_pcalloc(pool, sizeof(*retval));
   unsigned char ingroup[3];
-  int ingrouplen = 0, linelen = 0;
+  size_t ingrouplen = 0;
+  size_t linelen = 0;
 
   encode_bytes(encoded, str->data, str->len, ingroup, &ingrouplen, &linelen,
                break_lines);
@@ -396,7 +397,8 @@ base64_from_checksum(const svn_checksum_
 {
   svn_stringbuf_t *checksum_str;
   unsigned char ingroup[3];
-  int ingrouplen = 0, linelen = 0;
+  size_t ingrouplen = 0;
+  size_t linelen = 0;
   checksum_str = svn_stringbuf_create("", pool);
 
   encode_bytes(checksum_str, checksum->digest,



Re: svn commit: r1126481 - /subversion/trunk/subversion/libsvn_subr/svn_base64.c

Posted by Greg Stein <gs...@gmail.com>.
On Mon, May 23, 2011 at 09:29, Hyrum K Wright <hy...@hyrumwright.org> wrote:
> On Mon, May 23, 2011 at 6:16 AM, Greg Stein <gs...@gmail.com> wrote:
>>
>> On Mon, May 23, 2011 at 09:11,  <hw...@apache.org> wrote:
>> > Author: hwright
>> > Date: Mon May 23 13:11:10 2011
>> > New Revision: 1126481
>> >
>> > URL: http://svn.apache.org/viewvc?rev=1126481&view=rev
>> > Log:
>> > Remove some integer size mismatch warnings by using size_t in places
>> > where
>> > we calculate pointer differences.
>>
>> Strictly speaking, it is best to use apr_size_t for those old
>> platforms where size_t is not available.
>>
>> That said, I doubt we're running on them nowadays...
>
> This came up in IRC just now, and we did the following on the 1.6.x branch:
>   $ find . -name '*.c' | xargs grep -w 'size_t' | wc -l
>        219
>   $
> It appears we've been releasing code with size_t for quite some time, and we
> haven't heard any complains, so I think we're safe.  :)

"Strictly speaking" :-)

(and its also why pocore doesn't go down that nonsense road...)

Cheers,
-g

Re: svn commit: r1126481 - /subversion/trunk/subversion/libsvn_subr/svn_base64.c

Posted by Hyrum K Wright <hy...@hyrumwright.org>.
On Mon, May 23, 2011 at 6:16 AM, Greg Stein <gs...@gmail.com> wrote:

> On Mon, May 23, 2011 at 09:11,  <hw...@apache.org> wrote:
> > Author: hwright
> > Date: Mon May 23 13:11:10 2011
> > New Revision: 1126481
> >
> > URL: http://svn.apache.org/viewvc?rev=1126481&view=rev
> > Log:
> > Remove some integer size mismatch warnings by using size_t in places
> where
> > we calculate pointer differences.
>
> Strictly speaking, it is best to use apr_size_t for those old
> platforms where size_t is not available.
>
> That said, I doubt we're running on them nowadays...


This came up in IRC just now, and we did the following on the 1.6.x branch:
  $ find . -name '*.c' | xargs grep -w 'size_t' | wc -l
       219
  $

It appears we've been releasing code with size_t for quite some time, and we
haven't heard any complains, so I think we're safe.  :)

-Hyrum

Re: svn commit: r1126481 - /subversion/trunk/subversion/libsvn_subr/svn_base64.c

Posted by Greg Stein <gs...@gmail.com>.
On Mon, May 23, 2011 at 09:11,  <hw...@apache.org> wrote:
> Author: hwright
> Date: Mon May 23 13:11:10 2011
> New Revision: 1126481
>
> URL: http://svn.apache.org/viewvc?rev=1126481&view=rev
> Log:
> Remove some integer size mismatch warnings by using size_t in places where
> we calculate pointer differences.

Strictly speaking, it is best to use apr_size_t for those old
platforms where size_t is not available.

That said, I doubt we're running on them nowadays...

Cheers,
-g