aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--serd/serd.h8
-rw-r--r--src/node.c6
-rw-r--r--tests/serd_test.c12
4 files changed, 14 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 623a371f..a741e689 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -31,7 +31,7 @@ serd (UNRELEASED) unstable; urgency=low
document, to prevent silent merging of distinct blank nodes.
* Handle files and strings that start with a UTF-8 Byte Order Mark.
* Add serd_writer_get_env().
- * Add serd_node_new_uri_from_path() and serd_file_uri_parse() and implement
+ * Add serd_node_new_file_uri() and serd_file_uri_parse() and implement
proper URI to/from path hex escaping, etc.
* Add serd_uri_serialise_relative() for making URIs relative to a base
where possible (by chopping a common prefix and adding dot segments).
diff --git a/serd/serd.h b/serd/serd.h
index 3a2f9e3b..4388c3b4 100644
--- a/serd/serd.h
+++ b/serd/serd.h
@@ -422,15 +422,15 @@ serd_node_new_uri_from_string(const uint8_t* str,
SerdURI* out);
/**
- Create a new file URI node from a file system path.
+ Create a new file URI node from a file system path and optional hostname.
If @c path is relative, @c hostname is ignored.
If @c out is not NULL, it will be set to the parsed URI.
*/
SERD_API
SerdNode
-serd_node_new_uri_from_path(const uint8_t* path,
- const uint8_t* hostname,
- SerdURI* out);
+serd_node_new_file_uri(const uint8_t* path,
+ const uint8_t* hostname,
+ SerdURI* out);
/**
Create a new node by serialising @c uri into a new string.
diff --git a/src/node.c b/src/node.c
index dc352389..4191dfe4 100644
--- a/src/node.c
+++ b/src/node.c
@@ -133,9 +133,9 @@ is_uri_path_char(const uint8_t c)
SERD_API
SerdNode
-serd_node_new_uri_from_path(const uint8_t* path,
- const uint8_t* hostname,
- SerdURI* out)
+serd_node_new_file_uri(const uint8_t* path,
+ const uint8_t* hostname,
+ SerdURI* out)
{
const size_t path_len = strlen((const char*)path);
const size_t hostname_len = hostname ? strlen((const char*)hostname) : 0;
diff --git a/tests/serd_test.c b/tests/serd_test.c
index 000415de..11f32ed8 100644
--- a/tests/serd_test.c
+++ b/tests/serd_test.c
@@ -252,10 +252,10 @@ main()
return failure("Bad path %s for %s\n", serd_uri_to_path(uri), uri);
}
- // Test serd_node_new_uri_from_path and serd_file_uri_parse
+ // Test serd_node_new_file_uri and serd_file_uri_parse
SerdURI furi;
const uint8_t* path_str = USTR("C:/My 100%");
- SerdNode file_node = serd_node_new_uri_from_path(path_str, 0, &furi);
+ SerdNode file_node = serd_node_new_file_uri(path_str, 0, &furi);
uint8_t* hostname = NULL;
uint8_t* out_path = serd_file_uri_parse(file_node.buf, &hostname);
if (strcmp((const char*)file_node.buf, "file:///C:/My%20100%%")) {
@@ -270,7 +270,7 @@ main()
serd_node_free(&file_node);
path_str = USTR("C:\\Pointless Space");
- file_node = serd_node_new_uri_from_path(path_str, USTR("pwned"), 0);
+ file_node = serd_node_new_file_uri(path_str, USTR("pwned"), 0);
hostname = NULL;
out_path = serd_file_uri_parse(file_node.buf, &hostname);
if (strcmp((const char*)file_node.buf, "file://pwned/C:/Pointless%20Space")) {
@@ -286,7 +286,7 @@ main()
serd_node_free(&file_node);
path_str = USTR("/foo/bar");
- file_node = serd_node_new_uri_from_path(path_str, 0, 0);
+ file_node = serd_node_new_file_uri(path_str, 0, 0);
hostname = NULL;
out_path = serd_file_uri_parse(file_node.buf, &hostname);
if (strcmp((const char*)file_node.buf, "file:///foo/bar")) {
@@ -301,7 +301,7 @@ main()
serd_node_free(&file_node);
path_str = USTR("/foo/bar");
- file_node = serd_node_new_uri_from_path(path_str, USTR("localhost"), 0);
+ file_node = serd_node_new_file_uri(path_str, USTR("localhost"), 0);
out_path = serd_file_uri_parse(file_node.buf, &hostname);
if (strcmp((const char*)file_node.buf, "file://localhost/foo/bar")) {
return failure("Bad URI %s\n", file_node.buf);
@@ -316,7 +316,7 @@ main()
serd_node_free(&file_node);
path_str = USTR("a/relative path");
- file_node = serd_node_new_uri_from_path(path_str, 0, 0);
+ file_node = serd_node_new_file_uri(path_str, 0, 0);
out_path = serd_file_uri_parse(file_node.buf, &hostname);
if (strcmp((const char*)file_node.buf, "a/relative%20path")) {
return failure("Bad URI %s\n", file_node.buf);