From 2ffe350c965512304db31169955c344aa43d121e Mon Sep 17 00:00:00 2001 From: Eduard Staniloiu Date: Sun, 21 May 2017 18:52:21 +0300 Subject: [PATCH] Replace deprecated functions from std_conv and std_uri --- std/conv.d | 4 ++-- std/uri.d | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/std/conv.d b/std/conv.d index 7389b944cb1..ef729674418 100644 --- a/std/conv.d +++ b/std/conv.d @@ -2135,12 +2135,12 @@ Lerr: /// @safe pure unittest { - import std.string : munch; + import std.string : tr; string test = "123 \t 76.14"; auto a = parse!uint(test); assert(a == 123); assert(test == " \t 76.14"); // parse bumps string - munch(test, " \t\n\r"); // skip ws + test = tr(test, " \t\n\r", "", "d"); // skip ws assert(test == "76.14"); auto b = parse!double(test); assert(b == 76.14); diff --git a/std/uri.d b/std/uri.d index f05d7cc164a..0f03d03bae2 100644 --- a/std/uri.d +++ b/std/uri.d @@ -316,11 +316,12 @@ if (isSomeChar!Char) string decode(Char)(in Char[] encodedURI) if (isSomeChar!Char) { - // selective imports trigger wrong deprecation - // https://issues.dlang.org/show_bug.cgi?id=17193 - static import std.utf; + import std.utf : encode; + import std.algorithm.iteration : each; auto s = URI_Decode(encodedURI, URI_Reserved | URI_Hash); - return std.utf.toUTF8(s); + char[] r; + s.each!(c => encode(r, c)); + return r; } /******************************* @@ -331,11 +332,12 @@ if (isSomeChar!Char) string decodeComponent(Char)(in Char[] encodedURIComponent) if (isSomeChar!Char) { - // selective imports trigger wrong deprecation - // https://issues.dlang.org/show_bug.cgi?id=17193 - static import std.utf; + import std.utf : encode; + import std.algorithm.iteration : each; auto s = URI_Decode(encodedURIComponent, 0); - return std.utf.toUTF8(s); + char[] r; + s.each!(c => encode(r, c)); + return r; } /*****************************