diff options
author | David Robillard <d@drobilla.net> | 2011-05-24 17:17:26 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-05-24 17:17:26 +0000 |
commit | ba61f0950156b04dfae0320927543420020b7fc9 (patch) | |
tree | 4f9d0d520c7e73833d322221a90e21c3bdf5d3df /src | |
parent | 2dff746982463158fdf7c3a4a47fee92b1d61551 (diff) | |
download | serd-ba61f0950156b04dfae0320927543420020b7fc9.tar.gz serd-ba61f0950156b04dfae0320927543420020b7fc9.tar.bz2 serd-ba61f0950156b04dfae0320927543420020b7fc9.zip |
Add serd_uri_to_path to API.
Remove unused SERD_ANON_END statement flag.
git-svn-id: http://svn.drobilla.net/serd/trunk@191 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src')
-rw-r--r-- | src/reader.c | 27 | ||||
-rw-r--r-- | src/uri.c | 26 |
2 files changed, 27 insertions, 26 deletions
diff --git a/src/reader.c b/src/reader.c index bdd0ba06..67f53513 100644 --- a/src/reader.c +++ b/src/reader.c @@ -1492,37 +1492,12 @@ serd_reader_add_blank_prefix(SerdReader* reader, } } -static const uint8_t* -file_uri_to_path(const uint8_t* uri) -{ - const uint8_t* filename = NULL; - if (serd_uri_string_has_scheme(uri)) { - // Absolute URI, ensure it a file and chop scheme - if (strncmp((const char*)uri, "file:", 5)) { - fprintf(stderr, "Unsupported URI scheme `%s'\n", uri); - return NULL; -#ifdef __WIN32__ - } else if (!strncmp((const char*)uri, "file:///", 8)) { - filename = uri + 8; -#else - } else if (!strncmp((const char*)uri, "file://", 7)) { - filename = uri + 7; -#endif - } else { - filename = uri + 5; - } - } else { - filename = uri; - } - return filename; -} - SERD_API SerdStatus serd_reader_read_file(SerdReader* reader, const uint8_t* uri) { - const uint8_t* path = file_uri_to_path(uri); + const uint8_t* path = serd_uri_to_path(uri); if (!path) { return SERD_ERR_BAD_ARG; } @@ -25,6 +25,32 @@ // #define URI_DEBUG 1 SERD_API +const uint8_t* +serd_uri_to_path(const uint8_t* uri) +{ + const uint8_t* filename = NULL; + if (serd_uri_string_has_scheme(uri)) { + // Absolute URI, ensure it a file and chop scheme + if (strncmp((const char*)uri, "file:", 5)) { + fprintf(stderr, "Unsupported URI scheme `%s'\n", uri); + return NULL; +#ifdef __WIN32__ + } else if (!strncmp((const char*)uri, "file:///", 8)) { + filename = uri + 8; +#else + } else if (!strncmp((const char*)uri, "file://", 7)) { + filename = uri + 7; +#endif + } else { + filename = uri + 5; + } + } else { + filename = uri; + } + return filename; +} + +SERD_API bool serd_uri_string_has_scheme(const uint8_t* utf8) { |