From ebfc9d2d76df8fd027c2b9e0141d0064d17c6db0 Mon Sep 17 00:00:00 2001 From: andrewlalis Date: Tue, 13 Feb 2024 18:06:39 -0500 Subject: [PATCH] Upgraded path-matcher to v1.1.4, used explicit casts in multivalue_map. --- dub.json | 2 +- dub.selections.json | 2 +- integration-tests/speed-test/dub.selections.json | 2 +- source/handy_httpd/components/multivalue_map.d | 13 +++++++------ 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/dub.json b/dub.json index 55b78f0..b6ab062 100644 --- a/dub.json +++ b/dub.json @@ -13,7 +13,7 @@ "httparsed": "~>1.2.1", "slf4d": "~>3", "streams": "~>3", - "path-matcher": "~>1.1.3" + "path-matcher": "~>1.1.4" }, "description": "Extremely lightweight HTTP server for D.", "license": "MIT", diff --git a/dub.selections.json b/dub.selections.json index 60492c5..60ad36b 100644 --- a/dub.selections.json +++ b/dub.selections.json @@ -2,7 +2,7 @@ "fileVersion": 1, "versions": { "httparsed": "1.2.1", - "path-matcher": "1.1.3", + "path-matcher": "1.1.4", "slf4d": "3.0.0", "streams": "3.5.0" } diff --git a/integration-tests/speed-test/dub.selections.json b/integration-tests/speed-test/dub.selections.json index 456ee05..71d7d0e 100644 --- a/integration-tests/speed-test/dub.selections.json +++ b/integration-tests/speed-test/dub.selections.json @@ -5,7 +5,7 @@ "cachetools": "0.4.1", "handy-httpd": {"path":"../../"}, "httparsed": "1.2.1", - "path-matcher": "1.1.3", + "path-matcher": "1.1.4", "requests": "2.1.3", "slf4d": "3.0.0", "streams": "3.5.0", diff --git a/source/handy_httpd/components/multivalue_map.d b/source/handy_httpd/components/multivalue_map.d index 3395eb8..50fdc43 100644 --- a/source/handy_httpd/components/multivalue_map.d +++ b/source/handy_httpd/components/multivalue_map.d @@ -77,7 +77,7 @@ struct MultiValueMap(KeyType, ValueType, alias KeySort = (a, b) => a < b) { private Optional!Entry getEntry(KeyType k) { long idx = indexOf(k); if (idx == -1) return Optional!Entry.empty(); - return Optional!Entry.of(entries[idx]); + return Optional!Entry.of(entries[cast(size_t) idx]); } /** @@ -120,7 +120,7 @@ struct MultiValueMap(KeyType, ValueType, alias KeySort = (a, b) => a < b) { ValueType[] getAll(KeyType k) const { long idx = indexOf(k); if (idx == -1) return []; - return entries[idx].values.dup; + return entries[cast(size_t) idx].values.dup; } /** @@ -134,7 +134,7 @@ struct MultiValueMap(KeyType, ValueType, alias KeySort = (a, b) => a < b) { Optional!ValueType getFirst(KeyType k) const { long idx = indexOf(k); if (idx == -1) return Optional!ValueType.empty(); - return Optional!ValueType.of(entries[idx].values[0]); + return Optional!ValueType.of(entries[cast(size_t) idx].values[0]); } /** @@ -151,7 +151,7 @@ struct MultiValueMap(KeyType, ValueType, alias KeySort = (a, b) => a < b) { import std.algorithm.sorting : sort; sort!((a, b) => KeySort(a.key, b.key))(entries); } else { - entries[idx].values ~= v; + entries[cast(size_t) idx].values ~= v; } } @@ -176,7 +176,8 @@ struct MultiValueMap(KeyType, ValueType, alias KeySort = (a, b) => a < b) { return; } if (idx + 1 < entries.length) { - entries[idx .. $ - 1] = entries[idx + 1 .. $]; + const i = cast(size_t) idx; + entries[i .. $ - 1] = entries[i + 1 .. $]; } entries.length = entries.length - 1; } @@ -248,7 +249,7 @@ struct MultiValueMap(KeyType, ValueType, alias KeySort = (a, b) => a < b) { if (idx == -1) { entryAppender ~= Entry(k, [v]); } else { - m.entries[idx].values ~= v; + m.entries[cast(size_t) idx].values ~= v; } return this; }