[glib/wip/hadess/log-successful-installed-tests: 5/6] Revert "Revert "guuid: Remove support for curly braces and URN UUIDs""
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/hadess/log-successful-installed-tests: 5/6] Revert "Revert "guuid: Remove support for curly braces and URN UUIDs""
- Date: Wed, 4 Dec 2019 13:35:04 +0000 (UTC)
commit 51eae9e38f871dc7e52e5a6cabd45642ab018bfc
Author: Bastien Nocera <hadess hadess net>
Date: Tue Jan 9 16:06:27 2018 +0100
Revert "Revert "guuid: Remove support for curly braces and URN UUIDs""
This reverts commit ac5d47280374af2d09c914180527d71fdfbb1f61.
glib/guuid.c | 23 +----------------------
glib/tests/guuid.c | 4 ++--
2 files changed, 3 insertions(+), 24 deletions(-)
---
diff --git a/glib/guuid.c b/glib/guuid.c
index 88ff8f3ee..8aa1d0084 100644
--- a/glib/guuid.c
+++ b/glib/guuid.c
@@ -94,27 +94,9 @@ uuid_parse_string (const gchar *str,
gint i, j, hi, lo;
guint expected_len = 36;
- if (g_str_has_prefix (str, "urn:uuid:"))
- str += 9;
- else if (g_str_has_prefix (str, "{urn:uuid:"))
- expected_len += 11;
- else if (str[0] == '{')
- expected_len += 2;
-
if (strlen (str) != expected_len)
return FALSE;
- if (str[0] == '{')
- {
- if (str[expected_len - 1] != '}')
- return FALSE;
-
- str++;
- }
-
- if (g_str_has_prefix (str, "urn:uuid:"))
- str += 9;
-
for (i = 0, j = 0; i < 16;)
{
if (j == 8 || j == 13 || j == 18 || j == 23)
@@ -146,12 +128,9 @@ uuid_parse_string (const gchar *str,
*
* Parses the string @str and verify if it is a UUID.
*
- * The function accepts the following syntaxes:
+ * The function accepts the following syntax:
*
* - simple forms (e.g. `f81d4fae-7dec-11d0-a765-00a0c91e6bf6`)
- * - simple forms with curly braces (e.g.
- * `{urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6}`)
- * - URN (e.g. `urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6`)
*
* Note that hyphens are required within the UUID string itself,
* as per the aforementioned RFC.
diff --git a/glib/tests/guuid.c b/glib/tests/guuid.c
index 437749f0e..41e2c81e9 100644
--- a/glib/tests/guuid.c
+++ b/glib/tests/guuid.c
@@ -30,13 +30,13 @@ test_guuid_string (void)
g_assert_false (g_uuid_string_is_valid ("00010203-0405-0607-0809"));
g_assert_false (g_uuid_string_is_valid ("zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz"));
g_assert_false (g_uuid_string_is_valid ("000102030405060708090a0b0c0d0e0f"));
+ g_assert_false (g_uuid_string_is_valid ("{urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6}"));
+ g_assert_false (g_uuid_string_is_valid ("urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6"));
g_assert_true (g_uuid_string_is_valid ("00010203-0405-0607-0809-0a0b0c0d0e0f"));
g_assert_true (g_uuid_string_is_valid ("7d444840-9dc0-11d1-b245-5ffdce74fad2"));
g_assert_true (g_uuid_string_is_valid ("e902893a-9d22-3c7e-a7b8-d6e313b71d9f"));
g_assert_true (g_uuid_string_is_valid ("6ba7b810-9dad-11d1-80b4-00c04fd430c8"));
- g_assert_true (g_uuid_string_is_valid ("{urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6}"));
- g_assert_true (g_uuid_string_is_valid ("urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6"));
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]