diff options
author | David Robillard <d@drobilla.net> | 2020-12-14 16:04:45 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-12-14 16:04:45 +0100 |
commit | 0821550b4d304da8b5f092a75311f13d288dee95 (patch) | |
tree | c3bb1c4ba1d497075840b3a820feb4d5164a26c6 | |
parent | 15693714974fd4af7a9bee3e6a0c0f6f439dfde6 (diff) | |
download | jalv-0821550b4d304da8b5f092a75311f13d288dee95.tar.gz jalv-0821550b4d304da8b5f092a75311f13d288dee95.tar.bz2 jalv-0821550b4d304da8b5f092a75311f13d288dee95.zip |
Initialize all variables
-rw-r--r-- | .clang-tidy | 1 | ||||
-rw-r--r-- | src/jack.c | 7 | ||||
-rw-r--r-- | src/jalv_console.c | 4 | ||||
-rw-r--r-- | src/jalv_qt.cpp | 23 | ||||
-rw-r--r-- | src/lv2_evbuf.c | 2 | ||||
-rw-r--r-- | src/state.c | 2 | ||||
-rw-r--r-- | src/symap.c | 6 |
7 files changed, 25 insertions, 20 deletions
diff --git a/.clang-tidy b/.clang-tidy index 0c2aa22..e7202ea 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -20,7 +20,6 @@ Checks: > -clang-analyzer-optin.cplusplus.VirtualCall, -clang-analyzer-security.insecureAPI.strcpy, -cppcoreguidelines-avoid-non-const-global-variables, - -cppcoreguidelines-init-variables, -cppcoreguidelines-macro-usage, -cppcoreguidelines-owning-memory, -cppcoreguidelines-pro-bounds-pointer-arithmetic, @@ -236,8 +236,11 @@ jack_process_cb(jack_nframes_t nframes, void* data) lv2_evbuf_is_valid(i); i = lv2_evbuf_next(i)) { // Get event from LV2 buffer - uint32_t frames, subframes, type, size; - uint8_t* body; + uint32_t frames = 0; + uint32_t subframes = 0; + uint32_t type = 0; + uint32_t size = 0; + uint8_t* body = NULL; lv2_evbuf_get(i, &frames, &subframes, &type, &size, &body); if (buf && type == jalv->urids.midi_MidiEvent) { diff --git a/src/jalv_console.c b/src/jalv_console.c index f376333..d000826 100644 --- a/src/jalv_console.c +++ b/src/jalv_console.c @@ -165,8 +165,8 @@ static void jalv_process_command(Jalv* jalv, const char* cmd) { char sym[1024]; - uint32_t index; - float value; + uint32_t index = 0; + float value = 0.0f; if (!strncmp(cmd, "help", 4)) { fprintf(stderr, "Commands:\n" diff --git a/src/jalv_qt.cpp b/src/jalv_qt.cpp index 67fd454..c05391c 100644 --- a/src/jalv_qt.cpp +++ b/src/jalv_qt.cpp @@ -115,7 +115,7 @@ FlowLayout::FlowLayout(int margin, int hSpacing, int vSpacing) FlowLayout::~FlowLayout() { - QLayoutItem* item; + QLayoutItem* item = nullptr; while ((item = takeAt(0))) { delete item; } @@ -203,8 +203,8 @@ FlowLayout::sizeHint() const QSize FlowLayout::minimumSize() const { - QSize size; - QLayoutItem* item; + QSize size = {}; + QLayoutItem* item = nullptr; foreach (item, itemList) { size = size.expandedTo(item->minimumSize()); } @@ -215,7 +215,10 @@ FlowLayout::minimumSize() const int FlowLayout::doLayout(const QRect &rect, bool testOnly) const { - int left, top, right, bottom; + int left = 0; + int top = 0; + int right = 0; + int bottom = 0; getContentsMargins(&left, &top, &right, &bottom); QRect effectiveRect = rect.adjusted(+left, +top, -right, -bottom); @@ -223,7 +226,7 @@ FlowLayout::doLayout(const QRect &rect, bool testOnly) const int y = effectiveRect.y(); int lineHeight = 0; - QLayoutItem* item; + QLayoutItem* item = nullptr; foreach (item, itemList) { QWidget* wid = item->widget(); @@ -418,9 +421,9 @@ Control::Control(PortContainer portContainer, QWidget* parent) JalvNodes* nodes = &portContainer.jalv->nodes; const LilvPort* lilvPort = port->lilv_port; - LilvNode* nmin; - LilvNode* nmax; - LilvNode* ndef; + LilvNode* nmin = nullptr; + LilvNode* nmax = nullptr; + LilvNode* ndef = nullptr; lilv_port_get_range(plugin, lilvPort, &ndef, &nmin, &nmax); LilvNode* stepsNode = lilv_port_get(plugin, lilvPort, nodes->pprops_rangeSteps); @@ -511,7 +514,7 @@ Control::Control(PortContainer portContainer, QWidget* parent) void Control::setValue(float value) { - float step; + float step = 0.0f; if (isInteger) { step = value; @@ -725,7 +728,7 @@ jalv_open_ui(Jalv* jalv) jalv_ui_instantiate(jalv, jalv_native_ui_type(), win); } - QWidget* widget; + QWidget* widget = nullptr; if (jalv->ui_instance) { widget = (QWidget*)suil_instance_get_widget(jalv->ui_instance); } else { diff --git a/src/lv2_evbuf.c b/src/lv2_evbuf.c index a64d860..8cc667d 100644 --- a/src/lv2_evbuf.c +++ b/src/lv2_evbuf.c @@ -112,7 +112,7 @@ lv2_evbuf_next(LV2_Evbuf_Iterator iter) LV2_Evbuf* evbuf = iter.evbuf; uint32_t offset = iter.offset; - uint32_t size; + uint32_t size = 0; size = ((LV2_Atom_Event*) ((char*)LV2_ATOM_CONTENTS(LV2_Atom_Sequence, &evbuf->buf.atom) + offset))->body.size; diff --git a/src/state.c b/src/state.c index 4237d54..f5a61ea 100644 --- a/src/state.c +++ b/src/state.c @@ -133,7 +133,7 @@ set_port_value(const char* port_symbol, return; } - float fvalue; + float fvalue = 0.0f; if (type == jalv->forge.Float) { fvalue = *(const float*)value; } else if (type == jalv->forge.Double) { diff --git a/src/symap.c b/src/symap.c index afcdadb..5e33544 100644 --- a/src/symap.c +++ b/src/symap.c @@ -107,7 +107,7 @@ symap_search(const Symap* map, const char* sym, bool* exact) uint32_t lower = 0; uint32_t upper = map->size - 1; uint32_t i = upper; - int cmp; + int cmp = 0; while (upper >= lower) { i = lower + ((upper - lower) / 2); @@ -133,7 +133,7 @@ symap_search(const Symap* map, const char* sym, bool* exact) uint32_t symap_try_map(Symap* map, const char* sym) { - bool exact; + bool exact = false; const uint32_t index = symap_search(map, sym, &exact); if (exact) { assert(!strcmp(map->symbols[map->index[index]], sym)); @@ -146,7 +146,7 @@ symap_try_map(Symap* map, const char* sym) uint32_t symap_map(Symap* map, const char* sym) { - bool exact; + bool exact = false; const uint32_t index = symap_search(map, sym, &exact); if (exact) { assert(!strcmp(map->symbols[map->index[index] - 1], sym)); |