[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: Karl Fogel <kfogel_at_newton.ch.collab.net>
Date: 2002-04-23 17:55:10 CEST

"Sander Striker" <striker@apache.org> writes:
> Got lots of warnings on the windows build. This takes care
> of them. Not sure we want to typecast ourselves into oblivion
> though.
>
> This patch deliberately has no log msg (each cast needs review).
>
> Thoughts?

Gack. I wonder: is there a flag we can pass to VC to suppress this
kind of warning, instead? (Or would that have other undesirable side
effects?)

This patch may take care of the situation now, but the same problem
will be constantly arising in future code. I'd hate to be in a
situation where every code change committed from non-Win32 needs to be
touched up, after the fact, to placate VC. What a pain that would
be...

-K

> Index: ./subversion/libsvn_fs/strings-table.c
> ===================================================================
> --- ./subversion/libsvn_fs/strings-table.c
> +++ ./subversion/libsvn_fs/strings-table.c Tue Apr 23 13:18:13 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 Tue Apr 23 13:18:13 2002
> @@ -445,12 +445,13 @@
> algorithm, and is what has to go when we have a
> true delta combiner. */
> SVN_ERR (rep_read_range (wb->fs, wb->base_rep, sbuf,
> - window->sview_offset, &slen,
> + (apr_size_t)window->sview_offset,
> + &slen,
> wb->trail));
> src_read = 1;
> }
> - memcpy (tbuf + len_read, sbuf + op->offset, op->length);
> - len_read += op->length;
> + memcpy (tbuf + len_read, sbuf + op->offset, (apr_size_t)op->length);
> + len_read += (apr_size_t)op->length;
> }
> break;
>
> @@ -459,7 +460,7 @@
> /* This could be done in bigger blocks, at the expense
> of some more complexity. */
> int t;
> - for (t = op->offset; t < op->offset + op->length; t++)
> + for (t = (int)op->offset; t < op->offset + op->length; t++)
> tbuf[len_read++] = tbuf[t];
> }
> break;
> @@ -468,8 +469,8 @@
> {
> memcpy (tbuf + len_read,
> window->new_data->data + op->offset,
> - op->length);
> - len_read += op->length;
> + (apr_size_t)op->length);
> + len_read += (apr_size_t)op->length;
> }
> break;
>
> Index: ./subversion/libsvn_wc/props.c
> ===================================================================
> --- ./subversion/libsvn_wc/props.c
> +++ ./subversion/libsvn_wc/props.c Tue Apr 23 13:10:06 2002
> @@ -659,19 +659,19 @@
> 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;
> - tmp_prop_base = svn_stringbuf_ncreate (str, len, pool);
> + tmp_prop_base = svn_stringbuf_ncreate (str, (apr_size_t)len, pool);
>
> str = strstr (base_propfile_path->data, SVN_WC_ADM_DIR_NAME);
> len = base_propfile_path->data + base_propfile_path->len - str;
> - real_prop_base = svn_stringbuf_ncreate (str, len, pool);
> + real_prop_base = svn_stringbuf_ncreate (str, (apr_size_t)len, pool);
>
> str = strstr (local_prop_tmp_path->data, SVN_WC_ADM_DIR_NAME);
> len = local_prop_tmp_path->data + local_prop_tmp_path->len - str;
> - tmp_props = svn_stringbuf_ncreate (str, len, pool);
> + tmp_props = svn_stringbuf_ncreate (str, (apr_size_t)len, pool);
>
> str = strstr (local_propfile_path->data, SVN_WC_ADM_DIR_NAME);
> len = local_propfile_path->data + local_propfile_path->len - str;
> - real_props = svn_stringbuf_ncreate (str, len, pool);
> + real_props = svn_stringbuf_ncreate (str, (apr_size_t)len, pool);
>
> /* Write log entry to move pristine tmp copy to real pristine area. */
> svn_xml_make_open_tag (entry_accum,
> Index: ./subversion/libsvn_wc/log.c
> ===================================================================
> --- ./subversion/libsvn_wc/log.c
> +++ ./subversion/libsvn_wc/log.c Tue Apr 23 13:24:19 2002
> @@ -1095,7 +1095,7 @@
> apr_hash_this (hi, &key, &keylen, &val);
> entry = val;
>
> - if ((keylen == strlen (SVN_WC_ENTRY_THIS_DIR))
> + if ((keylen == (apr_ssize_t)strlen (SVN_WC_ENTRY_THIS_DIR))
> && (strcmp ((char *) key, SVN_WC_ENTRY_THIS_DIR) == 0))
> is_this_dir = TRUE;
>
> Index: ./subversion/clients/cmdline/util.c
> ===================================================================
> --- ./subversion/clients/cmdline/util.c
> +++ ./subversion/clients/cmdline/util.c Tue Apr 23 13:24:19 2002
> @@ -463,10 +463,10 @@
> 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 Tue Apr 23 13:24:19 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;
> @@ -341,10 +341,10 @@
> case svn_txdelta_new:
> if (op.length > new_len - npos)
> return -1;
> - npos += op.length;
> + npos += (apr_size_t)op.length;
> break;
> }
> - tpos += op.length;
> + tpos += (apr_size_t)op.length;
> if (tpos < 0)
> return -1;
> n++;
> @@ -415,22 +415,22 @@
> p = decode_int (&val, p, end);
> if (p == NULL)
> return SVN_NO_ERROR;
> - sview_len = val;
> + sview_len = (apr_size_t)val;
>
> p = decode_int (&val, p, end);
> if (p == NULL)
> return SVN_NO_ERROR;
> - tview_len = val;
> + tview_len = (apr_size_t)val;
>
> p = decode_int (&val, p, end);
> if (p == NULL)
> return SVN_NO_ERROR;
> - inslen = val;
> + inslen = (apr_size_t)val;
>
> p = decode_int (&val, p, end);
> if (p == NULL)
> return SVN_NO_ERROR;
> - newlen = val;
> + newlen = (apr_size_t)val;
>
> /* Check for integer overflow (don't want to let the input trick
> us into invalid pointer games using negative numbers). */
> @@ -477,7 +477,7 @@
> if (op->action_code == svn_txdelta_new)
> {
> op->offset = npos;
> - npos += op->length;
> + npos += (apr_size_t)op->length;
> }
> }
> window.num_ops = ninst;
> Index: ./subversion/libsvn_delta/text_delta.c
> ===================================================================
> --- ./subversion/libsvn_delta/text_delta.c
> +++ ./subversion/libsvn_delta/text_delta.c Tue Apr 23 13:18:46 2002
> @@ -155,7 +155,7 @@
> op->action_code = opcode;
> op->offset = bob->new_data->len;
> op->length = length;
> - svn_stringbuf_appendbytes (bob->new_data, new_data, length);
> + svn_stringbuf_appendbytes (bob->new_data, new_data, (apr_size_t)length);
> break;
> default:
> assert (!"unknown delta op.");
> @@ -351,8 +351,8 @@
> case svn_txdelta_source:
> /* Copy from source area. */
> assert (op->offset + op->length <= window->sview_len);
> - memcpy (tbuf + tpos, sbuf + op->offset, op->length);
> - tpos += op->length;
> + memcpy (tbuf + tpos, sbuf + op->offset, (apr_size_t)op->length);
> + tpos += (apr_size_t)op->length;
> break;
>
> case svn_txdelta_target:
> @@ -361,7 +361,7 @@
> and target copies are allowed to overlap to generate
> repeated data. */
> assert (op->offset < tpos);
> - for (i = op->offset; i < op->offset + op->length; i++)
> + for (i = (apr_size_t)op->offset; i < op->offset + op->length; i++)
> tbuf[tpos++] = tbuf[i];
> break;
>
> @@ -370,8 +370,8 @@
> assert (op->offset + op->length <= window->new_data->len);
> memcpy (tbuf + tpos,
> window->new_data->data + op->offset,
> - op->length);
> - tpos += op->length;
> + (apr_size_t)op->length);
> + tpos += (apr_size_t)op->length;
> break;
>
> default:
> @@ -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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Apr 23 17:53:01 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.