mirror of
https://github.com/open-goal/jak-project
synced 2026-07-11 23:30:16 -04:00
cpp warning fixes
This commit is contained in:
@@ -55,7 +55,7 @@ std::string apply_formatting(
|
||||
}
|
||||
// TODO - might want to make some kind of per-form config struct, simplify the passing around of
|
||||
// info below
|
||||
for (int i = 0; i < curr_node.refs.size(); i++) {
|
||||
for (int i = 0; i < (int)curr_node.refs.size(); i++) {
|
||||
const auto& ref = curr_node.refs.at(i);
|
||||
// Figure out if the element should be inlined or not
|
||||
bool inline_element = inline_form;
|
||||
|
||||
@@ -22,7 +22,7 @@ void separate_by_newline(std::string& curr_text,
|
||||
// We only are concerned with top level forms or elements
|
||||
// Skip the last element, no trailing new-lines (let the editors handle this!)
|
||||
// Also peek ahead to see if there was a comment on this line, if so don't separate things!
|
||||
if (!containing_node.metadata.is_top_level || index >= containing_node.refs.size() - 1 ||
|
||||
if (!containing_node.metadata.is_top_level || index >= (int)containing_node.refs.size() - 1 ||
|
||||
(containing_node.refs.at(index + 1).metadata.is_comment &&
|
||||
containing_node.refs.at(index + 1).metadata.is_inline)) {
|
||||
return;
|
||||
@@ -100,7 +100,7 @@ bool form_should_be_constant_paired(const FormatterTreeNode& node) {
|
||||
return false;
|
||||
}
|
||||
int num_pairs = 0;
|
||||
for (int i = 0; i < node.refs.size() - 1; i++) {
|
||||
for (int i = 0; i < (int)node.refs.size() - 1; i++) {
|
||||
const auto& ref = node.refs.at(i);
|
||||
const auto& next_ref = node.refs.at(i + 1);
|
||||
if (ref.token && next_ref.token) {
|
||||
@@ -147,7 +147,7 @@ int compute_form_width_after_index(const FormatterTreeNode& node,
|
||||
}
|
||||
}
|
||||
int form_width = 0;
|
||||
for (int i = 0; i < node.refs.size(); i++) {
|
||||
for (int i = 0; i < (int)node.refs.size(); i++) {
|
||||
const auto& ref = node.refs.at(i);
|
||||
if (depth == 0 && i < index) {
|
||||
continue;
|
||||
@@ -275,7 +275,7 @@ void append_newline(std::string& curr_text,
|
||||
const bool flowing,
|
||||
const bool constant_pair_form,
|
||||
const bool force_newline) {
|
||||
if (force_newline && index >= 1 || (node.metadata.is_comment && !node.metadata.is_inline)) {
|
||||
if ((force_newline && index >= 1) || (node.metadata.is_comment && !node.metadata.is_inline)) {
|
||||
curr_text = str_util::rtrim(curr_text) + "\n";
|
||||
return;
|
||||
}
|
||||
@@ -362,8 +362,8 @@ void align_lines(std::string& text,
|
||||
alignment_width = 1;
|
||||
}
|
||||
std::string aligned_form = "";
|
||||
for (int i = 0; i < lines.size(); i++) {
|
||||
if (i >= start_index) {
|
||||
for (size_t i = 0; i < lines.size(); i++) {
|
||||
if ((int)i >= start_index) {
|
||||
aligned_form += str_util::repeat(alignment_width, " ");
|
||||
}
|
||||
aligned_form += lines.at(i);
|
||||
|
||||
+1
-1
@@ -147,7 +147,7 @@ void set_file(const std::string& filename,
|
||||
existing_log_files = file_util::sort_filepaths(existing_log_files, true);
|
||||
if (existing_log_files.size() > (LOG_ROTATE_MAX - 1)) {
|
||||
lg::info("removing {} log files", existing_log_files.size() - (LOG_ROTATE_MAX - 1));
|
||||
for (int i = 0; i < existing_log_files.size() - (LOG_ROTATE_MAX - 1); i++) {
|
||||
for (int i = 0; i < (int)existing_log_files.size() - (LOG_ROTATE_MAX - 1); i++) {
|
||||
lg::info("removing {}", existing_log_files.at(i).string());
|
||||
fs::remove(existing_log_files.at(i));
|
||||
}
|
||||
|
||||
@@ -276,7 +276,7 @@ bool Matcher::do_match(Form* input, MatchResult::Maps* maps_out, const Env* cons
|
||||
} else if (m_kind == Kind::VAR_NAME) {
|
||||
return env && env->get_variable_name_name_only(result) == m_str;
|
||||
} else if (m_reg_out_id != -1) {
|
||||
if (m_kind == Kind::SAME_VAR && maps_out->regs.size() > m_reg_out_id &&
|
||||
if (m_kind == Kind::SAME_VAR && (int)maps_out->regs.size() > m_reg_out_id &&
|
||||
maps_out->regs.at(m_reg_out_id)) {
|
||||
return env && env->get_variable_name_name_only(result) ==
|
||||
env->get_variable_name_name_only(*maps_out->regs.at(m_reg_out_id));
|
||||
@@ -695,7 +695,7 @@ bool Matcher::do_match(Form* input, MatchResult::Maps* maps_out, const Env* cons
|
||||
if (as_let) {
|
||||
// fail if we have wrong number of entries/body elts or recursive marker
|
||||
if ((m_entry_matchers.size() != as_let->entries().size()) ||
|
||||
(m_sub_matchers.size() != as_let->body()->size()) ||
|
||||
((int)m_sub_matchers.size() != as_let->body()->size()) ||
|
||||
(as_let->is_star() != m_let_is_star)) {
|
||||
return false;
|
||||
}
|
||||
@@ -706,7 +706,7 @@ bool Matcher::do_match(Form* input, MatchResult::Maps* maps_out, const Env* cons
|
||||
}
|
||||
}
|
||||
// now match body
|
||||
for (int i = 0; i < m_sub_matchers.size(); ++i) {
|
||||
for (int i = 0; i < (int)m_sub_matchers.size(); ++i) {
|
||||
Form fake;
|
||||
fake.elts().push_back(as_let->body()->elts().at(i));
|
||||
if (!m_sub_matchers.at(i).do_match(&fake, maps_out, env)) {
|
||||
@@ -908,7 +908,7 @@ bool LetEntryMatcher::do_match(const LetElement::Entry& input,
|
||||
case Kind::ANY:
|
||||
case Kind::NAME:
|
||||
if (m_reg_out_id != -1) {
|
||||
if (m_kind == Kind::NAME && maps_out->regs.size() > m_reg_out_id &&
|
||||
if (m_kind == Kind::NAME && (int)maps_out->regs.size() > m_reg_out_id &&
|
||||
maps_out->regs.at(m_reg_out_id)) {
|
||||
return env && env->get_variable_name_name_only(input.dest) ==
|
||||
env->get_variable_name_name_only(*maps_out->regs.at(m_reg_out_id));
|
||||
|
||||
@@ -2023,8 +2023,8 @@ void DrawableInlineArrayActor::read_from_file(TypedRef ref,
|
||||
|
||||
void CollideHash::read_from_file(TypedRef ref,
|
||||
const decompiler::DecompilerTypeSystem& dts,
|
||||
level_tools::DrawStats* stats,
|
||||
GameVersion version) {
|
||||
level_tools::DrawStats* /*stats*/,
|
||||
GameVersion /*version*/) {
|
||||
num_items = read_plain_data_field<uint32_t>(ref, "num-items", dts);
|
||||
item_array = deref_label(get_field_ref(ref, "item-array", dts));
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ int sql_query_sync(Ptr<String> string_in) {
|
||||
auto new_result_ptr = call_method_of_type_arg2(intern_from_c("debug").offset, type,
|
||||
GOAL_NEW_METHOD, type.offset, results.size());
|
||||
SQLResult* new_result = Ptr<SQLResult>(new_result_ptr).c();
|
||||
for (int i = 0; i < results.size(); i++) {
|
||||
for (int i = 0; i < (int)results.size(); i++) {
|
||||
new_result->data[i] = Ptr<String>(make_debug_string_from_c(results.at(i).data()));
|
||||
}
|
||||
new_result->len = results.size();
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
std::optional<json> initialize_handler(Workspace& workspace, int id, json params) {
|
||||
std::optional<json> initialize_handler(Workspace& /*workspace*/, int /*id*/, json /*params*/) {
|
||||
InitializeResult result;
|
||||
return result.to_json();
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ LSPRoute::LSPRoute(std::function<std::optional<json>(Workspace&, int, json)> req
|
||||
|
||||
void LSPRouter::init_routes() {
|
||||
m_routes["shutdown"] =
|
||||
LSPRoute([](Workspace& workspace, int id, nlohmann::json params) -> std::optional<json> {
|
||||
LSPRoute([](Workspace& /*workspace*/, int /*id*/, nlohmann::json /*params*/) -> std::optional<json> {
|
||||
lg::info("Shutting down LSP due to explicit request");
|
||||
exit(0);
|
||||
});
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "lsp/state/data/mips_instructions.h"
|
||||
#include "lsp/state/workspace.h"
|
||||
|
||||
std::optional<json> get_completions_handler(Workspace& workspace, int id, json params) {
|
||||
std::optional<json> get_completions_handler(Workspace& /*workspace*/, int /*id*/, json params) {
|
||||
auto converted_params = params.get<LSPSpec::CompletionParams>();
|
||||
|
||||
// TODO - these need to be cached,
|
||||
|
||||
@@ -29,7 +29,7 @@ std::optional<LSPSpec::Color> color_hexstring_to_lsp_color(const std::string& co
|
||||
return LSPSpec::Color{red, green, blue, 1.0};
|
||||
}
|
||||
|
||||
std::optional<json> document_color_handler(Workspace& workspace, int id, json raw_params) {
|
||||
std::optional<json> document_color_handler(Workspace& /*workspace*/, int /*id*/, json raw_params) {
|
||||
auto params = raw_params.get<LSPSpec::DocumentColorParams>();
|
||||
json colors = json::array();
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
std::optional<json> document_symbols_handler(Workspace& workspace, int id, json params) {
|
||||
std::optional<json> document_symbols_handler(Workspace& workspace, int /*id*/, json params) {
|
||||
auto converted_params = params.get<LSPSpec::DocumentSymbolParams>();
|
||||
auto tracked_file = workspace.get_tracked_ir_file(converted_params.m_textDocument.m_uri);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "lsp/state/data/mips_instructions.h"
|
||||
#include "lsp/state/workspace.h"
|
||||
|
||||
std::optional<json> formatting_handler(Workspace& workspace, int id, json raw_params) {
|
||||
std::optional<json> formatting_handler(Workspace& workspace, int /*id*/, json raw_params) {
|
||||
auto params = raw_params.get<LSPSpec::DocumentFormattingParams>();
|
||||
const auto file_type = workspace.determine_filetype_from_uri(params.textDocument.m_uri);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "lsp/state/data/mips_instructions.h"
|
||||
#include "lsp/state/workspace.h"
|
||||
|
||||
std::optional<json> go_to_definition_handler(Workspace& workspace, int id, json raw_params) {
|
||||
std::optional<json> go_to_definition_handler(Workspace& workspace, int /*id*/, json raw_params) {
|
||||
auto params = raw_params.get<LSPSpec::TextDocumentPositionParams>();
|
||||
const auto file_type = workspace.determine_filetype_from_uri(params.m_textDocument.m_uri);
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ std::string truncate_docstring(const std::string& docstring) {
|
||||
return truncated;
|
||||
}
|
||||
|
||||
std::optional<json> hover_handler(Workspace& workspace, int id, json raw_params) {
|
||||
std::optional<json> hover_handler(Workspace& workspace, int /*id*/, json raw_params) {
|
||||
auto params = raw_params.get<LSPSpec::TextDocumentPositionParams>();
|
||||
auto file_type = workspace.determine_filetype_from_uri(params.m_textDocument.m_uri);
|
||||
|
||||
@@ -221,9 +221,9 @@ std::optional<json> hover_handler(Workspace& workspace, int id, json raw_params)
|
||||
signature += symbol.value();
|
||||
if (takes_args) {
|
||||
signature += "(";
|
||||
for (int i = 0; i < args.size(); i++) {
|
||||
for (int i = 0; i < (int)args.size(); i++) {
|
||||
const auto& arg = args.at(i);
|
||||
if (i == args.size() - 1) {
|
||||
if (i == (int)args.size() - 1) {
|
||||
signature += fmt::format("{}: {}", arg.name, arg.type);
|
||||
} else {
|
||||
signature += fmt::format("{}: {}, ", arg.name, arg.type);
|
||||
|
||||
Reference in New Issue
Block a user