From 3696f98e6f1ac44f8ebfe975405cf82f6d0f8a72 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 27 May 2012 23:05:45 +0000 Subject: Re-implement URIMap to tolerate broken plugins that use the wrong context to map MIDI event types (fix #4889). All uri-map contexts are now just ignored, and equivalent to urid (which is equivalent to uri-map with context NULL). We now just hope that no event types are mapped after UINT16_MAX URIs have been mapped, and die horribly otherwise. This is exceedingly unlikely to happen any time in the next several years, if ever. git-svn-id: svn://localhost/ardour2/branches/3.0@12462 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/uri_map.h | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) (limited to 'libs/ardour/ardour/uri_map.h') diff --git a/libs/ardour/ardour/uri_map.h b/libs/ardour/ardour/uri_map.h index a6c9dc7a8b..18008f0df2 100644 --- a/libs/ardour/ardour/uri_map.h +++ b/libs/ardour/ardour/uri_map.h @@ -30,8 +30,10 @@ namespace ARDOUR { - /** Implementation of the LV2 uri-map and urid extensions. + * + * This just uses a pair of std::map and is not so great in the space overhead + * department, but it's fast enough and not really performance critical anyway. */ class URIMap : public boost::noncopyable { public: @@ -44,26 +46,15 @@ public: LV2_URID_Map* urid_map() { return &_urid_map_feature_data; } LV2_URID_Unmap* urid_unmap() { return &_urid_unmap_feature_data; } - uint32_t uri_to_id(const char* map, const char* uri); - - const char* id_to_uri(const char* map, uint32_t id); + uint32_t uri_to_id(const char* uri); + const char* id_to_uri(uint32_t id) const; private: - static uint32_t uri_map_uri_to_id(LV2_URI_Map_Callback_Data callback_data, - const char* map, - const char* uri); - - static LV2_URID urid_map(LV2_URID_Map_Handle handle, - const char* uri); + typedef std::map Map; + typedef std::map Unmap; - static const char* urid_unmap(LV2_URID_Unmap_Handle handle, - LV2_URID urid); - - typedef std::map EventToGlobal; - typedef std::map GlobalToEvent; - - EventToGlobal _event_to_global; - GlobalToEvent _global_to_event; + Map _map; + Unmap _unmap; LV2_Feature _uri_map_feature; LV2_URI_Map_Feature _uri_map_feature_data; @@ -73,7 +64,6 @@ private: LV2_URID_Unmap _urid_unmap_feature_data; }; - } // namespace ARDOUR #endif // __ardour_uri_map_h__ -- cgit v1.2.3