From 969cd2c5c7f6e214f6acd474a61672bc898399dd Mon Sep 17 00:00:00 2001 From: Matthias Klumpp Date: Sun, 12 Jan 2020 21:22:56 +0100 Subject: [PATCH] trivial: Remove some deprecations --- src/asgen/utils.d | 4 ++-- src/asgen/zarchive.d | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/asgen/utils.d b/src/asgen/utils.d index f7444030..42cfab9c 100644 --- a/src/asgen/utils.d +++ b/src/asgen/utils.d @@ -186,7 +186,7 @@ bool isTopLevelDomain (const string value) pure @trusted string buildCptGlobalID (string cid, string checksum, bool allowNoChecksum = false) pure in { assert (cid.length >= 2); } -body +do { if (cid is null) return null; @@ -412,7 +412,7 @@ bool isRemote (const string uri) private immutable(Nullable!SysTime) download (const string url, ref File dest, const uint retryCount = 5) @trusted in { assert (url.isRemote); } -body +do { import core.time : dur; import std.string : toLower; diff --git a/src/asgen/zarchive.d b/src/asgen/zarchive.d index 9a241111..afe5162d 100644 --- a/src/asgen/zarchive.d +++ b/src/asgen/zarchive.d @@ -246,7 +246,7 @@ public: void extractArchive (const string dest) in { assert (std.file.isDir (dest)); } - body + do { import std.path; archive_entry *en; @@ -525,14 +525,14 @@ public: closed = true; } - void addFile (string fname, string dest = null) + void addFile (const string fname, const string dest = null) in { if (!std.file.exists (fname)) { logError ("File %s does not exist!", fname); assert (0); } } - body + do { import std.conv: octal; import std.path: baseName; @@ -543,14 +543,15 @@ public: stat_t st; ubyte[BUFFER_SIZE] buff; - if (dest is null) - dest = baseName (fname); + string destName = dest; + if (destName is null) + destName = baseName (fname); lstat (fname.toStringz, &st); entry = archive_entry_new (); scope (exit) archive_entry_free (entry); - archive_entry_set_pathname (entry, toStringz (dest)); + archive_entry_set_pathname (entry, destName.toStringz); archive_entry_set_size (entry, st.st_size); archive_entry_set_filetype (entry, S_IFREG); archive_entry_set_perm (entry, octal!755);