[PATCH setup 1/2] NetIO: Remove unused url parsing code
SZAVAI Gyula
szgyg@ludens.elte.hu
Wed Feb 28 11:54:00 GMT 2018
---
netio.cc | 64 --------------------------------------------------------------
netio.h | 11 ++---------
nio-ie5.cc | 3 +--
3 files changed, 3 insertions(+), 75 deletions(-)
diff --git a/netio.cc b/netio.cc
index d60f119..c8982de 100644
--- a/netio.cc
+++ b/netio.cc
@@ -42,70 +42,6 @@ char *NetIO::net_proxy_passwd;
char *NetIO::net_ftp_user;
char *NetIO::net_ftp_passwd;
-NetIO::NetIO (char const *Purl)
-{
- set_url (Purl);
-}
-
-NetIO::~NetIO ()
-{
- if (url)
- delete[] url;
- if (proto)
- delete[] proto;
- if (host)
- delete[] host;
- if (path)
- delete[] path;
-}
-
-void
-NetIO::set_url (char const *Purl)
-{
- char *bp, *ep, c;
-
- file_size = 0;
- url = new char[strlen (Purl) + 1];
- strcpy (url, Purl);
- proto = 0;
- host = 0;
- port = 0;
- path = 0;
-
- bp = url;
- ep = strstr (bp, "://");
- if (!ep)
- {
- path = strdup (url);
- return;
- }
-
- *ep = 0;
- proto = new char [strlen (bp)+1];
- strcpy (proto, bp);
- *ep = ':';
- bp = ep + 3;
-
- ep = bp + strcspn (bp, ":/");
- c = *ep;
- *ep = 0;
- host = new char [strlen (bp) + 1];
- strcpy (host, bp);
- *ep = c;
-
- if (*ep == ':')
- {
- port = atoi (ep + 1);
- ep = strchr (ep, '/');
- }
-
- if (*ep)
- {
- path = new char [strlen (ep)+1];
- strcpy (path, ep);
- }
-}
-
int
NetIO::ok ()
{
diff --git a/netio.h b/netio.h
index 7b7d13f..6d0f044 100644
--- a/netio.h
+++ b/netio.h
@@ -24,8 +24,6 @@
class NetIO
{
protected:
- NetIO (char const *url);
- void set_url (char const *url);
BOOL ftp_auth;
static char *net_user;
@@ -39,13 +37,8 @@ protected:
public:
/* if nonzero, this is the estimated total file size */
int file_size;
- /* broken down url FYI */
- char *url;
- char *proto;
- char *host;
- int port;
- char *path;
- virtual ~ NetIO ();
+
+ virtual ~ NetIO () {};
/* The user calls this function to create a suitable accessor for
the given URL. It uses the network setup state in state.h. If
diff --git a/nio-ie5.cc b/nio-ie5.cc
index 5c93894..6fada0f 100644
--- a/nio-ie5.cc
+++ b/nio-ie5.cc
@@ -114,8 +114,7 @@ DWORD Proxy::type (void) const
static HINTERNET internet = 0;
static Proxy last_proxy = Proxy(-1, "", -1);
-NetIO_IE5::NetIO_IE5 (char const *_url, bool cachable):
-NetIO (_url)
+NetIO_IE5::NetIO_IE5 (char const *url, bool cachable)
{
int resend = 0;
--
2.16.1
More information about the Cygwin-apps
mailing list