Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix macos compilation errors #81

Merged
merged 3 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Externals/semver/src/Semver200_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,11 @@ namespace version {
for (const auto& r : allowed_prerel_id_chars) {
res |= (c >= r.first && c <= r.second);
}
//if (!res)
// throw Parse_error("invalid character encountered: " + string(1, c));
// 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));
}

inline bool is_identifier_numeric(const string& id) {
Expand Down
15 changes: 12 additions & 3 deletions Source/Core/Common/StringUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <string>
#include <type_traits>
#include <vector>
#include <unordered_map>

#include <fmt/format.h>

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/UICommon/UICommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,8 @@ void SetUserDirectory(std::string custom_path)
}
}
#endif
}
#endif
}
#endif
File::SetUserPath(D_USER_IDX, std::move(user_path));
}
Expand Down