From c3f3207b0d8881c237e3ac44ddbd66fe3f169586 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 25 Feb 2016 19:33:46 +0100 Subject: [PATCH] Cleanups --- frontend/drivers/platform_linux.c | 4 ++-- frontend/drivers/platform_linux.h | 6 +++--- patch.c | 26 +++++++++++++++++++++----- patch.h | 15 --------------- 4 files changed, 26 insertions(+), 25 deletions(-) diff --git a/frontend/drivers/platform_linux.c b/frontend/drivers/platform_linux.c index 0e95521412..830671c4a2 100644 --- a/frontend/drivers/platform_linux.c +++ b/frontend/drivers/platform_linux.c @@ -64,7 +64,7 @@ typedef struct } CpuList; static bool cpu_inited_once; -static cpu_family g_cpuFamily; +static enum cpu_family g_cpuFamily; static uint64_t g_cpuFeatures; static int g_cpuCount; @@ -425,7 +425,7 @@ static void linux_cpu_init(void) buf = NULL; } -cpu_family linux_get_cpu_platform(void) +enum cpu_family linux_get_cpu_platform(void) { return g_cpuFamily; } diff --git a/frontend/drivers/platform_linux.h b/frontend/drivers/platform_linux.h index 5fcefcdfe3..9ccdf069b5 100644 --- a/frontend/drivers/platform_linux.h +++ b/frontend/drivers/platform_linux.h @@ -23,7 +23,7 @@ #include -typedef enum +enum cpu_family { CPU_FAMILY_UNKNOWN = 0, CPU_FAMILY_ARM, @@ -31,7 +31,7 @@ typedef enum CPU_FAMILY_MIPS, CPU_FAMILY_MAX /* do not remove */ -} cpu_family; +}; enum { @@ -56,7 +56,7 @@ enum #define MAX_AXIS 10 #endif -cpu_family linux_get_cpu_family(void); +enum cpu_family linux_get_cpu_family(void); uint64_t linux_get_cpu_features(void); diff --git a/patch.c b/patch.c index 0da4484abe..737a6d87d6 100644 --- a/patch.c +++ b/patch.c @@ -41,6 +41,22 @@ enum bps_mode TARGET_COPY }; +enum patch_error +{ + PATCH_UNKNOWN = 0, + PATCH_SUCCESS, + PATCH_PATCH_TOO_SMALL, + PATCH_PATCH_INVALID_HEADER, + PATCH_PATCH_INVALID, + PATCH_SOURCE_TOO_SMALL, + PATCH_TARGET_TOO_SMALL, + PATCH_SOURCE_INVALID, + PATCH_TARGET_INVALID, + PATCH_SOURCE_CHECKSUM_INVALID, + PATCH_TARGET_CHECKSUM_INVALID, + PATCH_PATCH_CHECKSUM_INVALID +}; + struct bps_data { const uint8_t *modify_data, *source_data; @@ -52,7 +68,7 @@ struct bps_data size_t source_relative_offset, target_relative_offset, output_offset; }; -typedef patch_error_t (*patch_func_t)(const uint8_t*, size_t, +typedef enum patch_error (*patch_func_t)(const uint8_t*, size_t, const uint8_t*, size_t, uint8_t*, size_t*); static uint8_t bps_read(struct bps_data *bps) @@ -99,7 +115,7 @@ static void bps_write(struct bps_data *bps, uint8_t data) #endif } -static patch_error_t bps_apply_patch( +static enum patch_error bps_apply_patch( const uint8_t *modify_data, size_t modify_length, const uint8_t *source_data, size_t source_length, uint8_t *target_data, size_t *target_length) @@ -304,7 +320,7 @@ static uint64_t ups_decode(struct ups_data *data) return offset; } -static patch_error_t ups_apply_patch( +static enum patch_error ups_apply_patch( const uint8_t *patchdata, size_t patchlength, const uint8_t *sourcedata, size_t sourcelength, uint8_t *targetdata, size_t *targetlength) @@ -403,7 +419,7 @@ static patch_error_t ups_apply_patch( return PATCH_SOURCE_INVALID; } -static patch_error_t ips_apply_patch( +static enum patch_error ips_apply_patch( const uint8_t *patchdata, size_t patchlen, const uint8_t *sourcedata, size_t sourcelength, uint8_t *targetdata, size_t *targetlength) @@ -493,7 +509,7 @@ static bool apply_patch_content(uint8_t **buf, size_t target_size; ssize_t patch_size; void *patch_data = NULL; - patch_error_t err = PATCH_UNKNOWN; + enum patch_error err = PATCH_UNKNOWN; bool success = false; uint8_t *patched_content = NULL; ssize_t ret_size = *size; diff --git a/patch.h b/patch.h index 9f406dcfca..e797ccb760 100644 --- a/patch.h +++ b/patch.h @@ -23,21 +23,6 @@ /* BPS/UPS/IPS implementation from bSNES (nall::). * Modified for RetroArch. */ -typedef enum -{ - PATCH_UNKNOWN = 0, - PATCH_SUCCESS, - PATCH_PATCH_TOO_SMALL, - PATCH_PATCH_INVALID_HEADER, - PATCH_PATCH_INVALID, - PATCH_SOURCE_TOO_SMALL, - PATCH_TARGET_TOO_SMALL, - PATCH_SOURCE_INVALID, - PATCH_TARGET_INVALID, - PATCH_SOURCE_CHECKSUM_INVALID, - PATCH_TARGET_CHECKSUM_INVALID, - PATCH_PATCH_CHECKSUM_INVALID -} patch_error_t; /** * patch_content: