Author: hwright Date: Mon Oct 4 16:30:08 2010 New Revision: 1004314 URL: http://svn.apache.org/viewvc?rev=1004314&view=rev Log: Tighten variable scope in many locations.
Found by: Philipp Kloke <[email protected]> * subversion/libsvn_diff/diff_file.c, subversion/libsvn_subr/error.c, subversion/libsvn_subr/opt.c, subversion/libsvn_subr/dirent_uri.c, subversion/libsvn_subr/deprecated.c, subversion/libsvn_subr/io.c, subversion/libsvn_ra_local/ra_plugin.c, subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c, subversion/mod_dav_svn/reports/update.c, subversion/tests/svn_test_main.c, subversion/svndumpfilter/main.c, subversion/libsvn_ra_svn/cyrus_auth.c, subversion/libsvn_ra_svn/marshal.c, subversion/svn/propdel-cmd.c, subversion/svn/propget-cmd.c, subversion/svn/log-cmd.c, subversion/svn/propset-cmd.c, subversion/svn/switch-cmd.c, subversion/svn/proplist-cmd.c, subversion/svn/propedit-cmd.c, subversion/libsvn_fs_base/tree.c, subversion/libsvn_fs_base/revs-txns.c, subversion/libsvn_wc/deprecated.c, subversion/libsvn_wc/update_editor.c, subversion/libsvn_wc/old-and-busted.c, subversion/libsvn_wc/wc_db.c, subversion/svnlook/main.c, subversion/libsvn_client/export.c, subversion/libsvn_client/patch.c, subversion/libsvn_client/merge.c, subversion/libsvn_client/mergeinfo.c, subversion/libsvn_ra_neon/mergeinfo.c, subversion/libsvn_ra_serf/mergeinfo.c, subversion/libsvn_repos/reporter.c, subversion/libsvn_repos/fs-wrap.c, subversion/libsvn_repos/delta.c, subversion/svnserve/serve.c: Tighten variable scope. Modified: subversion/trunk/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c subversion/trunk/subversion/libsvn_client/export.c subversion/trunk/subversion/libsvn_client/merge.c subversion/trunk/subversion/libsvn_client/mergeinfo.c subversion/trunk/subversion/libsvn_client/patch.c subversion/trunk/subversion/libsvn_diff/diff_file.c subversion/trunk/subversion/libsvn_fs_base/revs-txns.c subversion/trunk/subversion/libsvn_fs_base/tree.c subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c subversion/trunk/subversion/libsvn_ra_neon/mergeinfo.c subversion/trunk/subversion/libsvn_ra_serf/mergeinfo.c subversion/trunk/subversion/libsvn_ra_svn/cyrus_auth.c subversion/trunk/subversion/libsvn_ra_svn/marshal.c subversion/trunk/subversion/libsvn_repos/delta.c subversion/trunk/subversion/libsvn_repos/fs-wrap.c subversion/trunk/subversion/libsvn_repos/reporter.c subversion/trunk/subversion/libsvn_subr/deprecated.c subversion/trunk/subversion/libsvn_subr/dirent_uri.c subversion/trunk/subversion/libsvn_subr/error.c subversion/trunk/subversion/libsvn_subr/io.c subversion/trunk/subversion/libsvn_subr/opt.c subversion/trunk/subversion/libsvn_wc/deprecated.c subversion/trunk/subversion/libsvn_wc/old-and-busted.c subversion/trunk/subversion/libsvn_wc/update_editor.c subversion/trunk/subversion/libsvn_wc/wc_db.c subversion/trunk/subversion/mod_dav_svn/reports/update.c subversion/trunk/subversion/svn/log-cmd.c subversion/trunk/subversion/svn/propdel-cmd.c subversion/trunk/subversion/svn/propedit-cmd.c subversion/trunk/subversion/svn/propget-cmd.c subversion/trunk/subversion/svn/proplist-cmd.c subversion/trunk/subversion/svn/propset-cmd.c subversion/trunk/subversion/svn/switch-cmd.c subversion/trunk/subversion/svndumpfilter/main.c subversion/trunk/subversion/svnlook/main.c subversion/trunk/subversion/svnserve/serve.c subversion/trunk/subversion/tests/svn_test_main.c Modified: subversion/trunk/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c (original) +++ subversion/trunk/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c Mon Oct 4 16:30:08 2010 @@ -1417,7 +1417,6 @@ static apr_status_t io_handle_cleanup(vo svn_error_t *svn_swig_pl_make_stream(svn_stream_t **stream, SV *obj) { IO *io; - int simple_type = 1; if (!SvOK(obj)) { *stream = NULL; @@ -1425,6 +1424,7 @@ svn_error_t *svn_swig_pl_make_stream(svn } if (obj && sv_isobject(obj)) { + int simple_type = 1; if (sv_derived_from(obj, "SVN::Stream")) svn_swig_pl_callback_thunk(CALL_METHOD, (void *)"svn_stream", &obj, "O", obj); Modified: subversion/trunk/subversion/libsvn_client/export.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/export.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_client/export.c (original) +++ subversion/trunk/subversion/libsvn_client/export.c Mon Oct 4 16:30:08 2010 @@ -300,7 +300,6 @@ copy_versioned_files(const char *from, const char *to_abspath; svn_node_kind_t from_kind; svn_depth_t node_depth; - int j; SVN_ERR(svn_dirent_get_absolute(&from_abspath, from, pool)); SVN_ERR(svn_dirent_get_absolute(&to_abspath, to, pool)); @@ -350,6 +349,7 @@ copy_versioned_files(const char *from, if (from_kind == svn_node_dir) { apr_fileperms_t perm = APR_OS_DEFAULT; + int j; /* Try to make the new directory. If this fails because the directory already exists, check our FORCE flag to see if we Modified: subversion/trunk/subversion/libsvn_client/merge.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_client/merge.c (original) +++ subversion/trunk/subversion/libsvn_client/merge.c Mon Oct 4 16:30:08 2010 @@ -1121,8 +1121,6 @@ merge_props_changed(const char *local_di definition, 'svn merge' shouldn't touch any data within .svn/ */ if (props->nelts) { - int i; - /* If this is a forward merge then don't add new mergeinfo to PATH that is already part of PATH's own history, see http://svn.haxx.se/dev/archive-2008-09/0006.shtml. If the @@ -1150,6 +1148,8 @@ merge_props_changed(const char *local_di is having its existing mergeinfo deleted. */ if (!merge_b->dry_run) { + int i; + for (i = 0; i < props->nelts; ++i) { svn_prop_t *prop = &APR_ARRAY_IDX(props, i, svn_prop_t); @@ -6596,7 +6596,6 @@ do_file_merge(svn_mergeinfo_catalog_t re svn_merge_range_t range; svn_mergeinfo_t target_mergeinfo; svn_merge_range_t *conflicted_range = NULL; - int i; svn_boolean_t indirect = FALSE; apr_pool_t *subpool; svn_boolean_t is_rollback = (revision1 > revision2); @@ -6676,6 +6675,7 @@ do_file_merge(svn_mergeinfo_catalog_t re if (!merge_b->record_only) { apr_array_header_t *ranges_to_merge = remaining_ranges; + int i; /* If we have ancestrally related sources and more than one range to merge, eliminate no-op ranges before going through Modified: subversion/trunk/subversion/libsvn_client/mergeinfo.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/mergeinfo.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_client/mergeinfo.c (original) +++ subversion/trunk/subversion/libsvn_client/mergeinfo.c Mon Oct 4 16:30:08 2010 @@ -1258,11 +1258,12 @@ static svn_mergeinfo_t find_nearest_ancestor(const apr_array_header_t *depth_first_catalog_index, const char *abs_repos_path) { - int i; int ancestor_index = -1; if (depth_first_catalog_index) { + int i; + for (i = 0; i < depth_first_catalog_index->nelts; i++) { svn_sort__item_t item = APR_ARRAY_IDX(depth_first_catalog_index, i, Modified: subversion/trunk/subversion/libsvn_client/patch.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_client/patch.c (original) +++ subversion/trunk/subversion/libsvn_client/patch.c Mon Oct 4 16:30:08 2010 @@ -939,7 +939,6 @@ scan_for_match(svn_linenum_t *matched_li ! content_info->eof) { svn_boolean_t matched; - int i; svn_pool_clear(iterpool); @@ -951,6 +950,7 @@ scan_for_match(svn_linenum_t *matched_li if (matched) { svn_boolean_t taken = FALSE; + int i; /* Don't allow hunks to match at overlapping locations. */ for (i = 0; i < content_info->hunks->nelts; i++) Modified: subversion/trunk/subversion/libsvn_diff/diff_file.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_diff/diff_file.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_diff/diff_file.c (original) +++ subversion/trunk/subversion/libsvn_diff/diff_file.c Mon Oct 4 16:30:08 2010 @@ -1130,11 +1130,11 @@ svn_diff_file_output_unified3(svn_stream apr_pool_t *pool) { svn_diff__file_output_baton_t baton; - int i; if (svn_diff_contains_diffs(diff)) { const char **c; + int i; memset(&baton, 0, sizeof(baton)); baton.output_stream = output_stream; Modified: subversion/trunk/subversion/libsvn_fs_base/revs-txns.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_base/revs-txns.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_fs_base/revs-txns.c (original) +++ subversion/trunk/subversion/libsvn_fs_base/revs-txns.c Mon Oct 4 16:30:08 2010 @@ -1159,7 +1159,6 @@ svn_fs_base__purge_txn(svn_fs_t *fs, { struct cleanup_txn_args args; transaction_t *txn; - int i; SVN_ERR(svn_fs__check_fs(fs, TRUE)); @@ -1182,6 +1181,8 @@ svn_fs_base__purge_txn(svn_fs_t *fs, /* Kill the transaction's copies (which should gracefully...). */ if (txn->copies) { + int i; + for (i = 0; i < txn->copies->nelts; i++) { SVN_ERR(svn_fs_base__retry_txn Modified: subversion/trunk/subversion/libsvn_fs_base/tree.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_base/tree.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_fs_base/tree.c (original) +++ subversion/trunk/subversion/libsvn_fs_base/tree.c Mon Oct 4 16:30:08 2010 @@ -1775,7 +1775,7 @@ deltify_mutable(svn_fs_t *fs, For 1.6 and beyond, we just deltify the current node against its predecessors, using skip deltas similar to the way FSFS does. */ - int pred_count, nlevels, lev, count; + int pred_count; const svn_fs_id_t *pred_id; struct txn_pred_count_args tpc_args; apr_pool_t *subpools[2]; @@ -1861,6 +1861,8 @@ deltify_mutable(svn_fs_t *fs, } else { + int nlevels, lev, count; + /**** REVERSE DELTA STORAGE ****/ /* Decide how many predecessors to redeltify. To save overhead, Modified: subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c (original) +++ subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c Mon Oct 4 16:30:08 2010 @@ -250,7 +250,6 @@ make_reporter(svn_ra_session_t *session, { svn_ra_local__session_baton_t *sess = session->priv; void *rbaton; - size_t repos_url_len; const char *other_fs_path = NULL; const char *repos_url_decoded; @@ -262,6 +261,8 @@ make_reporter(svn_ra_session_t *session, regular filesystem path. */ if (other_url) { + size_t repos_url_len; + other_url = svn_path_uri_decode(other_url, pool); repos_url_decoded = svn_path_uri_decode(sess->repos_url, pool); repos_url_len = strlen(repos_url_decoded); @@ -872,13 +873,14 @@ svn_ra_local__get_log(svn_ra_session_t * apr_pool_t *pool) { svn_ra_local__session_baton_t *sess = session->priv; - int i; struct log_baton lb; apr_array_header_t *abs_paths = apr_array_make(pool, 0, sizeof(const char *)); if (paths) { + int i; + for (i = 0; i < paths->nelts; i++) { const char *relative_path = APR_ARRAY_IDX(paths, i, const char *); Modified: subversion/trunk/subversion/libsvn_ra_neon/mergeinfo.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_neon/mergeinfo.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_ra_neon/mergeinfo.c (original) +++ subversion/trunk/subversion/libsvn_ra_neon/mergeinfo.c Mon Oct 4 16:30:08 2010 @@ -166,7 +166,7 @@ svn_ra_neon__get_mergeinfo(svn_ra_sessio svn_boolean_t include_descendants, apr_pool_t *pool) { - int i, status_code; + int status_code; svn_ra_neon__session_t *ras = session->priv; svn_stringbuf_t *request_body = svn_stringbuf_create("", pool); struct mergeinfo_baton mb; @@ -204,6 +204,8 @@ svn_ra_neon__get_mergeinfo(svn_ra_sessio if (paths) { + int i; + for (i = 0; i < paths->nelts; i++) { const char *this_path = Modified: subversion/trunk/subversion/libsvn_ra_serf/mergeinfo.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/mergeinfo.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_ra_serf/mergeinfo.c (original) +++ subversion/trunk/subversion/libsvn_ra_serf/mergeinfo.c Mon Oct 4 16:30:08 2010 @@ -184,7 +184,6 @@ create_mergeinfo_body(serf_bucket_t **bk { mergeinfo_context_t *mergeinfo_ctx = baton; serf_bucket_t *body_bkt; - int i; body_bkt = serf_bucket_aggregate_create(alloc); @@ -209,6 +208,8 @@ create_mergeinfo_body(serf_bucket_t **bk if (mergeinfo_ctx->paths) { + int i; + for (i = 0; i < mergeinfo_ctx->paths->nelts; i++) { const char *this_path = APR_ARRAY_IDX(mergeinfo_ctx->paths, Modified: subversion/trunk/subversion/libsvn_ra_svn/cyrus_auth.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/cyrus_auth.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_ra_svn/cyrus_auth.c (original) +++ subversion/trunk/subversion/libsvn_ra_svn/cyrus_auth.c Mon Oct 4 16:30:08 2010 @@ -632,10 +632,11 @@ svn_error_t *svn_ra_svn__enable_sasl_enc apr_pool_t *pool) { const sasl_ssf_t *ssfp; - int result; if (! conn->encrypted) { + int result; + /* Get the strength of the security layer. */ result = sasl_getprop(sasl_ctx, SASL_SSF, (void*) &ssfp); if (result != SASL_OK) Modified: subversion/trunk/subversion/libsvn_ra_svn/marshal.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/marshal.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_ra_svn/marshal.c (original) +++ subversion/trunk/subversion/libsvn_ra_svn/marshal.c Mon Oct 4 16:30:08 2010 @@ -582,7 +582,7 @@ static svn_error_t *read_item(svn_ra_svn int level) { char c = first_char; - apr_uint64_t val, prev_val=0; + apr_uint64_t val; svn_stringbuf_t *str; svn_ra_svn_item_t *listitem; @@ -600,7 +600,7 @@ static svn_error_t *read_item(svn_ra_svn val = c - '0'; while (1) { - prev_val = val; + apr_uint64_t prev_val = val; SVN_ERR(readbuf_getchar(conn, pool, &c)); if (!svn_ctype_isdigit(c)) break; Modified: subversion/trunk/subversion/libsvn_repos/delta.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/delta.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_repos/delta.c (original) +++ subversion/trunk/subversion/libsvn_repos/delta.c Mon Oct 4 16:30:08 2010 @@ -965,7 +965,6 @@ delta_dirs(struct context *c, entries hash? */ if (s_entries && ((s_entry = apr_hash_get(s_entries, key, klen)) != 0)) { - int distance; svn_node_kind_t src_kind; s_fullpath = svn_path_join(source_path, t_entry->name, subpool); @@ -984,7 +983,7 @@ delta_dirs(struct context *c, old one and add the new one. 1: means the nodes are related through ancestry, so go ahead and do the replace directly. */ - distance = svn_fs_compare_ids(s_entry->id, t_entry->id); + int distance = svn_fs_compare_ids(s_entry->id, t_entry->id); if (distance == 0) { /* no-op */ Modified: subversion/trunk/subversion/libsvn_repos/fs-wrap.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/fs-wrap.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_repos/fs-wrap.c (original) +++ subversion/trunk/subversion/libsvn_repos/fs-wrap.c Mon Oct 4 16:30:08 2010 @@ -276,7 +276,6 @@ svn_repos_fs_change_rev_prop4(svn_repos_ apr_pool_t *pool) { svn_repos_revision_access_level_t readability; - char action; SVN_ERR(svn_repos_check_revision_access(&readability, repos, rev, authz_read_func, authz_read_baton, @@ -285,6 +284,7 @@ svn_repos_fs_change_rev_prop4(svn_repos_ if (readability == svn_repos_revision_access_full) { const svn_string_t *old_value; + char action; SVN_ERR(validate_prop(name, new_value, pool)); @@ -612,7 +612,6 @@ svn_repos_fs_get_mergeinfo(svn_mergeinfo apr_array_header_t *readable_paths = (apr_array_header_t *) paths; svn_fs_root_t *root; apr_pool_t *iterpool = svn_pool_create(pool); - int i; if (!SVN_IS_VALID_REVNUM(rev)) SVN_ERR(svn_fs_youngest_rev(&rev, repos->fs, pool)); @@ -621,6 +620,8 @@ svn_repos_fs_get_mergeinfo(svn_mergeinfo /* Filter out unreadable paths before divining merge tracking info. */ if (authz_read_func) { + int i; + for (i = 0; i < paths->nelts; i++) { svn_boolean_t readable; Modified: subversion/trunk/subversion/libsvn_repos/reporter.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/reporter.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_repos/reporter.c (original) +++ subversion/trunk/subversion/libsvn_repos/reporter.c Mon Oct 4 16:30:08 2010 @@ -760,7 +760,6 @@ update_entry(report_baton_t *b, svn_revn void *new_baton; svn_checksum_t *checksum; const char *hex_digest; - int distance; /* For non-switch operations, follow link_path in the target. */ if (info && info->link_path && !b->is_switch) @@ -798,7 +797,7 @@ update_entry(report_baton_t *b, svn_revn related = FALSE; if (s_entry && t_entry && s_entry->kind == t_entry->kind) { - distance = svn_fs_compare_ids(s_entry->id, t_entry->id); + int distance = svn_fs_compare_ids(s_entry->id, t_entry->id); if (distance == 0 && !any_path_info(b, e_path) && (!info || (!info->start_empty && !info->lock_token)) && (requested_depth <= wc_depth || t_entry->kind == svn_node_file)) Modified: subversion/trunk/subversion/libsvn_subr/deprecated.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/deprecated.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_subr/deprecated.c (original) +++ subversion/trunk/subversion/libsvn_subr/deprecated.c Mon Oct 4 16:30:08 2010 @@ -549,17 +549,20 @@ svn_opt_print_help(apr_getopt_t *os, apr_pool_t *pool) { apr_array_header_t *targets = NULL; - int i; if (os) SVN_ERR(svn_opt_parse_all_args(&targets, os, pool)); if (os && targets->nelts) /* help on subcommand(s) requested */ - for (i = 0; i < targets->nelts; i++) - { - svn_opt_subcommand_help(APR_ARRAY_IDX(targets, i, const char *), - cmd_table, option_table, pool); - } + { + int i; + + for (i = 0; i < targets->nelts; i++) + { + svn_opt_subcommand_help(APR_ARRAY_IDX(targets, i, const char *), + cmd_table, option_table, pool); + } + } else if (print_version) /* just --version */ SVN_ERR(svn_opt__print_version_info(pgm_name, version_footer, quiet, pool)); Modified: subversion/trunk/subversion/libsvn_subr/dirent_uri.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/dirent_uri.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_subr/dirent_uri.c (original) +++ subversion/trunk/subversion/libsvn_subr/dirent_uri.c Mon Oct 4 16:30:08 2010 @@ -1936,10 +1936,9 @@ svn_dirent_condense_targets(const char * apr_pool_t *result_pool, apr_pool_t *scratch_pool) { - int i, j, num_condensed = targets->nelts; + int i, num_condensed = targets->nelts; svn_boolean_t *removed; apr_array_header_t *abs_targets; - size_t basedir_len; /* Early exit when there's no data to work on. */ if (targets->nelts <= 0) @@ -1995,6 +1994,8 @@ svn_dirent_condense_targets(const char * if (pcondensed_targets != NULL) { + size_t basedir_len; + if (remove_redundancies) { /* Find the common part of each pair of targets. If @@ -2006,6 +2007,8 @@ svn_dirent_condense_targets(const char * another non-removed target, remove the child. */ for (i = 0; i < abs_targets->nelts; ++i) { + int j; + if (removed[i]) continue; @@ -2101,10 +2104,9 @@ svn_uri_condense_targets(const char **pc apr_pool_t *result_pool, apr_pool_t *scratch_pool) { - int i, j, num_condensed = targets->nelts; + int i, num_condensed = targets->nelts; apr_array_header_t *uri_targets; svn_boolean_t *removed; - size_t basedir_len; /* Early exit when there's no data to work on. */ if (targets->nelts <= 0) @@ -2156,6 +2158,8 @@ svn_uri_condense_targets(const char **pc if (pcondensed_targets != NULL) { + size_t basedir_len; + if (remove_redundancies) { /* Find the common part of each pair of targets. If @@ -2167,6 +2171,8 @@ svn_uri_condense_targets(const char **pc another non-removed target, remove the child. */ for (i = 0; i < uri_targets->nelts; ++i) { + int j; + if (removed[i]) continue; Modified: subversion/trunk/subversion/libsvn_subr/error.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/error.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_subr/error.c (original) +++ subversion/trunk/subversion/libsvn_subr/error.c Mon Oct 4 16:30:08 2010 @@ -485,11 +485,12 @@ svn_handle_error2(svn_error_t *err, tmp_err = err; while (tmp_err) { - int i; svn_boolean_t printed_already = FALSE; if (! tmp_err->message) { + int i; + for (i = 0; i < empties->nelts; i++) { if (tmp_err->apr_err == APR_ARRAY_IDX(empties, i, apr_status_t) ) Modified: subversion/trunk/subversion/libsvn_subr/io.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/io.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_subr/io.c (original) +++ subversion/trunk/subversion/libsvn_subr/io.c Mon Oct 4 16:30:08 2010 @@ -2561,7 +2561,6 @@ svn_io_parse_mimetypes_file(apr_hash_t * { apr_array_header_t *tokens; const char *type; - int i; svn_pool_clear(subpool); @@ -2573,6 +2572,8 @@ svn_io_parse_mimetypes_file(apr_hash_t * /* Only pay attention to non-empty, non-comment lines. */ if (buf->len) { + int i; + if (buf->data[0] == '#') continue; Modified: subversion/trunk/subversion/libsvn_subr/opt.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/opt.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_subr/opt.c (original) +++ subversion/trunk/subversion/libsvn_subr/opt.c Mon Oct 4 16:30:08 2010 @@ -88,18 +88,21 @@ svn_opt_get_option_from_code2(int code, for (i = 0; option_table[i].optch; i++) if (option_table[i].optch == code) { - int j; if (command) - for (j = 0; ((j < SVN_OPT_MAX_OPTIONS) && - command->desc_overrides[j].optch); j++) - if (command->desc_overrides[j].optch == code) - { - apr_getopt_option_t *tmpopt = - apr_palloc(pool, sizeof(*tmpopt)); - *tmpopt = option_table[i]; - tmpopt->description = command->desc_overrides[j].desc; - return tmpopt; - } + { + int j; + + for (j = 0; ((j < SVN_OPT_MAX_OPTIONS) && + command->desc_overrides[j].optch); j++) + if (command->desc_overrides[j].optch == code) + { + apr_getopt_option_t *tmpopt = + apr_palloc(pool, sizeof(*tmpopt)); + *tmpopt = option_table[i]; + tmpopt->description = command->desc_overrides[j].desc; + return tmpopt; + } + } return &(option_table[i]); } @@ -1031,18 +1034,21 @@ svn_opt_print_help3(apr_getopt_t *os, apr_pool_t *pool) { apr_array_header_t *targets = NULL; - int i; if (os) SVN_ERR(svn_opt_parse_all_args(&targets, os, pool)); if (os && targets->nelts) /* help on subcommand(s) requested */ - for (i = 0; i < targets->nelts; i++) - { - svn_opt_subcommand_help3(APR_ARRAY_IDX(targets, i, const char *), - cmd_table, option_table, - global_options, pool); - } + { + int i; + + for (i = 0; i < targets->nelts; i++) + { + svn_opt_subcommand_help3(APR_ARRAY_IDX(targets, i, const char *), + cmd_table, option_table, + global_options, pool); + } + } else if (print_version) /* just --version */ SVN_ERR(svn_opt__print_version_info(pgm_name, version_footer, quiet, pool)); Modified: subversion/trunk/subversion/libsvn_wc/deprecated.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/deprecated.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_wc/deprecated.c (original) +++ subversion/trunk/subversion/libsvn_wc/deprecated.c Mon Oct 4 16:30:08 2010 @@ -2064,7 +2064,6 @@ svn_wc_parse_externals_description2(apr_ { apr_array_header_t *list; apr_pool_t *subpool = svn_pool_create(pool); - int i; SVN_ERR(svn_wc_parse_externals_description3(externals_p ? &list : NULL, parent_directory, desc, @@ -2072,6 +2071,8 @@ svn_wc_parse_externals_description2(apr_ if (externals_p) { + int i; + *externals_p = apr_array_make(pool, list->nelts, sizeof(svn_wc_external_item_t *)); for (i = 0; i < list->nelts; i++) @@ -2103,7 +2104,6 @@ svn_wc_parse_externals_description(apr_h apr_pool_t *pool) { apr_array_header_t *list; - int i; SVN_ERR(svn_wc_parse_externals_description2(externals_p ? &list : NULL, parent_directory, desc, pool)); @@ -2111,6 +2111,8 @@ svn_wc_parse_externals_description(apr_h /* Store all of the items into the hash if that was requested. */ if (externals_p) { + int i; + *externals_p = apr_hash_make(pool); for (i = 0; i < list->nelts; i++) { Modified: subversion/trunk/subversion/libsvn_wc/old-and-busted.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/old-and-busted.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_wc/old-and-busted.c (original) +++ subversion/trunk/subversion/libsvn_wc/old-and-busted.c Mon Oct 4 16:30:08 2010 @@ -1194,7 +1194,6 @@ svn_wc__read_entries_old(apr_hash_t **en char *curp; const char *endp; svn_wc_entry_t *entry; - int entryno, entries_format; svn_stream_t *stream; svn_string_t *buf; @@ -1216,6 +1215,7 @@ svn_wc__read_entries_old(apr_hash_t **en result_pool, scratch_pool)); else { + int entryno, entries_format; const char *val; /* Read the format line from the entries file. In case we're in the Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_wc/update_editor.c (original) +++ subversion/trunk/subversion/libsvn_wc/update_editor.c Mon Oct 4 16:30:08 2010 @@ -4304,7 +4304,6 @@ close_file(void *file_baton, * a text conflict. So flag a tree conflict here. */ if (fb->adding_file && fb->add_existed) { - int i; svn_boolean_t local_is_link = FALSE; svn_boolean_t incoming_is_link = FALSE; @@ -4323,6 +4322,8 @@ close_file(void *file_baton, } else { + int i; + for (i = 0; i < regular_props->nelts; ++i) { const svn_prop_t *prop = &APR_ARRAY_IDX(regular_props, i, Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_wc/wc_db.c (original) +++ subversion/trunk/subversion/libsvn_wc/wc_db.c Mon Oct 4 16:30:08 2010 @@ -7822,7 +7822,7 @@ svn_wc__db_node_hidden(svn_boolean_t *hi { svn_wc__db_pdh_t *pdh; const char *local_relpath; - svn_wc__db_status_t work_status, base_status; + svn_wc__db_status_t base_status; svn_sqlite__stmt_t *stmt; svn_boolean_t have_row; #ifdef SVN_WC__NODES @@ -7868,7 +7868,8 @@ svn_wc__db_node_hidden(svn_boolean_t *hi { /* Note: this can ONLY be an add/copy-here/move-here. It is not possible to delete a "hidden" node. */ - work_status = svn_sqlite__column_token(stmt, 0, presence_map); + svn_wc__db_status_t work_status = + svn_sqlite__column_token(stmt, 0, presence_map); *hidden = (work_status == svn_wc__db_status_excluded); SVN_ERR(svn_sqlite__reset(stmt)); return SVN_NO_ERROR; Modified: subversion/trunk/subversion/mod_dav_svn/reports/update.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/reports/update.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/mod_dav_svn/reports/update.c (original) +++ subversion/trunk/subversion/mod_dav_svn/reports/update.c Mon Oct 4 16:30:08 2010 @@ -409,8 +409,6 @@ open_helper(svn_boolean_t is_dir, static svn_error_t * close_helper(svn_boolean_t is_dir, item_baton_t *baton) { - int i; - if (baton->uc->resource_walk) return SVN_NO_ERROR; @@ -419,6 +417,7 @@ close_helper(svn_boolean_t is_dir, item_ if (baton->removed_props && (! baton->added || baton->copyfrom)) { const char *qname; + int i; for (i = 0; i < baton->removed_props->nelts; i++) { Modified: subversion/trunk/subversion/svn/log-cmd.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/log-cmd.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/svn/log-cmd.c (original) +++ subversion/trunk/subversion/svn/log-cmd.c Mon Oct 4 16:30:08 2010 @@ -163,9 +163,6 @@ log_entry_receiver(void *baton, const char *date; const char *message; - /* Number of lines in the msg. */ - int lines; - if (lb->ctx->cancel_func) SVN_ERR(lb->ctx->cancel_func(lb->ctx->cancel_baton)); @@ -201,7 +198,9 @@ log_entry_receiver(void *baton, if (message != NULL) { - lines = svn_cstring_count_newlines(message) + 1; + /* Number of lines in the msg. */ + int lines = svn_cstring_count_newlines(message) + 1; + SVN_ERR(svn_cmdline_printf(pool, Q_(" | %d line", " | %d lines", lines), lines)); Modified: subversion/trunk/subversion/svn/propdel-cmd.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/propdel-cmd.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/svn/propdel-cmd.c (original) +++ subversion/trunk/subversion/svn/propdel-cmd.c Mon Oct 4 16:30:08 2010 @@ -71,7 +71,6 @@ svn_cl__propdel(apr_getopt_t *os, const char *pname, *pname_utf8; apr_array_header_t *args, *targets; struct notify_wrapper_baton nwb = { 0 }; - int i; /* Get the property's name (and a UTF-8 version of that name). */ SVN_ERR(svn_opt_parse_num_args(&args, os, 1, pool)); @@ -121,6 +120,7 @@ svn_cl__propdel(apr_getopt_t *os, else /* operate on a normal, versioned property (not a revprop) */ { apr_pool_t *subpool = svn_pool_create(pool); + int i; if (opt_state->depth == svn_depth_unknown) opt_state->depth = svn_depth_empty; Modified: subversion/trunk/subversion/svn/propedit-cmd.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/propedit-cmd.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/svn/propedit-cmd.c (original) +++ subversion/trunk/subversion/svn/propedit-cmd.c Mon Oct 4 16:30:08 2010 @@ -76,7 +76,6 @@ svn_cl__propedit(apr_getopt_t *os, svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx; const char *pname, *pname_utf8; apr_array_header_t *args, *targets; - int i; /* Validate the input and get the property's name (and a UTF-8 version of that name). */ @@ -177,6 +176,7 @@ svn_cl__propedit(apr_getopt_t *os, { apr_pool_t *subpool = svn_pool_create(pool); struct commit_info_baton cib; + int i; /* The customary implicit dot rule has been prone to user error * here. For example, Jon Trowbridge <[email protected]> did Modified: subversion/trunk/subversion/svn/propget-cmd.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/propget-cmd.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/svn/propget-cmd.c (original) +++ subversion/trunk/subversion/svn/propget-cmd.c Mon Oct 4 16:30:08 2010 @@ -190,7 +190,6 @@ svn_cl__propget(apr_getopt_t *os, const char *pname, *pname_utf8; apr_array_header_t *args, *targets; svn_stream_t *out; - int i; if (opt_state->verbose && (opt_state->revprop || opt_state->strict || opt_state->xml)) @@ -273,6 +272,7 @@ svn_cl__propget(apr_getopt_t *os, else /* operate on a normal, versioned property (not a revprop) */ { apr_pool_t *subpool = svn_pool_create(pool); + int i; if (opt_state->xml) SVN_ERR(svn_cl__xml_print_header("properties", subpool)); Modified: subversion/trunk/subversion/svn/proplist-cmd.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/proplist-cmd.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/svn/proplist-cmd.c (original) +++ subversion/trunk/subversion/svn/proplist-cmd.c Mon Oct 4 16:30:08 2010 @@ -112,7 +112,6 @@ svn_cl__proplist(apr_getopt_t *os, svn_cl__opt_state_t *opt_state = ((svn_cl__cmd_baton_t *) baton)->opt_state; svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx; apr_array_header_t *targets; - int i; SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os, opt_state->targets, @@ -165,6 +164,7 @@ svn_cl__proplist(apr_getopt_t *os, } else /* operate on normal, versioned properties (not revprops) */ { + int i; apr_pool_t *iterpool; svn_proplist_receiver_t pl_receiver; Modified: subversion/trunk/subversion/svn/propset-cmd.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/propset-cmd.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/svn/propset-cmd.c (original) +++ subversion/trunk/subversion/svn/propset-cmd.c Mon Oct 4 16:30:08 2010 @@ -55,7 +55,6 @@ svn_cl__propset(apr_getopt_t *os, svn_string_t *propval = NULL; svn_boolean_t propval_came_from_cmdline; apr_array_header_t *args, *targets; - int i; /* PNAME and PROPVAL expected as first 2 arguments if filedata was NULL, else PNAME alone will precede the targets. Get a UTF-8 @@ -131,6 +130,7 @@ svn_cl__propset(apr_getopt_t *os, else /* operate on a normal, versioned property (not a revprop) */ { apr_pool_t *iterpool; + int i; if (opt_state->depth == svn_depth_unknown) opt_state->depth = svn_depth_empty; Modified: subversion/trunk/subversion/svn/switch-cmd.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/switch-cmd.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/svn/switch-cmd.c (original) +++ subversion/trunk/subversion/svn/switch-cmd.c Mon Oct 4 16:30:08 2010 @@ -47,7 +47,6 @@ rewrite_urls(const apr_array_header_t *t apr_pool_t *subpool; const char *from; const char *to; - int i; if (targets->nelts < 2) return svn_error_create(SVN_ERR_CL_INSUFFICIENT_ARGS, 0, NULL); @@ -70,6 +69,8 @@ rewrite_urls(const apr_array_header_t *t } else { + int i; + for (i = 2; i < targets->nelts; i++) { const char *target = APR_ARRAY_IDX(targets, i, const char *); Modified: subversion/trunk/subversion/svndumpfilter/main.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svndumpfilter/main.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/svndumpfilter/main.c (original) +++ subversion/trunk/subversion/svndumpfilter/main.c Mon Oct 4 16:30:08 2010 @@ -702,7 +702,6 @@ adjust_mergeinfo(svn_string_t **final_va const char *merge_source = svn__apr_hash_index_key(hi); apr_array_header_t *rangelist = svn__apr_hash_index_val(hi); struct parse_baton_t *pb = rb->pb; - int i; /* Determine whether the merge_source is a part of the prefix. */ if (skip_path(merge_source, pb->prefixes, pb->do_exclude, pb->glob)) @@ -719,6 +718,8 @@ adjust_mergeinfo(svn_string_t **final_va /* Possibly renumber revisions in merge source's rangelist. */ if (pb->do_renumber_revs) { + int i; + for (i = 0; i < rangelist->nelts; i++) { struct revmap_t *revmap_start; Modified: subversion/trunk/subversion/svnlook/main.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnlook/main.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/svnlook/main.c (original) +++ subversion/trunk/subversion/svnlook/main.c Mon Oct 4 16:30:08 2010 @@ -1186,7 +1186,6 @@ print_tree(svn_fs_root_t *root, apr_pool_t *pool) { apr_pool_t *subpool; - int i; apr_hash_t *entries; apr_hash_index_t *hi; const char* name; @@ -1195,8 +1194,11 @@ print_tree(svn_fs_root_t *root, /* Print the indentation. */ if (!full_paths) - for (i = 0; i < indentation; i++) - SVN_ERR(svn_cmdline_fputs(" ", stdout, pool)); + { + int i; + for (i = 0; i < indentation; i++) + SVN_ERR(svn_cmdline_fputs(" ", stdout, pool)); + } /* ### The path format is inconsistent.. needs fix */ if (full_paths) Modified: subversion/trunk/subversion/svnserve/serve.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnserve/serve.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/svnserve/serve.c (original) +++ subversion/trunk/subversion/svnserve/serve.c Mon Oct 4 16:30:08 2010 @@ -1429,7 +1429,6 @@ static svn_error_t *get_dir(svn_ra_svn_c apr_uint64_t dirent_fields; apr_array_header_t *dirent_fields_list = NULL; svn_ra_svn_item_t *elt; - int i; SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "c(?r)bb?l", &path, &rev, &want_props, &want_contents, @@ -1441,6 +1440,8 @@ static svn_error_t *get_dir(svn_ra_svn_c } else { + int i; + dirent_fields = 0; for (i = 0; i < dirent_fields_list->nelts; ++i) Modified: subversion/trunk/subversion/tests/svn_test_main.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/svn_test_main.c?rev=1004314&r1=1004313&r2=1004314&view=diff ============================================================================== --- subversion/trunk/subversion/tests/svn_test_main.c (original) +++ subversion/trunk/subversion/tests/svn_test_main.c Mon Oct 4 16:30:08 2010 @@ -279,7 +279,6 @@ int main(int argc, const char *argv[]) { const char *prog_name; - int test_num; int i; svn_boolean_t got_error = FALSE; apr_pool_t *pool, *test_pool; @@ -427,8 +426,9 @@ main(int argc, const char *argv[]) { if (svn_ctype_isdigit(argv[i][0])) { + int test_num = atoi(argv[i]); + ran_a_test = TRUE; - test_num = atoi(argv[i]); if (do_test_num(prog_name, test_num, FALSE, &opts, test_pool)) got_error = TRUE;
