Commit 8331dbbd authored by Benjamin Heisch's avatar Benjamin Heisch
Browse files

Removed all Warnings from gcc

parent f0b4404b
Pipeline #19077 failed with stages
in 3 minutes and 10 seconds
......@@ -21,8 +21,8 @@ public:
{
// auto in0 = getPortAt<IAudioPort>(this, 0,PortDirection::Input);
// auto out0 = getPortAt<IAudioPort>(this, 0, PortDirection::Output);
for (int i = 0; i < in0->size(); i++) {
for (int s = 0; s < in0->getSampleSize(); s++) {
for (size_t i = 0; i < in0->size(); i++) {
for (size_t s = 0; s < in0->getSampleSize(); s++) {
if(in0->at(i)->getData() != nullptr && out0->at(i)->getData()!=nullptr )
out0->at(i)->getData()[s] = in0->at(i)->getData()[s];
}
......
......@@ -24,7 +24,7 @@ const LADSPA_Descriptor* ladspa_descriptor(unsigned long index)
desc->ImplementationData = new LADSPAHandleDataType { GlobalData().getPlugin(index).get(), desc };
/******************* INSTANTIATION**********************/
desc->instantiate = [](const LADSPA_Descriptor* descriptor, unsigned long SampleRate) -> LADSPA_Handle {
desc->instantiate = [](const LADSPA_Descriptor* descriptor, unsigned long ) -> LADSPA_Handle {
auto data = static_cast<LADSPAHandleDataType*>(descriptor->ImplementationData);
data->plug->init();
return data;
......@@ -67,7 +67,7 @@ const LADSPA_Descriptor* ladspa_descriptor(unsigned long index)
char** portNamesCArray = new char*[desc->PortCount * sizeof(const char*)];
auto portDescripors = new LADSPA_PortDescriptor[desc->PortCount * sizeof(LADSPA_PortDescriptor)];
auto rangeHints = new LADSPA_PortRangeHint[desc->PortCount * sizeof(LADSPA_PortDescriptor)];
iteratePorts<IAudioPort>(plug.get(), [&portNamesCArray, &portDescripors, &rangeHints, &curIndex](IAudioPort* p, size_t portIndex) {
iteratePorts<IAudioPort>(plug.get(), [&portNamesCArray, &portDescripors, &rangeHints, &curIndex](IAudioPort* p, size_t ) {
for (size_t i = 0; i < p->size(); i++) {
std::string name = p->getPortName().to_string() + (p->at(i)->getName()!= "" ? static_cast<std::string>(p->at(i)->getName()): std::to_string(i));
portNamesCArray[curIndex] = new char[name.length() + 1];
......@@ -105,7 +105,7 @@ const LADSPA_Descriptor* ladspa_descriptor(unsigned long index)
IPlugin* plug = (IPlugin*)desc->ImplementationData;
plug->processAudio(plug->getPortComponent()->getInputPorts(), plug->getPortComponent()->getOutputPorts());
};*/
desc->set_run_adding_gain;
//desc->set_run_adding_gain;
return desc;
}
}
......@@ -33,12 +33,12 @@ public:
auto handle = desc->instantiate(desc, sampleRate);
desc->activate(handle);
auto portData = std::vector<LADSPA_Data*>(desc->PortCount);
for (size_t i = 0; i < desc->PortCount; i++) {
for (unsigned long i = 0; i < desc->PortCount; i++) {
portData[i] = new LADSPA_Data[sampleRate];
desc->connect_port(handle, i, portData[i]);
}
desc->run(handle, sampleRate);
for (int i = 0; i < desc->PortCount; i++) {
for (unsigned long i = 0; i < desc->PortCount; i++) {
delete[] portData[i];
}
desc->deactivate(handle);
......
......@@ -82,7 +82,7 @@ inline bool supportsMidi(IPlugin* plug,IPort* port) {
/**
The `lv2_descriptor()` function is the entry point to the plugin library. The
host will load symbols the library and call this function repeatedly with increasing
indices to find all the plugins defined in the library. The index is not an
indices to find all the plugins defined in the library. The descriptorIndex is not an
indentifier, the URI of the returned descriptor is used to determine the
identify of the plugin.
......@@ -91,10 +91,9 @@ inline bool supportsMidi(IPlugin* plug,IPort* port) {
*/
static std::unordered_map<std::string, uint32_t> URI_INDEX_MAP;
extern "C" {
static int currentLV2Index = 0;
const LV2_Descriptor* lv2_descriptor(uint32_t index)
{
if (index < 0 || index >= GlobalData().getNumberOfRegisteredPlugins())
if (index >= GlobalData().getNumberOfRegisteredPlugins())
return NULL;
PluginPtr plug = GlobalData().getPlugin(index);
......@@ -152,10 +151,10 @@ extern "C" {
// midiData->body.
};
desc->instantiate = [](const LV2_Descriptor* descriptor, double SampleRate, const char* bundlePath, const LV2_Feature* const* features)->LV2_Handle {
auto index = URI_INDEX_MAP[std::string(descriptor->URI)];
GlobalData().getPlugin(index)->init();
auto lv2Handle = new LV2HandleDataType{ GlobalData().getPlugin(index).get(),descriptor };
desc->instantiate = [](const LV2_Descriptor* descriptor, double , const char* , const LV2_Feature* const* features)->LV2_Handle {
auto descriptorIndex = URI_INDEX_MAP[std::string(descriptor->URI)];
GlobalData().getPlugin(descriptorIndex)->init();
auto lv2Handle = new LV2HandleDataType{ GlobalData().getPlugin(descriptorIndex).get(),descriptor,nullptr,{} };
for (int i = 0; features[i]; ++i) {
if (!strcmp(features[i]->URI, LV2_URID__map)) {
lv2Handle->map = (LV2_URID_Map*)features[i]->data;
......@@ -180,7 +179,7 @@ extern "C" {
auto data = static_cast<LV2HandleDataType*>(instance);
//TODO not nice. Maybe write a function, which does this, but is RT Capable (non mem allocation and blocking ist allowed.
iteratePorts<IAudioPort>(data->plug, [SampleCount](IAudioPort* p, size_t index) {
iteratePorts<IAudioPort>(data->plug, [SampleCount](IAudioPort* p, size_t ) {
p->setSampleSize(SampleCount);
return false;
});
......@@ -193,18 +192,18 @@ extern "C" {
handleOutput(&mHandle);
};
desc->extension_data = [](const char* uri)-> const void* {
desc->extension_data = [](const char* )-> const void* {
return nullptr;
};
return desc;
}
const LV2_Lib_Descriptor* lv2_lib_descriptor(const char* bundle_path, const LV2_Feature* const* features)
const LV2_Lib_Descriptor* lv2_lib_descriptor(const char* , const LV2_Feature* const* )
{
auto lDesc= new LV2_Lib_Descriptor;
lDesc->cleanup = [](LV2_Lib_Handle h) {};
lDesc->get_plugin = [](LV2_Lib_Handle h, uint32_t index) {
lDesc->cleanup = [](LV2_Lib_Handle ) {};
lDesc->get_plugin = [](LV2_Lib_Handle , uint32_t index) {
return lv2_descriptor(index);
};
lDesc->size = sizeof(LV2_Lib_Descriptor);
......
......@@ -12,6 +12,8 @@ std::string mapSpeakerConfToLV2Type(SpeakerConfiguration conf) {
switch (conf) {
case SpeakerConfiguration::Mono:
return "MonoGroup";
default:
return "Loll!";
}
return "";
}
......@@ -43,7 +45,7 @@ std::string getTTLFromPlugin(IPlugin* pluginPtr)
iteratePorts<IPort>(plug, [&plugTTL,&pCount, portsSize, plug](IPort* p, size_t ) {
if (dynamic_cast<IAudioPort*>(p) != nullptr) {
auto aPort = dynamic_cast<IAudioPort*>(p);
for (int i = 0; i < aPort->size(); i++) {
for (size_t i = 0; i < aPort->size(); i++) {
std::string symbol = to_string(aPort->at(i)->getName());
std::transform(symbol.begin(), symbol.end(), symbol.begin(), ::tolower);
std::string name = symbol;
......
......@@ -10,6 +10,7 @@
#include <array>
#include <algorithm>
#include <map>
#include <exception>
inline std::string replaceInString(std::string strToChange, const std::string itemToReplace, const std::string substitute)
......@@ -79,11 +80,11 @@ public:
void* data = nullptr;
PortType type;
Direction dir;
Port(const LilvPort* lilvPort, PortType type,Direction dir, const LV2Features* features) {
this->lilvPort = lilvPort;
this->type = type;
this->features = features;
this->dir = dir;
Port(const LilvPort* _lilvPort, PortType _type,Direction _dir, const LV2Features* _features) {
this->lilvPort = _lilvPort;
this->type = _type;
this->features = _features;
this->dir = _dir;
}
Port(const Port& other) {
features = other.features;
......@@ -112,6 +113,8 @@ public:
this->size_of_data =sizeof(float)*sample_count;
data = new float[sample_count];
return;
default:
return;
}
}
......@@ -134,7 +137,8 @@ public:
delete[](float*)this->data;
return;
default:
delete this->data;
// delete this->data;
return;
}
this->data = nullptr;
}
......@@ -157,15 +161,15 @@ public:
* @param w
* @return
*/
Plugin(const LilvPlugin* lilvPlugin, const LV2Features* features, LilvWorld* w) {
this->lilvPlugin = lilvPlugin;
this->features = features;
Plugin(const LilvPlugin* _lilvPlugin, const LV2Features* _features, LilvWorld* w) {
this->lilvPlugin = _lilvPlugin;
this->features = _features;
auto auPort = lilv_new_uri(w, LILV_URI_AUDIO_PORT);
auto midiEvent = lilv_new_uri(w, LILV_URI_MIDI_EVENT);
auto inPort = lilv_new_uri(w, LILV_URI_INPUT_PORT);
auto outPort = lilv_new_uri(w, LILV_URI_OUTPUT_PORT);
for (int i = 0; i < lilv_plugin_get_num_ports(this->lilvPlugin);i++) {
for (uint32_t i = 0; i < lilv_plugin_get_num_ports(this->lilvPlugin);i++) {
auto lilvPort = lilv_plugin_get_port_by_index(this->lilvPlugin, i);
auto pType = PortType::Undefined;
if (lilv_port_is_a(this->lilvPlugin, lilvPort, auPort))
......@@ -187,8 +191,8 @@ public:
* @param sampleRate
* @return
*/
inline void instantiate(size_t sampleRate) {
this->sampleRate = sampleRate;
inline void instantiate(size_t _sampleRate) {
this->sampleRate = _sampleRate;
lilvInstance = lilv_plugin_instantiate(this->lilvPlugin, this->sampleRate, features->features.data());
}
......@@ -197,7 +201,7 @@ public:
* @param audioPortBufferSize Memorysize of each audiobuffer in every Port.
*/
inline void allocateAndConnectPorts(size_t audioPortBufferSize) {
for (int i = 0; i < this->ports.size(); i++) {
for (size_t i = 0; i < this->ports.size(); i++) {
this->ports[i].allocate(audioPortBufferSize);
lilv_instance_connect_port(lilvInstance, i, this->ports[i].data);
}
......
......@@ -132,8 +132,8 @@ public:
if (this->module != nullptr)
delete this->module;
}
inline virtual void initialize(TestSuiteData data) override {
this->data = data;
inline virtual void initialize(TestSuiteData _data) override {
this->data = _data;
this->module = new LV2Module(this->data.pluginPath);
}
......@@ -146,7 +146,7 @@ public:
virtual SucceedState run() override
{
double sampleRate=512;
size_t sampleCount = 512;
// size_t sampleCount = 512;
for (auto plug : this->module->plugins) {
plug.verify();
plug.instantiate(sampleRate);
......
......@@ -26,7 +26,7 @@
#include <errno.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <ctype.h>
#ifdef _WIN32
# include <windows.h>
# include <direct.h>
......@@ -953,6 +953,224 @@ read_node(Sratom* sratom,
SordModel* model,
const SordNode* node,
ReadMode mode);
/**
@defgroup sratom Sratom
A library for serialising LV2 Atoms.
@{
*/
/**
Atom serialiser.
*/
typedef struct SratomImpl Sratom;
/**
Mode for reading resources to LV2 Objects.
This affects how resources (which are either blank nodes or have URIs) are
read by sratom_read(), since they may be read as simple references (a URI or
blank node ID) or a complete description (an atom "Object").
Currently, blank nodes are always read as Objects, but support for reading
blank node IDs may be added in the future.
*/
/**
Create a new Atom serialiser.
*/
Sratom*
sratom_new(LV2_URID_Map* map);
/**
Free an Atom serialisation.
*/
void
sratom_free(Sratom* sratom);
/**
Set the environment for reading or writing Turtle.
This can be used to set namespace prefixes and a base URI for
sratom_to_turtle() and sratom_from_turtle().
*/
void
sratom_set_env(Sratom* sratom,
SerdEnv* env);
/**
Set the sink(s) where sratom will write its output.
This must be called before calling sratom_write().
*/
void
sratom_set_sink(Sratom* sratom,
const char* base_uri,
SerdStatementSink sink,
SerdEndSink end_sink,
void* handle);
/**
Write pretty numeric literals.
If `pretty_numbers` is true, numbers will be written as pretty Turtle
literals, rather than string literals with precise types. The cost of this
is that the types might get fudged on a round-trip to RDF and back.
*/
void
sratom_set_pretty_numbers(Sratom* sratom,
bool pretty_numbers);
/**
Configure how resources will be read to form LV2 Objects.
*/
void
sratom_set_object_mode(Sratom* sratom,
SratomObjectMode object_mode);
/**
Write an Atom to RDF.
The serialised atom is written to the sink set by sratom_set_sink().
@return 0 on success, or a non-zero error code otherwise.
*/
int
sratom_write(Sratom* sratom,
LV2_URID_Unmap* unmap,
uint32_t flags,
const SerdNode* subject,
const SerdNode* predicate,
uint32_t type_urid,
uint32_t size,
const void* body);
/**
Read an Atom from RDF.
The resulting atom will be written to `forge`.
*/
void
sratom_read(Sratom* sratom,
LV2_Atom_Forge* forge,
SordWorld* world,
SordModel* model,
const SordNode* node);
/**
Serialise an Atom to a Turtle string.
The returned string must be free()'d by the caller.
*/
char*
sratom_to_turtle(Sratom* sratom,
LV2_URID_Unmap* unmap,
const char* base_uri,
const SerdNode* subject,
const SerdNode* predicate,
uint32_t type,
uint32_t size,
const void* body);
/**
Read an Atom from a Turtle string.
The returned atom must be free()'d by the caller.
*/
LV2_Atom*
sratom_from_turtle(Sratom* sratom,
const char* base_uri,
const SerdNode* subject,
const SerdNode* predicate,
const char* str);
/**
A convenient resizing sink for LV2_Atom_Forge.
The handle must point to an initialized SerdChunk.
*/
LV2_Atom_Forge_Ref
sratom_forge_sink(LV2_Atom_Forge_Sink_Handle handle,
const void* buf,
uint32_t size);
/**
The corresponding deref function for sratom_forge_sink.
*/
LV2_Atom*
sratom_forge_deref(LV2_Atom_Forge_Sink_Handle handle,
LV2_Atom_Forge_Ref ref);
/* Character utilities */
/** Return true if `c` lies within [`min`...`max`] (inclusive) */
static inline bool
in_range(const int c, const int min, const int max)
{
return (c >= min && c <= max);
}
/** RFC2234: ALPHA ::= %x41-5A / %x61-7A ; A-Z / a-z */
static inline bool
is_alpha(const int c)
{
return in_range(c, 'A', 'Z') || in_range(c, 'a', 'z');
}
/** RFC2234: DIGIT ::= %x30-39 ; 0-9 */
static inline bool
is_digit(const int c)
{
return in_range(c, '0', '9');
}
/* RFC2234: HEXDIG ::= DIGIT / "A" / "B" / "C" / "D" / "E" / "F" */
static inline bool
is_hexdig(const int c)
{
return is_digit(c) || in_range(c, 'A', 'F');
}
/* Turtle / JSON / C: XDIGIT ::= DIGIT / A-F / a-f */
static inline bool
is_xdigit(const int c)
{
return is_hexdig(c) || in_range(c, 'a', 'f');
}
static inline bool
is_space(const char c)
{
switch (c) {
case ' ': case '\f': case '\n': case '\r': case '\t': case '\v':
return true;
default:
return false;
}
}
static inline bool
is_base64(const uint8_t c)
{
return is_alpha(c) || is_digit(c) || c == '+' || c == '/' || c == '=';
}
/* String utilities */
size_t
serd_substrlen(const uint8_t* str,
size_t len,
size_t* n_bytes,
SerdNodeFlags* flags);
Sratom*
sratom_new(LV2_URID_Map* map)
......@@ -1092,7 +1310,7 @@ static bool
path_is_absolute(const char* path)
{
return (path[0] == '/'
|| (isalpha(path[0]) && path[1] == ':'
|| (is_alpha(path[0]) && path[1] == ':'
&& (path[2] == '/' || path[2] == '\\')));
}
......@@ -4207,160 +4425,6 @@ sord_write_iter(SordIter* iter,
/***********************SRATOM*****************************/
/**
@defgroup sratom Sratom
A library for serialising LV2 Atoms.
@{
*/
/**
Atom serialiser.
*/
typedef struct SratomImpl Sratom;
/**
Mode for reading resources to LV2 Objects.
This affects how resources (which are either blank nodes or have URIs) are
read by sratom_read(), since they may be read as simple references (a URI or
blank node ID) or a complete description (an atom "Object").
Currently, blank nodes are always read as Objects, but support for reading
blank node IDs may be added in the future.
*/
/**
Create a new Atom serialiser.
*/
Sratom*
sratom_new(LV2_URID_Map* map);
/**
Free an Atom serialisation.
*/
void
sratom_free(Sratom* sratom);
/**
Set the environment for reading or writing Turtle.
This can be used to set namespace prefixes and a base URI for
sratom_to_turtle() and sratom_from_turtle().
*/
void
sratom_set_env(Sratom* sratom,
SerdEnv* env);
/**
Set the sink(s) where sratom will write its output.
This must be called before calling sratom_write().
*/
void
sratom_set_sink(Sratom* sratom,
const char* base_uri,
SerdStatementSink sink,
SerdEndSink end_sink,
void* handle);
/**
Write pretty numeric literals.
If `pretty_numbers` is true, numbers will be written as pretty Turtle
literals, rather than string literals with precise types. The cost of this
is that the types might get fudged on a round-trip to RDF and back.
*/
void
sratom_set_pretty_numbers(Sratom* sratom,
bool pretty_numbers);
/**
Configure how resources will be read to form LV2 Objects.
*/
void
sratom_set_object_mode(Sratom* sratom,
SratomObjectMode object_mode);
/**
Write an Atom to RDF.
The serialised atom is written to the sink set by sratom_set_sink().
@return 0 on success, or a non-zero error code otherwise.
*/
int
sratom_write(Sratom* sratom,
LV2_URID_Unmap* unmap,
uint32_t flags,
const SerdNode* subject,
const SerdNode* predicate,
uint32_t type_urid,
uint32_t size,
const void* body);
/**
Read an Atom from RDF.
The resulting atom will be written to `forge`.
*/
void
sratom_read(Sratom* sratom,
LV2_Atom_Forge* forge,
SordWorld* world,
SordModel* model,
const SordNode* node);
/**
Serialise an Atom to a Turtle string.
The returned string must be free()'d by the caller.
*/
char*
sratom_to_turtle(Sratom* sratom,
LV2_URID_Unmap* unmap,
const char* base_uri,
const SerdNode* subject,
const SerdNode* predicate,
uint32_t type,
uint32_t size,
const void* body);
/**
Read an Atom from a Turtle string.
The returned atom must be free()'d by the caller.
*/
LV2_Atom*
sratom_from_turtle(Sratom* sratom,
const char* base_uri,
const SerdNode* subject,
const SerdNode* predicate,
const char* str);