?I am not sure if I am answering correctly (because I usually do not use
mailing lists, I just selected the "Answer to all" button of my mail
program), but I hope so.
I now checked the code again, but with a newer version of cppcheck. The
results are in the attachement.
If you would like to try to check the code by yourself, see
https://sourceforge.net/projects/cppcheck/ (the tool is very easy to use)
-----Ursprüngliche Nachricht-----
From: Hyrum K. Wright
Sent: Thursday, October 07, 2010 2:56 PM
To: Philipp Kloke
Cc: users@subversion.apache.org
Subject: Re: Checked Subversions code with cppcheck
On Mon, Oct 4, 2010 at 9:59 AM, Hyrum K. Wright
<hyrum_wri...@mail.utexas.edu> wrote:
On Mon, Oct 4, 2010 at 9:34 AM, Philipp Kloke <philipp.kl...@web.de>
wrote:
?Hi,
I used cppcheck to analyze the source code of Subversion.
Cppcheck claims to have found five errors and some style problems.
Please have a look on the result file in the attachement.
Thanks for the feedback! I'll look at making some of these changes,
and let you know how it goes. (In the future, as this is related to
the development of Subversion, feel free to send this type of mail
straight to d...@subversion.apache.org.)
I've incorporated as many fixes as I could, given the drift on trunk.
Could you rerun your tool and report the result back?
Thanks,
-Hyrum
[subversion\bindings\javahl\native\InputStream.h:45]: (Style) Unused private
function 'InputStream::read'
[subversion\bindings\javahl\native\InputStream.h:46]: (Style) Unused private
function 'InputStream::close'
[subversion\bindings\javahl\native\JNIThreadData.cpp:40]: (Style) Member
variable not initialized in the constructor 'JNIThreadData::m_formatBuffer'
[subversion\bindings\javahl\native\OutputStream.h:44]: (Style) Unused
private function 'OutputStream::write'
[subversion\bindings\javahl\native\OutputStream.h:46]: (Style) Unused
private function 'OutputStream::close'
[subversion\bindings\javahl\native\StatusCallback.cpp:37]: (Style) Member
variable not initialized in the constructor 'StatusCallback::wc_ctx'
[subversion\bindings\javahl\native\SVNClient.cpp:112] ->
[subversion\bindings\javahl\native\SVNClient.h:193]: (Style) The function
'SVNClient::getLastPath' can be const
[subversion\libsvn_auth_kwallet\kwallet.cpp:203]: (Style) Variable 'app' is
assigned a value that is never used
[subversion\libsvn_auth_kwallet\kwallet.cpp:273]: (Style) Variable 'app' is
assigned a value that is never used
[subversion\libsvn_delta\compose_delta.c:46] ->
[subversion\libsvn_delta\compose_delta.c:45]: (Style) Struct
'range_index_node_t' hides typedef with same name
[subversion\libsvn_delta\compose_delta.c:70] ->
[subversion\libsvn_delta\compose_delta.c:69]: (Style) Struct
'range_list_node_t' hides typedef with same name
[subversion\libsvn_delta\compose_delta.c:93] ->
[subversion\libsvn_delta\compose_delta.c:92]: (Style) Union 'alloc_block_t'
hides typedef with same name
[subversion\libsvn_diff\diff.h:62] -> [subversion\libsvn_diff\diff.h:38]:
(Style) Struct 'svn_diff__position_t' hides typedef with same name
[subversion\libsvn_diff\diff.h:69] -> [subversion\libsvn_diff\diff.h:39]:
(Style) Struct 'svn_diff__lcs_t' hides typedef with same name
[subversion\libsvn_diff\diff.c:43]: (Style) Variable 'diff' is not assigned
a value
[subversion\libsvn_diff\lcs.c:43] -> [subversion\libsvn_diff\lcs.c:41]:
(Style) Struct 'svn_diff__snake_t' hides typedef with same name
[subversion\libsvn_diff\token.c:42] -> [subversion\libsvn_diff\diff.h:36]:
(Style) Struct 'svn_diff__node_t' hides typedef with same name
[subversion\libsvn_diff\token.c:52] -> [subversion\libsvn_diff\diff.h:37]:
(Style) Struct 'svn_diff__tree_t' hides typedef with same name
[subversion\libsvn_diff\token.c:144]: (Style) Variable 'start_position' is
not assigned a value
[subversion\libsvn_fs_base\dag.c:64] ->
[subversion\libsvn_fs_base\dag.h:71]: (Style) Struct 'dag_node_t' hides
typedef with same name
[subversion\libsvn_fs_base\bdb\env.c:86] ->
[subversion\libsvn_fs_base\bdb\env.h:47]: (Style) Struct 'bdb_env_t' hides
typedef with same name
[subversion\libsvn_fs_base\bdb\env.c:237]: (Error) Memory leak: error_info
[subversion\libsvn_fs_fs\dag.c:45] -> [subversion\libsvn_fs_fs\dag.h:62]:
(Style) Struct 'dag_node_t' hides typedef with same name
[subversion\libsvn_ra_neon\session.c:454]: (Style) Variable
'http_auth_types' is assigned a value that is never used
[subversion\libsvn_ra_serf\ra_serf.h:138] ->
[subversion\libsvn_ra_serf\ra_serf.h:67]: (Style) Struct
'svn_ra_serf__session_t' hides typedef with same name
[subversion\libsvn_ra_serf\ra_serf.h:1485] ->
[subversion\libsvn_ra_serf\ra_serf.h:68]: (Style) Struct
'svn_ra_serf__auth_protocol_t' hides typedef with same name
[subversion\libsvn_ra_serf\ra_serf.h:596] ->
[subversion\libsvn_ra_serf\ra_serf.h:560]: (Style) Struct
'svn_ra_serf__xml_parser_t' hides typedef with same name
[subversion\libsvn_ra_serf\commit.c:755]: (Error) Uninitialized variable:
prop_name
[subversion\libsvn_ra_serf\merge.c:91] ->
[subversion\libsvn_ra_serf\ra_serf.h:1068]: (Style) Struct
'svn_ra_serf__merge_context_t' hides typedef with same name
[subversion\libsvn_ra_serf\options.c:65] ->
[subversion\libsvn_ra_serf\ra_serf.h:1100]: (Style) Struct
'svn_ra_serf__options_context_t' hides typedef with same name
[subversion\libsvn_ra_serf\property.c:65] ->
[subversion\libsvn_ra_serf\ra_serf.h:906]: (Style) Struct
'svn_ra_serf__propfind_context_t' hides typedef with same name
[subversion\libsvn_ra_serf\replay.c:64] ->
[subversion\libsvn_ra_serf\replay.c:62]: (Style) Struct 'replay_info_t'
hides typedef with same name
[subversion\libsvn_ra_serf\update.c:283] ->
[subversion\libsvn_ra_serf\update.c:78]: (Style) Struct 'report_context_t'
hides typedef with same name
[subversion\libsvn_ra_svn\ra_svn.h:92] ->
[subversion\libsvn_ra_svn\ra_svn.h:64]: (Style) Struct
'svn_ra_svn__session_baton_t' hides typedef with same name
[subversion\libsvn_subr\config.c:43] ->
[subversion\libsvn_subr\config.c:42]: (Style) Struct 'cfg_section_t' hides
typedef with same name
[subversion\libsvn_subr\config.c:58] ->
[subversion\libsvn_subr\config.c:57]: (Style) Struct 'cfg_option_t' hides
typedef with same name
[subversion\libsvn_subr\error.c:74]: (Style) Redundant assignment of "err"
to itself
[subversion\libsvn_subr\opt.c:682]: (Style) Non-empty string test can be
simplified to "*peg_rev != '\0'"
[subversion\libsvn_subr\win32_xlate.c:74] ->
[subversion\libsvn_subr\win32_xlate.h:30]: (Style) Struct 'win32_xlate_t'
hides typedef with same name
[subversion\libsvn_wc\adm_ops.c:1202]: (Error) Uninitialized variable:
base_status
[subversion\libsvn_wc\tree_conflicts.c:407]: (Style) Non-empty string test
can be simplified to "*victim_basename != '\0'"
[subversion\libsvn_wc\wc_db_private.h:36] ->
[subversion\libsvn_wc\wc_db.h:125]: (Style) Struct 'svn_wc__db_t' hides
typedef with same name
[subversion\libsvn_wc\wc_db.c:7364]: (Style) The scope of the variable i can
be reduced
Warning: It can be unsafe to fix this message. Be careful. Especially when
there are inner loops.
Here is an example where cppcheck will write that the scope for 'i' can be
reduced:
void f(int x)
{
int i = 0;
if (x) {
// it's safe to move 'int i = 0' here
for (int n = 0; n < 10; ++n) {
// it is possible but not safe to move 'int i = 0' here
do_something(&i);
}
}
}
When you see this message it is always safe to reduce the variable scope 1
level.
[subversion\mod_dav_svn\repos.c:1640] ->
[subversion\mod_dav_svn\repos.c:1482]: (Style) Struct 'accept_rec' hides
typedef with same name
[subversion\mod_dav_svn\version.c:342]: (Style) Variable 'res' is assigned a
value that is never used
[subversion\svnserve\main.c:311]: (Style) struct or union member
'serve_thread_t::conn' is never used
[subversion\svnserve\main.c:312]: (Style) struct or union member
'serve_thread_t::params' is never used
[subversion\svnserve\main.c:313]: (Style) struct or union member
'serve_thread_t::pool' is never used
[subversion\svnserve\serve.c:1960]: (Error) Possible null pointer
dereference: revprop_items - otherwise it is redundant to check if
revprop_items is null at line 1962
[subversion\tests\libsvn_fs_base\fs-base-test.c:1155]: (Style) The scope of
the variable i can be reduced
Warning: It can be unsafe to fix this message. Be careful. Especially when
there are inner loops.
Here is an example where cppcheck will write that the scope for 'i' can be
reduced:
void f(int x)
{
int i = 0;
if (x) {
// it's safe to move 'int i = 0' here
for (int n = 0; n < 10; ++n) {
// it is possible but not safe to move 'int i = 0' here
do_something(&i);
}
}
}
When you see this message it is always safe to reduce the variable scope 1
level.
[subversion\tests\libsvn_fs_base\fs-base-test.c:1089]: (Style) struct or
union member 'node_created_rev_args::path' is never used
[subversion\tests\libsvn_fs_base\fs-base-test.c:1090]: (Style) struct or
union member 'node_created_rev_args::rev' is never used