From 9f7d2de1ee0443c1d82a854ac459fc7dbe79749d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 4 Feb 2018 20:49:28 +0100 Subject: Remove serd_uri_to_path() --- src/serdi.c | 9 +++++++-- src/uri.c | 23 ----------------------- 2 files changed, 7 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/serdi.c b/src/serdi.c index 02714201..5cea387e 100644 --- a/src/serdi.c +++ b/src/serdi.c @@ -201,11 +201,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; } @@ -296,6 +300,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); diff --git a/src/uri.c b/src/uri.c index a891c6df..2fb17f38 100644 --- a/src/uri.c +++ b/src/uri.c @@ -19,29 +19,6 @@ #include #include -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) { -- cgit v1.2.1