From 4fa91364b545ccba013435f75a72b87e6eb63b87 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 26 Sep 2016 12:52:54 -0400 Subject: Fix comparison of restored states with paths --- NEWS | 6 ++++++ src/state.c | 2 +- test/test.lv2/test.c | 11 ++++++++--- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index dfb5dc3..05555c4 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,9 @@ +lilv (0.24.1) unstable; + + * Fix comparison of restored states with paths + + -- David Robillard Mon, 26 Sep 2016 12:51:37 -0400 + lilv (0.24.0) stable; * Add new hand-crafted Pythonic bindings with full test coverage diff --git a/src/state.c b/src/state.c index 7a8abc0..4781405 100644 --- a/src/state.c +++ b/src/state.c @@ -588,7 +588,7 @@ new_state_from_model(LilvWorld* world, prop.value = malloc(atom->size); memcpy(prop.value, LV2_ATOM_BODY_CONST(atom), atom->size); if (atom->type == forge.Path) { - prop.flags = LV2_STATE_IS_PORTABLE; + prop.flags = LV2_STATE_IS_POD; } if (prop.value) { diff --git a/test/test.lv2/test.c b/test/test.lv2/test.c index 27344e7..37d29c1 100644 --- a/test/test.lv2/test.c +++ b/test/test.lv2/test.c @@ -247,7 +247,7 @@ save(LV2_Handle instance, apath, strlen(apath) + 1, map_uri(plugin, LV2_ATOM__Path), - LV2_STATE_IS_PORTABLE); + LV2_STATE_IS_POD); free(apath); free(apath2); @@ -262,7 +262,7 @@ save(LV2_Handle instance, apath, strlen(apath) + 1, map_uri(plugin, LV2_ATOM__Path), - LV2_STATE_IS_PORTABLE); + LV2_STATE_IS_POD); free(apath); } @@ -279,7 +279,7 @@ save(LV2_Handle instance, apath, strlen(apath) + 1, map_uri(plugin, LV2_ATOM__Path), - LV2_STATE_IS_PORTABLE); + LV2_STATE_IS_POD); free(apath); free(spath); } @@ -322,6 +322,11 @@ restore(LV2_Handle instance, map_uri(plugin, "http://example.org/extfile"), &size, &type, &valflags); + if (valflags != LV2_STATE_IS_POD) { + fprintf(stderr, "error: Restored bad file flags\n"); + return LV2_STATE_ERR_BAD_FLAGS; + } + if (apath) { char* path = map_path->absolute_path(map_path->handle, apath); FILE* f = fopen(path, "r"); -- cgit v1.2.1