aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS6
-rw-r--r--include/serd/serd.h28
-rw-r--r--src/uri.c27
-rw-r--r--test/test_uri.c41
4 files changed, 7 insertions, 95 deletions
diff --git a/NEWS b/NEWS
index 1bd53c47..c8e75d49 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,9 @@
+serd (1.0.1) unstable;
+
+ * Remove serd_uri_to_path()
+
+ -- David Robillard <d@drobilla.net> Wed, 13 Jan 2021 13:29:44 +0000
+
serd (0.30.11) unstable;
* Fix writing long literals with triple quotes
diff --git a/include/serd/serd.h b/include/serd/serd.h
index fcba2ddf..189592de 100644
--- a/include/serd/serd.h
+++ b/include/serd/serd.h
@@ -61,18 +61,6 @@
SERD_API \
SERD_CONST_FUNC
-#ifndef SERD_DISABLE_DEPRECATED
-# if defined(__clang__) && __clang_major__ >= 7
-# define SERD_DEPRECATED_BY(rep) __attribute__((deprecated("", rep)))
-# elif defined(__GNUC__) && __GNUC__ > 4
-# define SERD_DEPRECATED_BY(rep) __attribute__((deprecated("Use " rep)))
-# elif defined(__GNUC__)
-# define SERD_DEPRECATED_BY(rep) __attribute__((deprecated))
-# else
-# define SERD_DEPRECATED_BY(rep)
-# endif
-#endif
-
#ifdef __cplusplus
extern "C" {
# if defined(__GNUC__)
@@ -254,22 +242,6 @@ typedef struct {
static const SerdURI SERD_URI_NULL =
{{NULL, 0}, {NULL, 0}, {NULL, 0}, {NULL, 0}, {NULL, 0}, {NULL, 0}};
-#ifndef SERD_DISABLE_DEPRECATED
-
-/**
- Return the local path for `uri`, or NULL if `uri` is not a file URI.
- Note this (inappropriately named) function only removes the file scheme if
- necessary, and returns `uri` unmodified if it is an absolute path. Percent
- encoding and other issues are not handled, to properly convert a file URI to
- a path, use serd_file_uri_parse().
-*/
-SERD_API
-SERD_DEPRECATED_BY("serd_file_uri_parse")
-const uint8_t* SERD_NULLABLE
-serd_uri_to_path(const uint8_t* SERD_NONNULL uri);
-
-#endif
-
/**
Get the unescaped path and hostname from a file URI.
diff --git a/src/uri.c b/src/uri.c
index 2a906d44..e0bfb4e5 100644
--- a/src/uri.c
+++ b/src/uri.c
@@ -25,32 +25,6 @@
#include <stdlib.h>
#include <string.h>
-const uint8_t*
-serd_uri_to_path(const uint8_t* uri)
-{
- const uint8_t* path = uri;
- if (!is_windows_path(uri) && serd_uri_string_has_scheme(uri)) {
- if (strncmp((const char*)uri, "file:", 5)) {
- fprintf(stderr, "Non-file URI `%s'\n", uri);
- return NULL;
- }
-
- if (!strncmp((const char*)uri, "file://localhost/", 17)) {
- path = uri + 16;
- } else if (!strncmp((const char*)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;
-}
-
uint8_t*
serd_file_uri_parse(const uint8_t* const uri, uint8_t** const hostname)
{
@@ -58,6 +32,7 @@ serd_file_uri_parse(const uint8_t* const uri, uint8_t** const hostname)
if (hostname) {
*hostname = NULL;
}
+
if (!strncmp((const char*)uri, "file://", 7)) {
const uint8_t* auth = uri + 7;
if (*auth == '/') { // No hostname
diff --git a/test/test_uri.c b/test/test_uri.c
index f7e1bfab..e0348049 100644
--- a/test/test_uri.c
+++ b/test/test_uri.c
@@ -50,46 +50,6 @@ test_file_uri(const char* hostname,
serd_node_free(&node);
}
-#if defined(__GNUC__)
-# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
-
-static void
-test_uri_to_path(void)
-{
- const uint8_t* uri = (const uint8_t*)"file:///home/user/foo.ttl";
- assert(!strcmp((const char*)serd_uri_to_path(uri), "/home/user/foo.ttl"));
-
- uri = (const uint8_t*)"file://localhost/home/user/foo.ttl";
- assert(!strcmp((const char*)serd_uri_to_path(uri), "/home/user/foo.ttl"));
-
- uri = (const uint8_t*)"file:illegal/file/uri";
- assert(!serd_uri_to_path(uri));
-
- uri = (const uint8_t*)"file:///c:/awful/system";
- assert(!strcmp((const char*)serd_uri_to_path(uri), "c:/awful/system"));
-
- uri = (const uint8_t*)"file:///c:awful/system";
- assert(!strcmp((const char*)serd_uri_to_path(uri), "/c:awful/system"));
-
- uri = (const uint8_t*)"file:///0/1";
- assert(!strcmp((const char*)serd_uri_to_path(uri), "/0/1"));
-
- uri = (const uint8_t*)"C:\\Windows\\Sucks";
- assert(!strcmp((const char*)serd_uri_to_path(uri), "C:\\Windows\\Sucks"));
-
- uri = (const uint8_t*)"C|/Windows/Sucks";
- assert(!strcmp((const char*)serd_uri_to_path(uri), "C|/Windows/Sucks"));
-
- uri = (const uint8_t*)"http://example.org/path";
- assert(!serd_uri_to_path(uri));
-}
-
-#if defined(__GNUC__)
-# pragma GCC diagnostic pop
-#endif
-
static void
test_uri_parsing(void)
{
@@ -175,7 +135,6 @@ test_relative_uri(void)
int
main(void)
{
- test_uri_to_path();
test_uri_parsing();
test_uri_from_string();
test_relative_uri();