diff options
author | David Robillard <d@drobilla.net> | 2015-09-04 22:28:28 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2015-09-04 22:28:28 +0000 |
commit | 183195508e8f45bc571fac8955789e70570b8a1b (patch) | |
tree | ec9eb4ff7060b3b0beec0bebac2b26073e4189fd /src | |
parent | 9cfc41a86b30d4b10cffd5404c91ce852ab6a1a8 (diff) | |
download | ingen-183195508e8f45bc571fac8955789e70570b8a1b.tar.gz ingen-183195508e8f45bc571fac8955789e70570b8a1b.tar.bz2 ingen-183195508e8f45bc571fac8955789e70570b8a1b.zip |
Fix various atom conversion issues.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5719 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/Forge.cpp | 4 | ||||
-rw-r--r-- | src/Parser.cpp | 2 | ||||
-rw-r--r-- | src/gui/Port.cpp | 2 | ||||
-rw-r--r-- | src/gui/RenameWindow.cpp | 3 | ||||
-rw-r--r-- | src/server/events/CreateBlock.cpp | 4 | ||||
-rw-r--r-- | src/server/events/CreateGraph.cpp | 7 | ||||
-rw-r--r-- | src/server/events/CreatePort.cpp | 5 | ||||
-rw-r--r-- | src/server/events/Delta.cpp | 30 |
8 files changed, 34 insertions, 23 deletions
diff --git a/src/Forge.cpp b/src/Forge.cpp index fff4295a..52a01f40 100644 --- a/src/Forge.cpp +++ b/src/Forge.cpp @@ -53,6 +53,10 @@ Forge::str(const Atom& atom, bool quoted) ss << (quoted ? "<" : "") << _map.unmap_uri(atom.get<int32_t>()) << (quoted ? ">" : ""); + } else if (atom.type() == Path) { + ss << (quoted ? "<" : "") + << atom.ptr<const char>() + << (quoted ? ">" : ""); } else if (atom.type() == String) { ss << (quoted ? "\"" : "") << atom.ptr<const char>() diff --git a/src/Parser.cpp b/src/Parser.cpp index 562d0367..070e0781 100644 --- a/src/Parser.cpp +++ b/src/Parser.cpp @@ -192,7 +192,7 @@ get_port(Ingen::World* world, // Get symbol Resource::Properties::const_iterator s = props.find(uris.lv2_symbol); std::string sym; - if (s != props.end()) { + if (s != props.end() && s->second.type() == world->forge().String) { sym = s->second.ptr<char>(); } else { const std::string subject_str = subject.to_string(); diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index b66450ff..ca31e445 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -266,7 +266,7 @@ Port::build_uri_menu() } LilvNode* designation = lilv_new_uri( - world->lilv_world(), designation_atom.ptr<char>()); + world->lilv_world(), world->forge().str(designation_atom, false).c_str()); LilvNode* rdfs_range = lilv_new_uri( world->lilv_world(), LILV_NS_RDFS "range"); diff --git a/src/gui/RenameWindow.cpp b/src/gui/RenameWindow.cpp index d4e3b9a4..5020f6ef 100644 --- a/src/gui/RenameWindow.cpp +++ b/src/gui/RenameWindow.cpp @@ -116,7 +116,8 @@ RenameWindow::ok_clicked() Raul::Path path = _object->path(); const Atom& name_atom = _object->get_property(uris.lv2_name); - if (!label.empty() && (!name_atom.is_valid() || label != name_atom.ptr<char>())) { + if (!label.empty() && (name_atom.type() != uris.forge.String || + label != name_atom.ptr<char>())) { _app->set_property(Node::path_to_uri(path), uris.lv2_name, _app->forge().alloc(label)); diff --git a/src/server/events/CreateBlock.cpp b/src/server/events/CreateBlock.cpp index 8e1ebfe4..22c8731f 100644 --- a/src/server/events/CreateBlock.cpp +++ b/src/server/events/CreateBlock.cpp @@ -81,12 +81,12 @@ CreateBlock::pre_process() // Get prototype iterator t = _properties.find(uris.lv2_prototype); - if (t == _properties.end() || t->second.type() != uris.forge.URI) { + if (t == _properties.end() || !uris.forge.is_uri(t->second)) { // Missing/invalid prototype return Event::pre_process_done(Status::BAD_REQUEST); } - const Raul::URI prototype(t->second.ptr<char>()); + const Raul::URI prototype(uris.forge.str(t->second, false)); // Find polyphony const iterator p = _properties.find(uris.ingen_polyphonic); diff --git a/src/server/events/CreateGraph.cpp b/src/server/events/CreateGraph.cpp index d0115a4d..7c4b1940 100644 --- a/src/server/events/CreateGraph.cpp +++ b/src/server/events/CreateGraph.cpp @@ -83,10 +83,11 @@ CreateGraph::pre_process() } if (t != _properties.end() && - Raul::URI::is_valid(t->second.ptr<char>()) && - Node::uri_is_path(Raul::URI(t->second.ptr<char>()))) { + uris.forge.is_uri(t->second) && + Raul::URI::is_valid(uris.forge.str(t->second, false)) && + Node::uri_is_path(Raul::URI(uris.forge.str(t->second, false)))) { // Create a duplicate of an existing graph - const Raul::URI prototype(t->second.ptr<char>()); + const Raul::URI prototype(uris.forge.str(t->second, false)); GraphImpl* ancestor = dynamic_cast<GraphImpl*>( _engine.store()->get(Node::uri_to_path(prototype))); if (!ancestor) { diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp index 9dce0ad0..173b8a73 100644 --- a/src/server/events/CreatePort.cpp +++ b/src/server/events/CreatePort.cpp @@ -76,8 +76,9 @@ CreatePort::CreatePort(Engine& engine, const Range buffer_types = properties.equal_range(uris.atom_bufferType); for (Iterator i = buffer_types.first; i != buffer_types.second; ++i) { - if (i->second.type() == _engine.world()->forge().URI) { - _buf_type = _engine.world()->uri_map().map_uri(i->second.ptr<char>()); + if (uris.forge.is_uri(i->second)) { + _buf_type = _engine.world()->uri_map().map_uri( + uris.forge.str(i->second, false)); } } } diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp index a768beb0..a85c8253 100644 --- a/src/server/events/Delta.cpp +++ b/src/server/events/Delta.cpp @@ -17,6 +17,8 @@ #include <vector> #include <thread> +#include <glibmm/convert.h> + #include "ingen/Log.hpp" #include "ingen/Store.hpp" #include "ingen/URIs.hpp" @@ -290,22 +292,24 @@ Delta::pre_process() _status = Status::BAD_VALUE_TYPE; } } else if (key == uris.pset_preset) { - if (value.type() == uris.forge.URI) { - const char* str = value.ptr<char>(); - if (Raul::URI::is_valid(str)) { - op = SpecialType::PRESET; - const Raul::URI uri(str); - if ((_state = block->load_preset(Raul::URI(str)))) { - lilv_state_emit_port_values( - _state, s_add_set_event, this); - } else { - _engine.log().warn(fmt("Failed to load preset <%1%>\n") % str); - } + std::string uri_str; + if (uris.forge.is_uri(value)) { + uri_str = uris.forge.str(value, false); + } else if (value.type() == uris.forge.Path) { + uri_str = Glib::filename_to_uri(value.ptr<char>()); + } + + if (Raul::URI::is_valid(uri_str)) { + const Raul::URI uri(uri_str); + op = SpecialType::PRESET; + if ((_state = block->load_preset(uri))) { + lilv_state_emit_port_values( + _state, s_add_set_event, this); } else { - _status = Status::BAD_VALUE; + _engine.log().warn(fmt("Failed to load preset <%1%>\n") % uri); } } else { - _status = Status::BAD_VALUE_TYPE; + _status = Status::BAD_VALUE; } } } |