Browse Source

More noexcept stuff

tags/1.9.4
falkTX 10 years ago
parent
commit
98969cbb9a
13 changed files with 68 additions and 50 deletions
  1. +4
    -4
      source/modules/ladspa_rdf.hpp
  2. +8
    -8
      source/modules/lv2_rdf.hpp
  3. +1
    -1
      source/utils/CarlaExternalUI.hpp
  4. +19
    -10
      source/utils/CarlaLadspaUtils.hpp
  5. +3
    -3
      source/utils/CarlaLv2Utils.hpp
  6. +9
    -4
      source/utils/CarlaOscUtils.hpp
  7. +1
    -1
      source/utils/CarlaRingBuffer.hpp
  8. +2
    -2
      source/utils/CarlaShmUtils.hpp
  9. +4
    -4
      source/utils/CarlaStateUtils.cpp
  10. +4
    -4
      source/utils/CarlaStateUtils.hpp
  11. +10
    -4
      source/utils/CarlaVstUtils.hpp
  12. +2
    -3
      source/utils/LinkedList.hpp
  13. +1
    -2
      source/utils/RtLinkedList.hpp

+ 4
- 4
source/modules/ladspa_rdf.hpp View File

@@ -1,6 +1,6 @@
/*
* Custom types to store LADSPA-RDF information
* Copyright (C) 2011-2013 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -126,7 +126,7 @@ struct LADSPA_RDF_ScalePoint {
: Value(0.0f),
Label(nullptr) {}

~LADSPA_RDF_ScalePoint()
~LADSPA_RDF_ScalePoint() noexcept
{
if (Label != nullptr)
{
@@ -158,7 +158,7 @@ struct LADSPA_RDF_Port {
ScalePointCount(0),
ScalePoints(nullptr) {}

~LADSPA_RDF_Port()
~LADSPA_RDF_Port() noexcept
{
if (Label != nullptr)
{
@@ -193,7 +193,7 @@ struct LADSPA_RDF_Descriptor {
PortCount(0),
Ports(nullptr) {}

~LADSPA_RDF_Descriptor()
~LADSPA_RDF_Descriptor() noexcept
{
if (Title != nullptr)
{


+ 8
- 8
source/modules/lv2_rdf.hpp View File

@@ -1,6 +1,6 @@
/*
* Custom types to store LV2 information
* Copyright (C) 2011-2013 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -333,7 +333,7 @@ struct LV2_RDF_PortUnit {
Symbol(nullptr),
Unit(0) {}

~LV2_RDF_PortUnit()
~LV2_RDF_PortUnit() noexcept
{
if (Name != nullptr)
{
@@ -364,7 +364,7 @@ struct LV2_RDF_PortScalePoint {
: Label(nullptr),
Value(0.0f) {}

~LV2_RDF_PortScalePoint()
~LV2_RDF_PortScalePoint() noexcept
{
if (Label != nullptr)
{
@@ -403,7 +403,7 @@ struct LV2_RDF_Port {
ScalePointCount(0),
ScalePoints(nullptr) {}

~LV2_RDF_Port()
~LV2_RDF_Port() noexcept
{
if (Name != nullptr)
{
@@ -434,7 +434,7 @@ struct LV2_RDF_Preset {
: URI(nullptr),
Label(nullptr) {}

~LV2_RDF_Preset()
~LV2_RDF_Preset() noexcept
{
if (URI != nullptr)
{
@@ -460,7 +460,7 @@ struct LV2_RDF_Feature {
: Type(0),
URI(nullptr) {}

~LV2_RDF_Feature()
~LV2_RDF_Feature() noexcept
{
if (URI != nullptr)
{
@@ -495,7 +495,7 @@ struct LV2_RDF_UI {
ExtensionCount(0),
Extensions(nullptr) {}

~LV2_RDF_UI()
~LV2_RDF_UI() noexcept
{
if (URI != nullptr)
{
@@ -575,7 +575,7 @@ struct LV2_RDF_Descriptor {
Type[0] = Type[1] = 0x0;
}

~LV2_RDF_Descriptor()
~LV2_RDF_Descriptor() noexcept
{
if (URI != nullptr)
{


+ 1
- 1
source/utils/CarlaExternalUI.hpp View File

@@ -49,7 +49,7 @@ public:
return uiState;
}

void setData(const char* const filename, const double sampleRate, const char* const uiTitle)
void setData(const char* const filename, const double sampleRate, const char* const uiTitle) noexcept
{
fFilename = filename;
fSampleRate = CarlaString(sampleRate);


+ 19
- 10
source/utils/CarlaLadspaUtils.hpp View File

@@ -140,7 +140,7 @@ bool is_ladspa_rdf_descriptor_valid(const LADSPA_RDF_Descriptor* const rdfDescri
// Get default control port value

static inline
LADSPA_Data get_default_ladspa_port_value(const LADSPA_PortRangeHintDescriptor hintDescriptor, const LADSPA_Data min, const LADSPA_Data max)
LADSPA_Data get_default_ladspa_port_value(const LADSPA_PortRangeHintDescriptor hintDescriptor, const LADSPA_Data min, const LADSPA_Data max) noexcept
{
if (LADSPA_IS_HINT_HAS_DEFAULT(hintDescriptor))
{
@@ -166,21 +166,30 @@ LADSPA_Data get_default_ladspa_port_value(const LADSPA_PortRangeHintDescriptor h

case LADSPA_HINT_DEFAULT_LOW:
if (LADSPA_IS_HINT_LOGARITHMIC(hintDescriptor))
return std::exp((std::log(min)*0.75f) + (std::log(max)*0.25f));
else
return (min*0.75f) + (max*0.25f);
{
try {
return std::exp((std::log(min)*0.75f) + (std::log(max)*0.25f));
} catch(...) {}
}
return (min*0.75f) + (max*0.25f);

case LADSPA_HINT_DEFAULT_MIDDLE:
if (LADSPA_IS_HINT_LOGARITHMIC(hintDescriptor))
return std::sqrt(min*max);
else
return (min+max)/2;
{
try {
return std::sqrt(min*max);
} catch(...) {}
}
return (min+max)/2;

case LADSPA_HINT_DEFAULT_HIGH:
if (LADSPA_IS_HINT_LOGARITHMIC(hintDescriptor))
return std::exp((std::log(min)*0.25f) + (std::log(max)*0.75f));
else
return (min*0.25f) + (max*0.75f);
{
try {
return std::exp((std::log(min)*0.25f) + (std::log(max)*0.75f));
} catch(...) {}
}
return (min*0.25f) + (max*0.75f);
}
}



+ 3
- 3
source/utils/CarlaLv2Utils.hpp View File

@@ -1272,7 +1272,7 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri, const bool fillPresets)
// Check if we support a plugin port

static inline
bool is_lv2_port_supported(const LV2_Property types)
bool is_lv2_port_supported(const LV2_Property types) noexcept
{
if (LV2_IS_PORT_CONTROL(types))
return true;
@@ -1293,7 +1293,7 @@ bool is_lv2_port_supported(const LV2_Property types)
// Check if we support a plugin feature

static inline
bool is_lv2_feature_supported(const LV2_URI uri)
bool is_lv2_feature_supported(const LV2_URI uri) noexcept
{
CARLA_SAFE_ASSERT_RETURN(uri != nullptr && uri[0] != '\0', false);

@@ -1344,7 +1344,7 @@ bool is_lv2_feature_supported(const LV2_URI uri)
// Check if we support a plugin or UI feature

static inline
bool is_lv2_ui_feature_supported(const LV2_URI uri)
bool is_lv2_ui_feature_supported(const LV2_URI uri) noexcept
{
CARLA_SAFE_ASSERT_RETURN(uri != nullptr && uri[0] != '\0', false);



+ 9
- 4
source/utils/CarlaOscUtils.hpp View File

@@ -39,12 +39,12 @@ struct CarlaOscData {
source(nullptr),
target(nullptr) {}

~CarlaOscData()
~CarlaOscData() noexcept
{
free();
}

void free()
void free() noexcept
{
if (path != nullptr)
{
@@ -54,17 +54,22 @@ struct CarlaOscData {

if (source != nullptr)
{
lo_address_free(source);
try {
lo_address_free(source);
} catch(...) {}
source = nullptr;
}

if (target != nullptr)
{
lo_address_free(target);
try {
lo_address_free(target);
} catch(...) {}
target = nullptr;
}
}

CARLA_PREVENT_HEAP_ALLOCATION
CARLA_DECLARE_NON_COPY_STRUCT(CarlaOscData)
};



+ 1
- 1
source/utils/CarlaRingBuffer.hpp View File

@@ -29,7 +29,7 @@ struct HeapRingBuffer {
bool invalidateCommit;
char* buf;

HeapRingBuffer& operator=(const HeapRingBuffer& rb)
HeapRingBuffer& operator=(const HeapRingBuffer& rb) noexcept
{
CARLA_SAFE_ASSERT_RETURN(size == rb.size, *this);



+ 2
- 2
source/utils/CarlaShmUtils.hpp View File

@@ -38,7 +38,7 @@ static shm_t gNullCarlaShm = -1;
// shared memory calls

static inline
bool carla_is_shm_valid(const shm_t& shm)
bool carla_is_shm_valid(const shm_t& shm) noexcept
{
#ifdef CARLA_OS_WIN
return (shm.shm != nullptr && shm.shm != INVALID_HANDLE_VALUE);
@@ -48,7 +48,7 @@ bool carla_is_shm_valid(const shm_t& shm)
}

static inline
void carla_shm_init(shm_t& shm)
void carla_shm_init(shm_t& shm) noexcept
{
#ifdef CARLA_OS_WIN
shm.shm = nullptr;


+ 4
- 4
source/utils/CarlaStateUtils.cpp View File

@@ -38,7 +38,7 @@ StateParameter::StateParameter() noexcept
midiChannel(0),
midiCC(-1) {}

StateParameter::~StateParameter()
StateParameter::~StateParameter() noexcept
{
if (name != nullptr)
{
@@ -60,7 +60,7 @@ StateCustomData::StateCustomData() noexcept
key(nullptr),
value(nullptr) {}

StateCustomData::~StateCustomData()
StateCustomData::~StateCustomData() noexcept
{
if (type != nullptr)
{
@@ -101,12 +101,12 @@ SaveState::SaveState() noexcept
currentMidiProgram(-1),
chunk(nullptr) {}

SaveState::~SaveState()
SaveState::~SaveState() noexcept
{
reset();
}

void SaveState::reset()
void SaveState::reset() noexcept
{
if (type != nullptr)
{


+ 4
- 4
source/utils/CarlaStateUtils.hpp View File

@@ -44,7 +44,7 @@ struct StateParameter {
int16_t midiCC;

StateParameter() noexcept;
~StateParameter();
~StateParameter() noexcept;

CARLA_DECLARE_NON_COPY_STRUCT(StateParameter)
};
@@ -55,7 +55,7 @@ struct StateCustomData {
const char* value;

StateCustomData() noexcept;
~StateCustomData();
~StateCustomData() noexcept;

CARLA_DECLARE_NON_COPY_STRUCT(StateCustomData)
};
@@ -91,8 +91,8 @@ struct SaveState {
StateCustomDataList customData;

SaveState() noexcept;
~SaveState();
void reset();
~SaveState() noexcept;
void reset() noexcept;

CARLA_DECLARE_NON_COPY_STRUCT(SaveState)
};


+ 10
- 4
source/utils/CarlaVstUtils.hpp View File

@@ -141,16 +141,22 @@ typedef AEffect* (*VST_Function)(audioMasterCallback);
// Check if feature is supported by the plugin

static inline
bool vstPluginCanDo(AEffect* const effect, const char* const feature)
bool vstPluginCanDo(AEffect* const effect, const char* const feature) noexcept
{
return (effect->dispatcher(effect, effCanDo, 0, 0, const_cast<char*>(feature), 0.0f) == 1);
bool ret = false;

try {
ret = (effect->dispatcher(effect, effCanDo, 0, 0, const_cast<char*>(feature), 0.0f) == 1);
} catch(...) {}

return ret;
}

// -----------------------------------------------------------------------
// Convert Effect opcode to string

static inline
const char* vstEffectOpcode2str(const int32_t opcode)
const char* vstEffectOpcode2str(const int32_t opcode) noexcept
{
switch (opcode)
{
@@ -343,7 +349,7 @@ const char* vstEffectOpcode2str(const int32_t opcode)
// Convert Host/Master opcode to string

static inline
const char* vstMasterOpcode2str(const int32_t opcode)
const char* vstMasterOpcode2str(const int32_t opcode) noexcept
{
switch (opcode)
{


+ 2
- 3
source/utils/LinkedList.hpp View File

@@ -401,7 +401,7 @@ protected:
k_list_head fQueue;

virtual Data* _allocate() noexcept = 0;
virtual void _deallocate(Data*& dataPtr) noexcept = 0;
virtual void _deallocate(Data* const dataPtr) noexcept = 0;

private:
mutable T fRetValue;
@@ -456,12 +456,11 @@ private:
return (typename AbstractLinkedList<T>::Data*)std::malloc(this->fDataSize);
}

void _deallocate(typename AbstractLinkedList<T>::Data*& dataPtr) noexcept override
void _deallocate(typename AbstractLinkedList<T>::Data* const dataPtr) noexcept override
{
CARLA_SAFE_ASSERT_RETURN(dataPtr != nullptr,);

std::free(dataPtr);
dataPtr = nullptr;
}

LINKED_LIST_DECLARATIONS(LinkedList)


+ 1
- 2
source/utils/RtLinkedList.hpp View File

@@ -179,12 +179,11 @@ private:
return (typename AbstractLinkedList<T>::Data*)fMemPool.allocate_sleepy();
}

void _deallocate(typename AbstractLinkedList<T>::Data*& dataPtr) noexcept override
void _deallocate(typename AbstractLinkedList<T>::Data* const dataPtr) noexcept override
{
CARLA_SAFE_ASSERT_RETURN(dataPtr != nullptr,);

fMemPool.deallocate(dataPtr);
dataPtr = nullptr;
}

LINKED_LIST_DECLARATIONS(RtLinkedList)


Loading…
Cancel
Save