summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2017-12-18 00:45:27 +0100
committerDavid Robillard <d@drobilla.net>2019-01-12 18:20:04 +0100
commit8c19e157e148efb59d6ea2f815783755b6075c7e (patch)
tree094a95326138dd3a46cbd52b84981e36faebc64a
parent967a8b9d6690a5ece385d07af04c322d645de23f (diff)
downloadingen-8c19e157e148efb59d6ea2f815783755b6075c7e.tar.gz
ingen-8c19e157e148efb59d6ea2f815783755b6075c7e.tar.bz2
ingen-8c19e157e148efb59d6ea2f815783755b6075c7e.zip
Rename Atom::get_body to Atom::body and use Atom::ptr consistently
-rw-r--r--ingen/Atom.hpp10
-rw-r--r--src/AtomWriter.cpp4
-rw-r--r--src/Configuration.cpp2
-rw-r--r--src/Forge.cpp6
-rw-r--r--src/Serialiser.cpp6
-rw-r--r--src/gui/NodeModule.cpp2
-rw-r--r--src/server/ControlBindings.cpp2
-rw-r--r--src/server/LV2Block.cpp2
-rw-r--r--src/server/RunContext.cpp2
-rw-r--r--src/server/events/SetPortValue.cpp2
-rw-r--r--tests/ingen_bench.cpp6
-rw-r--r--tests/ingen_test.cpp4
12 files changed, 24 insertions, 24 deletions
diff --git a/ingen/Atom.hpp b/ingen/Atom.hpp
index 86528ea1..a0e30805 100644
--- a/ingen/Atom.hpp
+++ b/ingen/Atom.hpp
@@ -59,7 +59,7 @@ public:
memcpy(_body.ptr, &_atom, sizeof(LV2_Atom));
}
if (body) {
- memcpy(get_body(), body, size);
+ memcpy(this->body(), body, size);
}
}
@@ -132,21 +132,21 @@ public:
inline LV2_URID type() const { return _atom.type; }
inline bool is_valid() const { return _atom.type; }
- inline const void* get_body() const {
+ inline const void* body() const {
return is_reference() ? (void*)(_body.ptr + 1) : &_body.val;
}
- inline void* get_body() {
+ inline void* body() {
return is_reference() ? (void*)(_body.ptr + 1) : &_body.val;
}
template <typename T> const T& get() const {
assert(size() == sizeof(T));
- return *static_cast<const T*>(get_body());
+ return *static_cast<const T*>(body());
}
template <typename T> const T* ptr() const {
- return static_cast<const T*>(get_body());
+ return static_cast<const T*>(body());
}
const LV2_Atom* atom() const {
diff --git a/src/AtomWriter.cpp b/src/AtomWriter.cpp
index 015e5fc7..0cc90714 100644
--- a/src/AtomWriter.cpp
+++ b/src/AtomWriter.cpp
@@ -134,7 +134,7 @@ AtomWriter::forge_properties(ScopedObject& object, const Properties& properties)
if (p.second.type() == _forge.URI) {
forge_uri(URI(p.second.ptr<char>()));
} else {
- _forge.atom(p.second.size(), p.second.type(), p.second.get_body());
+ _forge.atom(p.second.size(), p.second.type(), p.second.body());
}
}
}
@@ -360,7 +360,7 @@ AtomWriter::operator()(const SetProperty& message)
const auto& value = message.value;
msg.object.key(_uris.patch_value);
- _forge.atom(value.size(), value.type(), value.get_body());
+ _forge.atom(value.size(), value.type(), value.body());
}
/** @page protocol
diff --git a/src/Configuration.cpp b/src/Configuration.cpp
index c05c516e..f6d02c18 100644
--- a/src/Configuration.cpp
+++ b/src/Configuration.cpp
@@ -327,7 +327,7 @@ Configuration::save(URIMap& uri_map,
SerdNode pred = serd_node_from_string(
SERD_CURIE, (const uint8_t*)key.c_str());
sratom_write(sratom, &uri_map.urid_unmap_feature()->urid_unmap, 0,
- &base, &pred, value.type(), value.size(), value.get_body());
+ &base, &pred, value.type(), value.size(), value.body());
}
sratom_free(sratom);
diff --git a/src/Forge.cpp b/src/Forge.cpp
index fbebbeb5..f54a3cc4 100644
--- a/src/Forge.cpp
+++ b/src/Forge.cpp
@@ -48,7 +48,7 @@ Forge::str(const Atom& atom, bool quoted)
ss << (atom.get<int32_t>() ? "true" : "false");
} else if (atom.type() == URI) {
ss << (quoted ? "<" : "")
- << atom.ptr<const char>()
+ << atom.ptr<char>()
<< (quoted ? ">" : "");
} else if (atom.type() == URID) {
ss << (quoted ? "<" : "")
@@ -56,11 +56,11 @@ Forge::str(const Atom& atom, bool quoted)
<< (quoted ? ">" : "");
} else if (atom.type() == Path) {
ss << (quoted ? "<" : "")
- << atom.ptr<const char>()
+ << atom.ptr<char>()
<< (quoted ? ">" : "");
} else if (atom.type() == String) {
ss << (quoted ? "\"" : "")
- << atom.ptr<const char>()
+ << atom.ptr<char>()
<< (quoted ? "\"" : "");
}
return ss.str();
diff --git a/src/Serialiser.cpp b/src/Serialiser.cpp
index 36d4a87f..858e7f2d 100644
--- a/src/Serialiser.cpp
+++ b/src/Serialiser.cpp
@@ -557,7 +557,7 @@ Serialiser::Impl::serialise_properties(Sord::Node id,
const Sord::URI key(_model->world(), p.first);
if (!skip_property(_world.uris(), key)) {
if (p.second.type() == _world.uris().atom_URI &&
- !strncmp((const char*)p.second.get_body(), "ingen:/main/", 13)) {
+ !strncmp(p.second.ptr<char>(), "ingen:/main/", 13)) {
/* Value is a graph URI relative to the running engine.
Chop the prefix and save the path relative to the graph file.
This allows saving references to bundle resources. */
@@ -565,12 +565,12 @@ Serialiser::Impl::serialise_properties(Sord::Node id,
sord_node_to_serd_node(id.c_obj()),
sord_node_to_serd_node(key.c_obj()),
p.second.type(), p.second.size(),
- (const char*)p.second.get_body() + 13);
+ p.second.ptr<char>() + 13);
} else {
sratom_write(_sratom, unmap, 0,
sord_node_to_serd_node(id.c_obj()),
sord_node_to_serd_node(key.c_obj()),
- p.second.type(), p.second.size(), p.second.get_body());
+ p.second.type(), p.second.size(), p.second.body());
}
}
}
diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp
index 8605e91d..c73cb91e 100644
--- a/src/gui/NodeModule.cpp
+++ b/src/gui/NodeModule.cpp
@@ -222,7 +222,7 @@ NodeModule::port_value_changed(uint32_t index, const Atom& value)
if (value.type() == uris.atom_Float &&
_block->get_port(index)->is_numeric()) {
- _plugin_ui->port_event(index, sizeof(float), 0, value.ptr<float>());
+ _plugin_ui->port_event(index, sizeof(float), 0, value.body());
} else {
_plugin_ui->port_event(index,
lv2_atom_total_size(value.atom()),
diff --git a/src/server/ControlBindings.cpp b/src/server/ControlBindings.cpp
index 2a269cac..67842291 100644
--- a/src/server/ControlBindings.cpp
+++ b/src/server/ControlBindings.cpp
@@ -69,7 +69,7 @@ ControlBindings::binding_key(const Atom& binding) const
LV2_Atom* num = nullptr;
if (binding.type() == uris.atom_Object) {
const LV2_Atom_Object_Body* obj = (const LV2_Atom_Object_Body*)
- binding.get_body();
+ binding.body();
if (obj->otype == uris.midi_Bender) {
key = Key(Type::MIDI_BENDER);
} else if (obj->otype == uris.midi_ChannelPressure) {
diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp
index 765643d6..fd555c7f 100644
--- a/src/server/LV2Block.cpp
+++ b/src/server/LV2Block.cpp
@@ -669,7 +669,7 @@ get_port_value(const char* port_symbol,
if (port && port->is_input() && port->value().is_valid()) {
*size = port->value().size();
*type = port->value().type();
- return port->value().get_body();
+ return port->value().body();
}
return nullptr;
diff --git a/src/server/RunContext.cpp b/src/server/RunContext.cpp
index ee272d46..6efc81ee 100644
--- a/src/server/RunContext.cpp
+++ b/src/server/RunContext.cpp
@@ -116,7 +116,7 @@ RunContext::emit_notifications(FrameTime end)
if (_event_sink->read(sizeof(note), &note) == sizeof(note)) {
Atom value = _engine.world()->forge().alloc(
note.size, note.type, nullptr);
- if (_event_sink->read(note.size, value.get_body()) == note.size) {
+ if (_event_sink->read(note.size, value.body()) == note.size) {
i += note.size;
const char* key = _engine.world()->uri_map().unmap_uri(note.key);
if (key) {
diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp
index fa36d739..c0087d8f 100644
--- a/src/server/events/SetPortValue.cpp
+++ b/src/server/events/SetPortValue.cpp
@@ -112,7 +112,7 @@ SetPortValue::apply(RunContext& context)
if (!buf->append_event(_time - context.start(),
_value.size(),
_value.type(),
- (const uint8_t*)_value.get_body())) {
+ (const uint8_t*)_value.body())) {
_status = Status::NO_SPACE;
}
} else if (buf->type() == uris.atom_URID) {
diff --git a/tests/ingen_bench.cpp b/tests/ingen_bench.cpp
index 2ac1f5f1..a21601f1 100644
--- a/tests/ingen_bench.cpp
+++ b/tests/ingen_bench.cpp
@@ -82,11 +82,11 @@ main(int argc, char** argv)
}
// Get start graph and output file options
- const std::string start_graph = real_path((const char*)load.get_body());
- const std::string out_file = (const char*)out.get_body();
+ const std::string start_graph = real_path(load.ptr<char>());
+ const std::string out_file = out.ptr<char>();
if (start_graph.empty()) {
cerr << "error: initial graph '"
- << ((const char*)load.get_body())
+ << load.ptr<char>()
<< "' does not exist" << endl;
return EXIT_FAILURE;
}
diff --git a/tests/ingen_test.cpp b/tests/ingen_test.cpp
index 4c00799d..22b5b3dc 100644
--- a/tests/ingen_test.cpp
+++ b/tests/ingen_test.cpp
@@ -86,7 +86,7 @@ main(int argc, char** argv)
}
// Get start graph and commands file options
- const char* load_path = (const char*)load.get_body();
+ const char* load_path = load.ptr<char>();
char* real_start_graph = realpath(load_path, nullptr);
if (!real_start_graph) {
cerr << "error: initial graph '" << load_path << "' does not exist" << endl;
@@ -94,7 +94,7 @@ main(int argc, char** argv)
}
const std::string start_graph = real_start_graph;
- const FilePath cmds_file_path = (const char*)execute.get_body();
+ const FilePath cmds_file_path = execute.ptr<char>();
free(real_start_graph);
// Load modules