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

RE: [PATCH] VC warnings

From: Sander Striker <striker_at_apache.org>
Date: 2002-04-24 03:13:44 CEST

> From: Greg Stein [mailto:gstein@lyra.org]
> Sent: 23 April 2002 19:58

[...]
> Some of these relate to the issue I filed about adding 'svn_filesize_t'.
> Subversion, as an entire system, should be defined to work with 64-bit-sized
> files. At least from the API sense. Depending upon the local platform, or
> the backend of the FS, or Apache limitations, we might have restrictions
> here and there which will drop it. But the *definition* should be 64-bit
> throughout.

While avoiding the svn_filesize_t, this gets rid of some warnings. Also
it won't conflict with when svn_filesize_t is introduced (I hope ;).

Sander

---
Log:
A 'get rid of warnings' change.  Inspired by Greg Stein.
* subversion/include/svn_delta.h
  (svn_txdelta_op_t): Change type of 'offset'
    and 'length' from apr_off_t to apr_size_t.
* subversion/libsvn_fs/strings-table.c
  (string_read): Cast 'offset' to the type used
    by Berkeley DB.
* subversion/libsvn_fs/reps-strings.c
  (window_handler): Change type of 't' from
    int to apr_size_t.
* subversion/libsvn_wc/props.c
  (svn_wc__merge_prop_diffs): Change type of
    'len' from apr_off_t to apr_size_t.  Also
    add a typecast.
* subversion/libsvn_wc/log.c
  (svn_wc_cleanup): Use Gregs Real Man solution
    to set 'is_this_dir'.
* subversion/clients/cmdline/util.c
  (svn_cl__edit_externally): Add typecasts.
* subversion/libsvn_delta/svndiff.c
  (encode_int): Add typecast.
* subversion/libsvn_delta/text_delta.c
  (apply_window): Add typecasts.
Index: ./subversion/include/svn_delta.h
===================================================================
--- ./subversion/include/svn_delta.h
+++ ./subversion/include/svn_delta.h	Wed Apr 24 02:17:48 2002
@@ -112,8 +112,8 @@
 /* A single text delta instruction.  */
 typedef struct svn_txdelta_op_t {
   enum svn_delta_action action_code;
-  apr_off_t offset;
-  apr_off_t length;
+  apr_size_t offset;
+  apr_size_t length;
 } svn_txdelta_op_t;
 
 
Index: ./subversion/libsvn_fs/strings-table.c
===================================================================
--- ./subversion/libsvn_fs/strings-table.c
+++ ./subversion/libsvn_fs/strings-table.c	Wed Apr 24 02:11:36 2002
@@ -218,7 +218,7 @@
   svn_fs__clear_dbt (&result);
   result.data = buf;
   result.ulen = *len;
-  result.doff = offset;
+  result.doff = (u_int32_t)offset;
   result.dlen = *len;
   result.flags |= (DB_DBT_USERMEM | DB_DBT_PARTIAL);
   db_err = cursor->c_get (cursor, &query, &result, DB_CURRENT);
Index: ./subversion/libsvn_fs/reps-strings.c
===================================================================
--- ./subversion/libsvn_fs/reps-strings.c
+++ ./subversion/libsvn_fs/reps-strings.c	Wed Apr 24 02:23:10 2002
@@ -458,7 +458,7 @@
               {
                 /* This could be done in bigger blocks, at the expense
                    of some more complexity. */
-                int t;
+                apr_size_t t;
                 for (t = op->offset; t < op->offset + op->length; t++)
                   tbuf[len_read++] = tbuf[t];
               }
Index: ./subversion/libsvn_wc/props.c
===================================================================
--- ./subversion/libsvn_wc/props.c
+++ ./subversion/libsvn_wc/props.c	Wed Apr 24 02:43:34 2002
@@ -452,7 +452,7 @@
   int i;
   svn_boolean_t is_dir;
   const char * str;
-  apr_off_t len;
+  apr_size_t len;
   
   /* Zillions of pathnames to compute!  yeargh!  */
   svn_stringbuf_t *base_propfile_path, *local_propfile_path;
@@ -658,7 +658,7 @@
      paths are RELATIVE pathnames (each beginning with ".svn/"), so
      that each .svn subdir remains separable when executing run_log().  */
   str = strstr (base_prop_tmp_path->data, SVN_WC_ADM_DIR_NAME);
-  len = base_prop_tmp_path->data + base_prop_tmp_path->len - str;
+  len = (apr_size_t)(base_prop_tmp_path->data - str) + base_prop_tmp_path->len;
   tmp_prop_base = svn_stringbuf_ncreate (str, len, pool);
 
   str = strstr (base_propfile_path->data, SVN_WC_ADM_DIR_NAME);
Index: ./subversion/libsvn_wc/log.c
===================================================================
--- ./subversion/libsvn_wc/log.c
+++ ./subversion/libsvn_wc/log.c	Wed Apr 24 02:33:56 2002
@@ -1090,14 +1090,17 @@
       apr_ssize_t keylen;
       void *val;
       svn_wc_entry_t *entry;
-      svn_boolean_t is_this_dir = FALSE;
+      svn_boolean_t is_this_dir;
 
       apr_hash_this (hi, &key, &keylen, &val);
       entry = val;
 
-      if ((keylen == strlen (SVN_WC_ENTRY_THIS_DIR))
-          && (strcmp ((char *) key, SVN_WC_ENTRY_THIS_DIR) == 0))
-        is_this_dir = TRUE;
+#define KLEN (sizeof(SVN_WC_ENTRY_THIS_DIR) - 1)
+
+      is_this_dir = keylen == KLEN
+                    && memcmp(key, SVN_WC_ENTRY_THIS_DIR, KLEN) == 0;
+
+#undef KLEN
 
       if ((entry->kind == svn_node_dir) && (! is_this_dir))
         {
Index: ./subversion/clients/cmdline/util.c
===================================================================
--- ./subversion/clients/cmdline/util.c
+++ ./subversion/clients/cmdline/util.c	Wed Apr 24 02:36:09 2002
@@ -463,10 +463,11 @@
       else
         {
           /* Read the entire file into memory. */
-          svn_stringbuf_ensure (new_contents, finfo_after.size + 1);
+          svn_stringbuf_ensure (new_contents,
+                                (apr_size_t)(finfo_after.size + 1));
           apr_err = apr_file_read_full (tmp_file, 
                                         new_contents->data, 
-                                        finfo_after.size,
+                                        (apr_size_t)finfo_after.size,
                                         &(new_contents->len));
           new_contents->data[new_contents->len] = 0;
           
Index: ./subversion/libsvn_delta/svndiff.c
===================================================================
--- ./subversion/libsvn_delta/svndiff.c
+++ ./subversion/libsvn_delta/svndiff.c	Wed Apr 24 02:36:38 2002
@@ -80,7 +80,7 @@
   while (--n >= 0)
     {
       cont = ((n > 0) ? 0x1 : 0x0) << 7;
-      *p++ = ((val >> (n * 7)) & 0x7f) | cont;
+      *p++ = (char)(((val >> (n * 7)) & 0x7f) | cont);
     }
 
   return p;
Index: ./subversion/libsvn_delta/text_delta.c
===================================================================
--- ./subversion/libsvn_delta/text_delta.c
+++ ./subversion/libsvn_delta/text_delta.c	Wed Apr 24 02:43:02 2002
@@ -421,7 +421,7 @@
        * overlap to the beginning of the new buffer.  */
       if (ab->sbuf_offset + ab->sbuf_len > window->sview_offset)
         {
-          apr_size_t start = window->sview_offset - ab->sbuf_offset;
+          apr_size_t start = (apr_size_t)(window->sview_offset - ab->sbuf_offset);
           memmove (ab->sbuf, old_sbuf + start, ab->sbuf_len - start);
           ab->sbuf_len -= start;
         }
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Apr 24 03:07:45 2002

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.