diff options
author | David Robillard <d@drobilla.net> | 2018-02-04 20:49:28 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2018-11-25 09:21:03 +0100 |
commit | 8a315ba8778378c1d9e5f03173a1c0715698a601 (patch) | |
tree | 4cc08ea04d785c246660c1c282d74f0fbc53d8e7 /src | |
parent | 43e4cba8561d332cdc0fa9d257008dc68bb65a96 (diff) | |
download | serd-8a315ba8778378c1d9e5f03173a1c0715698a601.tar.gz serd-8a315ba8778378c1d9e5f03173a1c0715698a601.tar.bz2 serd-8a315ba8778378c1d9e5f03173a1c0715698a601.zip |
Remove serd_uri_to_path()
Diffstat (limited to 'src')
-rw-r--r-- | src/serdi.c | 9 | ||||
-rw-r--r-- | src/uri.c | 23 |
2 files changed, 7 insertions, 25 deletions
diff --git a/src/serdi.c b/src/serdi.c index 571e2208..ec66cfd3 100644 --- a/src/serdi.c +++ b/src/serdi.c @@ -199,11 +199,15 @@ main(int argc, char** argv) return 1; } - const char* input = (const char*)argv[a++]; + char* input_path = NULL; + const char* input = (const char*)argv[a++]; if (from_file) { in_name = in_name ? in_name : input; if (!in_fd) { - input = serd_uri_to_path(in_name); + if (!strncmp(input, "file:", 5)) { + input_path = serd_file_uri_parse(input, NULL); + input = input_path; + } if (!input || !(in_fd = serd_fopen(input, "rb"))) { return 1; } @@ -294,6 +298,7 @@ main(int argc, char** argv) serd_writer_free(writer); serd_env_free(env); serd_node_free(base); + free(input_path); if (from_file) { fclose(in_fd); @@ -21,29 +21,6 @@ // #define URI_DEBUG 1 -const char* -serd_uri_to_path(const char* uri) -{ - const char* path = uri; - if (!is_windows_path(uri) && serd_uri_string_has_scheme(uri)) { - if (strncmp(uri, "file:", 5)) { - fprintf(stderr, "Non-file URI `%s'\n", uri); - return NULL; - } else if (!strncmp(uri, "file://localhost/", 17)) { - path = uri + 16; - } else if (!strncmp(uri, "file://", 7)) { - path = uri + 7; - } else { - fprintf(stderr, "Invalid file URI `%s'\n", uri); - return NULL; - } - if (is_windows_path(path + 1)) { - ++path; // Special case for terrible Windows file URIs - } - } - return path; -} - char* serd_file_uri_parse(const char* uri, char** hostname) { |