summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-12-08 19:13:33 +0100
committerDavid Robillard <d@drobilla.net>2019-12-08 20:59:06 +0100
commit14cd32a043552d39738ae0e84e4ef8ab93783296 (patch)
tree829845243215ed3fd96ff8fd6d6f324c35a60b3e
parent88dff1aabd3c81d1d81ac256e0061b98e0d24cec (diff)
downloadingen-14cd32a043552d39738ae0e84e4ef8ab93783296.tar.gz
ingen-14cd32a043552d39738ae0e84e4ef8ab93783296.tar.bz2
ingen-14cd32a043552d39738ae0e84e4ef8ab93783296.zip
Cleanup: Use "auto" to avoid repeating type names
-rw-r--r--src/AtomReader.cpp12
-rw-r--r--src/Library.cpp2
-rw-r--r--src/Log.cpp10
-rw-r--r--src/Parser.cpp10
-rw-r--r--src/Resource.cpp2
-rw-r--r--src/TurtleWriter.cpp2
-rw-r--r--src/URIMap.cpp4
-rw-r--r--src/server/ArcImpl.cpp2
-rw-r--r--src/server/BlockFactory.cpp4
-rw-r--r--src/server/Buffer.cpp43
-rw-r--r--src/server/ControlBindings.cpp9
-rw-r--r--src/server/DuplexPort.cpp2
-rw-r--r--src/server/GraphImpl.cpp2
-rw-r--r--src/server/LV2Block.cpp16
-rw-r--r--src/server/LV2Plugin.cpp2
-rw-r--r--src/server/PortImpl.cpp6
-rw-r--r--src/server/PreProcessor.cpp2
-rw-r--r--src/server/UndoStack.cpp4
-rw-r--r--src/server/Worker.cpp15
-rw-r--r--src/server/events/Connect.cpp4
-rw-r--r--src/server/events/Delta.cpp24
-rw-r--r--src/server/events/DisconnectAll.cpp2
22 files changed, 89 insertions, 90 deletions
diff --git a/src/AtomReader.cpp b/src/AtomReader.cpp
index 821b52a1..8b63c749 100644
--- a/src/AtomReader.cpp
+++ b/src/AtomReader.cpp
@@ -51,8 +51,8 @@ AtomReader::get_atom(const LV2_Atom* in, Atom& out)
{
if (in) {
if (in->type == _uris.atom_URID) {
- const LV2_Atom_URID* urid = (const LV2_Atom_URID*)in;
- const char* uri = _map.unmap_uri(urid->body);
+ const auto* const urid = reinterpret_cast<const LV2_Atom_URID*>(in);
+ const char* const uri = _map.unmap_uri(urid->body);
if (uri) {
out = Atom(sizeof(int32_t), _uris.atom_URID, &urid->body);
} else {
@@ -141,7 +141,7 @@ AtomReader::is_message(const URIs& uris, const LV2_Atom* msg)
return false;
}
- const LV2_Atom_Object* obj = (const LV2_Atom_Object*)msg;
+ const auto* obj = (const LV2_Atom_Object*)msg;
return (obj->body.otype == uris.patch_Get ||
obj->body.otype == uris.patch_Delete ||
obj->body.otype == uris.patch_Put ||
@@ -159,9 +159,9 @@ AtomReader::write(const LV2_Atom* msg, int32_t default_id)
return false;
}
- const LV2_Atom_Object* obj = (const LV2_Atom_Object*)msg;
- const LV2_Atom* subject = nullptr;
- const LV2_Atom* number = nullptr;
+ const auto* obj = (const LV2_Atom_Object*)msg;
+ const LV2_Atom* subject = nullptr;
+ const LV2_Atom* number = nullptr;
lv2_atom_object_get(obj,
(LV2_URID)_uris.patch_subject, &subject,
diff --git a/src/Library.cpp b/src/Library.cpp
index 44deea90..a8a7107e 100644
--- a/src/Library.cpp
+++ b/src/Library.cpp
@@ -42,7 +42,7 @@ Library::get_function(const char* name)
return (VoidFuncPtr)GetProcAddress((HMODULE)_lib, name);
#else
using VoidFuncGetter = VoidFuncPtr (*)(void*, const char*);
- VoidFuncGetter dlfunc = (VoidFuncGetter)dlsym;
+ auto dlfunc = reinterpret_cast<VoidFuncGetter>(dlsym);
return dlfunc(_lib, name);
#endif
}
diff --git a/src/Log.cpp b/src/Log.cpp
index 756bb8c3..cf18b58c 100644
--- a/src/Log.cpp
+++ b/src/Log.cpp
@@ -120,8 +120,8 @@ Log::vtprintf(LV2_URID type, const char* fmt, va_list args)
static int
log_vprintf(LV2_Log_Handle handle, LV2_URID type, const char* fmt, va_list args)
{
- Log::Feature::Handle* f = (Log::Feature::Handle*)handle;
- va_list noargs;
+ auto* f = static_cast<Log::Feature::Handle*>(handle);
+ va_list noargs = {};
int ret = f->log->vtprintf(type, f->node->path().c_str(), noargs);
ret += f->log->vtprintf(type, ": ", noargs);
@@ -143,7 +143,7 @@ log_printf(LV2_Log_Handle handle, LV2_URID type, const char* fmt, ...)
static void
free_log_feature(LV2_Feature* feature) {
- LV2_Log_Log* lv2_log = (LV2_Log_Log*)feature->data;
+ auto* lv2_log = static_cast<LV2_Log_Log*>(feature->data);
free(lv2_log->handle);
free(feature);
}
@@ -151,14 +151,14 @@ free_log_feature(LV2_Feature* feature) {
SPtr<LV2_Feature>
Log::Feature::feature(World& world, Node* block)
{
- Handle* handle = (Handle*)calloc(1, sizeof(Handle));
+ auto* handle = static_cast<Handle*>(calloc(1, sizeof(Handle)));
handle->lv2_log.handle = handle;
handle->lv2_log.printf = log_printf;
handle->lv2_log.vprintf = log_vprintf;
handle->log = &world.log();
handle->node = block;
- LV2_Feature* f = (LV2_Feature*)malloc(sizeof(LV2_Feature));
+ auto* f = static_cast<LV2_Feature*>(malloc(sizeof(LV2_Feature)));
f->URI = LV2_LOG__log;
f->data = &handle->lv2_log;
diff --git a/src/Parser.cpp b/src/Parser.cpp
index c1d8554d..c4661789 100644
--- a/src/Parser.cpp
+++ b/src/Parser.cpp
@@ -274,7 +274,7 @@ parse_block(ingen::World& world,
return boost::optional<Raul::Path>();
}
- const uint8_t* type_uri = (const uint8_t*)prototype.to_c_string();
+ const auto* type_uri = (const uint8_t*)prototype.to_c_string();
if (!serd_uri_string_has_scheme(type_uri) ||
!strncmp((const char*)type_uri, "file:", 5)) {
// Prototype is a file, subgraph
@@ -631,10 +631,10 @@ Parser::parse_file(ingen::World& world,
}
// Initialise parsing environment
- const URI file_uri = URI(file_path);
- const uint8_t* uri_c_str = (const uint8_t*)uri.c_str();
- SerdNode base_node = serd_node_from_string(SERD_URI, uri_c_str);
- SerdEnv* env = serd_env_new(&base_node);
+ const URI file_uri = URI(file_path);
+ const auto* uri_c_str = (const uint8_t*)uri.c_str();
+ SerdNode base_node = serd_node_from_string(SERD_URI, uri_c_str);
+ SerdEnv* env = serd_env_new(&base_node);
// Load graph into model
Sord::Model model(*world.rdf_world(), uri.string(), SORD_SPO|SORD_PSO, false);
diff --git a/src/Resource.cpp b/src/Resource.cpp
index 2601c2e3..fca76572 100644
--- a/src/Resource.cpp
+++ b/src/Resource.cpp
@@ -58,7 +58,7 @@ Resource::set_property(const URI& uri, const Atom& value, Resource::Graph ctx)
auto next = i;
++next;
if (i->second.context() == ctx) {
- const Atom value(i->second);
+ const auto value = i->second;
_properties.erase(i);
on_property_removed(uri, value);
}
diff --git a/src/TurtleWriter.cpp b/src/TurtleWriter.cpp
index 85777044..1ed9399e 100644
--- a/src/TurtleWriter.cpp
+++ b/src/TurtleWriter.cpp
@@ -26,7 +26,7 @@ namespace ingen {
static size_t
c_text_sink(const void* buf, size_t len, void* stream)
{
- TurtleWriter* writer = (TurtleWriter*)stream;
+ auto* writer = static_cast<TurtleWriter*>(stream);
return writer->text_sink(buf, len);
}
diff --git a/src/URIMap.cpp b/src/URIMap.cpp
index c7d82c4b..121f47c2 100644
--- a/src/URIMap.cpp
+++ b/src/URIMap.cpp
@@ -50,7 +50,7 @@ LV2_URID
URIMap::URIDMapFeature::default_map(LV2_URID_Map_Handle h,
const char* c_uri)
{
- URIMap* const map((URIMap*)h);
+ auto* const map((URIMap*)h);
std::string uri(c_uri);
std::lock_guard<std::mutex> lock(map->_mutex);
@@ -90,7 +90,7 @@ const char*
URIMap::URIDUnmapFeature::default_unmap(LV2_URID_Unmap_Handle h,
LV2_URID urid)
{
- URIMap* const map((URIMap*)h);
+ auto* const map((URIMap*)h);
std::lock_guard<std::mutex> lock(map->_mutex);
return (urid > 0 && urid <= map->_unmap.size()
diff --git a/src/server/ArcImpl.cpp b/src/server/ArcImpl.cpp
index 591c1391..d9a2b783 100644
--- a/src/server/ArcImpl.cpp
+++ b/src/server/ArcImpl.cpp
@@ -48,7 +48,7 @@ ArcImpl::ArcImpl(PortImpl* tail, PortImpl* head)
ArcImpl::~ArcImpl()
{
if (is_linked()) {
- InputPort* iport = dynamic_cast<InputPort*>(_head);
+ auto* iport = dynamic_cast<InputPort*>(_head);
if (iport) {
iport->remove_arc(*this);
}
diff --git a/src/server/BlockFactory.cpp b/src/server/BlockFactory.cpp
index 18b19a4c..6fc5b9ee 100644
--- a/src/server/BlockFactory.cpp
+++ b/src/server/BlockFactory.cpp
@@ -138,7 +138,7 @@ BlockFactory::load_plugin(const URI& uri)
const LilvPlugins* plugs = lilv_world_get_all_plugins(_world.lilv_world());
const LilvPlugin* plug = lilv_plugins_get_by_uri(plugs, node);
if (plug) {
- LV2Plugin* const ingen_plugin = new LV2Plugin(_world, plug);
+ auto* const ingen_plugin = new LV2Plugin(_world, plug);
_plugins.emplace(uri, ingen_plugin);
}
lilv_node_free(node);
@@ -215,7 +215,7 @@ BlockFactory::load_lv2_plugins()
auto p = _plugins.find(uri);
if (p == _plugins.end()) {
- LV2Plugin* const plugin = new LV2Plugin(_world, lv2_plug);
+ auto* const plugin = new LV2Plugin(_world, lv2_plug);
_plugins.emplace(uri, plugin);
} else if (lilv_plugin_verify(lv2_plug)) {
p->second->set_is_zombie(false);
diff --git a/src/server/Buffer.cpp b/src/server/Buffer.cpp
index 2fa5c387..21a757c6 100644
--- a/src/server/Buffer.cpp
+++ b/src/server/Buffer.cpp
@@ -69,7 +69,7 @@ Buffer::Buffer(BufferFactory& bufs,
array which is already silent since the buffer is zeroed. All other
buffers are atoms. */
if (_buf) {
- LV2_Atom* atom = get<LV2_Atom>();
+ auto* atom = get<LV2_Atom>();
atom->size = capacity - sizeof(LV2_Atom);
atom->type = type;
@@ -119,7 +119,7 @@ Buffer::clear()
} else if (is_control()) {
get<LV2_Atom_Float>()->body = 0;
} else if (is_sequence()) {
- LV2_Atom_Sequence* seq = get<LV2_Atom_Sequence>();
+ auto* seq = get<LV2_Atom_Sequence>();
seq->atom.type = _factory.uris().atom_Sequence;
seq->atom.size = sizeof(LV2_Atom_Sequence_Body);
seq->body.unit = 0;
@@ -131,11 +131,12 @@ Buffer::clear()
void
Buffer::render_sequence(const RunContext& context, const Buffer* src, bool add)
{
- const LV2_URID atom_Float = _factory.uris().atom_Float;
- const LV2_Atom_Sequence* seq = src->get<const LV2_Atom_Sequence>();
- const LV2_Atom_Float* init = (const LV2_Atom_Float*)src->value();
- float value = init ? init->body : 0.0f;
- SampleCount offset = context.offset();
+ const LV2_URID atom_Float = _factory.uris().atom_Float;
+ const auto* seq = src->get<const LV2_Atom_Sequence>();
+ const auto* init = (const LV2_Atom_Float*)src->value();
+ float value = init ? init->body : 0.0f;
+ SampleCount offset = context.offset();
+
LV2_ATOM_SEQUENCE_FOREACH(seq, ev) {
if (ev->time.frames >= offset && ev->body.type == atom_Float) {
write_block(value, offset, ev->time.frames, add);
@@ -226,9 +227,9 @@ float
Buffer::peak(const RunContext& context) const
{
#ifdef __SSE__
- const __m128* const vbuf = (const __m128*)samples();
- __m128 vpeak = mm_abs_ps(vbuf[0]);
- const SampleCount nblocks = context.nframes() / 4;
+ const auto* const vbuf = (const __m128*)samples();
+ __m128 vpeak = mm_abs_ps(vbuf[0]);
+ const SampleCount nblocks = context.nframes() / 4;
// First, find the vector absolute max of the buffer
for (SampleCount i = 1; i < nblocks; ++i) {
@@ -238,7 +239,7 @@ Buffer::peak(const RunContext& context) const
// Now we need the single max of vpeak
// vpeak = ABCD
// tmp = CDAB
- __m128 tmp = _mm_shuffle_ps(vpeak, vpeak, _MM_SHUFFLE(2, 3, 0, 1));
+ auto tmp = _mm_shuffle_ps(vpeak, vpeak, _MM_SHUFFLE(2, 3, 0, 1));
// vpeak = MAX(A,C) MAX(B,D) MAX(C,A) MAX(D,B)
vpeak = _mm_max_ps(vpeak, tmp);
@@ -269,7 +270,7 @@ void
Buffer::prepare_write(RunContext& context)
{
if (_type == _factory.uris().atom_Sequence) {
- LV2_Atom* atom = get<LV2_Atom>();
+ auto* atom = get<LV2_Atom>();
atom->type = (LV2_URID)_factory.uris().atom_Sequence;
atom->size = sizeof(LV2_Atom_Sequence_Body);
@@ -281,7 +282,7 @@ void
Buffer::prepare_output_write(RunContext& context)
{
if (_type == _factory.uris().atom_Sequence) {
- LV2_Atom* atom = get<LV2_Atom>();
+ auto* atom = get<LV2_Atom>();
atom->type = (LV2_URID)_factory.uris().atom_Chunk;
atom->size = _capacity - sizeof(LV2_Atom);
@@ -297,7 +298,7 @@ Buffer::append_event(int64_t frames,
{
assert(frames >= _latest_event);
- LV2_Atom* atom = get<LV2_Atom>();
+ auto* atom = get<LV2_Atom>();
if (atom->type == _factory.uris().atom_Chunk) {
clear(); // Chunk initialized with prepare_output_write(), clear
}
@@ -306,8 +307,8 @@ Buffer::append_event(int64_t frames,
return false;
}
- LV2_Atom_Sequence* seq = (LV2_Atom_Sequence*)atom;
- LV2_Atom_Event* ev = (LV2_Atom_Event*)(
+ auto* seq = (LV2_Atom_Sequence*)atom;
+ auto* ev = (LV2_Atom_Event*)(
(uint8_t*)seq + lv2_atom_total_size(&seq->atom));
ev->time.frames = frames;
@@ -331,8 +332,8 @@ Buffer::append_event(int64_t frames, const LV2_Atom* body)
bool
Buffer::append_event_buffer(const Buffer* buf)
{
- LV2_Atom_Sequence* seq = (LV2_Atom_Sequence*)get<LV2_Atom>();
- LV2_Atom_Sequence* bseq = (LV2_Atom_Sequence*)buf->get<LV2_Atom>();
+ auto* seq = (LV2_Atom_Sequence*)get<LV2_Atom>();
+ auto* bseq = (LV2_Atom_Sequence*)buf->get<LV2_Atom>();
if (seq->atom.type == _factory.uris().atom_Chunk) {
clear(); // Chunk initialized with prepare_output_write(), clear
}
@@ -356,7 +357,7 @@ SampleCount
Buffer::next_value_offset(SampleCount offset, SampleCount end) const
{
if (_type == _factory.uris().atom_Sequence && _value_type) {
- const LV2_Atom_Sequence* seq = get<const LV2_Atom_Sequence>();
+ const auto* seq = get<const LV2_Atom_Sequence>();
LV2_ATOM_SEQUENCE_FOREACH(seq, ev) {
if (ev->time.frames > offset &&
ev->time.frames < end &&
@@ -408,8 +409,8 @@ Buffer::update_value_buffer(SampleCount offset)
return;
}
- LV2_Atom_Sequence* seq = get<LV2_Atom_Sequence>();
- LV2_Atom_Event* latest = nullptr;
+ auto* seq = get<LV2_Atom_Sequence>();
+ LV2_Atom_Event* latest = nullptr;
LV2_ATOM_SEQUENCE_FOREACH(seq, ev) {
if (ev->time.frames > offset) {
break;
diff --git a/src/server/ControlBindings.cpp b/src/server/ControlBindings.cpp
index 4e40afab..ce08950e 100644
--- a/src/server/ControlBindings.cpp
+++ b/src/server/ControlBindings.cpp
@@ -78,8 +78,7 @@ ControlBindings::binding_key(const Atom& binding) const
Key key;
LV2_Atom* num = nullptr;
if (binding.type() == uris.atom_Object) {
- const LV2_Atom_Object_Body* obj = (const LV2_Atom_Object_Body*)
- binding.get_body();
+ const auto* obj = (const LV2_Atom_Object_Body*)binding.get_body();
if (obj->otype == uris.midi_Bender) {
key = Key(Type::MIDI_BENDER);
} else if (obj->otype == uris.midi_ChannelPressure) {
@@ -406,11 +405,11 @@ ControlBindings::pre_process(RunContext& ctx, Buffer* buffer)
return; // Don't bother reading input
}
- LV2_Atom_Sequence* seq = buffer->get<LV2_Atom_Sequence>();
+ auto* seq = buffer->get<LV2_Atom_Sequence>();
LV2_ATOM_SEQUENCE_FOREACH(seq, ev) {
if (ev->body.type == uris.midi_MidiEvent) {
- const uint8_t* buf = (const uint8_t*)LV2_ATOM_BODY(&ev->body);
- const Key key = midi_event_key(ev->body.size, buf, value);
+ const auto* buf = (const uint8_t*)LV2_ATOM_BODY(&ev->body);
+ const Key key = midi_event_key(ev->body.size, buf, value);
if (_learn_binding && !!key) {
finish_learn(ctx, key); // Learn new binding
diff --git a/src/server/DuplexPort.cpp b/src/server/DuplexPort.cpp
index 22c7d29c..854ada02 100644
--- a/src/server/DuplexPort.cpp
+++ b/src/server/DuplexPort.cpp
@@ -93,7 +93,7 @@ DuplexPort::duplicate(Engine& engine,
BufferFactory& bufs = *engine.buffer_factory();
const Atom polyphonic = get_property(bufs.uris().ingen_polyphonic);
- DuplexPort* dup = new DuplexPort(
+ auto* dup = new DuplexPort(
bufs, parent, symbol, _index,
polyphonic.type() == bufs.uris().atom_Bool && polyphonic.get<int32_t>(),
_type, _buffer_type, _buffer_size,
diff --git a/src/server/GraphImpl.cpp b/src/server/GraphImpl.cpp
index db1b4561..35afb67f 100644
--- a/src/server/GraphImpl.cpp
+++ b/src/server/GraphImpl.cpp
@@ -73,7 +73,7 @@ GraphImpl::duplicate(Engine& engine,
const SampleRate rate = engine.sample_rate();
// Duplicate graph
- GraphImpl* dup = new GraphImpl(
+ auto* dup = new GraphImpl(
engine, symbol, _polyphony, parent, rate, _poly_process);
Properties props = properties();
diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp
index d7406bb5..17b681f7 100644
--- a/src/server/LV2Block.cpp
+++ b/src/server/LV2Block.cpp
@@ -230,9 +230,9 @@ LV2Block::instantiate(BufferFactory& bufs, const LilvState* state)
bool ret = true;
- float* min_values = new float[num_ports];
- float* max_values = new float[num_ports];
- float* def_values = new float[num_ports];
+ auto* min_values = new float[num_ports];
+ auto* max_values = new float[num_ports];
+ auto* def_values = new float[num_ports];
lilv_plugin_get_port_ranges_float(plug, min_values, max_values, def_values);
uint32_t max_sequence_size = 0;
@@ -510,7 +510,7 @@ LV2Block::duplicate(Engine& engine,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, LV2_STATE_IS_NATIVE, nullptr);
// Duplicate and instantiate block
- LV2Block* dup = new LV2Block(_lv2_plugin, symbol, _polyphonic, parent, rate);
+ auto* dup = new LV2Block(_lv2_plugin, symbol, _polyphonic, parent, rate);
if (!dup->instantiate(*engine.buffer_factory(), state)) {
delete dup;
return nullptr;
@@ -554,8 +554,8 @@ LV2Block::work_respond(LV2_Worker_Respond_Handle handle,
uint32_t size,
const void* data)
{
- LV2Block* block = (LV2Block*)handle;
- LV2Block::Response* r = new LV2Block::Response(size, data);
+ auto* block = (LV2Block*)handle;
+ auto* r = new LV2Block::Response(size, data);
block->_responses.push_back(*r);
return LV2_WORKER_SUCCESS;
}
@@ -669,8 +669,8 @@ get_port_value(const char* port_symbol,
uint32_t* size,
uint32_t* type)
{
- LV2Block* const block = (LV2Block*)user_data;
- PortImpl* const port = block->port_by_symbol(port_symbol);
+ auto* const block = (LV2Block*)user_data;
+ auto* const port = block->port_by_symbol(port_symbol);
if (port && port->is_input() && port->value().is_valid()) {
*size = port->value().size();
diff --git a/src/server/LV2Plugin.cpp b/src/server/LV2Plugin.cpp
index 3411fef8..983f566c 100644
--- a/src/server/LV2Plugin.cpp
+++ b/src/server/LV2Plugin.cpp
@@ -95,7 +95,7 @@ LV2Plugin::instantiate(BufferFactory& bufs,
Engine& engine,
const LilvState* state)
{
- LV2Block* b = new LV2Block(
+ auto* b = new LV2Block(
this, symbol, polyphonic, parent, engine.sample_rate());
if (!b->instantiate(bufs, state)) {
diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp
index 604836cd..837662e0 100644
--- a/src/server/PortImpl.cpp
+++ b/src/server/PortImpl.cpp
@@ -475,14 +475,14 @@ PortImpl::monitor(RunContext& context, bool send_now)
break;
case PortType::ATOM:
if (_buffer_type == _bufs.uris().atom_Sequence) {
- const LV2_Atom* atom = buffer(0)->get<const LV2_Atom>();
- const LV2_Atom* value = buffer(0)->value();
+ const auto* atom = buffer(0)->get<const LV2_Atom>();
+ const auto* value = buffer(0)->value();
if (atom->type != _bufs.uris().atom_Sequence) {
/* Buffer contents are not actually a Sequence. Probably an
uninitialized Chunk, so do nothing. */
} else if (_monitored) {
/* Sequence explicitly monitored, send everything. */
- const LV2_Atom_Sequence* seq = (const LV2_Atom_Sequence*)atom;
+ const auto* seq = (const LV2_Atom_Sequence*)atom;
LV2_ATOM_SEQUENCE_FOREACH(seq, ev) {
context.notify(uris.ingen_activity,
context.start() + ev->time.frames,
diff --git a/src/server/PreProcessor.cpp b/src/server/PreProcessor.cpp
index 127e91b5..872302c0 100644
--- a/src/server/PreProcessor.cpp
+++ b/src/server/PreProcessor.cpp
@@ -153,7 +153,7 @@ PreProcessor::process(RunContext& context, PostProcessor& dest, size_t limit)
}
#endif
- Event* next = (Event*)last->next();
+ auto* next = (Event*)last->next();
last->next(nullptr);
dest.append(context, head, last);
diff --git a/src/server/UndoStack.cpp b/src/server/UndoStack.cpp
index fc5c1bf6..91e7b9ce 100644
--- a/src/server/UndoStack.cpp
+++ b/src/server/UndoStack.cpp
@@ -62,8 +62,8 @@ UndoStack::ignore_later_event(const LV2_Atom* first,
return false;
}
- const LV2_Atom_Object* f = (const LV2_Atom_Object*)first;
- const LV2_Atom_Object* s = (const LV2_Atom_Object*)second;
+ const auto* f = (const LV2_Atom_Object*)first;
+ const auto* s = (const LV2_Atom_Object*)second;
if (f->body.otype == _uris.patch_Set && f->body.otype == s->body.otype) {
const LV2_Atom* f_subject = nullptr;
const LV2_Atom* f_property = nullptr;
diff --git a/src/server/Worker.cpp b/src/server/Worker.cpp
index 67200365..ad5f2fd5 100644
--- a/src/server/Worker.cpp
+++ b/src/server/Worker.cpp
@@ -40,8 +40,8 @@ schedule(LV2_Worker_Schedule_Handle handle,
uint32_t size,
const void* data)
{
- LV2Block* block = (LV2Block*)handle;
- Engine& engine = block->parent_graph()->engine();
+ auto* block = (LV2Block*)handle;
+ Engine& engine = block->parent_graph()->engine();
return engine.worker()->request(block, size, data);
}
@@ -51,8 +51,8 @@ schedule_sync(LV2_Worker_Schedule_Handle handle,
uint32_t size,
const void* data)
{
- LV2Block* block = (LV2Block*)handle;
- Engine& engine = block->parent_graph()->engine();
+ auto* block = (LV2Block*)handle;
+ Engine& engine = block->parent_graph()->engine();
return engine.sync_worker()->request(block, size, data);
}
@@ -90,17 +90,16 @@ Worker::request(LV2Block* block,
SPtr<LV2_Feature>
Worker::Schedule::feature(World& world, Node* n)
{
- LV2Block* block = dynamic_cast<LV2Block*>(n);
+ auto* block = dynamic_cast<LV2Block*>(n);
if (!block) {
return SPtr<LV2_Feature>();
}
- LV2_Worker_Schedule* data = (LV2_Worker_Schedule*)malloc(
- sizeof(LV2_Worker_Schedule));
+ auto* data = (LV2_Worker_Schedule*)malloc(sizeof(LV2_Worker_Schedule));
data->handle = block;
data->schedule_work = synchronous ? schedule_sync : schedule;
- LV2_Feature* f = (LV2_Feature*)malloc(sizeof(LV2_Feature));
+ auto* f = (LV2_Feature*)malloc(sizeof(LV2_Feature));
f->URI = LV2_WORKER__schedule;
f->data = data;
diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp
index 23a7d4b4..dda1821b 100644
--- a/src/server/events/Connect.cpp
+++ b/src/server/events/Connect.cpp
@@ -63,8 +63,8 @@ Connect::pre_process(PreProcessContext& ctx)
return Event::pre_process_done(Status::NOT_FOUND, _msg.head);
}
- PortImpl* tail_output = dynamic_cast<PortImpl*>(tail);
- _head = dynamic_cast<InputPort*>(head);
+ auto* tail_output = dynamic_cast<PortImpl*>(tail);
+ _head = dynamic_cast<InputPort*>(head);
if (!tail_output || !_head) {
return Event::pre_process_done(Status::BAD_REQUEST, _msg.head);
}
diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp
index 19e5bb20..6ecddc1e 100644
--- a/src/server/events/Delta.cpp
+++ b/src/server/events/Delta.cpp
@@ -132,8 +132,8 @@ Delta::add_set_event(const char* port_symbol,
uint32_t size,
uint32_t type)
{
- BlockImpl* block = dynamic_cast<BlockImpl*>(_object);
- PortImpl* port = block->port_by_symbol(port_symbol);
+ auto* block = dynamic_cast<BlockImpl*>(_object);
+ auto* port = block->port_by_symbol(port_symbol);
if (!port) {
_engine.log().warn("Unknown port `%1%' in state", port_symbol);
return;
@@ -204,7 +204,7 @@ Delta::pre_process(PreProcessContext& ctx)
return Event::pre_process_done(Status::NOT_FOUND, prot);
}
- BlockImpl* block = dynamic_cast<BlockImpl*>(node);
+ auto* block = dynamic_cast<BlockImpl*>(node);
if (!block) {
return Event::pre_process_done(Status::BAD_OBJECT_TYPE, prot);
}
@@ -256,14 +256,14 @@ Delta::pre_process(PreProcessContext& ctx)
_types.reserve(_properties.size());
- NodeImpl* obj = dynamic_cast<NodeImpl*>(_object);
+ auto* obj = dynamic_cast<NodeImpl*>(_object);
// Remove any properties removed in delta
for (const auto& r : _remove) {
const URI& key = r.first;
const Atom& value = r.second;
if (key == uris.midi_binding && value == uris.patch_wildcard) {
- PortImpl* port = dynamic_cast<PortImpl*>(_object);
+ auto* port = dynamic_cast<PortImpl*>(_object);
if (port) {
_engine.control_bindings()->get_all(port->path(), _removed_bindings);
}
@@ -325,7 +325,7 @@ Delta::pre_process(PreProcessContext& ctx)
}
BlockImpl* block = nullptr;
- PortImpl* port = dynamic_cast<PortImpl*>(_object);
+ auto* port = dynamic_cast<PortImpl*>(_object);
if (port) {
if (key == uris.ingen_broadcast) {
if (value.type() == uris.forge.Bool) {
@@ -418,7 +418,7 @@ Delta::pre_process(PreProcessContext& ctx)
}
if (!_create_event && key == uris.ingen_polyphonic) {
- GraphImpl* parent = dynamic_cast<GraphImpl*>(obj->parent());
+ auto* parent = dynamic_cast<GraphImpl*>(obj->parent());
if (!parent) {
_status = Status::BAD_OBJECT_TYPE;
} else if (value.type() != uris.forge.Bool) {
@@ -426,7 +426,7 @@ Delta::pre_process(PreProcessContext& ctx)
} else {
op = SpecialType::POLYPHONIC;
obj->set_property(key, value, value.context());
- BlockImpl* block = dynamic_cast<BlockImpl*>(obj);
+ auto* block = dynamic_cast<BlockImpl*>(obj);
if (block) {
block->set_polyphonic(value.get<int32_t>());
}
@@ -497,9 +497,9 @@ Delta::execute(RunContext& context)
_engine.control_bindings()->remove(context, _removed_bindings);
}
- NodeImpl* const object = dynamic_cast<NodeImpl*>(_object);
- BlockImpl* const block = dynamic_cast<BlockImpl*>(_object);
- PortImpl* const port = dynamic_cast<PortImpl*>(_object);
+ auto* const object = dynamic_cast<NodeImpl*>(_object);
+ auto* const block = dynamic_cast<BlockImpl*>(_object);
+ auto* const port = dynamic_cast<PortImpl*>(_object);
std::vector<SpecialType>::const_iterator t = _types.begin();
for (const auto& p : _properties) {
@@ -578,7 +578,7 @@ void
Delta::post_process()
{
if (_state) {
- BlockImpl* block = dynamic_cast<BlockImpl*>(_object);
+ auto* block = dynamic_cast<BlockImpl*>(_object);
if (block) {
block->apply_state(_engine.sync_worker(), _state);
block->set_enabled(true);
diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp
index ada51302..4444bb26 100644
--- a/src/server/events/DisconnectAll.cpp
+++ b/src/server/events/DisconnectAll.cpp
@@ -112,7 +112,7 @@ DisconnectAll::pre_process(PreProcessContext& ctx)
// Find set of arcs to remove
std::set<ArcImpl*> to_remove;
for (const auto& a : _parent->arcs()) {
- ArcImpl* const arc = (ArcImpl*)a.second.get();
+ auto* const arc = static_cast<ArcImpl*>(a.second.get());
if (_block) {
if (arc->tail()->parent_block() == _block
|| arc->head()->parent_block() == _block) {