mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-09-14 05:22:02 +00:00
stratosphere: fix call to non-constexpr strlen in constexpr function
strlen being constexpr is a non-compliant GCC extension; Clang explicitly rejects it: https://reviews.llvm.org/D23692
This commit is contained in:
parent
11045ec5d0
commit
16e738ece2
2 changed files with 4 additions and 8 deletions
|
@ -62,18 +62,14 @@ namespace ams::settings {
|
|||
|
||||
char name[MaxLength];
|
||||
|
||||
static constexpr LanguageCode Encode(const char *name, size_t name_size) {
|
||||
static constexpr LanguageCode Encode(util::string_view name) {
|
||||
LanguageCode out{};
|
||||
for (size_t i = 0; i < MaxLength && i < name_size; i++) {
|
||||
for (size_t i = 0; i < MaxLength && i < name.size(); i++) {
|
||||
out.name[i] = name[i];
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
static constexpr LanguageCode Encode(const char *name) {
|
||||
return Encode(name, std::strlen(name));
|
||||
}
|
||||
|
||||
template<Language Lang>
|
||||
static constexpr inline LanguageCode EncodeLanguage = [] {
|
||||
if constexpr (false) { /* ... */ }
|
||||
|
|
|
@ -40,8 +40,8 @@ namespace ams::sm {
|
|||
return out;
|
||||
}
|
||||
|
||||
static constexpr ServiceName Encode(const char *name) {
|
||||
return Encode(name, std::strlen(name));
|
||||
static constexpr ServiceName Encode(util::string_view name) {
|
||||
return Encode(name.data(), name.size());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue