Fixed findings

List of Findings

Error: COMPILER_WARNING (CWE-1164): [#def1]
libpinyin-2.10.2/src/lookup/phonetic_lookup.cpp:21: included_from: Included from here.
libpinyin-2.10.2/src/lookup/phonetic_lookup.h:174:13: warning[-Wunused-function]: 'gint pinyin::trellis_value_compare(const trellis_value_t**, const trellis_value_t**)' defined but not used
#  174 | static gint trellis_value_compare(const trellis_value_t ** lhs,
#      |             ^~~~~~~~~~~~~~~~~~~~~
#  172|   }
#  173|   
#  174|-> static gint trellis_value_compare(const trellis_value_t ** lhs,
#  175|                                     const trellis_value_t ** rhs) {
#  176|       /* in descending order */

Error: COMPILER_WARNING (CWE-1164): [#def2]
libpinyin-2.10.2/src/lookup/phonetic_lookup.cpp:21: included_from: Included from here.
libpinyin-2.10.2/src/lookup/phonetic_lookup.h:174:13: warning[-Wunused-function]: ‘gint pinyin::trellis_value_compare(const trellis_value_t**, const trellis_value_t**)’ defined but not used
#  174 | static gint trellis_value_compare(const trellis_value_t ** lhs,
#      |             ^~~~~~~~~~~~~~~~~~~~~
#  172|   }
#  173|   
#  174|-> static gint trellis_value_compare(const trellis_value_t ** lhs,
#  175|                                     const trellis_value_t ** rhs) {
#  176|       /* in descending order */

Error: COMPILER_WARNING (CWE-195): [#def3]
libpinyin-2.10.2/src/pinyin.cpp: scope_hint: In function 'bool _prepend_longer_candidates(pinyin_instance_t*, CandidateVector)'
libpinyin-2.10.2/src/pinyin.cpp:1890:23: warning[-Wsign-compare]: comparison of integer expressions of different signedness: 'int' and 'guint' {aka 'unsigned int'}
# 1890 |     for (int i = 0; i < tokenarray->len; ++i) {
#      |                     ~~^~~~~~~~~~~~~~~~~
# 1888|       phrase_token_t longer_token = null_token;
# 1889|       PhraseItem longer_item, item;
# 1890|->     for (int i = 0; i < tokenarray->len; ++i) {
# 1891|           phrase_token_t token = g_array_index(tokenarray, phrase_token_t, i);
# 1892|   

Error: COMPILER_WARNING (CWE-1023): [#def4]
libpinyin-2.10.2/src/pinyin.cpp: scope_hint: In function 'bool _compute_phrase_length(pinyin_context_t*, CandidateVector)'
libpinyin-2.10.2/src/pinyin.cpp:1965:15: warning[-Wswitch]: enumeration value 'LONGER_CANDIDATE' not handled in switch
# 1965 |         switch(candidate->m_candidate_type) {
#      |               ^
# 1963|               (candidates, lookup_candidate_t, i);
# 1964|   
# 1965|->         switch(candidate->m_candidate_type) {
# 1966|           case NBEST_MATCH_CANDIDATE:
# 1967|               abort();

Error: COMPILER_WARNING (CWE-1023): [#def5]
libpinyin-2.10.2/src/pinyin.cpp:1965:15: warning[-Wswitch]: enumeration value 'PREDICTED_PUNCTUATION_CANDIDATE' not handled in switch
# 1963|               (candidates, lookup_candidate_t, i);
# 1964|   
# 1965|->         switch(candidate->m_candidate_type) {
# 1966|           case NBEST_MATCH_CANDIDATE:
# 1967|               abort();

Error: COMPILER_WARNING (CWE-563): [#def6]
libpinyin-2.10.2/src/pinyin.cpp: scope_hint: In function 'bool _compute_predicted_prefix_candidates(pinyin_instance_t*)'
libpinyin-2.10.2/src/pinyin.cpp:2373:17: warning[-Wunused-variable]: unused variable 'prefixes'
# 2373 |     TokenVector prefixes = instance->m_prefixes;
#      |                 ^~~~~~~~
# 2371|       FacadePhraseIndex * phrase_index = context->m_phrase_index;
# 2372|       CandidateVector candidates = instance->m_candidates;
# 2373|->     TokenVector prefixes = instance->m_prefixes;
# 2374|   
# 2375|       /* search prefix candidate. */

Error: COMPILER_WARNING (CWE-563): [#def7]
libpinyin-2.10.2/src/pinyin.cpp: scope_hint: In function 'bool pinyin_guess_predicted_candidates(pinyin_instance_t*, const char*)'
libpinyin-2.10.2/src/pinyin.cpp:2413:25: warning[-Wunused-variable]: unused variable 'phrase_index'
# 2413 |     FacadePhraseIndex * phrase_index = context->m_phrase_index;
#      |                         ^~~~~~~~~~~~
# 2411|                                          const char * prefix) {
# 2412|       pinyin_context_t * context = instance->m_context;
# 2413|->     FacadePhraseIndex * phrase_index = context->m_phrase_index;
# 2414|       CandidateVector candidates = instance->m_candidates;
# 2415|       TokenVector prefixes = instance->m_prefixes;

Error: COMPILER_WARNING (CWE-563): [#def8]
libpinyin-2.10.2/src/pinyin.cpp:2460:25: warning[-Wunused-variable]: unused variable 'phrase_index'
# 2460 |     FacadePhraseIndex * phrase_index = context->m_phrase_index;
#      |                         ^~~~~~~~~~~~
# 2458|   
# 2459|       pinyin_context_t * context = instance->m_context;
# 2460|->     FacadePhraseIndex * phrase_index = context->m_phrase_index;
# 2461|       CandidateVector candidates = instance->m_candidates;
# 2462|       TokenVector prefixes = instance->m_prefixes;

Error: COMPILER_WARNING (CWE-195): [#def9]
libpinyin-2.10.2/src/pinyin.cpp: scope_hint: In function 'bool pinyin_guess_predicted_candidates_with_punctuations(pinyin_instance_t*, const char*)'
libpinyin-2.10.2/src/pinyin.cpp:2468:32: warning[-Wsign-compare]: comparison of integer expressions of different signedness: 'gint' {aka 'int'} and 'guint' {aka 'unsigned int'}
# 2468 |     for (gint index = 0; index < prefixes->len; ++index) {
#      |                          ~~~~~~^~~~~~~~~~~~~~~
# 2466|       /* prepend the punctuations */
# 2467|       GArray * punct_array = g_array_new(TRUE, TRUE, sizeof(gchar *));
# 2468|->     for (gint index = 0; index < prefixes->len; ++index) {
# 2469|           prev_token = g_array_index(prefixes, phrase_token_t, index);
# 2470|   

Scan Properties

analyzer-version-clippy1.90.0
analyzer-version-cppcheck2.18.3
analyzer-version-gcc15.2.1
analyzer-version-gcc-analyzer16.0.0
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.90.0
diffbase-analyzer-version-cppcheck2.18.3
diffbase-analyzer-version-gcc15.2.1
diffbase-analyzer-version-gcc-analyzer16.0.0
diffbase-analyzer-version-shellcheck0.11.0
diffbase-analyzer-version-unicontrol0.0.2
diffbase-enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
diffbase-exit-code0
diffbase-hostip-172-16-1-32.us-west-2.compute.internal
diffbase-known-false-positives/usr/share/csmock/known-false-positives.js
diffbase-known-false-positives-rpmknown-false-positives-0.0.0.20250521.132812.g8eff701.main-1.el9.noarch
diffbase-mock-configfedora-rawhide-gcc-latest-x86_64
diffbase-project-namelibpinyin-2.10.3-1.fc44
diffbase-store-results-to/tmp/tmphwn8l0wd/libpinyin-2.10.3-1.fc44.tar.xz
diffbase-time-created2025-10-28 19:10:27
diffbase-time-finished2025-10-28 19:13:46
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'gcc,cppcheck,shellcheck,clippy,unicontrol' '-o' '/tmp/tmphwn8l0wd/libpinyin-2.10.3-1.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmphwn8l0wd/libpinyin-2.10.3-1.fc44.src.rpm'
diffbase-tool-versioncsmock-3.8.3.20251027.143044.ge6b947b-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-32.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250521.132812.g8eff701.main-1.el9.noarch
mock-configfedora-rawhide-gcc-latest-x86_64
project-namelibpinyin-2.10.2-2.fc43
store-results-to/tmp/tmphimm4qzn/libpinyin-2.10.2-2.fc43.tar.xz
time-created2025-10-28 19:06:19
time-finished2025-10-28 19:10:12
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'gcc,cppcheck,shellcheck,clippy,unicontrol' '-o' '/tmp/tmphimm4qzn/libpinyin-2.10.2-2.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmphimm4qzn/libpinyin-2.10.2-2.fc43.src.rpm'
tool-versioncsmock-3.8.3.20251027.143044.ge6b947b-1.el9