[gnome-boxes/housekeeping-autumn-2021: 6/9] spice-display: Drop unused "spice_validate_uri"




commit feead3e0b2a90eb8a1b8524b31dfd98438979b5d
Author: Felipe Borges <felipeborges gnome org>
Date:   Wed Oct 13 10:31:48 2021 +0200

    spice-display: Drop unused "spice_validate_uri"

 src/spice-display.vala | 39 ---------------------------------------
 1 file changed, 39 deletions(-)
---
diff --git a/src/spice-display.vala b/src/spice-display.vala
index 0d2feee7..d1d4933f 100644
--- a/src/spice-display.vala
+++ b/src/spice-display.vala
@@ -605,42 +605,3 @@ private void on_open_fd (Spice.Channel channel, int with_tls) {
         channel.open_fd (fd);
     }
 }
-
-// FIXME: this kind of function should be part of spice-gtk
-static void spice_validate_uri (string uri_as_text,
-                                out int? port = null,
-                                out int? tls_port = null) throws Boxes.Error {
-    var uri = Xml.URI.parse (uri_as_text);
-
-    if (uri == null)
-        throw new Boxes.Error.INVALID (_("Invalid URL"));
-
-    tls_port = 0;
-    port = uri.port;
-    var query_str = uri.query_raw ?? uri.query;
-
-    if (query_str != null) {
-        var query = new Boxes.Query (query_str);
-        if (query.get ("port") != null) {
-            if (port > 0)
-                throw new Boxes.Error.INVALID (_("The port must be specified once"));
-            port = int.parse (query.get ("port"));
-        }
-
-        if (query.get ("tls-port") != null)
-            tls_port = int.parse (query.get ("tls-port"));
-    }
-
-    switch (uri.scheme) {
-    case "spice":
-        if (port <= 0 && tls_port <= 0)
-            throw new Boxes.Error.INVALID (_("Missing port in Spice URL"));
-        break;
-    case "spice+unix":
-        if (port > 0 || uri.query_raw != null || uri.query != null)
-            throw new Boxes.Error.INVALID (_("Invalid URL"));
-        break;
-    default:
-        throw new Boxes.Error.INVALID (_("Invalid URL"));
-    }
-}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]