core: Fix clang build
Recent changes to the build system that made more warnings be flagged as errors caused building via clang to break. Fixes #4795
This commit is contained in:
parent
ca416a0fb8
commit
be1954e04c
105 changed files with 906 additions and 667 deletions
|
@ -109,7 +109,7 @@ std::size_t ServerSplitterInfo::Update(SplitterInfo::InInfoPrams& header) {
|
|||
new_connection = true;
|
||||
// We need to update the size here due to the splitter bug being present and providing an
|
||||
// incorrect size. We're suppose to also update the header here but we just ignore and continue
|
||||
return (sizeof(s32_le) * (header.length - 1)) + (sizeof(s32_le) * 3);
|
||||
return (sizeof(s32_le) * static_cast<size_t>(header.length - 1)) + (sizeof(s32_le) * 3);
|
||||
}
|
||||
|
||||
ServerSplitterDestinationData* ServerSplitterInfo::GetHead() {
|
||||
|
@ -306,13 +306,14 @@ bool SplitterContext::UpdateInfo(const std::vector<u8>& input, std::size_t& inpu
|
|||
break;
|
||||
}
|
||||
|
||||
if (header.send_id < 0 || static_cast<std::size_t>(header.send_id) > info_count) {
|
||||
const auto send_id = static_cast<std::size_t>(header.send_id);
|
||||
if (header.send_id < 0 || send_id > info_count) {
|
||||
LOG_ERROR(Audio, "Bad splitter data id");
|
||||
break;
|
||||
}
|
||||
|
||||
UpdateOffsets(sizeof(SplitterInfo::InInfoPrams));
|
||||
auto& info = GetInfo(header.send_id);
|
||||
auto& info = GetInfo(send_id);
|
||||
if (!RecomposeDestination(info, header, input, input_offset)) {
|
||||
LOG_ERROR(Audio, "Failed to recompose destination for splitter!");
|
||||
return false;
|
||||
|
@ -348,11 +349,12 @@ bool SplitterContext::UpdateData(const std::vector<u8>& input, std::size_t& inpu
|
|||
break;
|
||||
}
|
||||
|
||||
if (header.splitter_id < 0 || static_cast<std::size_t>(header.splitter_id) > data_count) {
|
||||
const auto splitter_id = static_cast<std::size_t>(header.splitter_id);
|
||||
if (header.splitter_id < 0 || splitter_id > data_count) {
|
||||
LOG_ERROR(Audio, "Bad splitter data id");
|
||||
break;
|
||||
}
|
||||
GetData(header.splitter_id).Update(header);
|
||||
GetData(splitter_id).Update(header);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -386,9 +388,9 @@ bool SplitterContext::RecomposeDestination(ServerSplitterInfo& info,
|
|||
return true;
|
||||
}
|
||||
|
||||
auto* start_head = &GetData(header.resource_id_base);
|
||||
auto* start_head = &GetData(static_cast<u32>(header.resource_id_base));
|
||||
current_head = start_head;
|
||||
std::vector<s32_le> resource_ids(size - 1);
|
||||
std::vector<s32_le> resource_ids(static_cast<size_t>(size - 1));
|
||||
if (!AudioCommon::CanConsumeBuffer(input.size(), input_offset,
|
||||
resource_ids.size() * sizeof(s32_le))) {
|
||||
LOG_ERROR(Audio, "Buffer is an invalid size!");
|
||||
|
@ -397,8 +399,8 @@ bool SplitterContext::RecomposeDestination(ServerSplitterInfo& info,
|
|||
std::memcpy(resource_ids.data(), input.data() + input_offset,
|
||||
resource_ids.size() * sizeof(s32_le));
|
||||
|
||||
for (auto resource_id : resource_ids) {
|
||||
auto* head = &GetData(resource_id);
|
||||
for (const auto resource_id : resource_ids) {
|
||||
auto* head = &GetData(static_cast<u32>(resource_id));
|
||||
current_head->SetNextDestination(head);
|
||||
current_head = head;
|
||||
}
|
||||
|
@ -444,7 +446,7 @@ bool NodeStates::DepthFirstSearch(EdgeMatrix& edge_matrix) {
|
|||
const auto node_id = static_cast<s32>(i);
|
||||
|
||||
// If we don't have a state, send to our index stack for work
|
||||
if (GetState(i) == NodeStates::State::NoState) {
|
||||
if (GetState(i) == State::NoState) {
|
||||
index_stack.push(node_id);
|
||||
}
|
||||
|
||||
|
@ -453,19 +455,19 @@ bool NodeStates::DepthFirstSearch(EdgeMatrix& edge_matrix) {
|
|||
// Get the current node
|
||||
const auto current_stack_index = index_stack.top();
|
||||
// Check if we've seen the node yet
|
||||
const auto index_state = GetState(current_stack_index);
|
||||
if (index_state == NodeStates::State::NoState) {
|
||||
const auto index_state = GetState(static_cast<u32>(current_stack_index));
|
||||
if (index_state == State::NoState) {
|
||||
// Mark the node as seen
|
||||
UpdateState(NodeStates::State::InFound, current_stack_index);
|
||||
} else if (index_state == NodeStates::State::InFound) {
|
||||
UpdateState(State::InFound, static_cast<u32>(current_stack_index));
|
||||
} else if (index_state == State::InFound) {
|
||||
// We've seen this node before, mark it as completed
|
||||
UpdateState(NodeStates::State::InCompleted, current_stack_index);
|
||||
UpdateState(State::InCompleted, static_cast<u32>(current_stack_index));
|
||||
// Update our index list
|
||||
PushTsortResult(current_stack_index);
|
||||
// Pop the stack
|
||||
index_stack.pop();
|
||||
continue;
|
||||
} else if (index_state == NodeStates::State::InCompleted) {
|
||||
} else if (index_state == State::InCompleted) {
|
||||
// If our node is already sorted, clear it
|
||||
index_stack.pop();
|
||||
continue;
|
||||
|
@ -479,11 +481,11 @@ bool NodeStates::DepthFirstSearch(EdgeMatrix& edge_matrix) {
|
|||
}
|
||||
|
||||
// Check if our node exists
|
||||
const auto node_state = GetState(j);
|
||||
if (node_state == NodeStates::State::NoState) {
|
||||
const auto node_state = GetState(static_cast<u32>(j));
|
||||
if (node_state == State::NoState) {
|
||||
// Add more work
|
||||
index_stack.push(j);
|
||||
} else if (node_state == NodeStates::State::InFound) {
|
||||
} else if (node_state == State::InFound) {
|
||||
UNREACHABLE_MSG("Node start marked as found");
|
||||
ResetState();
|
||||
return false;
|
||||
|
@ -507,17 +509,17 @@ void NodeStates::ResetState() {
|
|||
}
|
||||
}
|
||||
|
||||
void NodeStates::UpdateState(NodeStates::State state, std::size_t i) {
|
||||
void NodeStates::UpdateState(State state, std::size_t i) {
|
||||
switch (state) {
|
||||
case NodeStates::State::NoState:
|
||||
case State::NoState:
|
||||
was_node_found[i] = false;
|
||||
was_node_completed[i] = false;
|
||||
break;
|
||||
case NodeStates::State::InFound:
|
||||
case State::InFound:
|
||||
was_node_found[i] = true;
|
||||
was_node_completed[i] = false;
|
||||
break;
|
||||
case NodeStates::State::InCompleted:
|
||||
case State::InCompleted:
|
||||
was_node_found[i] = false;
|
||||
was_node_completed[i] = true;
|
||||
break;
|
||||
|
@ -528,13 +530,13 @@ NodeStates::State NodeStates::GetState(std::size_t i) {
|
|||
ASSERT(i < node_count);
|
||||
if (was_node_found[i]) {
|
||||
// If our node exists in our found list
|
||||
return NodeStates::State::InFound;
|
||||
return State::InFound;
|
||||
} else if (was_node_completed[i]) {
|
||||
// If node is in the completed list
|
||||
return NodeStates::State::InCompleted;
|
||||
return State::InCompleted;
|
||||
} else {
|
||||
// If in neither
|
||||
return NodeStates::State::NoState;
|
||||
return State::NoState;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -601,16 +603,16 @@ std::size_t EdgeMatrix::GetNodeCount() const {
|
|||
|
||||
void EdgeMatrix::SetState(s32 a, s32 b, bool state) {
|
||||
ASSERT(InRange(a, b));
|
||||
edge_matrix.at(a * node_count + b) = state;
|
||||
edge_matrix.at(static_cast<u32>(a) * node_count + static_cast<u32>(b)) = state;
|
||||
}
|
||||
|
||||
bool EdgeMatrix::GetState(s32 a, s32 b) {
|
||||
ASSERT(InRange(a, b));
|
||||
return edge_matrix.at(a * node_count + b);
|
||||
return edge_matrix.at(static_cast<u32>(a) * node_count + static_cast<u32>(b));
|
||||
}
|
||||
|
||||
bool EdgeMatrix::InRange(s32 a, s32 b) const {
|
||||
const std::size_t pos = a * node_count + b;
|
||||
const std::size_t pos = static_cast<u32>(a) * node_count + static_cast<u32>(b);
|
||||
return pos < (node_count * node_count);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue