diff --git a/src/rapi/rc_api_common.c b/src/rapi/rc_api_common.c index 68f756d4..5835b280 100644 --- a/src/rapi/rc_api_common.c +++ b/src/rapi/rc_api_common.c @@ -475,13 +475,13 @@ int rc_json_get_required_array(uint32_t* num_entries, rc_json_field_t* array_fie return 0; #endif - if (!rc_json_get_optional_array(num_entries, array_field, response, field, field_name)) + if (!rc_json_get_optional_array(num_entries, array_field, field, field_name)) return rc_json_missing_field(response, field); return 1; } -int rc_json_get_optional_array(uint32_t* num_entries, rc_json_field_t* array_field, rc_api_response_t* response, const rc_json_field_t* field, const char* field_name) { +int rc_json_get_optional_array(uint32_t* num_entries, rc_json_field_t* array_field, const rc_json_field_t* field, const char* field_name) { #ifndef NDEBUG if (strcmp(field->name, field_name) != 0) return 0; diff --git a/src/rapi/rc_api_common.h b/src/rapi/rc_api_common.h index 382e3d12..8ce2be47 100644 --- a/src/rapi/rc_api_common.h +++ b/src/rapi/rc_api_common.h @@ -55,7 +55,7 @@ void rc_json_get_optional_num(int32_t* out, const rc_json_field_t* field, const void rc_json_get_optional_unum(uint32_t* out, const rc_json_field_t* field, const char* field_name, uint32_t default_value); void rc_json_get_optional_float(float* out, const rc_json_field_t* field, const char* field_name, float default_value); void rc_json_get_optional_bool(int* out, const rc_json_field_t* field, const char* field_name, int default_value); -int rc_json_get_optional_array(uint32_t* num_entries, rc_json_field_t* iterator, rc_api_response_t* response, const rc_json_field_t* field, const char* field_name); +int rc_json_get_optional_array(uint32_t* num_entries, rc_json_field_t* iterator, const rc_json_field_t* field, const char* field_name); int rc_json_get_required_string(const char** out, rc_api_response_t* response, const rc_json_field_t* field, const char* field_name); int rc_json_get_required_num(int32_t* out, rc_api_response_t* response, const rc_json_field_t* field, const char* field_name); int rc_json_get_required_unum(uint32_t* out, rc_api_response_t* response, const rc_json_field_t* field, const char* field_name); diff --git a/src/rapi/rc_api_user.c b/src/rapi/rc_api_user.c index 7d818860..0349f4a5 100644 --- a/src/rapi/rc_api_user.c +++ b/src/rapi/rc_api_user.c @@ -146,7 +146,7 @@ int rc_api_process_start_session_server_response(rc_api_start_session_response_t if (result != RC_OK || !response->response.succeeded) return result; - if (rc_json_get_optional_array(&response->num_unlocks, &array_field, &response->response, &fields[2], "Unlocks") && response->num_unlocks) { + if (rc_json_get_optional_array(&response->num_unlocks, &array_field, &fields[2], "Unlocks") && response->num_unlocks) { response->unlocks = (rc_api_unlock_entry_t*)rc_buffer_alloc(&response->response.buffer, response->num_unlocks * sizeof(rc_api_unlock_entry_t)); if (!response->unlocks) return RC_OUT_OF_MEMORY; @@ -167,7 +167,7 @@ int rc_api_process_start_session_server_response(rc_api_start_session_response_t } } - if (rc_json_get_optional_array(&response->num_hardcore_unlocks, &array_field, &response->response, &fields[3], "HardcoreUnlocks") && response->num_hardcore_unlocks) { + if (rc_json_get_optional_array(&response->num_hardcore_unlocks, &array_field, &fields[3], "HardcoreUnlocks") && response->num_hardcore_unlocks) { response->hardcore_unlocks = (rc_api_unlock_entry_t*)rc_buffer_alloc(&response->response.buffer, response->num_hardcore_unlocks * sizeof(rc_api_unlock_entry_t)); if (!response->hardcore_unlocks) return RC_OUT_OF_MEMORY; diff --git a/src/rc_client.c b/src/rc_client.c index cd99c75c..80b84b1b 100644 --- a/src/rc_client.c +++ b/src/rc_client.c @@ -86,6 +86,8 @@ static void rc_client_submit_leaderboard_entry_retry(rc_client_scheduled_callbac static void rc_client_dummy_event_handler(const rc_client_event_t* event, rc_client_t* client) { + (void)event; + (void)client; } rc_client_t* rc_client_create(rc_client_read_memory_func_t read_memory_function, rc_client_server_call_t server_call_function) @@ -246,6 +248,8 @@ static rc_clock_t rc_client_clock_get_now_millisecs(const rc_client_t* client) { #if defined(CLOCK_MONOTONIC) struct timespec now; + (void)client; + if (clock_gettime(CLOCK_MONOTONIC, &now) < 0) return 0; @@ -255,6 +259,8 @@ static rc_clock_t rc_client_clock_get_now_millisecs(const rc_client_t* client) static LARGE_INTEGER freq; LARGE_INTEGER ticks; + (void)client; + /* Frequency is the number of ticks per second and is guaranteed to not change. */ if (!freq.QuadPart) { if (!QueryPerformanceFrequency(&freq)) @@ -270,6 +276,9 @@ static rc_clock_t rc_client_clock_get_now_millisecs(const rc_client_t* client) return (rc_clock_t)(ticks.QuadPart / freq.QuadPart); #else const clock_t clock_now = clock(); + + (void)client; + if (sizeof(clock_t) == 4) { static uint32_t clock_wraps = 0; static clock_t last_clock = 0; @@ -408,6 +417,8 @@ static const char* rc_client_server_error_message(int* result, int http_status_c return response->error_message; } + (void)http_status_code; + if (*result != RC_OK) return rc_error_str(*result); @@ -3200,6 +3211,9 @@ static void rc_client_award_achievement_retry(rc_client_scheduled_callback_data_ rc_client_award_achievement_callback_data_t* ach_data = (rc_client_award_achievement_callback_data_t*)callback_data->data; + (void)client; + (void)now; + rc_client_award_achievement_server_call(ach_data); } @@ -3828,6 +3842,9 @@ static void rc_client_submit_leaderboard_entry_retry(rc_client_scheduled_callbac rc_client_submit_leaderboard_entry_callback_data_t* lboard_data = (rc_client_submit_leaderboard_entry_callback_data_t*)callback_data->data; + (void)client; + (void)now; + rc_client_submit_leaderboard_entry_server_call(lboard_data); } @@ -4582,6 +4599,9 @@ static void rc_client_progress_tracker_timer_elapsed(rc_client_scheduled_callbac rc_client_event_t client_event; memset(&client_event, 0, sizeof(client_event)); + (void)callback_data; + (void)now; + rc_mutex_lock(&client->state.mutex); if (client->game->progress_tracker.action == RC_CLIENT_PROGRESS_TRACKER_ACTION_NONE) { client->game->progress_tracker.hide_callback->when = 0; diff --git a/test/Makefile b/test/Makefile index 7ed819dc..e705d43d 100644 --- a/test/Makefile +++ b/test/Makefile @@ -114,8 +114,9 @@ else endif # more strict validation for source files to eliminate warnings/errors in upstream consumers +SRC_CFLAGS=-pedantic -Wsign-compare -Wtype-limits -Wimplicit-fallthrough=3 -Wunused-parameter # 3DS build (retroarch) doesn't support signed char -SRC_CFLAGS=-pedantic -Wsign-compare -Wtype-limits -Wimplicit-fallthrough=3 -fno-signed-char +SRC_CFLAGS += -fno-signed-char ifeq ($(BUILD), c89) CFLAGS += -std=c89