summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/instance.c3
-rw-r--r--src/node.c11
-rw-r--r--src/pluginclass.c11
-rw-r--r--src/query.c3
-rw-r--r--src/state.c8
-rw-r--r--src/util.c26
6 files changed, 28 insertions, 34 deletions
diff --git a/src/instance.c b/src/instance.c
index 66f5d13..5092dcd 100644
--- a/src/instance.c
+++ b/src/instance.c
@@ -1,5 +1,5 @@
/*
- Copyright 2007-2014 David Robillard <http://drobilla.net>
+ Copyright 2007-2015 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -14,7 +14,6 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/node.c b/src/node.c
index d745adb..575d3f0 100644
--- a/src/node.c
+++ b/src/node.c
@@ -1,5 +1,5 @@
/*
- Copyright 2007-2014 David Robillard <http://drobilla.net>
+ Copyright 2007-2015 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -14,7 +14,7 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <assert.h>
+#include <math.h>
#include <stdlib.h>
#include <string.h>
@@ -140,8 +140,6 @@ lilv_node_new_from_node(LilvWorld* world, const SordNode* node)
world, type, (const char*)sord_node_get_string_counted(node, &len));
lilv_node_set_numerics_from_string(result, len);
break;
- default:
- assert(false);
}
return result;
@@ -327,6 +325,7 @@ lilv_node_is_literal(const LilvNode* value)
case LILV_VALUE_STRING:
case LILV_VALUE_INT:
case LILV_VALUE_FLOAT:
+ case LILV_VALUE_BLOB:
return true;
default:
return false;
@@ -366,12 +365,12 @@ lilv_node_is_float(const LilvNode* value)
LILV_API float
lilv_node_as_float(const LilvNode* value)
{
- assert(lilv_node_is_float(value) || lilv_node_is_int(value));
if (lilv_node_is_float(value)) {
return value->val.float_val;
- } else { // lilv_node_is_int(value)
+ } else if (lilv_node_is_int(value)) {
return (float)value->val.int_val;
}
+ return NAN;
}
LILV_API bool
diff --git a/src/pluginclass.c b/src/pluginclass.c
index f6f6cc6..0afb39a 100644
--- a/src/pluginclass.c
+++ b/src/pluginclass.c
@@ -1,5 +1,5 @@
/*
- Copyright 2007-2014 David Robillard <http://drobilla.net>
+ Copyright 2007-2015 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -14,7 +14,6 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <assert.h>
#include <stdlib.h>
#include <string.h>
@@ -26,9 +25,6 @@ lilv_plugin_class_new(LilvWorld* world,
const SordNode* uri,
const char* label)
{
- if (parent_node && sord_node_get_type(parent_node) != SORD_URI) {
- return NULL; // Not an LV2 plugin superclass (FIXME: discover properly)
- }
LilvPluginClass* pc = (LilvPluginClass*)malloc(sizeof(LilvPluginClass));
pc->world = world;
pc->uri = lilv_node_new_from_node(world, uri);
@@ -42,7 +38,10 @@ lilv_plugin_class_new(LilvWorld* world,
void
lilv_plugin_class_free(LilvPluginClass* plugin_class)
{
- assert(plugin_class->uri);
+ if (!plugin_class) {
+ return;
+ }
+
lilv_node_free(plugin_class->uri);
lilv_node_free(plugin_class->parent_uri);
lilv_node_free(plugin_class->label);
diff --git a/src/query.c b/src/query.c
index 0d06533..fe2988f 100644
--- a/src/query.c
+++ b/src/query.c
@@ -1,5 +1,5 @@
/*
- Copyright 2007-2014 David Robillard <http://drobilla.net>
+ Copyright 2007-2015 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -14,7 +14,6 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <assert.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/state.c b/src/state.c
index a29581a..ccc1b22 100644
--- a/src/state.c
+++ b/src/state.c
@@ -1,5 +1,5 @@
/*
- Copyright 2007-2014 David Robillard <http://drobilla.net>
+ Copyright 2007-2015 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -231,7 +231,11 @@ abstract_path(LV2_State_Map_Path_Handle handle,
if (!copy || !lilv_file_equals(real_path, copy)) {
// No recent enough copy, make a new one
copy = lilv_find_free_path(cpath, lilv_path_exists, NULL);
- lilv_copy_file(real_path, copy);
+ const int st = lilv_copy_file(real_path, copy);
+ if (st) {
+ LILV_ERRORF("Error copying state file %s (%s)\n",
+ copy, strerror(st));
+ }
}
free(real_path);
free(cpath);
diff --git a/src/util.c b/src/util.c
index c072514..7def7bd 100644
--- a/src/util.c
+++ b/src/util.c
@@ -1,5 +1,5 @@
/*
- Copyright 2007-2014 David Robillard <http://drobilla.net>
+ Copyright 2007-2015 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -21,7 +21,6 @@
# define _DARWIN_C_SOURCE 1 /* for flock */
#endif
-#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <stdarg.h>
@@ -90,7 +89,6 @@ lilv_strjoin(const char* first, ...)
char* new_result = (char*)realloc(result, len + this_len + 1);
if (!new_result) {
free(result);
- LILV_ERROR("realloc() failed\n");
return NULL;
}
@@ -293,36 +291,33 @@ lilv_copy_file(const char* src, const char* dst)
{
FILE* in = fopen(src, "r");
if (!in) {
- LILV_ERRORF("error opening %s (%s)\n", src, strerror(errno));
- return 1;
+ return errno;
}
FILE* out = fopen(dst, "w");
if (!out) {
- LILV_ERRORF("error opening %s (%s)\n", dst, strerror(errno));
- fclose(in);
- return 2;
+ return errno;
}
char* page = (char*)malloc(PAGE_SIZE);
size_t n_read = 0;
+ int st = 0;
while ((n_read = fread(page, 1, PAGE_SIZE, in)) > 0) {
if (fwrite(page, 1, n_read, out) != n_read) {
- LILV_ERRORF("write to %s failed (%s)\n", dst, strerror(errno));
+ st = errno;
break;
}
}
- const int ret = ferror(in) || ferror(out);
- if (ferror(in)) {
- LILV_ERRORF("read from %s failed (%s)\n", src, strerror(errno));
+ if (!st && (ferror(in) || ferror(out))) {
+ st = EBADFD;
}
free(page);
fclose(in);
fclose(out);
- return ret;
+ return st;
}
bool
@@ -381,6 +376,7 @@ lilv_size_mtime(const char* path, off_t* size, time_t* time)
struct stat buf;
if (stat(path, &buf)) {
LILV_ERRORF("stat(%s) (%s)\n", path, strerror(errno));
+ return;
}
if (size) {
@@ -575,10 +571,8 @@ lilv_mkdir_p(const char* dir_path)
if (path[i] == LILV_DIR_SEP[0] || path[i] == '\0') {
path[i] = '\0';
if (mkdir(path, 0755) && errno != EEXIST) {
- LILV_ERRORF("Failed to create %s (%s)\n",
- path, strerror(errno));
free(path);
- return 1;
+ return errno;
}
path[i] = LILV_DIR_SEP[0];
}