aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-02-04 20:49:28 +0100
committerDavid Robillard <d@drobilla.net>2021-03-07 15:32:23 -0500
commit96bcba9cd94879794de477ae7c5c04971fbd6f32 (patch)
treeced8ec83621bb2ac6f90fc1d9fc0e5b7f38e2c28
parentb9d0b9f058807d7253e88d37822c47b5462b65ea (diff)
downloadserd-96bcba9cd94879794de477ae7c5c04971fbd6f32.tar.gz
serd-96bcba9cd94879794de477ae7c5c04971fbd6f32.tar.bz2
serd-96bcba9cd94879794de477ae7c5c04971fbd6f32.zip
Remove serd_uri_to_path()
-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 03636d41..1de04d37 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 32488e18..cdcadcdb 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__)
@@ -361,22 +349,6 @@ typedef size_t (*SerdSink)(const void* SERD_NONNULL buf,
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 b70992ff..ed927695 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* uri, uint8_t** hostname)
{
@@ -58,6 +32,7 @@ serd_file_uri_parse(const uint8_t* uri, uint8_t** 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();