[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Remove compiler warnings - take 2

From: <jerenkrantz_at_apache.org>
Date: 2003-01-22 18:06:03 CET

This patch is updated to remove the portions of the code 'fixed' by
the apr_md5* prototype change. For some reason, two other files
generated warnings now. Odd, but they're now in this patch with
resolutions.

Any comments before I commit? (I'll run 'make check' first, of
course.) -- justin

* subversion/libsvn_wc/props.c (svn_wc__conflicting_propchanges_p):
  Rework code that is unreachable. (The answer to the comment is
'no.')
* subversion/libsvn_subr/svn_base64.c
  (encode_baton): Make buf an unsigned char.
  (encode_partial_group): Make extra an unsigned char.
  (svn_base64_encode_string): Make ingroup an unsigned char.
  (svn_base64_from_md5): Attempt to deal with signed/unsigned
mismatch by
  removing some abstractions that only deal with 'char'
* subversion/libsvn_subr/quoprint.c
  (decode_bytes): Make inbuf a char.
  (svn_quoprint_decode_string): Make ingroup a char.
* subversion/libsvn_subr/path.c
  (svn_path_is_child): Rework code that is unreachable by
consolidating the
  only path that returns a non-NULL value.

Index: subversion/libsvn_wc/props.c
===================================================================
--- subversion/libsvn_wc/props.c (revision 4499)
+++ subversion/libsvn_wc/props.c (working copy)
@@ -202,12 +202,9 @@
          local-name, local-value-data, update-value-data);
       return TRUE; /* conflict */
     }
- else
- /* values are the same, so another implicit merge. */
- return FALSE; /* no conflict */

- /* Default (will anyone ever reach this line?) */
- return FALSE; /* no conflict found */
+ /* values are the same, so another implicit merge. */
+ return FALSE; /* no conflict */
 }

Index: subversion/libsvn_subr/svn_base64.c
===================================================================
--- subversion/libsvn_subr/svn_base64.c (revision 4499)
+++ subversion/libsvn_subr/svn_base64.c (working copy)
@@ -40,7 +40,7 @@

 struct encode_baton {
   svn_stream_t *output;
- char buf[3]; /* Bytes waiting to be encoded */
+ unsigned char buf[3]; /* Bytes waiting to be encoded */
   int buflen; /* Number of bytes waiting */
   int linelen; /* Bytes output so far on this line
*/
   apr_pool_t *pool;
@@ -99,8 +99,8 @@
 /* Encode leftover data, if any, and possibly a final newline,
    appending to STR. LEN must be in the range 0..2. */
 static void
-encode_partial_group (svn_stringbuf_t *str, const char *extra, int
len,
- int linelen)
+encode_partial_group (svn_stringbuf_t *str, const unsigned char
*extra,
+ int len, int linelen)
 {
   unsigned char ingroup[3];
   char outgroup[4];
@@ -184,7 +184,7 @@
 svn_base64_encode_string (svn_stringbuf_t *str, apr_pool_t *pool)
 {
   svn_stringbuf_t *encoded = svn_stringbuf_create (, pool);
- char ingroup[3];
+ unsigned char ingroup[3];
   int ingrouplen = 0, linelen = 0;

   encode_bytes (encoded, str-data, str-len, ingroup, ingrouplen,
linelen);
@@ -333,10 +333,17 @@
 svn_base64_from_md5 (unsigned char digest[], apr_pool_t *pool)
 {
   svn_stringbuf_t *md5str;
+ unsigned char ingroup[3];
+ int ingrouplen = 0, linelen = 0;
+ md5str = svn_stringbuf_create (, pool);
+
+ /* This cast is safe because we know encode_bytes does a memcpy and
+ * does an implicit unsigned char * cast.
+ */
+ encode_bytes (md5str, (char*)digest, MD5_DIGESTSIZE, ingroup,
ingrouplen,
+ linelen);
+ encode_partial_group (md5str, ingroup, ingrouplen, linelen);

- md5str = svn_stringbuf_ncreate (digest, MD5_DIGESTSIZE, pool);
- md5str = svn_base64_encode_string (md5str, pool);
-
   /* Our base64-encoding routines append a final newline if any data
      was created at all, so let's hack that off. */
   if ((md5str)-len)
Index: subversion/libsvn_subr/quoprint.c
===================================================================
--- subversion/libsvn_subr/quoprint.c (revision 4499)
+++ subversion/libsvn_subr/quoprint.c (working copy)
@@ -200,7 +200,7 @@
    appended to STR. */
 static void
 decode_bytes (svn_stringbuf_t *str, const char *data, apr_size_t len,
- unsigned char *inbuf, int *inbuflen)
+ char *inbuf, int *inbuflen)
 {
   const char *p, *find1, *find2;
   char c;
@@ -296,7 +296,7 @@
 svn_quoprint_decode_string (svn_stringbuf_t *str, apr_pool_t *pool)
 {
   svn_stringbuf_t *decoded = svn_stringbuf_create (, pool);
- unsigned char ingroup[4];
+ char ingroup[4];
   int ingrouplen = 0;

   decode_bytes (decoded, str-data, str-len, ingroup, ingrouplen);
Index: subversion/libsvn_subr/path.c
===================================================================
--- subversion/libsvn_subr/path.c (revision 4499)
+++ subversion/libsvn_subr/path.c (working copy)
@@ -538,24 +538,16 @@
         return NULL;
     }

- /* Now run through the possibilities. */
+ /* The only possibility for it being child here is when path1 is
now blank,
+ * and path 2 is the beginning of a directory.
+ */

- if (path1[i] (! path2[i]))
+ if ((! path1[i]) path2[i] path2[i] == '/')
     {
- return NULL;
- }
- else if ((! path1[i]) path2[i])
- {
- if (path2[i] == '/')
- return apr_pstrdup (pool, path2 + i + 1);
- else
- return NULL;
- }
- else /* both ended */
- {
- return NULL;
+ return apr_pstrdup (pool, path2 + i + 1);
     }

+ /* Otherwise, path2 isn't a child. */
   return NULL;
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 14 02:06:20 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.