From bc10ae70f44ddd5f57d08ebefcb14d96ff5c4376 Mon Sep 17 00:00:00 2001 From: Alexander Zhirov Date: Sun, 21 Sep 2025 00:52:18 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BD=D0=B0=20null-terminated=20?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=BE=D0=BA=D1=83=20()=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=D0=B0=D1=87=D0=B8=20=D0=B2=20?= =?UTF-8?q?C-=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/wildmatch.d | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/wildmatch.d b/source/wildmatch.d index c41d605..b3565d2 100644 --- a/source/wildmatch.d +++ b/source/wildmatch.d @@ -1,6 +1,6 @@ module wildmatch; -import std.string : fromStringz; +import std.string : fromStringz, toStringz; import std.conv : to; extern(C): @@ -29,6 +29,8 @@ alias WM_FILE_NAME = WM_PATHNAME; */ private int wildmatch(const(char)* pattern, const(char)* str, int flags); -bool dwildmatch(string pattern, string str, int flags = WM_PATHNAME) { - return wildmatch(pattern.ptr, str.ptr, flags) == WM_MATCH; +bool dwildmatch(const string pattern, const string str, int flags = WM_PATHNAME) { + auto patternZ = pattern.toStringz(); + auto strZ = str.toStringz(); + return wildmatch(patternZ, strZ, flags) == WM_MATCH; }