Browse Source

Fix some warnings emitted by GCC 8 and Clang 7

pull/108/head
JP Cimalando Filipe Coelho <falktx@falktx.com> 6 years ago
parent
commit
c5e1f7d026
5 changed files with 34 additions and 8 deletions
  1. +26
    -0
      distrho/DistrhoPlugin.hpp
  2. +2
    -2
      distrho/src/DistrhoPluginLADSPA+DSSI.cpp
  3. +1
    -1
      distrho/src/DistrhoPluginLV2.cpp
  4. +4
    -4
      distrho/src/lv2/atom-util.h
  5. +1
    -1
      examples/Meters/ExampleUIMeters.cpp

+ 26
- 0
distrho/DistrhoPlugin.hpp View File

@@ -590,6 +590,22 @@ struct TimePosition {
beatType(0.0f), beatType(0.0f),
ticksPerBeat(0.0), ticksPerBeat(0.0),
beatsPerMinute(0.0) {} beatsPerMinute(0.0) {}

/**
Reinitialize this position using the default null initialization.
*/
void clear() noexcept
{
valid = false;
bar = 0;
beat = 0;
tick = 0;
barStartTick = 0.0;
beatsPerBar = 0.0f;
beatType = 0.0f;
ticksPerBeat = 0.0;
beatsPerMinute = 0.0;
}
} bbt; } bbt;


/** /**
@@ -599,6 +615,16 @@ struct TimePosition {
: playing(false), : playing(false),
frame(0), frame(0),
bbt() {} bbt() {}

/**
Reinitialize this position using the default null initialization.
*/
void clear() noexcept
{
playing = false;
frame = 0;
bbt.clear();
}
}; };


/** @} */ /** @} */


+ 2
- 2
distrho/src/DistrhoPluginLADSPA+DSSI.cpp View File

@@ -286,9 +286,9 @@ public:
# if DISTRHO_PLUGIN_WANT_STATE # if DISTRHO_PLUGIN_WANT_STATE
char* dssi_configure(const char* const key, const char* const value) char* dssi_configure(const char* const key, const char* const value)
{ {
if (std::strncmp(key, DSSI_RESERVED_CONFIGURE_PREFIX, std::strlen(DSSI_RESERVED_CONFIGURE_PREFIX) == 0))
if (std::strncmp(key, DSSI_RESERVED_CONFIGURE_PREFIX, std::strlen(DSSI_RESERVED_CONFIGURE_PREFIX)) == 0)
return nullptr; return nullptr;
if (std::strncmp(key, DSSI_GLOBAL_CONFIGURE_PREFIX, std::strlen(DSSI_GLOBAL_CONFIGURE_PREFIX) == 0))
if (std::strncmp(key, DSSI_GLOBAL_CONFIGURE_PREFIX, std::strlen(DSSI_GLOBAL_CONFIGURE_PREFIX)) == 0)
return nullptr; return nullptr;


fPlugin.setState(key, value); fPlugin.setState(key, value);


+ 1
- 1
distrho/src/DistrhoPluginLV2.cpp View File

@@ -169,7 +169,7 @@ public:
void lv2_activate() void lv2_activate()
{ {
#if DISTRHO_PLUGIN_WANT_TIMEPOS #if DISTRHO_PLUGIN_WANT_TIMEPOS
std::memset(&fTimePosition, 0, sizeof(TimePosition));
fTimePosition.clear();


// hosts may not send all values, resulting on some invalid data // hosts may not send all values, resulting on some invalid data
fTimePosition.bbt.bar = 1; fTimePosition.bbt.bar = 1;


+ 4
- 4
distrho/src/lv2/atom-util.h View File

@@ -117,13 +117,13 @@ lv2_atom_sequence_next(const LV2_Atom_Event* i)
@endcode @endcode
*/ */
#define LV2_ATOM_SEQUENCE_FOREACH(seq, iter) \ #define LV2_ATOM_SEQUENCE_FOREACH(seq, iter) \
for (const LV2_Atom_Event* (iter) = lv2_atom_sequence_begin(&(seq)->body); \
for (const LV2_Atom_Event* iter = lv2_atom_sequence_begin(&(seq)->body); \
!lv2_atom_sequence_is_end(&(seq)->body, (seq)->atom.size, (iter)); \ !lv2_atom_sequence_is_end(&(seq)->body, (seq)->atom.size, (iter)); \
(iter) = lv2_atom_sequence_next(iter)) (iter) = lv2_atom_sequence_next(iter))


/** Like LV2_ATOM_SEQUENCE_FOREACH but for a headerless sequence body. */ /** Like LV2_ATOM_SEQUENCE_FOREACH but for a headerless sequence body. */
#define LV2_ATOM_SEQUENCE_BODY_FOREACH(body, size, iter) \ #define LV2_ATOM_SEQUENCE_BODY_FOREACH(body, size, iter) \
for (const LV2_Atom_Event* (iter) = lv2_atom_sequence_begin(body); \
for (const LV2_Atom_Event* iter = lv2_atom_sequence_begin(body); \
!lv2_atom_sequence_is_end(body, size, (iter)); \ !lv2_atom_sequence_is_end(body, size, (iter)); \
(iter) = lv2_atom_sequence_next(iter)) (iter) = lv2_atom_sequence_next(iter))


@@ -214,13 +214,13 @@ lv2_atom_tuple_next(const LV2_Atom* i)
@endcode @endcode
*/ */
#define LV2_ATOM_TUPLE_FOREACH(tuple, iter) \ #define LV2_ATOM_TUPLE_FOREACH(tuple, iter) \
for (const LV2_Atom* (iter) = lv2_atom_tuple_begin(tuple); \
for (const LV2_Atom* iter = lv2_atom_tuple_begin(tuple); \
!lv2_atom_tuple_is_end(LV2_ATOM_BODY_CONST(tuple), (tuple)->size, (iter)); \ !lv2_atom_tuple_is_end(LV2_ATOM_BODY_CONST(tuple), (tuple)->size, (iter)); \
(iter) = lv2_atom_tuple_next(iter)) (iter) = lv2_atom_tuple_next(iter))


/** Like LV2_ATOM_TUPLE_FOREACH but for a headerless tuple body. */ /** Like LV2_ATOM_TUPLE_FOREACH but for a headerless tuple body. */
#define LV2_ATOM_TUPLE_BODY_FOREACH(body, size, iter) \ #define LV2_ATOM_TUPLE_BODY_FOREACH(body, size, iter) \
for (const LV2_Atom* (iter) = (const LV2_Atom*)body; \
for (const LV2_Atom* iter = (const LV2_Atom*)body; \
!lv2_atom_tuple_is_end(body, size, (iter)); \ !lv2_atom_tuple_is_end(body, size, (iter)); \
(iter) = lv2_atom_tuple_next(iter)) (iter) = lv2_atom_tuple_next(iter))




+ 1
- 1
examples/Meters/ExampleUIMeters.cpp View File

@@ -93,7 +93,7 @@ protected:
A state has changed on the plugin side. A state has changed on the plugin side.
This is called by the host to inform the UI about state changes. This is called by the host to inform the UI about state changes.
*/ */
void stateChanged(const char*, const char*)
void stateChanged(const char*, const char*) override
{ {
// nothing here // nothing here
} }


Loading…
Cancel
Save