mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-21 17:59:50 +00:00
Fix macOS compilation errors (#81)
* Move #endif to proper location on UICommon.cpp preventing compilation because of syntax error * Add missing include for unordered map and missing CodeTo implementation from Ishiiruka + Adjust code to use string_view * Trick compiler to think var is being used on Semver200_parser.cpp to prevent compilation errors on macos
This commit is contained in:
parent
59f2f6909d
commit
19e14a5608
3 changed files with 18 additions and 6 deletions
5
Externals/semver/src/Semver200_parser.cpp
vendored
5
Externals/semver/src/Semver200_parser.cpp
vendored
|
@ -92,7 +92,10 @@ namespace version {
|
|||
for (const auto& r : allowed_prerel_id_chars) {
|
||||
res |= (c >= r.first && c <= r.second);
|
||||
}
|
||||
//if (!res)
|
||||
// Trick the compiler that this is being used so it stops crashing on macos
|
||||
(void)res;
|
||||
|
||||
// if (!res)
|
||||
// throw Parse_error("invalid character encountered: " + string(1, c));
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
|
@ -593,7 +594,7 @@ std::string UTF16BEToUTF8(const char16_t* str, size_t max_size)
|
|||
template <typename T>
|
||||
#ifdef __APPLE__
|
||||
std::string CodeToWithFallbacks(const char* tocode, const char* fromcode,
|
||||
const std::basic_string<T>& input, iconv_fallbacks* fallbacks)
|
||||
const std::basic_string_view<T> input, iconv_fallbacks* fallbacks)
|
||||
#else
|
||||
std::string CodeTo(const char* tocode, const char* fromcode, std::basic_string_view<T> input)
|
||||
#endif
|
||||
|
@ -665,6 +666,14 @@ std::string CodeTo(const char* tocode, const char* fromcode, std::basic_string_v
|
|||
return result;
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
template <typename T>
|
||||
std::string CodeTo(const char* tocode, const char* fromcode, std::basic_string_view<T> input)
|
||||
{
|
||||
return CodeToWithFallbacks(tocode, fromcode, input, nullptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
std::string CodeToUTF8(const char* fromcode, std::basic_string_view<T> input)
|
||||
{
|
||||
|
@ -746,10 +755,10 @@ std::string UTF8ToSHIFTJIS(std::string_view input)
|
|||
fallbacks->mb_to_wc_fallback = nullptr;
|
||||
fallbacks->wc_to_mb_fallback = nullptr;
|
||||
fallbacks->data = nullptr;
|
||||
auto str = CodeToWithFallbacks("SJIS", "UTF-8", input, fallbacks);
|
||||
auto str = CodeToWithFallbacks("SJIS", "UTF-8", std::string_view(input), fallbacks);
|
||||
free(fallbacks);
|
||||
#else
|
||||
auto str = CodeTo("SJIS", "UTF-8", input);
|
||||
auto str = CodeTo("SJIS", "UTF-8", std::string_view(input));
|
||||
#endif
|
||||
return str;
|
||||
}
|
||||
|
|
|
@ -487,8 +487,8 @@ void SetUserDirectory(std::string custom_path)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
File::SetUserPath(D_USER_IDX, std::move(user_path));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue