From fc48ecaa1df4539c63d4b30d26b60299c8cf0772 Mon Sep 17 00:00:00 2001 From: LibretroAdmin Date: Tue, 7 Jan 2025 02:57:24 +0100 Subject: [PATCH] Local 'len' variables need to prefixed with '_', inner-loop len variables need to be prefixed with '__' --- gfx/common/win32_common.c | 18 +++++++++--------- input/common/wayland_common.c | 4 ++-- libretro-common/formats/json/rjson.c | 17 +++++++++-------- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/gfx/common/win32_common.c b/gfx/common/win32_common.c index aa84bd79258e..3566d418dc9e 100644 --- a/gfx/common/win32_common.c +++ b/gfx/common/win32_common.c @@ -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); } @@ -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 @@ -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) diff --git a/input/common/wayland_common.c b/input/common/wayland_common.c index 9f5d27373580..0be0406c32a3 100644 --- a/input/common/wayland_common.c +++ b/input/common/wayland_common.c @@ -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 }; @@ -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); diff --git a/libretro-common/formats/json/rjson.c b/libretro-common/formats/json/rjson.c index 07fcf2581420..bb3eaf346c39 100644 --- a/libretro-common/formats/json/rjson.c +++ b/libretro-common/formats/json/rjson.c @@ -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; } @@ -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; @@ -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: