From 4e8a95e59bf761bc4d0bcc4ba3ec042401073b54 Mon Sep 17 00:00:00 2001 From: Ake Rehnman Date: Tue, 2 May 2017 20:55:07 +0200 Subject: [PATCH 1/1] Use wininet for "file://" protocol. Use NetIO_File for unknown protocols. --- netio.cc | 10 ++++++---- nio-file.cc | 7 ------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/netio.cc b/netio.cc index cf634c1..07ee217 100644 --- a/netio.cc +++ b/netio.cc @@ -126,7 +126,7 @@ NetIO::open (char const *url, bool cachable) { NetIO *rv = 0; enum - { http, https, ftp, ftps, file } + { http, https, ftp, ftps, file, unk } proto; if (strncmp (url, "http://", 7) == 0) proto = http; @@ -136,10 +136,12 @@ NetIO::open (char const *url, bool cachable) proto = ftp; else if (strncmp (url, "ftps://", 7) == 0) proto = ftps; - else + else if (strncmp (url, "file://", 7) == 0) proto = file; + else + proto = unk; - if (proto == file) + if (proto == unk) rv = new NetIO_File (url); else if (net_method == IDC_NET_IE5) rv = new NetIO_IE5 (url, false, cachable); @@ -157,7 +159,7 @@ NetIO::open (char const *url, bool cachable) case ftp: rv = new NetIO_FTP (url); break; - case file: + case unk: rv = new NetIO_File (url); break; default: diff --git a/nio-file.cc b/nio-file.cc index e69f1ff..c302616 100644 --- a/nio-file.cc +++ b/nio-file.cc @@ -35,13 +35,6 @@ NetIO (Purl) { file_size = get_file_size (std::string("file://") + path); } - else - { - const char *err = strerror (errno); - if (!err) - err = "(unknown error)"; - note (NULL, IDS_ERR_OPEN_READ, path, err); - } } NetIO_File::~NetIO_File () -- 2.12.2