Skip to content

Commit

Permalink
Local 'len' variables need to prefixed with '_', inner-loop len
Browse files Browse the repository at this point in the history
variables need to be prefixed with '__'
  • Loading branch information
LibretroAdmin committed Jan 7, 2025
1 parent e40f405 commit fc48eca
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
18 changes: 9 additions & 9 deletions gfx/common/win32_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1333,14 +1333,14 @@ static LRESULT CALLBACK wnd_proc_common_dinput_internal(HWND hwnd,
break;
for (i = 0; i < len1; i = i + 2)
{
size_t len2;
size_t __len;
char *utf8 = utf16_to_utf8_string_alloc(wstr+i);
if (!utf8)
continue;
len2 = strlen(utf8) + 1;
if (len2 >= 1 && len2 <= 3)
__len = strlen(utf8) + 1;
if (__len >= 1 && __len <= 3)
{
if (len2 >= 2)
if (__len >= 2)
utf8[3] = (gcs) | (gcs >> 4);
input_keyboard_event(true, 1, *((int*)utf8), 0, RETRO_DEVICE_KEYBOARD);
}
Expand Down Expand Up @@ -2137,7 +2137,7 @@ static void win32_localize_menu(HMENU menu)
if (label_enum != MSG_UNKNOWN)
{
int len;
size_t len2;
size_t __len;
#ifndef LEGACY_WIN32
wchar_t* new_label_unicode = NULL;
#else
Expand All @@ -2156,25 +2156,25 @@ static void win32_localize_menu(HMENU menu)
MENU_ENUM_LABEL_VALUE_LOAD_CONTENT_LIST)
{
meta_key_name = "Ctrl+O";
len2 = STRLEN_CONST("Ctrl+O");
__len = STRLEN_CONST("Ctrl+O");
}
else if (label_enum ==
MENU_ENUM_LABEL_VALUE_INPUT_META_FULLSCREEN_TOGGLE_KEY)
{
meta_key_name = "Alt+Enter";
len2 = STRLEN_CONST("Alt+Enter");
__len = STRLEN_CONST("Alt+Enter");
}
else if (meta_key != 0)
{
meta_key_name = win32_meta_key_to_name(meta_key);
len2 = strlen(meta_key_name);
__len = strlen(meta_key_name);
}

/* Append localized name, tab character, and Shortcut Key */
if (meta_key_name && string_is_not_equal(meta_key_name, "nul"))
{
size_t len1 = strlen(new_label);
size_t buf_size = len1 + len2 + 2;
size_t buf_size = len1 + __len + 2;
new_label_text = (char*)malloc(buf_size);

if (new_label_text)
Expand Down
4 changes: 2 additions & 2 deletions input/common/wayland_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ static void wl_data_device_handle_drop(void *data,
int pipefd[2];
void *buffer;
size_t length;
size_t len = 0;
size_t _len = 0;
ssize_t read = 0;
char *line = NULL;
char file_list[512][512] = { 0 };
Expand Down Expand Up @@ -1030,7 +1030,7 @@ static void wl_data_device_handle_drop(void *data,
}

RARCH_WARN("[Wayland]: Files opp:\n");
while ((read = getline(&line, &len, stream)) != -1)
while ((read = getline(&line, &_len, stream)) != -1)
{
line[strcspn(line, "\r\n")] = 0;
RARCH_DBG("[Wayland]: > \"%s\"\n", line);
Expand Down
17 changes: 9 additions & 8 deletions libretro-common/formats/json/rjson.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,15 @@ static INLINE bool _rjson_pushchar(rjson_t *json, _rjson_char_t c)
static INLINE bool _rjson_pushchars(rjson_t *json,
const unsigned char *from, const unsigned char *to)
{
size_t len = json->string_len, new_len = len + (to - from);
unsigned char* string;
size_t _len = json->string_len;
size_t new_len = _len + (to - from);
while (new_len >= json->string_cap)
if (!_rjson_grow_string(json))
return false;
string = (unsigned char *)json->string;
while (len != new_len)
string[len++] = *(from++);
while (_len != new_len)
string[_len++] = *(from++);
json->string_len = new_len;
return true;
}
Expand Down Expand Up @@ -1126,7 +1127,7 @@ enum rjson_type rjson_parse(rjson_t *json, void* context,
bool (*null_handler )(void *context))
{
bool in_object = false;
size_t len;
size_t _len;
const char* string;
if (!object_member_handler) object_member_handler = _rjson_nop_string;
if (!string_handler ) string_handler = _rjson_nop_string;
Expand All @@ -1142,16 +1143,16 @@ enum rjson_type rjson_parse(rjson_t *json, void* context,
switch (rjson_next(json))
{
case RJSON_STRING:
string = rjson_get_string(json, &len);
string = rjson_get_string(json, &_len);
if (_rJSON_LIKELY(
(in_object && (json->stack_top->count & 1) ?
object_member_handler : string_handler)
(context, string, len)))
(context, string, _len)))
continue;
return RJSON_STRING;
case RJSON_NUMBER:
string = rjson_get_string(json, &len);
if (_rJSON_LIKELY(number_handler(context, string, len)))
string = rjson_get_string(json, &_len);
if (_rJSON_LIKELY(number_handler(context, string, _len)))
continue;
return RJSON_NUMBER;
case RJSON_OBJECT:
Expand Down

0 comments on commit fc48eca

Please sign in to comment.