Fix various clang warnings. sigrok-cli-unreleased
authorUwe Hermann <uwe@hermann-uwe.de>
Thu, 8 Jun 2017 21:16:18 +0000 (23:16 +0200)
committerUwe Hermann <uwe@hermann-uwe.de>
Thu, 8 Jun 2017 21:17:37 +0000 (23:17 +0200)
../show.c:668:30: warning: variable 'q' is uninitialized when used here [-Wuninitialized]
                                        s = sr_period_string(p, q);
                                                                ^
../show.c:324:30: note: initialize the variable 'q' to silence this warning
        const uint64_t *uint64, p, q, low, high;
                                    ^
                                     = 0
../show.c:668:27: warning: variable 'p' is uninitialized when used here [-Wuninitialized]
                                        s = sr_period_string(p, q);
                                                             ^
../show.c:324:27: note: initialize the variable 'p' to silence this warning
        const uint64_t *uint64, p, q, low, high;
                                 ^
                                  = 0
../show.c:458:58: warning: variable 'high' is uninitialized when used here [-Wuninitialized]
                                printf("    Maximum number of samples: %"PRIu64"\n", high);
                                                                                     ^~~~
../show.c:324:41:   CC       input.o
note: initialize the variable 'high' to silence this warning
        const uint64_t *uint64, p, q, low, high;
                                               ^
                                                = 0
../show.c:589:33: warning: variable 'low' is uninitialized when used here [-Wuninitialized]
                                printf("%"PRIu64"-%"PRIu64, low, high);
                                                            ^~~
../show.c:324:35: note: initialize the variable 'low' to silence this warning
        const uint64_t *uint64, p, q, low, high;
                                         ^
                                          = 0

show.c

diff --git a/show.c b/show.c
index 9491110..533ab1e 100644 (file)
--- a/show.c
+++ b/show.c
@@ -321,7 +321,7 @@ void show_dev_detail(void)
        GVariant *gvar_dict, *gvar_list, *gvar;
        gsize num_elements;
        double dlow, dhigh, dcur_low, dcur_high;
-       const uint64_t *uint64, p, q, low, high;
+       const uint64_t *uint64, p = 0, q = 0, low = 0, high = 0;
        uint64_t tmp_uint64, mask, cur_low, cur_high, cur_p, cur_q;
        GArray *opts;
        const int32_t *int32;