On 24. 5. 26 02:52, [email protected] wrote:
Author: brane
Date: Sun May 24 00:52:17 2026
New Revision: 1934546

Log:
Add svnbrowse to the autotools build.

Building svnbrowse is optional and can be enabled with --enable-svnbrowse.
When enabled, --with-ncurses can be used to find the ncurses installation.
[...]


This was a bit of an adventure, during which I found a bug in one of the Makefile generator's templates ... Anyway, svnbrowse works on my Mac, and by "works" I mean it doesn't crash immediately and it does browse the remote repository. Nice.

I did have to fix a trivial C90/C99 coding error, and I attached a list of maintainer-mode warnings for reference. Of these, one that particularly caught my eye is an integer value truncation warning generated from constructs like this:

    int len = strlen(string);


It popped up on my radar because I recall fixing a couple similar cases recently. I don't want to sound obnoxious but I'd like to note that the prototype for strlen is [1]:

    size_t strlen(const char*);


in other words, strlen does not return an int and size_t is unsigned and usually wider than int on 64-bit platforms. In Subversion code we generally use apr_size_t for string lengths, except when we're inconsistent.


-- Brane

[1] https://cppreference.net/c/string/byte/strlen.html
.../subversion/svnbrowse/model.c:42:14: warning: implicit conversion loses 
integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
   42 |   int alen = strlen(a);
      |       ~~~~   ^~~~~~~~~
.../subversion/svnbrowse/model.c:43:14: warning: implicit conversion loses 
integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
   43 |   int blen = strlen(b);
      |       ~~~~   ^~~~~~~~~
.../subversion/svnbrowse/model.c:88:1: warning: no previous prototype for 
function 'state_from_dir' [-Wmissing-prototypes]
   88 | state_from_dir(svn_browse__state_t **state_p,
      | ^
.../subversion/svnbrowse/model.c:87:1: note: declare 'static' if the function 
is not intended to be used outside of this translation unit
   87 | svn_error_t *
      | ^
      | static 
.../subversion/svnbrowse/model.c:142:21: warning: unused variable 'hi' 
[-Wunused-variable]
  142 |   apr_hash_index_t *hi;
      |                     ^~
.../subversion/svnbrowse/model.c:133:1: warning: no previous prototype for 
function 'state_from_file' [-Wmissing-prototypes]
  133 | state_from_file(svn_browse__state_t **state_p,
      | ^
.../subversion/svnbrowse/model.c:132:1: note: declare 'static' if the function 
is not intended to be used outside of this translation unit
  132 | svn_error_t *
      | ^
      | static 
.../subversion/svnbrowse/model.c:149:21: warning: variable 'fetched_revnum' is 
uninitialized when used here [-Wuninitialized]
  149 |   state->revision = fetched_revnum;
      |                     ^~~~~~~~~~~~~~
.../subversion/svnbrowse/model.c:141:30: note: initialize the variable 
'fetched_revnum' to silence this warning
  141 |   svn_revnum_t fetched_revnum;
      |                              ^
      |                               = 0
.../subversion/svnbrowse/model.c:284:15: warning: unused variable 'root' 
[-Wunused-variable]
  284 |   const char *root, *relpath;
      |               ^~~~
7 warnings generated.
.../subversion/svnbrowse/svnbrowse.c:46:27: warning: no previous extern 
declaration for non-static variable 'svn_browse__options' 
[-Wmissing-variable-declarations]
   46 | const apr_getopt_option_t svn_browse__options[] =
      |                           ^
.../subversion/svnbrowse/svnbrowse.c:46:7: note: declare 'static' if the 
variable is not intended to be used outside of this translation unit
   46 | const apr_getopt_option_t svn_browse__options[] =
      |       ^
.../subversion/svnbrowse/svnbrowse.c:247:62: warning: null passed to a callee 
that requires a non-null argument [-Wnonnull]
  247 |   apr_pool_cleanup_register(result_pool, view, view_cleanup, NULL);
      |                                                              ^~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/17/include/__stddef_null.h:26:14:
 note: expanded from macro 'NULL'
   26 | #define NULL ((void*)0)
      |              ^~~~~~~~~~
.../subversion/svnbrowse/svnbrowse.c:387:7: warning: unused variable 'attrs' 
[-Wunused-variable]
  387 |   int attrs = 0;
      |       ^~~~~
.../subversion/svnbrowse/svnbrowse.c:388:15: warning: unused variable 'prefix' 
[-Wunused-variable]
  388 |   const char *prefix;
      |               ^~~~~~
.../subversion/svnbrowse/svnbrowse.c:430:20: warning: unused variable 'buf' 
[-Wunused-variable]
  430 |   svn_stringbuf_t *buf = svn_stringbuf_create_empty(scratch_pool);
      |                    ^~~
.../subversion/svnbrowse/svnbrowse.c:443:50: warning: implicit conversion loses 
integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
  441 |   waddstr(win, svn_utf__cstring_utf8_align_left(
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  442 |                    apr_psprintf(scratch_pool, "URL: %s", abspath),
  443 |                    getmaxx(win) - strlen(prefix) - strlen(suffix),
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/curses.h:2089:39:
 note: expanded from macro 'waddstr'
 2089 | #define waddstr(win,str)        waddnstr(win,str,-1)
      |                                              ^~~
.../subversion/svnbrowse/svnbrowse.c:452:12: warning: returning 'const char[4]' 
from a function with result type 'char *' discards qualifiers 
[-Wincompatible-pointer-types-discards-qualifiers]
  452 |     return "All";
      |            ^~~~~
.../subversion/svnbrowse/svnbrowse.c:454:12: warning: returning 'const char[4]' 
from a function with result type 'char *' discards qualifiers 
[-Wincompatible-pointer-types-discards-qualifiers]
  454 |     return "Top";
      |            ^~~~~
.../subversion/svnbrowse/svnbrowse.c:456:12: warning: returning 'const char[4]' 
from a function with result type 'char *' discards qualifiers 
[-Wincompatible-pointer-types-discards-qualifiers]
  456 |     return "Bot";
      |            ^~~~~
.../subversion/svnbrowse/svnbrowse.c:489:52: warning: implicit conversion loses 
integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
  487 |   waddstr(win, svn_utf__cstring_utf8_align_left(
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  488 |                   apr_psprintf(scratch_pool, "Ready"),
  489 |                   getmaxx(win) - 4 - strlen(brand) - 16,
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/curses.h:2089:39:
 note: expanded from macro 'waddstr'
 2089 | #define waddstr(win,str)        waddnstr(win,str,-1)
      |                                              ^~~
.../subversion/svnbrowse/svnbrowse.c:617:18: warning: a function declaration 
without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
  617 | detect_color_mode()
      |                  ^
      |                   void
.../subversion/svnbrowse/svnbrowse.c:809:27: warning: unused variable 'item' 
[-Wunused-variable]
  809 |       svn_browse__item_t *item;
      |                           ^~~~
.../subversion/svnbrowse/svnbrowse.c:810:19: warning: unused variable 'new_url' 
[-Wunused-variable]
  810 |       const char *new_url;
      |                   ^~~~~~~
.../subversion/svnbrowse/svnbrowse.c:639:17: warning: variable 
'read_pass_from_stdin' set but not used [-Wunused-but-set-variable]
  639 |   svn_boolean_t read_pass_from_stdin = FALSE;
      |                 ^
14 warnings generated.

Reply via email to