diff options
author | David Robillard <d@drobilla.net> | 2011-04-30 03:03:42 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-04-30 03:03:42 +0000 |
commit | 7a507f3805a849b906eb78ed1debef0c9812bb3a (patch) | |
tree | 9dce35a243eb3e3e6d519f116f3ec7be77666385 | |
parent | d55f87b341e1855f2f6f544649f17f36aa22d7e4 (diff) | |
download | lilv-7a507f3805a849b906eb78ed1debef0c9812bb3a.tar.gz lilv-7a507f3805a849b906eb78ed1debef0c9812bb3a.tar.bz2 lilv-7a507f3805a849b906eb78ed1debef0c9812bb3a.zip |
Consistent error and warning message style.
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@3243 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | src/instance.c | 16 | ||||
-rw-r--r-- | src/lilv_internal.h | 8 | ||||
-rw-r--r-- | src/node.c | 3 | ||||
-rw-r--r-- | src/plugin.c | 19 | ||||
-rw-r--r-- | src/port.c | 4 | ||||
-rw-r--r-- | src/world.c | 11 |
6 files changed, 33 insertions, 28 deletions
diff --git a/src/instance.c b/src/instance.c index c9a5d83..95743f6 100644 --- a/src/instance.c +++ b/src/instance.c @@ -47,7 +47,7 @@ lilv_plugin_instantiate(const LilvPlugin* plugin, dlerror(); void* lib = dlopen(lib_path, RTLD_NOW); if (!lib) { - LILV_ERRORF("Unable to open library %s (%s)\n", lib_path, dlerror()); + LILV_ERRORF("Failed to open library %s (%s)\n", lib_path, dlerror()); return NULL; } @@ -55,8 +55,7 @@ lilv_plugin_instantiate(const LilvPlugin* plugin, lilv_dlfunc(lib, "lv2_descriptor"); if (!df) { - LILV_ERRORF("Could not find symbol 'lv2_descriptor', " - "%s is not a LV2 plugin.\n", lib_path); + LILV_ERRORF("Failed to find symbol 'lv2_descriptor' in %s\n", lib_path); dlclose(lib); return NULL; } else { @@ -68,15 +67,16 @@ lilv_plugin_instantiate(const LilvPlugin* plugin, for (uint32_t i = 0; true; ++i) { const LV2_Descriptor* ld = df(i); if (!ld) { - LILV_ERRORF("Did not find plugin %s in %s\n", - lilv_node_as_uri(lilv_plugin_get_uri(plugin)), lib_path); + LILV_ERRORF("Failed to find plugin <%s> in %s\n", + lilv_node_as_uri(lilv_plugin_get_uri(plugin)), + lib_path); dlclose(lib); break; // return NULL } else { // Parse bundle URI to use as base URI const LilvNode* bundle_uri = lilv_plugin_get_bundle_uri(plugin); - const char* bundle_uri_str = lilv_node_as_uri(bundle_uri); - SerdURI base_uri; + const char* bundle_uri_str = lilv_node_as_uri(bundle_uri); + SerdURI base_uri; if (!serd_uri_parse((const uint8_t*)bundle_uri_str, &base_uri)) { dlclose(lib); break; @@ -87,7 +87,7 @@ lilv_plugin_instantiate(const LilvPlugin* plugin, SerdNode abs_uri_node = serd_node_new_uri_from_string( (const uint8_t*)ld->URI, &base_uri, &abs_uri); if (!abs_uri_node.buf) { - LILV_ERRORF("Failed to parse library plugin URI `%s'\n", ld->URI); + LILV_ERRORF("Failed to parse plugin URI `%s'\n", ld->URI); dlclose(lib); break; } diff --git a/src/lilv_internal.h b/src/lilv_internal.h index c016eaf..eec8c89 100644 --- a/src/lilv_internal.h +++ b/src/lilv_internal.h @@ -325,13 +325,13 @@ lilv_dlfunc(void* handle, const char* symbol) static const LV2_Feature* const dman_features = { NULL }; #endif -#define LILV_ERROR(str) fprintf(stderr, "%s: error: " str, \ +#define LILV_ERROR(str) fprintf(stderr, "%s(): error: " str, \ __func__) -#define LILV_ERRORF(fmt, ...) fprintf(stderr, "%s: error: " fmt, \ +#define LILV_ERRORF(fmt, ...) fprintf(stderr, "%s(): error: " fmt, \ __func__, __VA_ARGS__) -#define LILV_WARN(str) fprintf(stderr, "%s: warning: " str, \ +#define LILV_WARN(str) fprintf(stderr, "%s(): warning: " str, \ __func__) -#define LILV_WARNF(fmt, ...) fprintf(stderr, "%s: warning: " fmt, \ +#define LILV_WARNF(fmt, ...) fprintf(stderr, "%s(): warning: " fmt, \ __func__, __VA_ARGS__) #ifdef __cplusplus @@ -116,7 +116,8 @@ lilv_node_new_from_node(LilvWorld* world, const SordNode* node) else if (sord_node_equals(datatype_uri, world->xsd_integer_node)) type = LILV_VALUE_INT; else - LILV_ERRORF("Unknown datatype %s\n", sord_node_get_string(datatype_uri)); + LILV_ERRORF("Unknown datatype `%s'\n", + sord_node_get_string(datatype_uri)); } result = lilv_node_new(world, type, (const char*)sord_node_get_string(node)); switch (result->type) { diff --git a/src/plugin.c b/src/plugin.c index 6bd2e78..4ea2757 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -129,7 +129,7 @@ lilv_plugin_load(LilvPlugin* p) const char* lib_path = lilv_uri_to_path(lilv_node_as_string(p->dynman_uri)); void* lib = dlopen(lib_path, RTLD_LAZY); if (!lib) { - LILV_WARNF("Unable to open dynamic manifest %s\n", + LILV_WARNF("Failed to open dynamic manifest %s\n", lilv_node_as_string(p->dynman_uri)); return; } @@ -191,7 +191,8 @@ lilv_plugin_load_ports_if_necessary(const LilvPlugin* const_p) p, port, p->world->lv2_symbol_node); if (!lilv_node_is_string(symbol)) { - LILV_ERROR("port has a non-string symbol\n"); + LILV_ERRORF("Plugin <%s> port symbol is not a string\n", + lilv_node_as_uri(p->plugin_uri)); p->num_ports = 0; goto error; } @@ -199,7 +200,8 @@ lilv_plugin_load_ports_if_necessary(const LilvPlugin* const_p) index = lilv_plugin_get_unique(p, port, p->world->lv2_index_node); if (!lilv_node_is_int(index)) { - LILV_ERROR("port has a non-integer index\n"); + LILV_ERRORF("Plugin <%s> port index is not an integer\n", + lilv_node_as_uri(p->plugin_uri)); p->num_ports = 0; goto error; } @@ -233,7 +235,8 @@ lilv_plugin_load_ports_if_necessary(const LilvPlugin* const_p) this_port->classes, lilv_node_new_from_node(p->world, type)); } else { - LILV_WARN("port has non-URI rdf:type\n"); + LILV_WARNF("Plugin <%s> port type is not a URI\n", + lilv_node_as_uri(p->plugin_uri)); } } lilv_match_end(types); @@ -403,7 +406,7 @@ lilv_plugin_get_name(const LilvPlugin* plugin) } if (!ret) - LILV_WARNF("<%s> has no (mandatory) doap:name\n", + LILV_WARNF("Plugin <%s> has no (mandatory) doap:name\n", lilv_node_as_string(lilv_plugin_get_uri(plugin))); return ret; @@ -425,11 +428,11 @@ lilv_plugin_get_value_for_subject(const LilvPlugin* p, { lilv_plugin_load_ports_if_necessary(p); if (!lilv_node_is_uri(subject) && !lilv_node_is_blank(subject)) { - LILV_ERROR("Subject is not a resource\n"); + LILV_ERRORF("Subject `%s' is not a resource\n", subject->str_val); return NULL; } if (!lilv_node_is_uri(predicate)) { - LILV_ERROR("Predicate is not a URI\n"); + LILV_ERRORF("Predicate `%s' is not a URI\n", predicate->str_val); return NULL; } @@ -756,7 +759,7 @@ lilv_plugin_get_uis(const LilvPlugin* p) || !lilv_node_is_uri(binary)) { lilv_node_free(binary); lilv_node_free(type); - LILV_ERROR("Corrupt UI\n"); + LILV_ERRORF("Corrupt UI <%s>\n", sord_node_get_string(ui)); continue; } @@ -121,7 +121,7 @@ lilv_port_get_value(const LilvPlugin* p, const LilvNode* predicate) { if (!lilv_node_is_uri(predicate)) { - LILV_ERROR("Predicate is not a URI\n"); + LILV_ERRORF("Predicate `%s' is not a URI\n", predicate->str_val); return NULL; } @@ -155,7 +155,7 @@ lilv_port_get_name(const LilvPlugin* p, } if (!ret) - LILV_WARNF("<%s> has no (mandatory) doap:name\n", + LILV_WARNF("Plugin <%s> port has no (mandatory) doap:name\n", lilv_node_as_string(lilv_plugin_get_uri(p))); return ret; diff --git a/src/world.c b/src/world.c index a18e0b8..522236a 100644 --- a/src/world.c +++ b/src/world.c @@ -430,7 +430,7 @@ lilv_world_load_dyn_manifest(LilvWorld* world, typedef int (*OpenFunc)(LV2_Dyn_Manifest_Handle*, const LV2_Feature *const *); OpenFunc open_func = (OpenFunc)lilv_dlfunc(lib, "lv2_dyn_manifest_open"); if (!open_func || open_func(&handle, &dman_features)) { - LILV_ERRORF("Missing lv2_dyn_manifest_open in `%s'\n", lib_path); + LILV_ERRORF("Failed to find `lv2_dyn_manifest_open' in `%s'\n", lib_path); dlclose(lib); continue; } @@ -440,7 +440,8 @@ lilv_world_load_dyn_manifest(LilvWorld* world, GetSubjectsFunc get_subjects_func = (GetSubjectsFunc)lilv_dlfunc( lib, "lv2_dyn_manifest_get_subjects"); if (!get_subjects_func) { - LILV_ERRORF("Missing lv2_dyn_manifest_get_subjects in `%s'\n", lib_path); + LILV_ERRORF("Failed to find `lv2_dyn_manifest_get_subjects' in `%s'\n", + lib_path); dlclose(lib); continue; } @@ -482,7 +483,7 @@ void lilv_world_load_bundle(LilvWorld* world, LilvNode* bundle_uri) { if (!lilv_node_is_uri(bundle_uri)) { - LILV_ERROR("Bundle 'URI' is not a URI\n"); + LILV_ERRORF ("Bundle URI `%s' is not a URI\n", bundle_uri->str_val); return; } @@ -545,7 +546,7 @@ expand(const char* path) ret = lilv_strdup(p.we_wordv[0]); } else { /* Multiple expansions in a single directory path? */ - LILV_ERRORF("malformed path `%s' ignored\n", path); + LILV_ERRORF("Malformed path `%s' ignored\n", path); } wordfree(&p); #elif defined(__WIN32__) @@ -564,7 +565,7 @@ lilv_world_load_directory(LilvWorld* world, const char* dir_path) { char* path = expand(dir_path); if (!path) { - LILV_WARNF("empty path `%s'\n", path); + LILV_WARNF("Empty path `%s'\n", path); return; } |