From 1c30b3d5a183ed79ca0489d4c78b85a567188c57 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 4 Jul 2022 14:47:22 +0200 Subject: [PATCH] lib/dbus/UDisks2: use std::string_view instead of StringView --- src/lib/dbus/UDisks2.cxx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/lib/dbus/UDisks2.cxx b/src/lib/dbus/UDisks2.cxx index 3ff5f3318..a2fa908f6 100644 --- a/src/lib/dbus/UDisks2.cxx +++ b/src/lib/dbus/UDisks2.cxx @@ -23,7 +23,6 @@ #include "ObjectManager.hxx" #include "util/SpanCast.hxx" #include "util/StringAPI.hxx" -#include "util/StringView.hxx" #include "util/Compiler.h" #include @@ -44,11 +43,11 @@ CheckString(I &&i) noexcept template gcc_pure -static StringView +static std::string_view CheckRecursedByteArrayToString(I &&i) noexcept { if (i.GetArgType() != DBUS_TYPE_BYTE) - return nullptr; + return {}; auto value = i.template GetFixedArray(); return ToStringView(value); @@ -56,22 +55,22 @@ CheckRecursedByteArrayToString(I &&i) noexcept template gcc_pure -static StringView +static std::string_view CheckByteArrayToString(I &&i) noexcept { if (i.GetArgType() != DBUS_TYPE_ARRAY) - return nullptr; + return {}; return CheckRecursedByteArrayToString(i.Recurse()); } template gcc_pure -static StringView +static std::string_view CheckByteArrayArrayFrontToString(I &&i) noexcept { if (i.GetArgType() != DBUS_TYPE_ARRAY) - return nullptr; + return {}; return CheckByteArrayToString(i.Recurse()); } @@ -110,8 +109,8 @@ ParseFileesystemDictEntry(Object &o, const char *name, /* get the first string in the array */ auto value = CheckByteArrayArrayFrontToString(value_i); - if (value != nullptr) - o.mount_point = {value.data, value.size}; + if (value.data() != nullptr) + o.mount_point = value; // TODO: check whether the string is a valid filesystem path }