Function argument name standardization

This commit is contained in:
LibretroAdmin 2025-01-17 04:16:12 +01:00
parent 9b5007aefd
commit 31b7812720
26 changed files with 187 additions and 210 deletions

View File

@ -289,20 +289,20 @@ static void rcheevos_client_http_task_save_callback(retro_task_t* task,
void rcheevos_client_http_load_response(const rc_api_request_t* request, void rcheevos_client_http_load_response(const rc_api_request_t* request,
rc_client_server_callback_t callback, void* callback_data) rc_client_server_callback_t callback, void* callback_data)
{ {
size_t size = 0;
char* contents; char* contents;
FILE* file = fopen(CHEEVOS_JSON_OVERRIDE, "rb"); size_t _len = 0;
FILE* file = fopen(CHEEVOS_JSON_OVERRIDE, "rb");
fseek(file, 0, SEEK_END); fseek(file, 0, SEEK_END);
size = ftell(file); _len = ftell(file);
fseek(file, 0, SEEK_SET); fseek(file, 0, SEEK_SET);
contents = (char*)malloc(size + 1); contents = (char*)malloc(_len + 1);
fread((void*)contents, 1, size, file); fread((void*)contents, 1, _len, file);
fclose(file); fclose(file);
contents[size] = 0; contents[_len] = 0;
CHEEVOS_LOG(RCHEEVOS_TAG "Loaded game info. Read %u bytes to %s\n", size, CHEEVOS_JSON_OVERRIDE); CHEEVOS_LOG(RCHEEVOS_TAG "Loaded game info. Read %u bytes to %s\n", _len, CHEEVOS_JSON_OVERRIDE);
callback(contents, 200, callback_data); callback(contents, 200, callback_data);
} }

View File

@ -277,9 +277,9 @@ static void vulkan_debug_mark_object(VkDevice device,
} }
static bool vulkan_buffer_chain_suballoc(struct vk_buffer_chain *chain, static bool vulkan_buffer_chain_suballoc(struct vk_buffer_chain *chain,
size_t size, struct vk_buffer_range *range) size_t len, struct vk_buffer_range *range)
{ {
VkDeviceSize next_offset = chain->offset + size; VkDeviceSize next_offset = chain->offset + len;
if (next_offset <= chain->current->buffer.size) if (next_offset <= chain->current->buffer.size)
{ {
range->data = (uint8_t*)chain->current->buffer.mapped + chain->offset; range->data = (uint8_t*)chain->current->buffer.mapped + chain->offset;
@ -287,24 +287,21 @@ static bool vulkan_buffer_chain_suballoc(struct vk_buffer_chain *chain,
range->offset = chain->offset; range->offset = chain->offset;
chain->offset = (next_offset + chain->alignment - 1) chain->offset = (next_offset + chain->alignment - 1)
& ~(chain->alignment - 1); & ~(chain->alignment - 1);
return true; return true;
} }
return false; return false;
} }
static struct vk_buffer_node *vulkan_buffer_chain_alloc_node( static struct vk_buffer_node *vulkan_buffer_chain_alloc_node(
const struct vulkan_context *context, const struct vulkan_context *context,
size_t size, VkBufferUsageFlags usage) size_t len, VkBufferUsageFlags usage)
{ {
struct vk_buffer_node *node = (struct vk_buffer_node*) struct vk_buffer_node *node = (struct vk_buffer_node*)
malloc(sizeof(*node)); malloc(sizeof(*node));
if (!node) if (!node)
return NULL; return NULL;
node->buffer = vulkan_create_buffer( node->buffer = vulkan_create_buffer(
context, size, usage); context, len, usage);
node->next = NULL; node->next = NULL;
return node; return node;
} }
@ -1355,7 +1352,7 @@ static void vulkan_create_wait_fences(gfx_ctx_vulkan_data_t *vk)
bool vulkan_buffer_chain_alloc(const struct vulkan_context *context, bool vulkan_buffer_chain_alloc(const struct vulkan_context *context,
struct vk_buffer_chain *chain, struct vk_buffer_chain *chain,
size_t size, struct vk_buffer_range *range) size_t len, struct vk_buffer_range *range)
{ {
if (!chain->head) if (!chain->head)
{ {
@ -1367,7 +1364,7 @@ bool vulkan_buffer_chain_alloc(const struct vulkan_context *context,
chain->offset = 0; chain->offset = 0;
} }
if (!vulkan_buffer_chain_suballoc(chain, size, range)) if (!vulkan_buffer_chain_suballoc(chain, len, range))
{ {
/* We've exhausted the current chain, traverse list until we /* We've exhausted the current chain, traverse list until we
* can find a block we can use. Usually, we just step once. */ * can find a block we can use. Usually, we just step once. */
@ -1375,24 +1372,24 @@ bool vulkan_buffer_chain_alloc(const struct vulkan_context *context,
{ {
chain->current = chain->current->next; chain->current = chain->current->next;
chain->offset = 0; chain->offset = 0;
if (vulkan_buffer_chain_suballoc(chain, size, range)) if (vulkan_buffer_chain_suballoc(chain, len, range))
return true; return true;
} }
/* We have to allocate a new node, might allocate larger /* We have to allocate a new node, might allocate larger
* buffer here than block_size in case we have * buffer here than block_size in case we have
* a very large allocation. */ * a very large allocation. */
if (size < chain->block_size) if (len < chain->block_size)
size = chain->block_size; len = chain->block_size;
if (!(chain->current->next = vulkan_buffer_chain_alloc_node( if (!(chain->current->next = vulkan_buffer_chain_alloc_node(
context, size, chain->usage))) context, len, chain->usage)))
return false; return false;
chain->current = chain->current->next; chain->current = chain->current->next;
chain->offset = 0; chain->offset = 0;
/* This cannot possibly fail. */ /* This cannot possibly fail. */
retro_assert(vulkan_buffer_chain_suballoc(chain, size, range)); retro_assert(vulkan_buffer_chain_suballoc(chain, len, range));
} }
return true; return true;
} }
@ -1418,7 +1415,7 @@ void vulkan_debug_mark_memory(VkDevice device, VkDeviceMemory memory)
struct vk_buffer vulkan_create_buffer( struct vk_buffer vulkan_create_buffer(
const struct vulkan_context *context, const struct vulkan_context *context,
size_t size, VkBufferUsageFlags usage) size_t len, VkBufferUsageFlags usage)
{ {
struct vk_buffer buffer; struct vk_buffer buffer;
VkMemoryRequirements mem_reqs; VkMemoryRequirements mem_reqs;
@ -1428,7 +1425,7 @@ struct vk_buffer vulkan_create_buffer(
info.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; info.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
info.pNext = NULL; info.pNext = NULL;
info.flags = 0; info.flags = 0;
info.size = size; info.size = len;
info.usage = usage; info.usage = usage;
info.sharingMode = VK_SHARING_MODE_EXCLUSIVE; info.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
info.queueFamilyIndexCount = 0; info.queueFamilyIndexCount = 0;
@ -1450,7 +1447,7 @@ struct vk_buffer vulkan_create_buffer(
vulkan_debug_mark_memory(context->device, buffer.memory); vulkan_debug_mark_memory(context->device, buffer.memory);
vkBindBufferMemory(context->device, buffer.buffer, buffer.memory, 0); vkBindBufferMemory(context->device, buffer.buffer, buffer.memory, 0);
buffer.size = size; buffer.size = len;
vkMapMemory(context->device, vkMapMemory(context->device,
buffer.memory, 0, buffer.size, 0, &buffer.mapped); buffer.memory, 0, buffer.size, 0, &buffer.mapped);

View File

@ -73,7 +73,7 @@ class Buffer
public: public:
Buffer(VkDevice device, Buffer(VkDevice device,
const VkPhysicalDeviceMemoryProperties &mem_props, const VkPhysicalDeviceMemoryProperties &mem_props,
size_t size, VkBufferUsageFlags usage); size_t len, VkBufferUsageFlags usage);
~Buffer(); ~Buffer();
size_t get_size() const { return size; } size_t get_size() const { return size; }
@ -1532,8 +1532,8 @@ StaticTexture::~StaticTexture()
Buffer::Buffer(VkDevice device, Buffer::Buffer(VkDevice device,
const VkPhysicalDeviceMemoryProperties &mem_props, const VkPhysicalDeviceMemoryProperties &mem_props,
size_t size, VkBufferUsageFlags usage) : size_t len, VkBufferUsageFlags usage) :
device(device), size(size) device(device), size(len)
{ {
VkBufferCreateInfo info; VkBufferCreateInfo info;
VkMemoryRequirements mem_reqs; VkMemoryRequirements mem_reqs;
@ -1542,7 +1542,7 @@ Buffer::Buffer(VkDevice device,
info.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; info.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
info.pNext = NULL; info.pNext = NULL;
info.flags = 0; info.flags = 0;
info.size = size; info.size = len;
info.usage = usage; info.usage = usage;
info.sharingMode = VK_SHARING_MODE_EXCLUSIVE; info.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
info.queueFamilyIndexCount = 0; info.queueFamilyIndexCount = 0;

View File

@ -198,18 +198,15 @@ struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END] = {
{ 4.0f / 3.0f , "" } /* full - initialized in video_driver_init_internal */ { 4.0f / 3.0f , "" } /* full - initialized in video_driver_init_internal */
}; };
static INLINE bool realloc_checked(void **ptr, size_t size) static INLINE bool realloc_checked(void **ptr, size_t len)
{ {
void *nptr = NULL; void *nptr = NULL;
if (*ptr) if (*ptr)
nptr = realloc(*ptr, size); nptr = realloc(*ptr, len);
else else
nptr = malloc(size); nptr = malloc(len);
if (nptr) if (nptr)
*ptr = nptr; *ptr = nptr;
return *ptr == nptr; return *ptr == nptr;
} }

View File

@ -164,20 +164,20 @@ static void retrode_update_button_state(retrode_pad_data_t *pad)
pad->buttons |= (pressed_keys & (1 << i)) ? (1 << button_mapping[i]) : 0; pad->buttons |= (pressed_keys & (1 << i)) ? (1 << button_mapping[i]) : 0;
} }
static void hidpad_retrode_pad_packet_handler(retrode_pad_data_t *pad, uint8_t *packet, size_t size) static void hidpad_retrode_pad_packet_handler(retrode_pad_data_t *pad, uint8_t *packet, size_t len)
{ {
memcpy(pad->data, packet, size); memcpy(pad->data, packet, len);
retrode_update_button_state(pad); retrode_update_button_state(pad);
} }
static void hidpad_retrode_packet_handler(void *device_data, uint8_t *packet, uint16_t size) static void hidpad_retrode_packet_handler(void *device_data, uint8_t *packet, uint16_t len)
{ {
retrode_device_data_t *device = (retrode_device_data_t *)device_data; retrode_device_data_t *device = (retrode_device_data_t *)device_data;
if (!device) if (!device)
return; return;
memcpy(device->data, packet, size); memcpy(device->data, packet, len);
/* /*
* packet[0] contains Retrode port number * packet[0] contains Retrode port number

View File

@ -191,17 +191,16 @@ static void update_analog_state(gca_pad_data_t *pad)
} }
} }
static void hidpad_wiiugca_pad_packet_handler(gca_pad_data_t *pad, uint8_t *packet, size_t size) static void hidpad_wiiugca_pad_packet_handler(gca_pad_data_t *pad, uint8_t *packet, size_t len)
{ {
if (size > 9) if (len > 9)
return; return;
memcpy(pad->data, packet, len);
memcpy(pad->data, packet, size);
update_button_state(pad); update_button_state(pad);
update_analog_state(pad); update_analog_state(pad);
} }
static void hidpad_wiiugca_packet_handler(void *device_data, uint8_t *packet, uint16_t size) static void hidpad_wiiugca_packet_handler(void *device_data, uint8_t *packet, uint16_t len)
{ {
uint32_t i; uint32_t i;
gca_device_data_t *device = (gca_device_data_t *)device_data; gca_device_data_t *device = (gca_device_data_t *)device_data;
@ -209,7 +208,7 @@ static void hidpad_wiiugca_packet_handler(void *device_data, uint8_t *packet, ui
if (!device) if (!device)
return; return;
memcpy(device->data, packet, size); memcpy(device->data, packet, len);
for (i = 1; i < 37; i += 9) for (i = 1; i < 37; i += 9)
{ {

View File

@ -221,7 +221,7 @@ const struct input_key_map input_config_key_map[] = {
{ "media", RETROK_LAUNCH_MEDIA }, { "media", RETROK_LAUNCH_MEDIA },
{ "app1", RETROK_LAUNCH_APP1 }, { "app1", RETROK_LAUNCH_APP1 },
{ "app2", RETROK_LAUNCH_APP2 }, { "app2", RETROK_LAUNCH_APP2 },
{ "nul", RETROK_UNKNOWN }, { "nul", RETROK_UNKNOWN },
{ NULL, RETROK_UNKNOWN }, { NULL, RETROK_UNKNOWN },
}; };
@ -1189,7 +1189,7 @@ const struct rarch_key_map rarch_key_map_x11[] = {
{ XFVK_KP0, RETROK_KP0 }, { XFVK_KP0, RETROK_KP0 },
{ XFVK_KPDL, RETROK_KP_PERIOD }, { XFVK_KPDL, RETROK_KP_PERIOD },
{ XFVK_KPEQ, RETROK_KP_EQUALS }, { XFVK_KPEQ, RETROK_KP_EQUALS },
{ XFVK_MUTE, RETROK_VOLUME_MUTE }, { XFVK_MUTE, RETROK_VOLUME_MUTE },
{ XFVK_VOUP, RETROK_VOLUME_UP }, { XFVK_VOUP, RETROK_VOLUME_UP },
{ XFVK_VODN, RETROK_VOLUME_DOWN }, { XFVK_VODN, RETROK_VOLUME_DOWN },
@ -1914,7 +1914,7 @@ const struct rarch_key_map rarch_key_map_ps3[] = {
{ KB_RAWKEY_SCROLL_LOCK, RETROK_SCROLLOCK }, { KB_RAWKEY_SCROLL_LOCK, RETROK_SCROLLOCK },
{ KB_RAWKEY_PAUSE, RETROK_BREAK }, { KB_RAWKEY_PAUSE, RETROK_BREAK },
/* /*
{ KB_RAWKEY_HASHTILDE, RETROK_HASH }, { KB_RAWKEY_HASHTILDE, RETROK_HASH },
{ KB_RAWKEY_KPLEFTPAREN, RETROK_LEFTPAREN }, { KB_RAWKEY_KPLEFTPAREN, RETROK_LEFTPAREN },
{ KB_RAWKEY_KPRIGHTPAREN, RETROK_RIGHTPAREN }, { KB_RAWKEY_KPRIGHTPAREN, RETROK_RIGHTPAREN },
@ -2162,7 +2162,7 @@ enum retro_key input_keymaps_translate_keysym_to_rk(unsigned sym)
* Translates a retro key identifier to a human-readable * Translates a retro key identifier to a human-readable
* identifier string. * identifier string.
**/ **/
void input_keymaps_translate_rk_to_str(enum retro_key key, char *buf, size_t size) void input_keymaps_translate_rk_to_str(enum retro_key key, char *buf, size_t len)
{ {
unsigned i; unsigned i;
@ -2180,7 +2180,7 @@ void input_keymaps_translate_rk_to_str(enum retro_key key, char *buf, size_t siz
if (input_config_key_map[i].key != key) if (input_config_key_map[i].key != key)
continue; continue;
strlcpy(buf, input_config_key_map[i].str, size); strlcpy(buf, input_config_key_map[i].str, len);
break; break;
} }
} }

View File

@ -224,12 +224,12 @@ enum retro_key input_keymaps_translate_keysym_to_rk(unsigned sym);
* input_keymaps_translate_rk_to_str: * input_keymaps_translate_rk_to_str:
* @key : Retro key identifier. * @key : Retro key identifier.
* @buf : Buffer. * @buf : Buffer.
* @size : Size of @buf. * @len : Size of @buf.
* *
* Translates a retro key identifier to a human-readable * Translates a retro key identifier to a human-readable
* identifier string. * identifier string.
**/ **/
void input_keymaps_translate_rk_to_str(enum retro_key key, char *buf, size_t size); void input_keymaps_translate_rk_to_str(enum retro_key key, char *buf, size_t len);
/** /**
* input_translate_rk_to_ascii: * input_translate_rk_to_ascii:

View File

@ -62,11 +62,11 @@ struct sevenzip_context_t
uint32_t block_index; uint32_t block_index;
}; };
static void *sevenzip_stream_alloc_impl(ISzAllocPtr p, size_t size) static void *sevenzip_stream_alloc_impl(ISzAllocPtr p, size_t len)
{ {
if (size == 0) if (len == 0)
return 0; return 0;
return malloc(size); return malloc(len);
} }
static void sevenzip_stream_free_impl(ISzAllocPtr p, void *address) static void sevenzip_stream_free_impl(ISzAllocPtr p, void *address)
@ -77,12 +77,12 @@ static void sevenzip_stream_free_impl(ISzAllocPtr p, void *address)
free(address); free(address);
} }
static void *sevenzip_stream_alloc_tmp_impl(ISzAllocPtr p, size_t size) static void *sevenzip_stream_alloc_tmp_impl(ISzAllocPtr p, size_t len)
{ {
(void)p; (void)p;
if (size == 0) if (len == 0)
return 0; return 0;
return malloc(size); return malloc(len);
} }
static void* sevenzip_stream_new(void) static void* sevenzip_stream_new(void)

View File

@ -1168,24 +1168,24 @@ size_t config_get_config_path(config_file_t *conf, char *s, size_t len)
} }
bool config_get_array(config_file_t *conf, const char *key, bool config_get_array(config_file_t *conf, const char *key,
char *buf, size_t size) char *buf, size_t len)
{ {
const struct config_entry_list *entry = config_get_entry(conf, key); const struct config_entry_list *entry = config_get_entry(conf, key);
if (entry) if (entry)
return strlcpy(buf, entry->value, size) < size; return strlcpy(buf, entry->value, len) < len;
return false; return false;
} }
bool config_get_path(config_file_t *conf, const char *key, bool config_get_path(config_file_t *conf, const char *key,
char *buf, size_t size) char *buf, size_t len)
{ {
#if defined(RARCH_CONSOLE) || !defined(RARCH_INTERNAL) #if defined(RARCH_CONSOLE) || !defined(RARCH_INTERNAL)
return config_get_array(conf, key, buf, size); return config_get_array(conf, key, buf, len);
#else #else
const struct config_entry_list *entry = config_get_entry(conf, key); const struct config_entry_list *entry = config_get_entry(conf, key);
if (entry) if (entry)
{ {
fill_pathname_expand_special(buf, entry->value, size); fill_pathname_expand_special(buf, entry->value, len);
return true; return true;
} }
return false; return false;

View File

@ -1170,7 +1170,7 @@ size_t fill_pathname_abbreviate_special(char *s,
* *
* @returns new string that has been sanitized * @returns new string that has been sanitized
**/ **/
const char *sanitize_path_part(const char *path_part, size_t size) const char *sanitize_path_part(const char *path_part, size_t len)
{ {
int i; int i;
int j = 0; int j = 0;
@ -1180,7 +1180,7 @@ const char *sanitize_path_part(const char *path_part, size_t size)
if (string_is_empty(path_part)) if (string_is_empty(path_part))
return NULL; return NULL;
tmp = (char *)malloc((size + 1) * sizeof(char)); tmp = (char *)malloc((len + 1) * sizeof(char));
for (i = 0; path_part[i] != '\0'; i++) for (i = 0; path_part[i] != '\0'; i++)
{ {

View File

@ -49,10 +49,10 @@ static void dword_write_be(uint8_t *buf, uint32_t val)
*buf++ = (uint8_t)(val >> 0); *buf++ = (uint8_t)(val >> 0);
} }
static bool png_write_crc_string(intfstream_t *intf_s, const uint8_t *data, size_t size) static bool png_write_crc_string(intfstream_t *intf_s, const uint8_t *data, size_t len)
{ {
uint8_t crc_raw[4] = {0}; uint8_t crc_raw[4] = {0};
uint32_t crc = encoding_crc32(0, data, size); uint32_t crc = encoding_crc32(0, data, len);
dword_write_be(crc_raw, crc); dword_write_be(crc_raw, crc);
return intfstream_write(intf_s, crc_raw, sizeof(crc_raw)) == sizeof(crc_raw); return intfstream_write(intf_s, crc_raw, sizeof(crc_raw)) == sizeof(crc_raw);
@ -94,12 +94,11 @@ static bool png_write_ihdr_string(intfstream_t *intf_s, const struct png_ihdr *i
sizeof(ihdr_raw) - sizeof(uint32_t)); sizeof(ihdr_raw) - sizeof(uint32_t));
} }
static bool png_write_idat_string(intfstream_t* intf_s, const uint8_t *data, size_t size) static bool png_write_idat_string(intfstream_t* intf_s, const uint8_t *data, size_t len)
{ {
if (intfstream_write(intf_s, data, size) != (ssize_t)size) if (intfstream_write(intf_s, data, len) != (ssize_t)len)
return false; return false;
return png_write_crc_string(intf_s, data + sizeof(uint32_t), len - sizeof(uint32_t));
return png_write_crc_string(intf_s, data + sizeof(uint32_t), size - sizeof(uint32_t));
} }
static bool png_write_iend_string(intfstream_t* intf_s) static bool png_write_iend_string(intfstream_t* intf_s)
@ -140,11 +139,11 @@ static void copy_bgr24_line(uint8_t *dst, const uint8_t *src, unsigned width)
} }
} }
static unsigned count_sad(const uint8_t *data, size_t size) static unsigned count_sad(const uint8_t *data, size_t len)
{ {
size_t i; size_t i;
unsigned cnt = 0; unsigned cnt = 0;
for (i = 0; i < size; i++) for (i = 0; i < len; i++)
{ {
if (data[i]) if (data[i])
cnt += abs((int8_t)data[i]); cnt += abs((int8_t)data[i]);
@ -223,7 +222,7 @@ bool rpng_save_image_stream(const uint8_t *data, intfstream_t* intf_s,
void *stream = NULL; void *stream = NULL;
uint32_t total_in = 0; uint32_t total_in = 0;
uint32_t total_out = 0; uint32_t total_out = 0;
if (!intf_s) if (!intf_s)
GOTO_END_ERROR(); GOTO_END_ERROR();
@ -370,8 +369,8 @@ bool rpng_save_image_argb(const char *path, const uint32_t *data,
{ {
bool ret = false; bool ret = false;
intfstream_t* intf_s = NULL; intfstream_t* intf_s = NULL;
intf_s = intfstream_open_file(path, intf_s = intfstream_open_file(path,
RETRO_VFS_FILE_ACCESS_WRITE, RETRO_VFS_FILE_ACCESS_WRITE,
RETRO_VFS_FILE_ACCESS_HINT_NONE); RETRO_VFS_FILE_ACCESS_HINT_NONE);
@ -388,11 +387,11 @@ bool rpng_save_image_bgr24(const char *path, const uint8_t *data,
{ {
bool ret = false; bool ret = false;
intfstream_t* intf_s = NULL; intfstream_t* intf_s = NULL;
intf_s = intfstream_open_file(path, intf_s = intfstream_open_file(path,
RETRO_VFS_FILE_ACCESS_WRITE, RETRO_VFS_FILE_ACCESS_WRITE,
RETRO_VFS_FILE_ACCESS_HINT_NONE); RETRO_VFS_FILE_ACCESS_HINT_NONE);
ret = rpng_save_image_stream(data, intf_s, width, height, ret = rpng_save_image_stream(data, intf_s, width, height,
(signed) pitch, 3); (signed) pitch, 3);
intfstream_close(intf_s); intfstream_close(intf_s);
free(intf_s); free(intf_s);
@ -412,14 +411,14 @@ uint8_t* rpng_save_image_bgr24_string(const uint8_t *data,
buf_length = (int)(width*height*3*DEFLATE_PADDING)+PNG_ROUGH_HEADER; buf_length = (int)(width*height*3*DEFLATE_PADDING)+PNG_ROUGH_HEADER;
buf = (uint8_t*)malloc(buf_length*sizeof(uint8_t)); buf = (uint8_t*)malloc(buf_length*sizeof(uint8_t));
if (!buf) if (!buf)
GOTO_END_ERROR(); GOTO_END_ERROR();
intf_s = intfstream_open_writable_memory(buf, intf_s = intfstream_open_writable_memory(buf,
RETRO_VFS_FILE_ACCESS_WRITE, RETRO_VFS_FILE_ACCESS_WRITE,
RETRO_VFS_FILE_ACCESS_HINT_NONE, RETRO_VFS_FILE_ACCESS_HINT_NONE,
buf_length); buf_length);
ret = rpng_save_image_stream((const uint8_t*)data, ret = rpng_save_image_stream((const uint8_t*)data,
intf_s, width, height, pitch, 3); intf_s, width, height, pitch, 3);
*bytes = intfstream_get_ptr(intf_s); *bytes = intfstream_get_ptr(intf_s);

View File

@ -25,19 +25,17 @@
#include <memalign.h> #include <memalign.h>
void *memalign_alloc(size_t boundary, size_t size) void *memalign_alloc(size_t boundary, size_t len)
{ {
void **place = NULL; void **place = NULL;
uintptr_t addr = 0; uintptr_t addr = 0;
void *ptr = (void*)malloc(boundary + size + sizeof(uintptr_t)); void *ptr = (void*)malloc(boundary + len + sizeof(uintptr_t));
if (!ptr) if (!ptr)
return NULL; return NULL;
addr = ((uintptr_t)ptr + sizeof(uintptr_t) + boundary) addr = ((uintptr_t)ptr + sizeof(uintptr_t) + boundary)
& ~(boundary - 1); & ~(boundary - 1);
place = (void**)addr; place = (void**)addr;
place[-1] = ptr; place[-1] = ptr;
return (void*)addr; return (void*)addr;
} }
@ -51,13 +49,13 @@ void memalign_free(void *ptr)
free(p[-1]); free(p[-1]);
} }
void *memalign_alloc_aligned(size_t size) void *memalign_alloc_aligned(size_t len)
{ {
#if defined(__x86_64__) || defined(__LP64) || defined(__IA64__) || defined(_M_X64) || defined(_M_X64) || defined(_WIN64) #if defined(__x86_64__) || defined(__LP64) || defined(__IA64__) || defined(_M_X64) || defined(_M_X64) || defined(_WIN64)
return memalign_alloc(64, size); return memalign_alloc(64, len);
#elif defined(__i386__) || defined(__i486__) || defined(__i686__) || defined(GEKKO) || defined(_M_IX86) #elif defined(__i386__) || defined(__i486__) || defined(__i686__) || defined(GEKKO) || defined(_M_IX86)
return memalign_alloc(32, size); return memalign_alloc(32, len);
#else #else
return memalign_alloc(32, size); return memalign_alloc(32, len);
#endif #endif
} }

View File

@ -92,27 +92,24 @@ int socket_next(void **address)
} }
ssize_t socket_receive_all_nonblocking(int fd, bool *error, ssize_t socket_receive_all_nonblocking(int fd, bool *error,
void *data_, size_t size) void *data_, size_t len)
{ {
ssize_t ret = recv(fd, (char*)data_, size, 0); ssize_t ret = recv(fd, (char*)data_, len, 0);
if (ret > 0) if (ret > 0)
return ret; return ret;
if (ret < 0 && isagain((int)ret)) if (ret < 0 && isagain((int)ret))
return 0; return 0;
*error = true; *error = true;
return -1; return -1;
} }
bool socket_receive_all_blocking(int fd, void *data_, size_t size) bool socket_receive_all_blocking(int fd, void *data_, size_t len)
{ {
const uint8_t *data = (const uint8_t*)data_; const uint8_t *data = (const uint8_t*)data_;
while (size) while (len)
{ {
ssize_t ret = recv(fd, (char*)data, size, 0); ssize_t ret = recv(fd, (char*)data, len, 0);
if (!ret) if (!ret)
return false; return false;
@ -125,7 +122,7 @@ bool socket_receive_all_blocking(int fd, void *data_, size_t size)
else else
{ {
data += ret; data += ret;
size -= ret; len -= ret;
} }
} }
@ -133,8 +130,7 @@ bool socket_receive_all_blocking(int fd, void *data_, size_t size)
} }
bool socket_receive_all_blocking_with_timeout(int fd, bool socket_receive_all_blocking_with_timeout(int fd,
void *data_, size_t size, void *data_, size_t len, int timeout)
int timeout)
{ {
const uint8_t *data = (const uint8_t*)data_; const uint8_t *data = (const uint8_t*)data_;
retro_time_t deadline = cpu_features_get_time_usec(); retro_time_t deadline = cpu_features_get_time_usec();
@ -144,9 +140,9 @@ bool socket_receive_all_blocking_with_timeout(int fd,
else else
deadline += 5000000; deadline += 5000000;
while (size) while (len)
{ {
ssize_t ret = recv(fd, (char*)data, size, 0); ssize_t ret = recv(fd, (char*)data, len, 0);
if (!ret) if (!ret)
return false; return false;
@ -169,7 +165,7 @@ bool socket_receive_all_blocking_with_timeout(int fd,
else else
{ {
data += ret; data += ret;
size -= ret; len -= ret;
} }
} }
@ -570,15 +566,15 @@ bool socket_wait(int fd, bool *rd, bool *wr, int timeout)
#endif #endif
} }
bool socket_send_all_blocking(int fd, const void *data_, size_t size, bool socket_send_all_blocking(int fd, const void *data_, size_t len,
bool no_signal) bool no_signal)
{ {
const uint8_t *data = (const uint8_t*)data_; const uint8_t *data = (const uint8_t*)data_;
int flags = no_signal ? MSG_NOSIGNAL : 0; int flags = no_signal ? MSG_NOSIGNAL : 0;
while (size) while (len)
{ {
ssize_t ret = send(fd, (const char*)data, size, flags); ssize_t ret = send(fd, (const char*)data, len, flags);
if (!ret) if (!ret)
continue; continue;
@ -591,7 +587,7 @@ bool socket_send_all_blocking(int fd, const void *data_, size_t size,
else else
{ {
data += ret; data += ret;
size -= ret; len -= ret;
} }
} }
@ -599,7 +595,7 @@ bool socket_send_all_blocking(int fd, const void *data_, size_t size,
} }
bool socket_send_all_blocking_with_timeout(int fd, bool socket_send_all_blocking_with_timeout(int fd,
const void *data_, size_t size, const void *data_, size_t len,
int timeout, bool no_signal) int timeout, bool no_signal)
{ {
const uint8_t *data = (const uint8_t*)data_; const uint8_t *data = (const uint8_t*)data_;
@ -611,9 +607,9 @@ bool socket_send_all_blocking_with_timeout(int fd,
else else
deadline += 5000000; deadline += 5000000;
while (size) while (len)
{ {
ssize_t ret = send(fd, (const char*)data, size, flags); ssize_t ret = send(fd, (const char*)data, len, flags);
if (!ret) if (!ret)
continue; continue;
@ -636,22 +632,22 @@ bool socket_send_all_blocking_with_timeout(int fd,
else else
{ {
data += ret; data += ret;
size -= ret; len -= ret;
} }
} }
return true; return true;
} }
ssize_t socket_send_all_nonblocking(int fd, const void *data_, size_t size, ssize_t socket_send_all_nonblocking(int fd, const void *data_, size_t len,
bool no_signal) bool no_signal)
{ {
const uint8_t *data = (const uint8_t*)data_; const uint8_t *data = (const uint8_t*)data_;
int flags = no_signal ? MSG_NOSIGNAL : 0; int flags = no_signal ? MSG_NOSIGNAL : 0;
while (size) while (len)
{ {
ssize_t ret = send(fd, (const char*)data, size, flags); ssize_t ret = send(fd, (const char*)data, len, flags);
if (!ret) if (!ret)
break; break;
@ -666,7 +662,7 @@ ssize_t socket_send_all_nonblocking(int fd, const void *data_, size_t size,
else else
{ {
data += ret; data += ret;
size -= ret; len -= ret;
} }
} }

View File

@ -29,24 +29,24 @@
#include <queues/fifo_queue.h> #include <queues/fifo_queue.h>
static bool fifo_initialize_internal(fifo_buffer_t *buf, size_t size) static bool fifo_initialize_internal(fifo_buffer_t *buf, size_t len)
{ {
uint8_t *buffer = (uint8_t*)calloc(1, size + 1); uint8_t *buffer = (uint8_t*)calloc(1, len + 1);
if (!buffer) if (!buffer)
return false; return false;
buf->buffer = buffer; buf->buffer = buffer;
buf->size = size + 1; buf->size = len + 1;
buf->first = 0; buf->first = 0;
buf->end = 0; buf->end = 0;
return true; return true;
} }
bool fifo_initialize(fifo_buffer_t *buf, size_t size) bool fifo_initialize(fifo_buffer_t *buf, size_t len)
{ {
return (buf && fifo_initialize_internal(buf, size)); return (buf && fifo_initialize_internal(buf, len));
} }
void fifo_free(fifo_buffer_t *buffer) void fifo_free(fifo_buffer_t *buffer)
@ -73,14 +73,14 @@ bool fifo_deinitialize(fifo_buffer_t *buffer)
return true; return true;
} }
fifo_buffer_t *fifo_new(size_t size) fifo_buffer_t *fifo_new(size_t len)
{ {
fifo_buffer_t *buf = (fifo_buffer_t*)malloc(sizeof(*buf)); fifo_buffer_t *buf = (fifo_buffer_t*)malloc(sizeof(*buf));
if (!buf) if (!buf)
return NULL; return NULL;
if (!fifo_initialize_internal(buf, size)) if (!fifo_initialize_internal(buf, len))
{ {
free(buf); free(buf);
return NULL; return NULL;
@ -89,36 +89,36 @@ fifo_buffer_t *fifo_new(size_t size)
return buf; return buf;
} }
void fifo_write(fifo_buffer_t *buffer, const void *in_buf, size_t size) void fifo_write(fifo_buffer_t *buffer, const void *in_buf, size_t len)
{ {
size_t first_write = size; size_t first_write = len;
size_t rest_write = 0; size_t rest_write = 0;
if (buffer->end + size > buffer->size) if (buffer->end + len > buffer->size)
{ {
first_write = buffer->size - buffer->end; first_write = buffer->size - buffer->end;
rest_write = size - first_write; rest_write = len - first_write;
} }
memcpy(buffer->buffer + buffer->end, in_buf, first_write); memcpy(buffer->buffer + buffer->end, in_buf, first_write);
memcpy(buffer->buffer, (const uint8_t*)in_buf + first_write, rest_write); memcpy(buffer->buffer, (const uint8_t*)in_buf + first_write, rest_write);
buffer->end = (buffer->end + size) % buffer->size; buffer->end = (buffer->end + len) % buffer->size;
} }
void fifo_read(fifo_buffer_t *buffer, void *in_buf, size_t size) void fifo_read(fifo_buffer_t *buffer, void *in_buf, size_t len)
{ {
size_t first_read = size; size_t first_read = len;
size_t rest_read = 0; size_t rest_read = 0;
if (buffer->first + size > buffer->size) if (buffer->first + len > buffer->size)
{ {
first_read = buffer->size - buffer->first; first_read = buffer->size - buffer->first;
rest_read = size - first_read; rest_read = len - first_read;
} }
memcpy(in_buf, (const uint8_t*)buffer->buffer + buffer->first, first_read); memcpy(in_buf, (const uint8_t*)buffer->buffer + buffer->first, first_read);
memcpy((uint8_t*)in_buf + first_read, buffer->buffer, rest_read); memcpy((uint8_t*)in_buf + first_read, buffer->buffer, rest_read);
buffer->first = (buffer->first + size) % buffer->size; buffer->first = (buffer->first + len) % buffer->size;
} }

View File

@ -28,7 +28,7 @@
#include <compat/strl.h> #include <compat/strl.h>
#include <compat/posix_string.h> #include <compat/posix_string.h>
bool msg_queue_initialize(msg_queue_t *queue, size_t size) bool msg_queue_initialize(msg_queue_t *queue, size_t len)
{ {
struct queue_elem **elems = NULL; struct queue_elem **elems = NULL;
@ -36,31 +36,31 @@ bool msg_queue_initialize(msg_queue_t *queue, size_t size)
return false; return false;
if (!(elems = (struct queue_elem**) if (!(elems = (struct queue_elem**)
calloc(size + 1, sizeof(struct queue_elem*)))) calloc(len + 1, sizeof(struct queue_elem*))))
return false; return false;
queue->tmp_msg = NULL; queue->tmp_msg = NULL;
queue->elems = elems; queue->elems = elems;
queue->ptr = 1; queue->ptr = 1;
queue->size = size + 1; queue->size = len + 1;
return true; return true;
} }
/** /**
* msg_queue_new: * msg_queue_new:
* @size : maximum size of message * @len : maximum size of message
* *
* Creates a message queue with maximum size different messages. * Creates a message queue with maximum size different messages.
* *
* Returns: NULL if allocation error, pointer to a message queue * Returns: NULL if allocation error, pointer to a message queue
* if successful. Has to be freed manually. * if successful. Has to be freed manually.
**/ **/
msg_queue_t *msg_queue_new(size_t size) msg_queue_t *msg_queue_new(size_t len)
{ {
msg_queue_t *queue = (msg_queue_t*)malloc(sizeof(*queue)); msg_queue_t *queue = (msg_queue_t*)malloc(sizeof(*queue));
if (!msg_queue_initialize(queue, size)) if (!msg_queue_initialize(queue, len))
{ {
if (queue) if (queue)
free(queue); free(queue);

View File

@ -27,19 +27,19 @@
#include <streams/network_stream.h> #include <streams/network_stream.h>
bool netstream_open(netstream_t *stream, void *buf, size_t size, size_t used) bool netstream_open(netstream_t *stream, void *buf, size_t len, size_t used)
{ {
if (buf) if (buf)
{ {
/* Pre-allocated buffer must have a non-zero size. */ /* Pre-allocated buffer must have a non-zero size. */
if (!size || used > size) if (!len || used > len)
return false; return false;
} }
else else
{ {
if (size) if (len)
{ {
buf = malloc(size); buf = malloc(len);
if (!buf) if (!buf)
return false; return false;
} }
@ -48,7 +48,7 @@ bool netstream_open(netstream_t *stream, void *buf, size_t size, size_t used)
} }
stream->buf = buf; stream->buf = buf;
stream->size = size; stream->size = len;
stream->used = used; stream->used = used;
stream->pos = 0; stream->pos = 0;
@ -252,14 +252,14 @@ bool netstream_write(netstream_t *stream, const void *data, size_t len)
} }
else else
{ {
size_t size = stream->size + (len - remaining); size_t _len = stream->size + (len - remaining);
void *buf = realloc(stream->buf, size); void *buf = realloc(stream->buf, _len);
if (!buf) if (!buf)
return false; return false;
stream->buf = buf; stream->buf = buf;
stream->size = size; stream->size = _len;
} }
} }

View File

@ -347,13 +347,12 @@ static struct buffer query_expect_eof(char *s, size_t len,
} }
static int query_peek(struct buffer buff, const char * data, static int query_peek(struct buffer buff, const char * data,
size_t size_data) size_t len)
{ {
size_t remain = buff.len - buff.offset; size_t remain = buff.len - buff.offset;
if (remain < size_data) if (remain < len)
return 0; return 0;
return (strncmp(buff.data + buff.offset, return (strncmp(buff.data + buff.offset, data, len) == 0);
data, size_data) == 0);
} }
static struct buffer query_get_char( static struct buffer query_get_char(

View File

@ -458,9 +458,9 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx,
if (entry->enum_idx == MENU_ENUM_LABEL_CHEEVOS_PASSWORD) if (entry->enum_idx == MENU_ENUM_LABEL_CHEEVOS_PASSWORD)
{ {
size_t j; size_t j;
size_t size = strlcpy(entry->password_value, entry->value, size_t _len = strlcpy(entry->password_value, entry->value,
sizeof(entry->password_value)); sizeof(entry->password_value));
for (j = 0; j < size; j++) for (j = 0; j < _len; j++)
entry->password_value[j] = '*'; entry->password_value[j] = '*';
} }
} }

View File

@ -183,23 +183,21 @@ static explore_state_t* explore_state;
static void ex_arena_grow(ex_arena *arena, size_t min_size) static void ex_arena_grow(ex_arena *arena, size_t min_size)
{ {
size_t size = EX_ARENA_ALIGN_UP( size_t _len = EX_ARENA_ALIGN_UP(
MAX(min_size, EX_ARENA_BLOCK_SIZE), EX_ARENA_ALIGNMENT); MAX(min_size, EX_ARENA_BLOCK_SIZE), EX_ARENA_ALIGNMENT);
arena->ptr = (char *)malloc(size); arena->ptr = (char *)malloc(_len);
arena->end = arena->ptr + size; arena->end = arena->ptr + _len;
RBUF_PUSH(arena->blocks, arena->ptr); RBUF_PUSH(arena->blocks, arena->ptr);
} }
static void *ex_arena_alloc(ex_arena *arena, size_t size) static void *ex_arena_alloc(ex_arena *arena, size_t len)
{ {
void *ptr = NULL; void *ptr = NULL;
if (len > (size_t)(arena->end - arena->ptr))
if (size > (size_t)(arena->end - arena->ptr)) ex_arena_grow(arena, len);
ex_arena_grow(arena, size);
ptr = arena->ptr; ptr = arena->ptr;
arena->ptr = (char *) arena->ptr = (char *)
EX_ARENA_ALIGN_UP((uintptr_t)(arena->ptr + size), EX_ARENA_ALIGNMENT); EX_ARENA_ALIGN_UP((uintptr_t)(arena->ptr + len), EX_ARENA_ALIGNMENT);
return ptr; return ptr;
} }
@ -996,14 +994,14 @@ static const char* explore_get_view_path(struct menu_state *menu_st, menu_list_t
const menu_ctx_driver_t *driver_ctx = menu_st->driver_ctx; const menu_ctx_driver_t *driver_ctx = menu_st->driver_ctx;
if (driver_ctx->list_get_entry) if (driver_ctx->list_get_entry)
{ {
size_t selection = driver_ctx->list_get_selection ? driver_ctx->list_get_selection(menu_st->userdata) : 0; size_t selection = driver_ctx->list_get_selection ? driver_ctx->list_get_selection(menu_st->userdata) : 0;
size_t size = driver_ctx->list_get_size ? driver_ctx->list_get_size(menu_st->userdata, MENU_LIST_TABS) : 0; size_t _len = driver_ctx->list_get_size ? driver_ctx->list_get_size(menu_st->userdata, MENU_LIST_TABS) : 0;
if (selection > 0 && size > 0) if (selection > 0 && _len > 0)
{ {
struct item_file *item = NULL; struct item_file *item = NULL;
/* Label contains the path and path contains the label */ /* Label contains the path and path contains the label */
if ((item = (struct item_file*)driver_ctx->list_get_entry(menu_st->userdata, MENU_LIST_HORIZONTAL, if ((item = (struct item_file*)driver_ctx->list_get_entry(menu_st->userdata, MENU_LIST_HORIZONTAL,
(unsigned)(selection - (size +1))))) (unsigned)(selection - (_len +1)))))
return item->label; return item->label;
} }
} }

View File

@ -735,12 +735,12 @@ static void RETRO_CALLCONV netplay_netpacket_poll_receive_cb(void);
* *
* Initialize a new socket buffer. * Initialize a new socket buffer.
*/ */
static bool netplay_init_socket_buffer(struct socket_buffer *sbuf, size_t size) static bool netplay_init_socket_buffer(struct socket_buffer *sbuf, size_t len)
{ {
sbuf->data = (unsigned char*)malloc(size); sbuf->data = (unsigned char*)malloc(len);
if (!sbuf->data) if (!sbuf->data)
return false; return false;
sbuf->bufsz = size; sbuf->bufsz = len;
sbuf->start = sbuf->read = sbuf->end = 0; sbuf->start = sbuf->read = sbuf->end = 0;
return true; return true;
@ -2197,7 +2197,7 @@ static void netplay_delta_frame_free(struct delta_frame *delta)
*/ */
static netplay_input_state_t netplay_input_state_for( static netplay_input_state_t netplay_input_state_for(
netplay_input_state_t *list, netplay_input_state_t *list,
uint32_t client_num, size_t size, uint32_t client_num, size_t len,
bool must_create, bool must_not_create) bool must_create, bool must_not_create)
{ {
netplay_input_state_t ret; netplay_input_state_t ret;
@ -2206,16 +2206,16 @@ static netplay_input_state_t netplay_input_state_for(
while (*list) while (*list)
{ {
ret = *list; ret = *list;
if (!ret->used && !must_not_create && ret->size == size) if (!ret->used && !must_not_create && ret->size == len)
{ {
ret->client_num = client_num; ret->client_num = client_num;
ret->used = true; ret->used = true;
memset(ret->data, 0, size*sizeof(uint32_t)); memset(ret->data, 0, len * sizeof(uint32_t));
return ret; return ret;
} }
else if (ret->used && ret->client_num == client_num) else if (ret->used && ret->client_num == client_num)
{ {
if (!must_create && ret->size == size) if (!must_create && ret->size == len)
return ret; return ret;
return NULL; return NULL;
} }
@ -2226,8 +2226,8 @@ static netplay_input_state_t netplay_input_state_for(
return NULL; return NULL;
/* Couldn't find a slot, allocate a fresh one */ /* Couldn't find a slot, allocate a fresh one */
if (size > 1) if (len > 1)
ret = (netplay_input_state_t)calloc(1, sizeof(struct netplay_input_state) + (size-1) * sizeof(uint32_t)); ret = (netplay_input_state_t)calloc(1, sizeof(struct netplay_input_state) + (len - 1) * sizeof(uint32_t));
else else
ret = (netplay_input_state_t)calloc(1, sizeof(struct netplay_input_state)); ret = (netplay_input_state_t)calloc(1, sizeof(struct netplay_input_state));
if (!ret) if (!ret)
@ -2235,7 +2235,7 @@ static netplay_input_state_t netplay_input_state_for(
*list = ret; *list = ret;
ret->client_num = client_num; ret->client_num = client_num;
ret->used = true; ret->used = true;
ret->size = (uint32_t)size; ret->size = (uint32_t)len;
return ret; return ret;
} }
@ -4477,21 +4477,19 @@ bool netplay_send_cur_input(netplay_t *netplay,
*/ */
bool netplay_send_raw_cmd(netplay_t *netplay, bool netplay_send_raw_cmd(netplay_t *netplay,
struct netplay_connection *connection, uint32_t cmd, const void *data, struct netplay_connection *connection, uint32_t cmd, const void *data,
size_t size) size_t len)
{ {
uint32_t cmdbuf[2]; uint32_t cmdbuf[2];
cmdbuf[0] = htonl(cmd); cmdbuf[0] = htonl(cmd);
cmdbuf[1] = htonl(size); cmdbuf[1] = htonl(len);
if (!netplay_send(&connection->send_packet_buffer, connection->fd, cmdbuf, if (!netplay_send(&connection->send_packet_buffer, connection->fd, cmdbuf,
sizeof(cmdbuf))) sizeof(cmdbuf)))
return false; return false;
if (len > 0)
if (size > 0) if (!netplay_send(&connection->send_packet_buffer, connection->fd, data, len))
if (!netplay_send(&connection->send_packet_buffer, connection->fd, data, size))
return false; return false;
return true; return true;
} }
@ -4503,7 +4501,7 @@ bool netplay_send_raw_cmd(netplay_t *netplay,
*/ */
void netplay_send_raw_cmd_all(netplay_t *netplay, void netplay_send_raw_cmd_all(netplay_t *netplay,
struct netplay_connection *except, uint32_t cmd, const void *data, struct netplay_connection *except, uint32_t cmd, const void *data,
size_t size) size_t len)
{ {
size_t i; size_t i;
for (i = 0; i < netplay->connections_size; i++) for (i = 0; i < netplay->connections_size; i++)
@ -4514,7 +4512,7 @@ void netplay_send_raw_cmd_all(netplay_t *netplay,
if ( (connection->flags & NETPLAY_CONN_FLAG_ACTIVE) if ( (connection->flags & NETPLAY_CONN_FLAG_ACTIVE)
&& (connection->mode >= NETPLAY_CONNECTION_CONNECTED)) && (connection->mode >= NETPLAY_CONNECTION_CONNECTED))
{ {
if (!netplay_send_raw_cmd(netplay, connection, cmd, data, size)) if (!netplay_send_raw_cmd(netplay, connection, cmd, data, len))
netplay_hangup(netplay, connection); netplay_hangup(netplay, connection);
} }
} }
@ -7054,13 +7052,13 @@ static bool netplay_init_socket_buffers(netplay_t *netplay)
return true; return true;
} }
static void netplay_write_block_header(unsigned char* output, const char* header, size_t size) static void netplay_write_block_header(unsigned char* output, const char* header, size_t len)
{ {
memcpy(output, header, 4); memcpy(output, header, 4);
output[4] = ((size) & 0xFF); output[4] = ((len) & 0xFF);
output[5] = ((size >> 8) & 0xFF); output[5] = ((len >> 8) & 0xFF);
output[6] = ((size >> 16) & 0xFF); output[6] = ((len >> 16) & 0xFF);
output[7] = ((size >> 24) & 0xFF); output[7] = ((len >> 24) & 0xFF);
} }
static bool netplay_init_serialization(netplay_t *netplay) static bool netplay_init_serialization(netplay_t *netplay)

View File

@ -533,15 +533,14 @@ bool secondary_core_ensure_exists(void *data, settings_t *settings)
#if defined(HAVE_DYNAMIC) #if defined(HAVE_DYNAMIC)
static bool secondary_core_deserialize(runloop_state_t *runloop_st, static bool secondary_core_deserialize(runloop_state_t *runloop_st,
settings_t *settings, settings_t *settings, const void *data, size_t len)
const void *data, size_t size)
{ {
bool ret = false; bool ret = false;
if (secondary_core_ensure_exists(runloop_st, settings)) if (secondary_core_ensure_exists(runloop_st, settings))
{ {
runloop_st->flags |= RUNLOOP_FLAG_REQUEST_SPECIAL_SAVESTATE; runloop_st->flags |= RUNLOOP_FLAG_REQUEST_SPECIAL_SAVESTATE;
ret = runloop_st->secondary_core.retro_unserialize(data, size); ret = runloop_st->secondary_core.retro_unserialize(data, len);
runloop_st->flags &= ~RUNLOOP_FLAG_REQUEST_SPECIAL_SAVESTATE; runloop_st->flags &= ~RUNLOOP_FLAG_REQUEST_SPECIAL_SAVESTATE;
} }
else else
@ -828,12 +827,12 @@ static void runahead_reset_hook(void)
runloop_st->retro_reset_callback_original(); runloop_st->retro_reset_callback_original();
} }
static bool runahead_unserialize_hook(const void *buf, size_t size) static bool runahead_unserialize_hook(const void *buf, size_t len)
{ {
runloop_state_t *runloop_st = runloop_state_get_ptr(); runloop_state_t *runloop_st = runloop_state_get_ptr();
runloop_st->flags |= RUNLOOP_FLAG_INPUT_IS_DIRTY; runloop_st->flags |= RUNLOOP_FLAG_INPUT_IS_DIRTY;
if (runloop_st->retro_unserialize_callback_original) if (runloop_st->retro_unserialize_callback_original)
return runloop_st->retro_unserialize_callback_original(buf, size); return runloop_st->retro_unserialize_callback_original(buf, len);
return false; return false;
} }

View File

@ -558,7 +558,7 @@ void libretro_get_environment_info(
} }
static dylib_t load_dynamic_core(const char *path, char *buf, static dylib_t load_dynamic_core(const char *path, char *buf,
size_t size) size_t len)
{ {
#if defined(ANDROID) #if defined(ANDROID)
/* Can't resolve symlinks when dealing with cores /* Can't resolve symlinks when dealing with cores
@ -589,7 +589,7 @@ static dylib_t load_dynamic_core(const char *path, char *buf,
/* Need to use absolute path for this setting. It can be /* Need to use absolute path for this setting. It can be
* saved to content history, and a relative path would * saved to content history, and a relative path would
* break in that scenario. */ * break in that scenario. */
path_resolve_realpath(buf, size, resolve_symlinks); path_resolve_realpath(buf, len, resolve_symlinks);
return dylib_load(path); return dylib_load(path);
} }

4
save.c
View File

@ -407,7 +407,7 @@ static bool content_load_ram_file(unsigned slot)
* Attempt to save valuable RAM data somewhere. * Attempt to save valuable RAM data somewhere.
**/ **/
static bool dump_to_file_desperate(const void *data, static bool dump_to_file_desperate(const void *data,
size_t size, unsigned type) size_t len, unsigned type)
{ {
char path[PATH_MAX_LENGTH + 256 + 32]; char path[PATH_MAX_LENGTH + 256 + 32];
path [0] = '\0'; path [0] = '\0';
@ -434,7 +434,7 @@ static bool dump_to_file_desperate(const void *data,
* > In this case, we don't want to further * > In this case, we don't want to further
* complicate matters by introducing zlib * complicate matters by introducing zlib
* compression overheads */ * compression overheads */
if (filestream_write_file(path, data, size)) if (filestream_write_file(path, data, len))
{ {
RARCH_WARN("[SRAM]: Succeeded in saving RAM data to \"%s\".\n", path); RARCH_WARN("[SRAM]: Succeeded in saving RAM data to \"%s\".\n", path);
return true; return true;

View File

@ -407,7 +407,7 @@ static void content_file_list_free(
free(file_list); free(file_list);
} }
static content_file_list_t *content_file_list_init(size_t size) static content_file_list_t *content_file_list_init(size_t len)
{ {
content_file_list_t *file_list = NULL; content_file_list_t *file_list = NULL;
@ -424,17 +424,17 @@ static content_file_list_t *content_file_list_init(size_t size)
{ {
/* Create entries list */ /* Create entries list */
if ((file_list->entries = (content_file_info_t *) if ((file_list->entries = (content_file_info_t *)
calloc(size, sizeof(content_file_info_t)))) calloc(len, sizeof(content_file_info_t))))
{ {
file_list->size = size; file_list->size = len;
/* Create retro_game_info object */ /* Create retro_game_info object */
if ((file_list->game_info = (struct retro_game_info *) if ((file_list->game_info = (struct retro_game_info *)
calloc(size, sizeof(struct retro_game_info)))) calloc(len, sizeof(struct retro_game_info))))
{ {
/* Create retro_game_info_ext object */ /* Create retro_game_info_ext object */
if ((file_list->game_info_ext = if ((file_list->game_info_ext =
(struct retro_game_info_ext *) (struct retro_game_info_ext *)
calloc(size, sizeof(struct retro_game_info_ext)))) calloc(len, sizeof(struct retro_game_info_ext))))
return file_list; return file_list;
} }
} }

View File

@ -517,24 +517,21 @@ end:
} }
static ssize_t task_overlay_find_index(const struct overlay *ol, static ssize_t task_overlay_find_index(const struct overlay *ol,
const char *name, size_t size) const char *name, size_t len)
{ {
size_t i; size_t i;
if (!ol) if (!ol)
return -1; return -1;
for (i = 0; i < len; i++)
for (i = 0; i < size; i++)
{ {
if (string_is_equal(ol[i].name, name)) if (string_is_equal(ol[i].name, name))
return i; return i;
} }
return -1; return -1;
} }
static bool task_overlay_resolve_targets(struct overlay *ol, static bool task_overlay_resolve_targets(struct overlay *ol,
size_t idx, size_t size) size_t idx, size_t len)
{ {
unsigned i; unsigned i;
struct overlay *current = (struct overlay*)&ol[idx]; struct overlay *current = (struct overlay*)&ol[idx];
@ -543,11 +540,11 @@ static bool task_overlay_resolve_targets(struct overlay *ol,
{ {
struct overlay_desc *desc = (struct overlay_desc*)&current->descs[i]; struct overlay_desc *desc = (struct overlay_desc*)&current->descs[i];
const char *next = desc->next_index_name; const char *next = desc->next_index_name;
ssize_t next_idx = (idx + 1) % size; ssize_t next_idx = (idx + 1) % len;
if (!string_is_empty(next)) if (!string_is_empty(next))
{ {
next_idx = task_overlay_find_index(ol, next, size); next_idx = task_overlay_find_index(ol, next, len);
if (next_idx < 0) if (next_idx < 0)
{ {