Author: brane
Date: Sun May 31 11:40:25 2026
New Revision: 1934816
Log:
Fix warnings in svnbrowse.
* subversion/svnbrowse/model.c
(compare_cstrings_lexically): Use apr_size_t for string lengths.
[-Wshorten-64-to-32]
(state_from_dir): Make function static. [-Wmissing-prototypes]
(state_from_file): Make function static. [-Wmissing-prototypes]
Remove unused variables 'hi' and 'fetched_revnum'. [-Wunused-variable]
Do not use uninitialized 'fetched_revnum'. [-Wuninitialized]
(svn_browse__model_create): Remove unused 'root'. [-Wunused-variable]
* subversion/svnbrowse/svnbrowse.c
(svn_browse__options): Make static. [-Wmissing-variable-declarations]
(view_make): Replace NULL cleanup function. [-Wnonnull]
(view_draw_item): Remove unused 'attrs' and 'prefix'. [-Wunused-variable]
(view_draw_header): Remove unused 'buf'. [-Wunused-variable]
(format_percentage_scroll): Return 'const char *' because the function
returns pointers to static strings.
[-Wincompatible-pointer-types-discards-qualifiers]
(detect_color_mode): Add (void) argument list. [-Wstrict-prototypes]
(sub_main): Comment out unused variable 'read_pass_from_stdin'.
[-Wunused-but-set-variable]
Remove unused 'item' and 'new_url'. [-Wunused-variable]
Modified:
subversion/trunk/subversion/svnbrowse/model.c
subversion/trunk/subversion/svnbrowse/svnbrowse.c
Modified: subversion/trunk/subversion/svnbrowse/model.c
==============================================================================
--- subversion/trunk/subversion/svnbrowse/model.c Sun May 31 11:38:15
2026 (r1934815)
+++ subversion/trunk/subversion/svnbrowse/model.c Sun May 31 11:40:25
2026 (r1934816)
@@ -39,13 +39,12 @@
static int
compare_cstrings_lexically(const char *a, const char *b)
{
- int alen = strlen(a);
- int blen = strlen(b);
- int len, val;
+ const apr_size_t alen = strlen(a);
+ const apr_size_t blen = strlen(b);
+ const apr_size_t len = (alen < blen) ? alen : blen;
/* Compare bytes of a's key and b's key up to the common length. */
- len = (alen < blen) ? alen : blen;
- val = memcmp(a, b, len);
+ const int val = memcmp(a, b, len);
if (val != 0)
return val;
@@ -84,7 +83,7 @@ sort_item_comparison_func(const void *le
return compare_cstrings_lexically(a->name, b->name);
}
-svn_error_t *
+static svn_error_t *
state_from_dir(svn_browse__state_t **state_p,
svn_ra_session_t *session,
const char *relpath,
@@ -129,7 +128,7 @@ state_from_dir(svn_browse__state_t **sta
return SVN_NO_ERROR;
}
-svn_error_t *
+static svn_error_t *
state_from_file(svn_browse__state_t **state_p,
svn_ra_session_t *session,
const char *relpath,
@@ -138,15 +137,13 @@ state_from_file(svn_browse__state_t **st
apr_pool_t *scratch_pool)
{
svn_browse__state_t *state = apr_pcalloc(result_pool, sizeof(*state));
- svn_revnum_t fetched_revnum;
- apr_hash_index_t *hi;
svn_dirent_t *dirent;
SVN_ERR(svn_ra_stat(session, relpath, revision, &dirent, scratch_pool));
state->type = svn_browse__state_file;
state->relpath = apr_pstrdup(result_pool, relpath);
- state->revision = fetched_revnum;
+ state->revision = revision;
state->this_dirent = svn_dirent_dup(dirent, result_pool);
state->pool = result_pool;
@@ -281,7 +278,7 @@ svn_browse__model_create(svn_browse__mod
svn_browse__model_t *model = apr_pcalloc(result_pool, sizeof(*model));
svn_ra_session_t *session;
apr_pool_t *state_pool;
- const char *root, *relpath;
+ const char *relpath;
svn_opt_revision_t peg_rev = *peg_revision;
svn_opt_revision_t start_rev = *revision;
Modified: subversion/trunk/subversion/svnbrowse/svnbrowse.c
==============================================================================
--- subversion/trunk/subversion/svnbrowse/svnbrowse.c Sun May 31 11:38:15
2026 (r1934815)
+++ subversion/trunk/subversion/svnbrowse/svnbrowse.c Sun May 31 11:40:25
2026 (r1934816)
@@ -43,7 +43,7 @@
/* Option codes and descriptions for the command line client.
* The entire list must be terminated with an entry of nulls. */
-const apr_getopt_option_t svn_browse__options[] =
+static const apr_getopt_option_t svn_browse__options[] =
{
{"username", opt_auth_username, 1, N_("specify a username ARG")},
{"password", opt_auth_password, 1,
@@ -244,7 +244,8 @@ view_make(svn_browse__model_t *model, sv
view->style = style;
view->screen = win;
view_layout(view);
- apr_pool_cleanup_register(result_pool, view, view_cleanup, NULL);
+ apr_pool_cleanup_register(result_pool, view, view_cleanup,
+ apr_pool_cleanup_null);
return view;
}
@@ -384,9 +385,6 @@ view_draw_item(const svn_browse__style_t
const svn_browse__item_t *item, WINDOW *win, int y,
svn_boolean_t selected, apr_pool_t *scratch_pool)
{
- int attrs = 0;
- const char *prefix;
-
move(y, 0);
wattrset(win, get_item_style(style, item->dirent->kind, selected));
@@ -427,7 +425,6 @@ view_draw_header(svn_browse__view_t *vie
{
const char *abspath = svn_path_url_add_component2(
view->model->root, view->model->current->relpath, scratch_pool);
- svn_stringbuf_t *buf = svn_stringbuf_create_empty(scratch_pool);
const char *prefix = " ";
const char *suffix = format_revision_header(view->model->revision,
@@ -445,7 +442,7 @@ view_draw_header(svn_browse__view_t *vie
waddstr(win, suffix);
}
-static char *
+static const char *
format_percentage_scroll(int scroll, int size, int height, apr_pool_t *pool)
{
if (size <= height)
@@ -614,7 +611,7 @@ show_version(apr_pool_t *scratch_pool,
}
static svn_browse__color_mode_e
-detect_color_mode()
+detect_color_mode(void)
{
if (has_colors())
{
@@ -636,7 +633,7 @@ sub_main(int *code, int argc, const char
svn_browse__view_t *view;
svn_browse__style_t *style;
svn_browse__opt_state_t opt_state = { 0 };
- svn_boolean_t read_pass_from_stdin = FALSE;
+ /* NOT USED: svn_boolean_t read_pass_from_stdin = FALSE; */
apr_pool_t *iterpool;
apr_getopt_t *os;
apr_array_header_t *targets = NULL;
@@ -685,9 +682,11 @@ sub_main(int *code, int argc, const char
case opt_auth_password:
opt_state.auth_password = apr_pstrdup(pool, opt_arg);
break;
+ /* NOT USED:
case opt_auth_password_from_stdin:
read_pass_from_stdin = TRUE;
break;
+ */
case opt_no_auth_cache:
opt_state.no_auth_cache = TRUE;
break;
@@ -806,8 +805,6 @@ sub_main(int *code, int argc, const char
/* Loop forever, unless we're not in an error state. */
while (! err)
{
- svn_browse__item_t *item;
- const char *new_url;
int ch;
svn_pool_clear(iterpool);