mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-22 02:09:06 +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
3
Externals/semver/src/Semver200_parser.cpp
vendored
3
Externals/semver/src/Semver200_parser.cpp
vendored
|
@ -92,6 +92,9 @@ namespace version {
|
||||||
for (const auto& r : allowed_prerel_id_chars) {
|
for (const auto& r : allowed_prerel_id_chars) {
|
||||||
res |= (c >= r.first && c <= r.second);
|
res |= (c >= r.first && c <= r.second);
|
||||||
}
|
}
|
||||||
|
// Trick the compiler that this is being used so it stops crashing on macos
|
||||||
|
(void)res;
|
||||||
|
|
||||||
// if (!res)
|
// if (!res)
|
||||||
// throw Parse_error("invalid character encountered: " + string(1, c));
|
// throw Parse_error("invalid character encountered: " + string(1, c));
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
|
||||||
|
@ -593,7 +594,7 @@ std::string UTF16BEToUTF8(const char16_t* str, size_t max_size)
|
||||||
template <typename T>
|
template <typename T>
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
std::string CodeToWithFallbacks(const char* tocode, const char* fromcode,
|
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
|
#else
|
||||||
std::string CodeTo(const char* tocode, const char* fromcode, std::basic_string_view<T> input)
|
std::string CodeTo(const char* tocode, const char* fromcode, std::basic_string_view<T> input)
|
||||||
#endif
|
#endif
|
||||||
|
@ -665,6 +666,14 @@ std::string CodeTo(const char* tocode, const char* fromcode, std::basic_string_v
|
||||||
return result;
|
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>
|
template <typename T>
|
||||||
std::string CodeToUTF8(const char* fromcode, std::basic_string_view<T> input)
|
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->mb_to_wc_fallback = nullptr;
|
||||||
fallbacks->wc_to_mb_fallback = nullptr;
|
fallbacks->wc_to_mb_fallback = nullptr;
|
||||||
fallbacks->data = 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);
|
free(fallbacks);
|
||||||
#else
|
#else
|
||||||
auto str = CodeTo("SJIS", "UTF-8", input);
|
auto str = CodeTo("SJIS", "UTF-8", std::string_view(input));
|
||||||
#endif
|
#endif
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
|
@ -487,8 +487,8 @@ void SetUserDirectory(std::string custom_path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
File::SetUserPath(D_USER_IDX, std::move(user_path));
|
File::SetUserPath(D_USER_IDX, std::move(user_path));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue