summaryrefslogtreecommitdiffstats
path: root/ingen
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-08-01 15:49:26 +0200
committerDavid Robillard <d@drobilla.net>2020-08-02 01:48:48 +0200
commit97dc2836a62625656a2af0e8def015ea0c322046 (patch)
tree5a6e32bc67f93876eeadb36b77ccd45976a3c354 /ingen
parent483ecd16de6801aed536eca64ed51a6a4c669e39 (diff)
downloadingen-97dc2836a62625656a2af0e8def015ea0c322046.tar.gz
ingen-97dc2836a62625656a2af0e8def015ea0c322046.tar.bz2
ingen-97dc2836a62625656a2af0e8def015ea0c322046.zip
Fix uninitialized members
Diffstat (limited to 'ingen')
-rw-r--r--ingen/Atom.hpp14
-rw-r--r--ingen/AtomForge.hpp3
-rw-r--r--ingen/Clock.hpp2
-rw-r--r--ingen/URIMap.hpp5
-rw-r--r--ingen/filesystem.hpp2
5 files changed, 13 insertions, 13 deletions
diff --git a/ingen/Atom.hpp b/ingen/Atom.hpp
index c4020b91..e92ab194 100644
--- a/ingen/Atom.hpp
+++ b/ingen/Atom.hpp
@@ -43,17 +43,18 @@ namespace ingen {
*/
class INGEN_API Atom {
public:
- Atom() noexcept { _atom.size = 0; _atom.type = 0; _body.ptr = nullptr; }
+ Atom() noexcept : _atom{0, 0}, _body{} {}
+
~Atom() { dealloc(); }
/** Construct a raw atom.
*
* Typically this is not used directly, use Forge methods to make atoms.
*/
- Atom(uint32_t size, LV2_URID type, const void* body) {
- _atom.size = size;
- _atom.type = type;
- _body.ptr = nullptr;
+ Atom(uint32_t size, LV2_URID type, const void* body)
+ : _atom{size, type}
+ , _body{}
+ {
if (is_reference()) {
_body.ptr = static_cast<LV2_Atom*>(malloc(sizeof(LV2_Atom) + size));
memcpy(_body.ptr, &_atom, sizeof(LV2_Atom));
@@ -64,7 +65,8 @@ public:
}
Atom(const Atom& copy)
- : _atom(copy._atom)
+ : _atom{copy._atom}
+ , _body{}
{
if (is_reference()) {
_body.ptr =
diff --git a/ingen/AtomForge.hpp b/ingen/AtomForge.hpp
index 10517894..b1cec69d 100644
--- a/ingen/AtomForge.hpp
+++ b/ingen/AtomForge.hpp
@@ -36,7 +36,8 @@ class AtomForge : public LV2_Atom_Forge
{
public:
explicit AtomForge(LV2_URID_Map& map)
- : _size{0}
+ : LV2_Atom_Forge{}
+ , _size{0}
, _capacity{8 * sizeof(LV2_Atom)}
, _sratom{sratom_new(&map)}
, _buf{static_cast<LV2_Atom*>(calloc(8, sizeof(LV2_Atom)))}
diff --git a/ingen/Clock.hpp b/ingen/Clock.hpp
index 5debb5e4..27d8443d 100644
--- a/ingen/Clock.hpp
+++ b/ingen/Clock.hpp
@@ -46,7 +46,7 @@ private:
#else
inline uint64_t now_microseconds() const {
- struct timespec time;
+ struct timespec time{};
clock_gettime(_clock, &time);
return static_cast<uint64_t>(time.tv_sec) * 1e6 +
static_cast<uint64_t>(time.tv_nsec) / 1e3;
diff --git a/ingen/URIMap.hpp b/ingen/URIMap.hpp
index db10241f..5b211612 100644
--- a/ingen/URIMap.hpp
+++ b/ingen/URIMap.hpp
@@ -49,10 +49,7 @@ public:
class Feature : public LV2Features::Feature {
public:
- Feature(const char* URI, void* data) {
- _feature.URI = URI;
- _feature.data = data;
- }
+ Feature(const char* URI, void* data) : _feature{URI, data} {}
const char* uri() const override { return _feature.URI; }
diff --git a/ingen/filesystem.hpp b/ingen/filesystem.hpp
index 3b2bc302..44b9148e 100644
--- a/ingen/filesystem.hpp
+++ b/ingen/filesystem.hpp
@@ -49,7 +49,7 @@ inline bool exists(const FilePath& path)
inline bool is_directory(const FilePath& path)
{
- struct stat info;
+ struct stat info{};
stat(path.c_str(), &info);
return S_ISDIR(info.st_mode);
}