diff options
author | David Robillard <d@drobilla.net> | 2011-04-30 17:41:21 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-04-30 17:41:21 +0000 |
commit | 98d5ce707366a4955bf072389cbc8b1029e1d2a9 (patch) | |
tree | f79d676f98229eba7308007970858b3e9bb817fe | |
parent | 4f124c1ee7fa82e9f3641897da2af4bc122c5522 (diff) | |
download | sord-98d5ce707366a4955bf072389cbc8b1029e1d2a9.tar.gz sord-98d5ce707366a4955bf072389cbc8b1029e1d2a9.tar.bz2 sord-98d5ce707366a4955bf072389cbc8b1029e1d2a9.zip |
Update for new Serd API
git-svn-id: http://svn.drobilla.net/sord/trunk@102 3d64ff67-21c5-427c-a301-fe4f08042e5a
-rw-r--r-- | sord/sordmm.hpp | 2 | ||||
-rw-r--r-- | src/sordi.c | 2 | ||||
-rw-r--r-- | src/syntax.c | 24 |
3 files changed, 14 insertions, 14 deletions
diff --git a/sord/sordmm.hpp b/sord/sordmm.hpp index dc80cb3..8977dc1 100644 --- a/sord/sordmm.hpp +++ b/sord/sordmm.hpp @@ -95,7 +95,7 @@ public: SerdNode curie_node = string_to_node(SERD_CURIE, curie); SerdChunk uri_prefix; SerdChunk uri_suffix; - if (serd_env_expand(_c_obj, &curie_node, &uri_prefix, &uri_suffix)) { + if (!serd_env_expand(_c_obj, &curie_node, &uri_prefix, &uri_suffix)) { std::string ret((const char*)uri_prefix.buf, uri_prefix.len); ret.append((const char*)uri_suffix.buf, uri_suffix.len); return ret; diff --git a/src/sordi.c b/src/sordi.c index 1931b93..78f8690 100644 --- a/src/sordi.c +++ b/src/sordi.c @@ -124,7 +124,7 @@ main(int argc, char** argv) printf("Loaded %zu statements\n", sord_num_nodes(world)); SerdURI base_uri; - if (!serd_uri_parse(input, &base_uri)) { + if (serd_uri_parse(input, &base_uri)) { fprintf(stderr, "Bad input URI <%s>\n", input); return 1; } diff --git a/src/syntax.c b/src/syntax.c index 61c003d..585a642 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -44,7 +44,7 @@ copy_string(const uint8_t* str, size_t* n_bytes) return ret; } -static bool +static SerdStatus event_base(void* handle, const SerdNode* uri_node) { @@ -53,7 +53,7 @@ event_base(void* handle, return serd_read_state_set_base_uri(state->read_state, uri_node); } -static bool +static SerdStatus event_prefix(void* handle, const SerdNode* name, const SerdNode* uri_node) @@ -94,7 +94,7 @@ sord_node_from_serd_node(ReadState* state, const SerdNode* sn, case SERD_CURIE: { SerdChunk uri_prefix; SerdChunk uri_suffix; - if (!serd_env_expand(state->env, sn, &uri_prefix, &uri_suffix)) { + if (serd_env_expand(state->env, sn, &uri_prefix, &uri_suffix)) { fprintf(stderr, "Failed to expand qname `%s'\n", sn->buf); return NULL; } @@ -140,7 +140,7 @@ sord_node_to_serd_node(const SordNode* node, SerdNode* out) out->n_chars = len - 1; // FIXME: UTF-8 } -static bool +static SerdStatus event_statement(void* handle, const SerdNode* graph, const SerdNode* subject, @@ -174,7 +174,7 @@ event_statement(void* handle, sord_node_free(state->world, o); sord_node_free(state->world, g); - return true; + return SERD_SUCCESS; } static const uint8_t* @@ -238,7 +238,7 @@ sord_read_file_handle(SordModel* model, uint8_t* base_uri_str = copy_string(base_uri_str_in, &base_uri_n_bytes); SerdURI base_uri; - if (!serd_uri_parse(base_uri_str, &base_uri)) { + if (serd_uri_parse(base_uri_str, &base_uri)) { fprintf(stderr, "Invalid base URI <%s>\n", base_uri_str); } @@ -257,14 +257,14 @@ sord_read_file_handle(SordModel* model, serd_reader_set_blank_prefix(state.reader, blank_prefix); } - const bool success = serd_reader_read_file(state.reader, fd, base_uri_str); + const SerdStatus ret = serd_reader_read_file(state.reader, fd, base_uri_str); serd_reader_free(state.reader); serd_read_state_free(state.read_state); serd_env_free(env); free(base_uri_str); - return success; + return (ret == SERD_SUCCESS); } SORD_API @@ -277,7 +277,7 @@ sord_read_string(SordModel* model, uint8_t* base_uri_str = copy_string(base_uri_str_in, &base_uri_n_bytes); SerdURI base_uri; - if (!serd_uri_parse(base_uri_str, &base_uri)) { + if (serd_uri_parse(base_uri_str, &base_uri)) { fprintf(stderr, "Invalid base URI <%s>\n", base_uri_str); } @@ -292,14 +292,14 @@ sord_read_string(SordModel* model, SERD_TURTLE, &state, event_base, event_prefix, event_statement, NULL); - const bool success = serd_reader_read_string(state.reader, str); + const SerdStatus status = serd_reader_read_string(state.reader, str); serd_reader_free(state.reader); serd_read_state_free(state.read_state); serd_env_free(env); free(base_uri_str); - return success; + return (status == SERD_SUCCESS); } SORD_API @@ -379,7 +379,7 @@ make_writer(SerdEnv* env, size_t base_uri_n_bytes = 0; uint8_t* base_uri_str = copy_string(base_uri_str_in, &base_uri_n_bytes); SerdURI base_uri; - if (!serd_uri_parse(base_uri_str, &base_uri)) { + if (serd_uri_parse(base_uri_str, &base_uri)) { fprintf(stderr, "Invalid base URI <%s>\n", base_uri_str); } |