lib/dbus/UDisks2: use std::string_view instead of StringView
This commit is contained in:
parent
4964eda167
commit
1c30b3d5a1
@ -23,7 +23,6 @@
|
||||
#include "ObjectManager.hxx"
|
||||
#include "util/SpanCast.hxx"
|
||||
#include "util/StringAPI.hxx"
|
||||
#include "util/StringView.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <functional>
|
||||
@ -44,11 +43,11 @@ CheckString(I &&i) noexcept
|
||||
|
||||
template<typename I>
|
||||
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<char>();
|
||||
return ToStringView(value);
|
||||
@ -56,22 +55,22 @@ CheckRecursedByteArrayToString(I &&i) noexcept
|
||||
|
||||
template<typename I>
|
||||
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<typename I>
|
||||
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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user