htclow: fix ordering of channels, uninitialized bug in service json parse

This commit is contained in:
Michael Scire 2021-02-25 11:21:34 -08:00 committed by SciresM
parent 18031ae107
commit 35c816d62f
2 changed files with 2 additions and 2 deletions

View file

@ -43,7 +43,7 @@ namespace ams::htclow::impl {
} }
constexpr ALWAYS_INLINE bool operator<(const ChannelInternalType &lhs, const ChannelInternalType &rhs) { constexpr ALWAYS_INLINE bool operator<(const ChannelInternalType &lhs, const ChannelInternalType &rhs) {
return lhs.module_id < rhs.module_id || lhs.reserved < rhs.reserved || lhs.channel_id < rhs.channel_id; return std::tie(lhs.module_id, lhs.reserved, lhs.channel_id) < std::tie(rhs.module_id, rhs.reserved, rhs.channel_id);
} }
constexpr ALWAYS_INLINE bool operator>(const ChannelInternalType &lhs, const ChannelInternalType &rhs) { constexpr ALWAYS_INLINE bool operator>(const ChannelInternalType &lhs, const ChannelInternalType &rhs) {

View file

@ -139,7 +139,7 @@ namespace ams::htclow::ctrl {
void ParseServiceChannel(s16 *out_version, impl::ChannelInternalType *out_channels, int *out_num_channels, int max_channels, void *str, size_t str_size) { void ParseServiceChannel(s16 *out_version, impl::ChannelInternalType *out_channels, int *out_num_channels, int max_channels, void *str, size_t str_size) {
/* Parse the JSON. */ /* Parse the JSON. */
const char *channel_strs[0x20]; const char *channel_strs[0x20];
int num_channels; int num_channels = 0;
ParseBody(out_version, channel_strs, std::addressof(num_channels), util::size(channel_strs), str, str_size); ParseBody(out_version, channel_strs, std::addressof(num_channels), util::size(channel_strs), str, str_size);
/* Parse the channel strings. */ /* Parse the channel strings. */