strl: copy string literals without scanning them at runtime

strlcpy() begins with strlen() of its source. It lives in another
translation unit, so with no LTO that scan happens at runtime even when
the source is a literal whose length the compiler already measured, and
the call itself cannot be folded away either.

strlcpy_lit() passes the length over as sizeof(). When the destination
size is also a constant -- sizeof(buf), the usual case -- nothing is
left but the stores memcpy() compiles to:

  strlcpy      "core_options"  sizeof(buf)   7.01 ns
  strlcpy_lit  "core_options"  sizeof(buf)   0.42 ns
  strlcpy      41-char literal sizeof(buf)   7.74 ns
  strlcpy_lit  41-char literal sizeof(buf)   0.71 ns
  strlcpy      "core_options"  runtime len   7.11 ns
  strlcpy_lit  "core_options"  runtime len   0.70 ns

The destination bound is kept. When the literal does not fit it defers
to strlcpy(), so the copy truncates as before rather than overrunning;
a form that took only the literal would have turned every one of these
sites into an overflow waiting for a small buffer. The literal is
concatenated with "" so a non-literal source is a compile error rather
than a sizeof() that silently measures a pointer.

818 sites across 104 files were converted by parsing arguments rather
than by pattern-matching text: only a three-argument call whose second
argument is a bare string literal is rewritten, so a macro that happens
to expand to a literal is left alone. Line endings are preserved, so
the CRLF files carry only their own changed lines.

test/compat/test_strl.c compares the two against each other over every
destination size from 0 past the literal's length, for literals that
are empty, single-character, path-shaped, adjacently concatenated and
escape-bearing, checking the return, the terminator and the whole
buffer so an overrun past the terminator is caught. ASan+UBSan+LSan and
TSan both 4/4. The full menu_displaylist_build_list walk over every
displaylist type is byte-identical to before the change
(md5 a2a081bcac09cdc8d72d67efd14ac40e).
This commit is contained in:
LibretroAdmin authored and libretroadmin committed 2026-08-30 02:10:20 +02:00
1 parent 2fe703f6b1
commit b9be38fd55
107 files changed
+993 -819

No files matched your search

+1 -1
View File
@@ -188,7 +188,7 @@ void game_ai_think(bool override_p1, bool override_p2, bool show_debug,
* strlen scan-from-start cost on each append. */
_len = strlcpy(data_path, game_ai_lib_path, sz);
if (_len < sz)
_len += strlcpy(data_path + _len, "/data/", sz - _len);
_len += strlcpy_lit(data_path + _len, "/data/", sz - _len);
if (_len < sz)
_len += strlcpy(data_path + _len, g_game_name, sz - _len);
if (_len >= sz - 1)
+4 -4
View File
@@ -349,10 +349,10 @@ static int rsnd_send_header_info(rsound_t *rd)
/* Here we embed in the rest of the WAV header for it to be somewhat valid */
strlcpy(header, "RIFF", sizeof(header));
strlcpy_lit(header, "RIFF", sizeof(header));
SET32(header, 4, 0);
strlcpy(header+8, "WAVE", sizeof(header));
strlcpy(header+12, "fmt ", sizeof(header));
strlcpy_lit(header+8, "WAVE", sizeof(header));
strlcpy_lit(header+12, "fmt ", sizeof(header));
temp32 = 16;
LSB32(temp32);
@@ -398,7 +398,7 @@ static int rsnd_send_header_info(rsound_t *rd)
LSB16(temp_bits);
SET16(header, FRAMESIZE, temp_bits);
strlcpy(header + 36, "data", sizeof(header));
strlcpy_lit(header + 36, "data", sizeof(header));
/* Do not care about cksize here (impossible to know beforehand).
* It is used by the server for format. */
+5 -5
View File
@@ -185,7 +185,7 @@ bool cheat_manager_save(
{
size_t _len = fill_pathname_join_special(cheats_file, cheat_database,
path, sizeof(cheats_file));
strlcpy(cheats_file + _len, ".cht", sizeof(cheats_file) - _len);
strlcpy_lit(cheats_file + _len, ".cht", sizeof(cheats_file) - _len);
}
if (!overwrite)
@@ -206,22 +206,22 @@ bool cheat_manager_save(
char var_key[128];
size_t _len = snprintf(var_key, sizeof(var_key), "cheat%u_", i);
strlcpy(var_key + _len, "desc", sizeof(var_key) - _len);
strlcpy_lit(var_key + _len, "desc", sizeof(var_key) - _len);
if (cheat_st->cheats[i].desc && *cheat_st->cheats[i].desc)
config_set_string(conf, var_key, cheat_st->cheats[i].desc);
else
config_set_string(conf, var_key, cheat_st->cheats[i].code);
strlcpy(var_key + _len, "code", sizeof(var_key) - _len);
strlcpy_lit(var_key + _len, "code", sizeof(var_key) - _len);
config_set_string(conf, var_key, cheat_st->cheats[i].code);
strlcpy(var_key + _len, "enable", sizeof(var_key) - _len);
strlcpy_lit(var_key + _len, "enable", sizeof(var_key) - _len);
config_set_string(conf, var_key,
cheat_st->cheats[i].state
? "true"
: "false");
strlcpy(var_key + _len, "big_endian", sizeof(var_key) - _len);
strlcpy_lit(var_key + _len, "big_endian", sizeof(var_key) - _len);
config_set_string(conf, var_key,
cheat_st->cheats[i].big_endian
? "true"
+8 -8
View File
@@ -276,7 +276,7 @@ static void rcheevos_show_completion_placard(const char* title, const char* badg
runtime_log_add_runtime_usec(runtime_log,
runloop_state->core_runtime_usec);
__len += strlcpy(msg + __len, " | ", sizeof(msg) - __len);
__len += strlcpy_lit(msg + __len, " | ", sizeof(msg) - __len);
runtime_log_get_runtime_str(runtime_log, msg + __len, sizeof(msg) - __len);
msg[sizeof(msg) - 1] = '\0';
@@ -445,7 +445,7 @@ static void rcheevos_award_achievement(const rc_client_achievement_t* cheevo)
char buffer[256];
size_t _len = strlcpy(buffer, msg_hash_to_str(MSG_ACHIEVEMENT_UNLOCKED),
sizeof(buffer));
_len += strlcpy(buffer + _len, ": ", sizeof(buffer) - _len);
_len += strlcpy_lit(buffer + _len, ": ", sizeof(buffer) - _len);
_len += strlcpy(buffer + _len, cheevo->title, sizeof(buffer) - _len);
runloop_msg_queue_push(buffer, _len, 0, 2 * 60, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
@@ -509,14 +509,14 @@ static void rcheevos_lboard_submitted(const rc_client_leaderboard_t* lboard,
{
_len = snprintf(buffer, sizeof(buffer), msg_hash_to_str(MSG_LEADERBOARD_SUBMISSION),
scoreboard->submitted_score, lboard->title);
_len += strlcpy(buffer + _len, " (", sizeof(buffer) - _len);
_len += strlcpy_lit(buffer + _len, " (", sizeof(buffer) - _len);
if (strcmp(scoreboard->best_score, scoreboard->submitted_score) == 0)
_len += snprintf(buffer + _len, sizeof(buffer) - _len,
msg_hash_to_str(MSG_LEADERBOARD_RANK), scoreboard->new_rank);
else
_len += snprintf(buffer + _len, sizeof(buffer) - _len,
msg_hash_to_str(MSG_LEADERBOARD_BEST), scoreboard->best_score);
_len += strlcpy(buffer + _len, ")", sizeof(buffer) - _len);
_len += strlcpy_lit(buffer + _len, ")", sizeof(buffer) - _len);
}
else
_len = snprintf(buffer, sizeof(buffer), msg_hash_to_str(MSG_LEADERBOARD_SUBMISSION),
@@ -534,7 +534,7 @@ static void rcheevos_lboard_canceled(const rc_client_leaderboard_t* lboard)
{
char buffer[256];
size_t _len = strlcpy(buffer, msg_hash_to_str(MSG_LEADERBOARD_FAILED), sizeof(buffer));
_len += strlcpy(buffer + _len, ": ", sizeof(buffer) - _len);
_len += strlcpy_lit(buffer + _len, ": ", sizeof(buffer) - _len);
_len += strlcpy(buffer + _len, lboard->title, sizeof(buffer) - _len);
runloop_msg_queue_push(buffer, _len, 0, 2 * 60, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
@@ -550,7 +550,7 @@ static void rcheevos_lboard_started(const rc_client_leaderboard_t* lboard)
char buffer[256];
size_t _len = strlcpy(buffer, msg_hash_to_str(MSG_LEADERBOARD_STARTED),
sizeof(buffer));
_len += strlcpy(buffer + _len, ": ", sizeof(buffer) - _len);
_len += strlcpy_lit(buffer + _len, ": ", sizeof(buffer) - _len);
_len += strlcpy(buffer + _len, lboard->title, sizeof(buffer) - _len);
if (lboard->description && *lboard->description)
_len += snprintf(buffer + _len, sizeof(buffer) - _len, "- %s",
@@ -617,7 +617,7 @@ static void rcheevos_server_error(const char* api_name, const char* message)
{
char buffer[256];
size_t _len = strlcpy(buffer, api_name, sizeof(buffer));
_len += strlcpy(buffer + _len, " failed: ", sizeof(buffer) - _len);
_len += strlcpy_lit(buffer + _len, " failed: ", sizeof(buffer) - _len);
_len += strlcpy(buffer + _len, message, sizeof(buffer) - _len);
runloop_msg_queue_push(buffer, _len, 0, 4 * 60, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
@@ -1504,7 +1504,7 @@ static void rcheevos_client_login_callback(int result,
{
settings_t* settings = config_get_ptr();
char msg[256];
size_t _len = strlcpy(msg, "RetroAchievements login failed: ",
size_t _len = strlcpy_lit(msg, "RetroAchievements login failed: ",
sizeof(msg));
_len += strlcpy(msg + _len, error_message, sizeof(msg) - _len);
CHEEVOS_LOG(RCHEEVOS_TAG "%s\n", msg);
+2 -2
View File
@@ -65,7 +65,7 @@ size_t rcheevos_menu_get_state(unsigned menu_offset, char *s, size_t len)
_len += strlcpy(s + _len, msg_hash_to_str(menuitem->state_label_idx), len - _len);
if (cheevo->measured_progress[0])
{
_len += strlcpy(s + _len, " - ", len - _len);
_len += strlcpy_lit(s + _len, " - ", len - _len);
_len += strlcpy(s + _len, cheevo->measured_progress, len - _len);
}
}
@@ -619,7 +619,7 @@ static void rcheevos_get_local_badge_filename(char badge_file[], size_t badge_fi
{
size_t _len = strlcpy(badge_file, badge, badge_file_size);
if (locked)
_len += strlcpy(badge_file + _len, "_lock", badge_file_size - _len);
_len += strlcpy_lit(badge_file + _len, "_lock", badge_file_size - _len);
strlcpy(badge_file + _len, FILE_PATH_PNG_EXTENSION, badge_file_size - _len);
}
+27 -27
View File
@@ -514,7 +514,7 @@ bool command_get_config_param(command_t *cmd, const char* arg)
(long long)(movie->frame_counter));
}
else
strlcpy(value_dynamic, "0 0 0", sizeof(value_dynamic));
strlcpy_lit(value_dynamic, "0 0 0", sizeof(value_dynamic));
}
#endif
#ifdef HAVE_MENU
@@ -537,7 +537,7 @@ bool command_get_config_param(command_t *cmd, const char* arg)
}
#endif
/* TODO: query any string */
_len = strlcpy(reply, "GET_CONFIG_PARAM ", sizeof(reply));
_len = strlcpy_lit(reply, "GET_CONFIG_PARAM ", sizeof(reply));
_len += strlcpy(reply + _len, arg, sizeof(reply) - _len);
reply[ _len] = ' ';
reply[++_len] = '\0';
@@ -651,7 +651,7 @@ command_t* command_uds_new(void)
/* use an abstract socket for simplicity */
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
strlcpy(&addr.sun_path[1], "retroarch/cmd", sizeof(addr.sun_path) - 1);
strlcpy_lit(&addr.sun_path[1], "retroarch/cmd", sizeof(addr.sun_path) - 1);
if ( bind(fd, (struct sockaddr*)&addr, addrsz) < 0
|| listen(fd, MAX_USER_CONNECTIONS) < 0
|| !socket_nonblock(fd))
@@ -829,7 +829,7 @@ bool command_load_state_slot(command_t *cmd, const char *arg)
unsigned int slot = (unsigned int)strtoul(arg, NULL, 10);
bool savestates_enabled = core_info_current_supports_savestate();
bool ret = false;
_len = strlcpy(reply, "LOAD_STATE_SLOT ", sizeof(reply));
_len = strlcpy_lit(reply, "LOAD_STATE_SLOT ", sizeof(reply));
_len += snprintf(reply + _len, sizeof(reply) - _len, "%d", slot);
runloop_get_savestate_path(state_path, sizeof(state_path), slot);
/* For LOADING, an existing state file outranks metadata and
@@ -859,7 +859,7 @@ bool command_save_state_slot(command_t* cmd, const char* arg)
unsigned int slot = (unsigned int)strtoul(arg, NULL, 10);
bool savestates_enabled = core_info_current_supports_savestate();
bool ret = false;
_len = strlcpy(reply, "SAVE_STATE_SLOT ", sizeof(reply));
_len = strlcpy_lit(reply, "SAVE_STATE_SLOT ", sizeof(reply));
_len += snprintf(reply + _len, sizeof(reply) - _len, "%d", slot);
if (savestates_enabled)
{
@@ -944,12 +944,12 @@ bool command_seek_replay(command_t *cmd, const char *arg)
ret = movie_seek_to_frame(input_st, frame);
if (ret)
{
_len = strlcpy(reply, "OK ", sizeof(reply));
_len = strlcpy_lit(reply, "OK ", sizeof(reply));
_len += snprintf(reply+_len, sizeof(reply)-_len,
"%" PRId64, input_st->bsv_movie_state.seek_target_frame);
}
else
_len = strlcpy(reply, "NO", sizeof(reply));
_len = strlcpy_lit(reply, "NO", sizeof(reply));
reply[_len] = '\n';
reply[++_len] = '\0';
cmd->replier(cmd, reply, _len);
@@ -964,14 +964,14 @@ bool command_save_savefiles(command_t *cmd, const char* arg)
{
char reply[4];
bool ret;
size_t _len = strlcpy(reply, "OK", sizeof(reply));
size_t _len = strlcpy_lit(reply, "OK", sizeof(reply));
reply[ _len] = '\n';
reply[++_len] = '\0';
/* In the future, this should probably send each saved file path
to the replier. */
ret = command_event(CMD_EVENT_SAVE_FILES, NULL);
if (!ret)
strlcpy(reply, "NO", sizeof(reply));
strlcpy_lit(reply, "NO", sizeof(reply));
cmd->replier(cmd, reply, _len);
return ret;
}
@@ -980,12 +980,12 @@ bool command_load_savefiles(command_t *cmd, const char* arg)
{
char reply[4];
bool ret;
size_t _len = strlcpy(reply, "OK", sizeof(reply));
size_t _len = strlcpy_lit(reply, "OK", sizeof(reply));
reply[ _len] = '\n';
reply[++_len] = '\0';
ret = command_event(CMD_EVENT_LOAD_FILES, NULL);
if (!ret)
strlcpy(reply, "NO", sizeof(reply));
strlcpy_lit(reply, "NO", sizeof(reply));
cmd->replier(cmd, reply, _len);
return ret;
}
@@ -1030,7 +1030,7 @@ bool command_read_ram(command_t *cmd, const char *arg)
}
else
{
strlcpy(reply_at, " -1\n", sizeof(reply) - strlen(reply));
strlcpy_lit(reply_at, " -1\n", sizeof(reply) - strlen(reply));
_len = reply_at + STRLEN_CONST(" -1\n") - reply;
}
cmd->replier(cmd, reply, _len);
@@ -1300,17 +1300,17 @@ static uint8_t *command_memory_get_pointer(
int for_write, char *s, size_t len)
{
if (!sys_info || sys_info->mmaps.num_descriptors == 0)
strlcpy(s, " -1 no memory map defined\n", len);
strlcpy_lit(s, " -1 no memory map defined\n", len);
else
{
size_t offset;
const rarch_memory_descriptor_t* desc = command_memory_get_descriptor(&sys_info->mmaps, address, &offset);
if (!desc)
strlcpy(s, " -1 no descriptor for address\n", len);
strlcpy_lit(s, " -1 no descriptor for address\n", len);
else if (!desc->core.ptr)
strlcpy(s, " -1 no data for descriptor\n", len);
strlcpy_lit(s, " -1 no data for descriptor\n", len);
else if (for_write && (desc->core.flags & RETRO_MEMDESC_CONST))
strlcpy(s, " -1 descriptor data is readonly\n", len);
strlcpy_lit(s, " -1 descriptor data is readonly\n", len);
else
{
*max_bytes = (unsigned int)(desc->core.len - offset);
@@ -1345,7 +1345,7 @@ bool command_get_status(command_t *cmd, const char* arg)
if (!runloop_st)
{
_len = strlcpy(reply, "GET_STATUS ERROR", sizeof(reply));
_len = strlcpy_lit(reply, "GET_STATUS ERROR", sizeof(reply));
cmd->replier(cmd, reply, _len);
return false;
}
@@ -1387,7 +1387,7 @@ bool command_get_status(command_t *cmd, const char* arg)
strlcpy_append(reply, sizeof(reply), &_len, "\n");
}
else
_len = strlcpy(reply, "GET_STATUS CONTENTLESS", sizeof(reply));
_len = strlcpy_lit(reply, "GET_STATUS CONTENTLESS", sizeof(reply));
cmd->replier(cmd, reply, _len);
return true;
@@ -1503,10 +1503,10 @@ void command_event_set_volume(
configuration_set_float(settings, settings->floats.audio_volume, new_volume);
_len = strlcpy(msg, msg_hash_to_str(MSG_AUDIO_VOLUME),
sizeof(msg));
_len += strlcpy(msg + _len, ": ", sizeof(msg) - _len);
_len += strlcpy_lit(msg + _len, ": ", sizeof(msg) - _len);
_len += snprintf(msg + _len, sizeof(msg) - _len, "%.1f",
new_volume);
_len += strlcpy(msg + _len, " dB", sizeof(msg) - _len);
_len += strlcpy_lit(msg + _len, " dB", sizeof(msg) - _len);
#if defined(HAVE_GFX_WIDGETS)
if (widgets_active)
@@ -1541,10 +1541,10 @@ void command_event_set_mixer_volume(
configuration_set_float(settings, settings->floats.audio_mixer_volume, new_volume);
_len = strlcpy(msg, msg_hash_to_str(MSG_AUDIO_VOLUME),
sizeof(msg));
_len += strlcpy(msg + _len, ": ", sizeof(msg) - _len);
_len += strlcpy_lit(msg + _len, ": ", sizeof(msg) - _len);
_len += snprintf(msg + _len, sizeof(msg) - _len, "%.1f",
new_volume);
_len += strlcpy(msg + _len, " dB", sizeof(msg) - _len);
_len += strlcpy_lit(msg + _len, " dB", sizeof(msg) - _len);
runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
@@ -1722,7 +1722,7 @@ size_t command_event_save_auto_state(void)
return 0;
_len = strlcpy(savestate_name_auto, name_savestate,
sizeof(savestate_name_auto));
_len += strlcpy(savestate_name_auto + _len, ".auto",
_len += strlcpy_lit(savestate_name_auto + _len, ".auto",
sizeof(savestate_name_auto) - _len);
if (content_auto_save_state((const char*)savestate_name_auto))
RARCH_LOG("[State] %s \"%s\" %s.\n",
@@ -1832,7 +1832,7 @@ bool command_event_load_auto_state(void)
_len = strlcpy(savestate_name_auto, name_savestate,
sizeof(savestate_name_auto));
strlcpy(savestate_name_auto + _len, ".auto",
strlcpy_lit(savestate_name_auto + _len, ".auto",
sizeof(savestate_name_auto) - _len);
if (!path_is_valid(savestate_name_auto))
@@ -2125,7 +2125,7 @@ static void command_event_set_savestate_garbage_collect(settings_t *settings)
/* Construct the save state thumbnail name
* and delete that one as well. */
i = strlen(state_to_delete);
strlcpy(state_to_delete + i,".png",STRLEN_CONST(".png")+1);
strlcpy_lit(state_to_delete + i,".png",STRLEN_CONST(".png")+1);
filestream_delete(state_to_delete);
RARCH_DBG("[State] Garbage collect, deleting \"%s\".\n",state_to_delete);
}
@@ -2355,7 +2355,7 @@ bool command_event_save_core_config(
if (i)
__len += snprintf(tmp + __len, sizeof(tmp) - __len, "-%u", i);
strlcpy(tmp + __len, ".cfg", sizeof(tmp) - __len);
strlcpy_lit(tmp + __len, ".cfg", sizeof(tmp) - __len);
if (!path_is_valid(tmp))
{
@@ -2419,7 +2419,7 @@ void command_event_save_current_config(enum override_type type)
if (path_is_empty(RARCH_PATH_CONFIG))
{
msg_cat = MESSAGE_QUEUE_CATEGORY_ERROR;
_len = strlcpy(msg, "Config directory not set, cannot save configuration.", sizeof(msg));
_len = strlcpy_lit(msg, "Config directory not set, cannot save configuration.", sizeof(msg));
}
else
{
+57 -57
View File
@@ -1624,9 +1624,9 @@ static struct config_array_setting *populate_settings_array(
static char reserved_keys[MAX_USERS][32];
for (i = 0; i < MAX_USERS; i++)
{
size_t _len = strlcpy(reserved_keys[i], "input_player", sizeof(reserved_keys[i]));
size_t _len = strlcpy_lit(reserved_keys[i], "input_player", sizeof(reserved_keys[i]));
_len += snprintf(reserved_keys[i] + _len, sizeof(reserved_keys[i]) - _len, "%u", i + 1);
strlcpy(reserved_keys[i] + _len, "_reserved_device", sizeof(reserved_keys[i]) - _len);
strlcpy_lit(reserved_keys[i] + _len, "_reserved_device", sizeof(reserved_keys[i]) - _len);
SETTING_ARRAY(reserved_keys[i], settings->arrays.input_reserved_devices[i], false, NULL, true);
}
}
@@ -5853,7 +5853,7 @@ void config_set_defaults(void *data)
path_mkdir(new_path);
if (!*settings->paths.path_content_favorites)
strlcpy(settings->paths.directory_content_favorites, "default",
strlcpy_lit(settings->paths.directory_content_favorites, "default",
sizeof(settings->paths.directory_content_favorites));
if ( !*settings->paths.directory_content_favorites
@@ -5871,7 +5871,7 @@ void config_set_defaults(void *data)
sizeof(settings->paths.path_content_favorites));
if (!*settings->paths.path_content_history)
strlcpy(settings->paths.directory_content_history, "default",
strlcpy_lit(settings->paths.directory_content_history, "default",
sizeof(settings->paths.directory_content_history));
if ( !*settings->paths.directory_content_history
@@ -5889,7 +5889,7 @@ void config_set_defaults(void *data)
sizeof(settings->paths.path_content_history));
if (!*settings->paths.path_content_image_history)
strlcpy(settings->paths.directory_content_image_history, "default",
strlcpy_lit(settings->paths.directory_content_image_history, "default",
sizeof(settings->paths.directory_content_image_history));
if ( !*settings->paths.directory_content_image_history
@@ -5907,7 +5907,7 @@ void config_set_defaults(void *data)
sizeof(settings->paths.path_content_image_history));
if (!*settings->paths.path_content_music_history)
strlcpy(settings->paths.directory_content_music_history, "default",
strlcpy_lit(settings->paths.directory_content_music_history, "default",
sizeof(settings->paths.directory_content_music_history));
if ( !*settings->paths.directory_content_music_history
@@ -5925,7 +5925,7 @@ void config_set_defaults(void *data)
sizeof(settings->paths.path_content_music_history));
if (!*settings->paths.path_content_video_history)
strlcpy(settings->paths.directory_content_video_history, "default",
strlcpy_lit(settings->paths.directory_content_video_history, "default",
sizeof(settings->paths.directory_content_video_history));
if ( !*settings->paths.directory_content_video_history
@@ -6483,7 +6483,7 @@ static bool config_load_file(global_t *global,
#ifdef HAVE_NETWORKGAMEPAD
{
char tmp[64];
size_t _len = strlcpy(tmp, "network_remote_enable_user_p", sizeof(tmp));
size_t _len = strlcpy_lit(tmp, "network_remote_enable_user_p", sizeof(tmp));
for (i = 0; i < MAX_USERS; i++)
{
bool tmp_bool = false;
@@ -6531,23 +6531,23 @@ static bool config_load_file(global_t *global,
{
char prefix[64];
size_t _len = strlcpy(prefix, "input_player", sizeof(prefix));
size_t _len = strlcpy_lit(prefix, "input_player", sizeof(prefix));
size_t old_len = _len;
for (i = 0; i < MAX_USERS; i++)
{
_len = old_len;
_len += snprintf(prefix + _len, sizeof(prefix) - _len, "%u", i + 1);
strlcpy(prefix + _len, "_mouse_index", sizeof(prefix) - _len);
strlcpy_lit(prefix + _len, "_mouse_index", sizeof(prefix) - _len);
CONFIG_GET_INT_BASE(conf, settings, uints.input_mouse_index[i], prefix);
strlcpy(prefix + _len, "_joypad_index", sizeof(prefix) - _len);
strlcpy_lit(prefix + _len, "_joypad_index", sizeof(prefix) - _len);
CONFIG_GET_INT_BASE(conf, settings, uints.input_joypad_index[i], prefix);
strlcpy(prefix + _len, "_analog_dpad_mode", sizeof(prefix) - _len);
strlcpy_lit(prefix + _len, "_analog_dpad_mode", sizeof(prefix) - _len);
CONFIG_GET_INT_BASE(conf, settings, uints.input_analog_dpad_mode[i], prefix);
strlcpy(prefix + _len, "_device_reservation_type", sizeof(prefix) - _len);
strlcpy_lit(prefix + _len, "_device_reservation_type", sizeof(prefix) - _len);
CONFIG_GET_INT_BASE(conf, settings, uints.input_device_reservation_type[i], prefix);
}
@@ -6716,7 +6716,7 @@ static bool config_load_file(global_t *global,
path_mkdir(new_path);
if (!*settings->paths.path_content_favorites)
strlcpy(settings->paths.directory_content_favorites, "default",
strlcpy_lit(settings->paths.directory_content_favorites, "default",
sizeof(settings->paths.directory_content_favorites));
if ( !*settings->paths.directory_content_favorites
@@ -6733,7 +6733,7 @@ static bool config_load_file(global_t *global,
sizeof(settings->paths.path_content_favorites));
if (!*settings->paths.path_content_history)
strlcpy(settings->paths.directory_content_history, "default",
strlcpy_lit(settings->paths.directory_content_history, "default",
sizeof(settings->paths.directory_content_history));
if ( !*settings->paths.directory_content_history
@@ -6750,7 +6750,7 @@ static bool config_load_file(global_t *global,
sizeof(settings->paths.path_content_history));
if (!*settings->paths.path_content_image_history)
strlcpy(settings->paths.directory_content_image_history, "default",
strlcpy_lit(settings->paths.directory_content_image_history, "default",
sizeof(settings->paths.directory_content_image_history));
if ( !*settings->paths.directory_content_image_history
@@ -6767,7 +6767,7 @@ static bool config_load_file(global_t *global,
sizeof(settings->paths.path_content_image_history));
if (*settings->paths.path_content_music_history)
strlcpy(settings->paths.directory_content_music_history, "default",
strlcpy_lit(settings->paths.directory_content_music_history, "default",
sizeof(settings->paths.directory_content_music_history));
if ( !*settings->paths.directory_content_music_history
@@ -6784,7 +6784,7 @@ static bool config_load_file(global_t *global,
sizeof(settings->paths.path_content_music_history));
if (!*settings->paths.path_content_video_history)
strlcpy(settings->paths.directory_content_video_history, "default",
strlcpy_lit(settings->paths.directory_content_video_history, "default",
sizeof(settings->paths.directory_content_video_history));
if ( !*settings->paths.directory_content_video_history
@@ -7795,16 +7795,16 @@ static void save_keybind_hat(config_file_t *conf, const char *key,
switch (GET_HAT_DIR(bind->joykey))
{
case HAT_UP_MASK:
strlcpy(s + _len, "up", sizeof(s) - _len);
strlcpy_lit(s + _len, "up", sizeof(s) - _len);
break;
case HAT_DOWN_MASK:
strlcpy(s + _len, "down", sizeof(s) - _len);
strlcpy_lit(s + _len, "down", sizeof(s) - _len);
break;
case HAT_LEFT_MASK:
strlcpy(s + _len, "left", sizeof(s) - _len);
strlcpy_lit(s + _len, "left", sizeof(s) - _len);
break;
case HAT_RIGHT_MASK:
strlcpy(s + _len, "right", sizeof(s) - _len);
strlcpy_lit(s + _len, "right", sizeof(s) - _len);
break;
default:
break;
@@ -7822,7 +7822,7 @@ static void save_keybind_joykey(config_file_t *conf,
char key[64];
size_t _len = fill_pathname_join_delim(key, prefix,
base, '_', sizeof(key));
strlcpy(key + _len, "_btn", sizeof(key) - _len);
strlcpy_lit(key + _len, "_btn", sizeof(key) - _len);
if (bind->joykey == NO_BTN)
{
@@ -7843,10 +7843,10 @@ static void save_keybind_joykey_label(config_file_t *conf,
char key[64];
size_t _len = fill_pathname_join_delim(key, prefix,
base, '_', sizeof(key));
_len += strlcpy(key + _len, "_btn", sizeof(key) - _len);
_len += strlcpy_lit(key + _len, "_btn", sizeof(key) - _len);
if (label->joykey && *label->joykey)
{
strlcpy(key + _len, "_label", sizeof(key) - _len);
strlcpy_lit(key + _len, "_label", sizeof(key) - _len);
config_set_string(conf, key, label->joykey);
}
}
@@ -7860,7 +7860,7 @@ static void save_keybind_axis(config_file_t *conf,
char key[64];
char config[16];
size_t _len = fill_pathname_join_delim(key, prefix, base, '_', sizeof(key));
strlcpy(key + _len, "_axis", sizeof(key) - _len);
strlcpy_lit(key + _len, "_axis", sizeof(key) - _len);
if (bind->joyaxis == AXIS_NONE)
{
@@ -7889,10 +7889,10 @@ static void save_keybind_axis_label(config_file_t *conf,
{
char key[64];
size_t _len = fill_pathname_join_delim(key, prefix, base, '_', sizeof(key));
_len += strlcpy(key + _len, "_axis", sizeof(key) - _len);
_len += strlcpy_lit(key + _len, "_axis", sizeof(key) - _len);
if (label->joyaxis && *label->joyaxis)
{
strlcpy(key + _len, "_label", sizeof(key) - _len);
strlcpy_lit(key + _len, "_label", sizeof(key) - _len);
config_set_string(conf, key, label->joyaxis);
}
}
@@ -7905,7 +7905,7 @@ static void save_keybind_mbutton(config_file_t *conf,
char key[64];
size_t _len = fill_pathname_join_delim(key, prefix,
base, '_', sizeof(key));
strlcpy(key + _len, "_mbtn", sizeof(key) - _len);
strlcpy_lit(key + _len, "_mbtn", sizeof(key) - _len);
switch (bind->mbutton)
{
@@ -7949,7 +7949,7 @@ void input_config_get_prefix(char *s, char len, char user, bool meta)
{
/* Meta binds are only for the first user. */
if (user == 0)
strlcpy(s, "input", len);
strlcpy_lit(s, "input", len);
}
else
snprintf(s, len, "input_player%u", user + 1);
@@ -8152,7 +8152,7 @@ void config_get_autoconf_profile_filename(
}
/* Generate autoconfig file path */
_len = strlcpy(s, sanitised_name, len);
strlcpy(s + _len, ".cfg", len - _len);
strlcpy_lit(s + _len, ".cfg", len - _len);
}
/**
@@ -8783,7 +8783,7 @@ bool config_save_file(const char *path)
snprintf(formatted_number, sizeof(formatted_number), "%u", i + 1);
_len = strlcpy(cfg, "input_device_p", sizeof(cfg));
_len = strlcpy_lit(cfg, "input_device_p", sizeof(cfg));
strlcpy(cfg + _len, formatted_number, sizeof(cfg) - _len);
if ( !minimal
|| settings->uints.input_device[i] != defaults->uints.input_device[i])
@@ -8791,31 +8791,31 @@ bool config_save_file(const char *path)
else
config_unset(conf, cfg);
_len = strlcpy(cfg, "input_player", sizeof(cfg));
_len = strlcpy_lit(cfg, "input_player", sizeof(cfg));
_len += strlcpy(cfg + _len, formatted_number, sizeof(cfg) - _len);
strlcpy(cfg + _len, "_mouse_index", sizeof(cfg) - _len);
strlcpy_lit(cfg + _len, "_mouse_index", sizeof(cfg) - _len);
if ( !minimal
|| settings->uints.input_mouse_index[i] != defaults->uints.input_mouse_index[i])
config_set_int(conf, cfg, settings->uints.input_mouse_index[i]);
else
config_unset(conf, cfg);
strlcpy(cfg + _len, "_joypad_index", sizeof(cfg) - _len);
strlcpy_lit(cfg + _len, "_joypad_index", sizeof(cfg) - _len);
if ( !minimal
|| settings->uints.input_joypad_index[i] != defaults->uints.input_joypad_index[i])
config_set_int(conf, cfg, settings->uints.input_joypad_index[i]);
else
config_unset(conf, cfg);
strlcpy(cfg + _len, "_analog_dpad_mode", sizeof(cfg) - _len);
strlcpy_lit(cfg + _len, "_analog_dpad_mode", sizeof(cfg) - _len);
if ( !minimal
|| settings->uints.input_analog_dpad_mode[i] != defaults->uints.input_analog_dpad_mode[i])
config_set_int(conf, cfg, settings->uints.input_analog_dpad_mode[i]);
else
config_unset(conf, cfg);
strlcpy(cfg + _len, "_device_reservation_type", sizeof(cfg) - _len);
strlcpy_lit(cfg + _len, "_device_reservation_type", sizeof(cfg) - _len);
if ( !minimal
|| settings->uints.input_device_reservation_type[i] != defaults->uints.input_device_reservation_type[i])
config_set_int(conf, cfg, settings->uints.input_device_reservation_type[i]);
@@ -8851,7 +8851,7 @@ bool config_save_file(const char *path)
#ifdef HAVE_NETWORKGAMEPAD
{
char tmp[64];
size_t _len = strlcpy(tmp, "network_remote_enable_user_p", sizeof(tmp));
size_t _len = strlcpy_lit(tmp, "network_remote_enable_user_p", sizeof(tmp));
for (i = 0; i < MAX_USERS; i++)
{
snprintf(tmp + _len, sizeof(tmp) - _len, "%u", i + 1);
@@ -9372,19 +9372,19 @@ int8_t config_save_overrides(enum override_type type,
if (settings->uints.input_device[i]
!= overrides->uints.input_device[i])
{
size_t _len = strlcpy(cfg, "input_device_p", sizeof(cfg));
size_t _len = strlcpy_lit(cfg, "input_device_p", sizeof(cfg));
strlcpy(cfg + _len, formatted_number, sizeof(cfg) - _len);
config_set_int(conf, cfg, overrides->uints.input_device[i]);
RARCH_DBG("[Override] %s = \"%u\"\n", cfg, overrides->uints.input_device[i]);
}
_len = strlcpy(cfg, "input_player", sizeof(cfg));
_len = strlcpy_lit(cfg, "input_player", sizeof(cfg));
_len += strlcpy(cfg + _len, formatted_number, sizeof(cfg) - _len);
if (settings->uints.input_mouse_index[i]
!= overrides->uints.input_mouse_index[i])
{
strlcpy(cfg + _len, "_mouse_index", sizeof(cfg) - _len);
strlcpy_lit(cfg + _len, "_mouse_index", sizeof(cfg) - _len);
config_set_int(conf, cfg, overrides->uints.input_mouse_index[i]);
RARCH_DBG("[Override] %s = \"%u\"\n", cfg, overrides->uints.input_mouse_index[i]);
}
@@ -9392,7 +9392,7 @@ int8_t config_save_overrides(enum override_type type,
if (settings->uints.input_joypad_index[i]
!= overrides->uints.input_joypad_index[i])
{
strlcpy(cfg + _len, "_joypad_index", sizeof(cfg) - _len);
strlcpy_lit(cfg + _len, "_joypad_index", sizeof(cfg) - _len);
config_set_int(conf, cfg, overrides->uints.input_joypad_index[i]);
RARCH_DBG("[Override] %s = \"%u\"\n", cfg, overrides->uints.input_joypad_index[i]);
}
@@ -9400,7 +9400,7 @@ int8_t config_save_overrides(enum override_type type,
if (settings->uints.input_device_reservation_type[i]
!= overrides->uints.input_device_reservation_type[i])
{
strlcpy(cfg + _len, "_device_reservation_type", sizeof(cfg) - _len);
strlcpy_lit(cfg + _len, "_device_reservation_type", sizeof(cfg) - _len);
config_set_int(conf, cfg, overrides->uints.input_device_reservation_type[i]);
RARCH_DBG("[Override] %s = \"%u\"\n", cfg, overrides->uints.input_device_reservation_type[i]);
}
@@ -9608,14 +9608,14 @@ bool input_remapping_load_file(void *data, const char *path)
char formatted_number[4];
formatted_number[0] = '\0';
snprintf(formatted_number, sizeof(formatted_number), "%u", i + 1);
_len = strlcpy(prefix, "input_player", sizeof(prefix));
_len = strlcpy_lit(prefix, "input_player", sizeof(prefix));
strlcpy(prefix + _len, formatted_number, sizeof(prefix) - _len);
_len = strlcpy(s1, prefix, sizeof(s1));
strlcpy(s1 + _len, "_btn", sizeof(s1) - _len);
strlcpy_lit(s1 + _len, "_btn", sizeof(s1) - _len);
_len = strlcpy(s2, prefix, sizeof(s2));
strlcpy(s2 + _len, "_key", sizeof(s2) - _len);
strlcpy_lit(s2 + _len, "_key", sizeof(s2) - _len);
_len = strlcpy(s3, prefix, sizeof(s3));
strlcpy(s3 + _len, "_stk", sizeof(s3) - _len);
strlcpy_lit(s3 + _len, "_stk", sizeof(s3) - _len);
for (j = 0; j < RARCH_ANALOG_BIND_LIST_END; j++)
{
@@ -9700,15 +9700,15 @@ bool input_remapping_load_file(void *data, const char *path)
}
}
_len = strlcpy(s1, "input_libretro_device_p", sizeof(s1));
_len = strlcpy_lit(s1, "input_libretro_device_p", sizeof(s1));
strlcpy(s1 + _len, formatted_number, sizeof(s1) - _len);
CONFIG_GET_INT_BASE(conf, settings, uints.input_libretro_device[i], s1);
_len = strlcpy(s1, prefix, sizeof(s1));
strlcpy(s1 + _len, "_analog_dpad_mode", sizeof(s1) - _len);
strlcpy_lit(s1 + _len, "_analog_dpad_mode", sizeof(s1) - _len);
CONFIG_GET_INT_BASE(conf, settings, uints.input_analog_dpad_mode[i], s1);
_len = strlcpy(s1, "input_remap_port_p", sizeof(s1));
_len = strlcpy_lit(s1, "input_remap_port_p", sizeof(s1));
strlcpy(s1 + _len, formatted_number, sizeof(s1) - _len);
CONFIG_GET_INT_BASE(conf, settings, uints.input_remap_ports[i], s1);
}
@@ -9814,14 +9814,14 @@ bool input_remapping_save_file(const char *path)
RARCH_ERR("[Config] Unexpectedly high number of users.");
break;
}
_len = strlcpy(prefix, "input_player", sizeof(prefix));
_len = strlcpy_lit(prefix, "input_player", sizeof(prefix));
strlcpy(prefix + _len, formatted_number, sizeof(prefix) - _len);
_len = strlcpy(s1, prefix, sizeof(s1));
strlcpy(s1 + _len, "_btn", sizeof(s1) - _len);
strlcpy_lit(s1 + _len, "_btn", sizeof(s1) - _len);
_len = strlcpy(s2, prefix, sizeof(s2));
strlcpy(s2 + _len, "_key", sizeof(s2) - _len);
strlcpy_lit(s2 + _len, "_key", sizeof(s2) - _len);
_len = strlcpy(s3, prefix, sizeof(s3));
strlcpy(s3 + _len, "_stk", sizeof(s3) - _len);
strlcpy_lit(s3 + _len, "_stk", sizeof(s3) - _len);
for (j = 0; j < RARCH_FIRST_CUSTOM_BIND; j++)
{
@@ -9901,15 +9901,15 @@ bool input_remapping_save_file(const char *path)
settings->uints.input_keymapper_ids[i][j]);
}
_len = strlcpy(s1, "input_libretro_device_p", sizeof(s1));
_len = strlcpy_lit(s1, "input_libretro_device_p", sizeof(s1));
strlcpy(s1 + _len, formatted_number, sizeof(s1) - _len);
config_set_int(conf, s1, input_config_get_device(i));
_len = strlcpy(s1, prefix, sizeof(s1));
strlcpy(s1 + _len, "_analog_dpad_mode", sizeof(s1) - _len);
strlcpy_lit(s1 + _len, "_analog_dpad_mode", sizeof(s1) - _len);
config_set_int(conf, s1, settings->uints.input_analog_dpad_mode[i]);
_len = strlcpy(s1, "input_remap_port_p", sizeof(s1));
_len = strlcpy_lit(s1, "input_remap_port_p", sizeof(s1));
strlcpy(s1 + _len, formatted_number, sizeof(s1) - _len);
config_set_int(conf, s1, settings->uints.input_remap_ports[i]);
}
+8 -8
View File
@@ -942,7 +942,7 @@ static bool core_info_replace_file(const char *from, const char *to)
_len = strlcpy(saved, to, sizeof(saved));
if (_len + STRLEN_CONST(".old") >= sizeof(saved))
return false;
strlcpy(saved + _len, ".old", sizeof(saved) - _len);
strlcpy_lit(saved + _len, ".old", sizeof(saved) - _len);
filestream_delete(saved); /* a leftover from a previous run */
if (filestream_rename(to, saved) != 0)
@@ -994,7 +994,7 @@ static bool core_info_cache_write(core_info_cache_list_t *list, const char *info
file_path);
return false;
}
strlcpy(write_path + _len, ".tmp", sizeof(write_path) - _len);
strlcpy_lit(write_path + _len, ".tmp", sizeof(write_path) - _len);
}
#if defined(CORE_INFO_CACHE_COMPRESS)
@@ -1508,9 +1508,9 @@ static core_path_list_t *core_info_path_list_new(const char *core_dir,
_len = strlcpy(exts, core_exts, sizeof(exts));
#if defined(HAVE_DYNAMIC)
/* > 'standalone exempt' */
strlcpy(exts + _len, "|lck|lsae", sizeof(exts) - _len);
strlcpy_lit(exts + _len, "|lck|lsae", sizeof(exts) - _len);
#else
strlcpy(exts + _len, "|lck", sizeof(exts) - _len);
strlcpy_lit(exts + _len, "|lck", sizeof(exts) - _len);
#endif
/* Fetch core directory listing */
@@ -1735,7 +1735,7 @@ static void core_info_resolve_firmware(
if (!firmware)
return;
_len = strlcpy(prefix, "firmware", sizeof(prefix));
_len = strlcpy_lit(prefix, "firmware", sizeof(prefix));
for (i = 0; i < firmware_count; i++)
{
@@ -1745,16 +1745,16 @@ static void core_info_resolve_firmware(
snprintf(prefix + _len, sizeof(prefix) - _len, "%u_", i);
_len2 = strlcpy(key, prefix, sizeof(key));
strlcpy(key + _len2, "opt", sizeof(key) - _len2);
strlcpy_lit(key + _len2, "opt", sizeof(key) - _len2);
if (config_get_bool(conf, key, &tmp_bool))
firmware[i].optional = tmp_bool;
strlcpy(key + _len2, "path", sizeof(key) - _len2);
strlcpy_lit(key + _len2, "path", sizeof(key) - _len2);
firmware[i].path = config_take_string(conf, key);
strlcpy(key + _len2, "desc", sizeof(key) - _len2);
strlcpy_lit(key + _len2, "desc", sizeof(key) - _len2);
firmware[i].desc = config_take_string(conf, key);
}
@@ -551,11 +551,11 @@ static int rate_cmp(const void *a, const void *b)
static void rate_to_string(double fps, char *out, size_t len)
{
if (fabs(fps - 60000.0 / 1001.0) < 0.01)
strlcpy(out, "59.94", len);
strlcpy_lit(out, "59.94", len);
else if (fabs(fps - 30000.0 / 1001.0) < 0.01)
strlcpy(out, "29.97", len);
strlcpy_lit(out, "29.97", len);
else if (fabs(fps - 24000.0 / 1001.0) < 0.01)
strlcpy(out, "23.976", len);
strlcpy_lit(out, "23.976", len);
else
snprintf(out, len, "%g", fps);
}
@@ -1952,13 +1952,13 @@ static bool load_game_internal(bool allow_fallback)
if(capture_resolution.value != NULL)
strlcpy(video_capture_resolution, capture_resolution.value, sizeof(video_capture_resolution));
else
strlcpy(video_capture_resolution, "auto", sizeof(video_capture_resolution));
strlcpy_lit(video_capture_resolution, "auto", sizeof(video_capture_resolution));
VIDEOPROC_CORE_PREFIX(environment_cb)(RETRO_ENVIRONMENT_GET_VARIABLE, &capture_rate);
if(capture_rate.value != NULL)
strlcpy(video_capture_rate, capture_rate.value, sizeof(video_capture_rate));
else
strlcpy(video_capture_rate, "auto", sizeof(video_capture_rate));
strlcpy_lit(video_capture_rate, "auto", sizeof(video_capture_rate));
VIDEOPROC_CORE_PREFIX(environment_cb)(RETRO_ENVIRONMENT_GET_VARIABLE, &capture_mode);
VIDEOPROC_CORE_PREFIX(environment_cb)(RETRO_ENVIRONMENT_GET_VARIABLE, &output_mode);
@@ -2328,7 +2328,7 @@ device_fallback:
* brings audio back up. */
unregister_audio_callback();
close_audio_device();
strlcpy(video_device, "dummy", sizeof(video_device));
strlcpy_lit(video_device, "dummy", sizeof(video_device));
setup_dummy_source();
{
/* Reflect the fallback in the core option so the menu shows what is
+10 -10
View File
@@ -88,7 +88,7 @@ static void get_first_valid_core(char* path_return, size_t len)
if ( name_len > ext_len
&& !strcmp(ent->d_name + name_len - ext_len, extension))
{
size_t _len = strlcpy(path_return, "sdmc:/retroarch/cores/", len);
size_t _len = strlcpy_lit(path_return, "sdmc:/retroarch/cores/", len);
strlcpy(path_return + _len, ent->d_name, len - _len);
break;
}
@@ -256,7 +256,7 @@ static void frontend_ctr_exec(const char *path, bool should_load_game)
is corrupt so we have to quit */
{
char err[PATH_MAX + 32];
size_t _len = strlcpy(err, "Can't launch core: ", sizeof(err));
size_t _len = strlcpy_lit(err, "Can't launch core: ", sizeof(err));
strlcpy(err + _len, path, sizeof(err) - _len);
error_and_quit(err);
}
@@ -543,7 +543,7 @@ static size_t frontend_ctr_get_os(char* s, size_t len, int* major, int* minor)
{
OS_VersionBin cver;
OS_VersionBin nver;
size_t _len = strlcpy(s, "3DS OS", len);
size_t _len = strlcpy_lit(s, "3DS OS", len);
Result data_invalid = osGetSystemVersionData(&nver, &cver);
if (data_invalid == 0)
{
@@ -568,26 +568,26 @@ static void frontend_ctr_get_name(char* s, size_t len)
switch (device_model)
{
case 0:
strlcpy(s, "Old 3DS", len);
strlcpy_lit(s, "Old 3DS", len);
break;
case 1:
strlcpy(s, "Old 3DS XL", len);
strlcpy_lit(s, "Old 3DS XL", len);
break;
case 2:
strlcpy(s, "New 3DS", len);
strlcpy_lit(s, "New 3DS", len);
break;
case 3:
strlcpy(s, "Old 2DS", len);
strlcpy_lit(s, "Old 2DS", len);
break;
case 4:
strlcpy(s, "New 3DS XL", len);
strlcpy_lit(s, "New 3DS XL", len);
break;
case 5:
strlcpy(s, "New 2DS XL", len);
strlcpy_lit(s, "New 2DS XL", len);
break;
default:
strlcpy(s, "Unknown Device", len);
strlcpy_lit(s, "Unknown Device", len);
break;
}
}
+3 -3
View File
@@ -297,9 +297,9 @@ static size_t frontend_darwin_get_os(char *s, size_t len, int *major, int *minor
#if defined(IOS)
get_ios_version(major, minor);
#if TARGET_OS_TV
_len = strlcpy(s, "tvOS", len);
_len = strlcpy_lit(s, "tvOS", len);
#else
_len = strlcpy(s, "iOS", len);
_len = strlcpy_lit(s, "iOS", len);
#endif
#elif defined(OSX)
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101300 /* MAC_OS_X_VERSION_10_13 */
@@ -332,7 +332,7 @@ static size_t frontend_darwin_get_os(char *s, size_t len, int *major, int *minor
Gestalt(gestaltSystemVersionMajor, (SInt32*)major);
}
#endif
_len = strlcpy(s, "OSX", len);
_len = strlcpy_lit(s, "OSX", len);
#endif
return _len;
}
+10 -10
View File
@@ -618,32 +618,32 @@ static void frontend_emscripten_get_env(int *argc, char *argv[],
if (home)
{
size_t _len = strlcpy(base_path, home, sizeof(base_path));
strlcpy(base_path + _len, "/retroarch", sizeof(base_path) - _len);
strlcpy_lit(base_path + _len, "/retroarch", sizeof(base_path) - _len);
#ifndef HAVE_EXTRA_WASMFS
/* can be removed when the new web player replaces the old one */
_len = strlcpy(user_path, home, sizeof(user_path));
strlcpy(user_path + _len,
strlcpy_lit(user_path + _len,
"/retroarch/userdata", sizeof(user_path) - _len);
_len = strlcpy(bundle_path, home, sizeof(bundle_path));
strlcpy(bundle_path + _len,
strlcpy_lit(bundle_path + _len,
"/retroarch/bundle", sizeof(bundle_path) - _len);
#else
_len = strlcpy(user_path, home, sizeof(user_path));
strlcpy(user_path + _len, "/retroarch", sizeof(user_path) - _len);
strlcpy_lit(user_path + _len, "/retroarch", sizeof(user_path) - _len);
_len = strlcpy(bundle_path, home, sizeof(bundle_path));
strlcpy(bundle_path + _len, "/retroarch", sizeof(bundle_path) - _len);
strlcpy_lit(bundle_path + _len, "/retroarch", sizeof(bundle_path) - _len);
#endif
}
else
{
strlcpy(base_path, "retroarch", sizeof(base_path));
strlcpy_lit(base_path, "retroarch", sizeof(base_path));
#ifndef HAVE_EXTRA_WASMFS
/* can be removed when the new web player replaces the old one */
strlcpy(user_path, "retroarch/userdata", sizeof(user_path));
strlcpy(bundle_path, "retroarch/bundle", sizeof(bundle_path));
strlcpy_lit(user_path, "retroarch/userdata", sizeof(user_path));
strlcpy_lit(bundle_path, "retroarch/bundle", sizeof(bundle_path));
#else
strlcpy(user_path, "retroarch", sizeof(user_path));
strlcpy(bundle_path, "retroarch", sizeof(bundle_path));
strlcpy_lit(user_path, "retroarch", sizeof(user_path));
strlcpy_lit(bundle_path, "retroarch", sizeof(bundle_path));
#endif
}
+1 -1
View File
@@ -231,7 +231,7 @@ static void frontend_gx_get_env(int *argc, char *argv[],
if ( string_starts_with_size(argv[0], "usb1", STRLEN_CONST("usb1"))
|| string_starts_with_size(argv[0], "usb2", STRLEN_CONST("usb2")))
{
size_t _len = strlcpy(g_defaults.dirs[DEFAULT_DIR_CORE], "usb",
size_t _len = strlcpy_lit(g_defaults.dirs[DEFAULT_DIR_CORE], "usb",
sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
strlcpy(g_defaults.dirs[DEFAULT_DIR_CORE] + _len,
argv[0] + 4,
+4 -4
View File
@@ -64,7 +64,7 @@ static void create_path_names(void)
if (!PATH_CHAR_IS_SLASH(user_path[_len - 1])) {
_len += strlcpy(user_path + _len, PATH_DEFAULT_SLASH(), sizeof(user_path) - _len);
}
strlcpy(user_path + _len, "retroarch", sizeof(user_path) - _len);
strlcpy_lit(user_path + _len, "retroarch", sizeof(user_path) - _len);
fill_pathname_basedir(g_defaults.dirs[DEFAULT_DIR_PORT], cwd, sizeof(g_defaults.dirs[DEFAULT_DIR_PORT]));
/* Content in the same folder */
@@ -151,7 +151,7 @@ bool getMountInfo(char *path, char *mountPoint, char *partition, char *newCWD)
/* Build partition string: "device:path" using strlcpy offsets */
size_t len = strlcpy(partition, str_list->elems[0].data, 50);
if (len < 50) {
len += strlcpy(partition + len, ":", 50 - len);
len += strlcpy_lit(partition + len, ":", 50 - len);
if (len < 50)
strlcpy(partition + len, str_list->elems[1].data, 50 - len);
}
@@ -159,7 +159,7 @@ bool getMountInfo(char *path, char *mountPoint, char *partition, char *newCWD)
/* Build mountPoint string: "mount:" using strlcpy offset */
len = strlcpy(mountPoint, str_list->elems[2].data, 10);
if (len < 10)
strlcpy(mountPoint + len, ":", 10 - len);
strlcpy_lit(mountPoint + len, ":", 10 - len);
/* Build newCWD string using strlcpy offset */
len = strlcpy(newCWD, mountPoint, FILENAME_MAX);
@@ -249,7 +249,7 @@ static void mount_partition(void)
{
/* We MUST put partition as empty to avoid wrong results
with LoadELFFromFileWithPartition */
strlcpy(partition, "", sizeof(partition));
strlcpy_lit(partition, "", sizeof(partition));
}
}
+3 -3
View File
@@ -93,8 +93,8 @@ static void frontend_psp_get_env_settings(int *argc, char *argv[],
#endif
#ifdef VITA
strlcpy(eboot_path, "app0:/", sizeof(eboot_path));
strlcpy(user_path, "ux0:/data/retroarch/", sizeof(user_path));
strlcpy_lit(eboot_path, "app0:/", sizeof(eboot_path));
strlcpy_lit(user_path, "ux0:/data/retroarch/", sizeof(user_path));
strlcpy(g_defaults.dirs[DEFAULT_DIR_PORT], eboot_path,
sizeof(g_defaults.dirs[DEFAULT_DIR_PORT]));
@@ -151,7 +151,7 @@ static void frontend_psp_get_env_settings(int *argc, char *argv[],
user_path[5] = '\0';
}
else
strlcpy(user_path, "ms0:/", sizeof(user_path));
strlcpy_lit(user_path, "ms0:/", sizeof(user_path));
strlcat(user_path, "PSP/RETROARCH", sizeof(user_path));
RARCH_LOG("[PSP]: Using %s for user data.\n", user_path);
+5 -5
View File
@@ -73,10 +73,10 @@ static void frontend_qnx_get_env_settings(int *argc, char *argv[],
}
else
{
strlcpy(assets_path, "app/native/assets", sizeof(assets_path));
strlcpy(data_path, "data", sizeof(data_path));
strlcpy(user_path, "shared/misc/retroarch", sizeof(user_path));
strlcpy(tmp_path, "tmp", sizeof(user_path));
strlcpy_lit(assets_path, "app/native/assets", sizeof(assets_path));
strlcpy_lit(data_path, "data", sizeof(data_path));
strlcpy_lit(user_path, "shared/misc/retroarch", sizeof(user_path));
strlcpy_lit(tmp_path, "tmp", sizeof(user_path));
}
/* app data */
@@ -151,7 +151,7 @@ static void frontend_qnx_get_env_settings(int *argc, char *argv[],
}
/* set GLUI as default menu */
strlcpy(g_defaults.settings_menu, "glui", sizeof(g_defaults.settings_menu));
strlcpy_lit(g_defaults.settings_menu, "glui", sizeof(g_defaults.settings_menu));
#ifndef IS_SALAMANDER
dir_check_defaults("custom.ini");
+3 -3
View File
@@ -207,7 +207,7 @@ static void get_first_valid_core(char *path_return, size_t len)
&& !strcmp(ent->d_name + name_len - ext_len, extension))
{
size_t _len = strlcpy(path_return, SD_PREFIX "/retroarch/cores", len);
_len += strlcpy(path_return + _len,
_len += strlcpy_lit(path_return + _len,
"/",
len - _len);
strlcpy(path_return + _len, ent->d_name, len - _len);
@@ -703,7 +703,7 @@ static size_t frontend_switch_get_os(
ipc_request_t rq;
#endif
_len = strlcpy(s, "Horizon OS", len);
_len = strlcpy_lit(s, "Horizon OS", len);
#ifdef HAVE_LIBNX
*major = 0;
@@ -772,7 +772,7 @@ fail:
static void frontend_switch_get_name(char *s, size_t len)
{
/* TODO/FIXME: Add Mariko at some point */
strlcpy(s, "Nintendo Switch", len);
strlcpy_lit(s, "Nintendo Switch", len);
}
void frontend_switch_process_args(int *argc, char *argv[])
+19 -19
View File
@@ -440,7 +440,7 @@ void android_run_lifecycle_hook(struct android_app *android_app,
if (string_is_empty(base))
return;
strlcpy(cmd, "sh ", sizeof(cmd));
strlcpy_lit(cmd, "sh ", sizeof(cmd));
fill_pathname_join_special(cmd + 3, base, name, sizeof(cmd) - 3);
if (!path_is_valid(cmd + 3))
@@ -2197,7 +2197,7 @@ const char *retroarch_get_webos_version(char *s, size_t len,
/* fallback to nyx os_info.json */
f = fopen("/var/run/nyx/os_info.json", "r");
if (!f)
return strlcpy(s, "webOS (unknown)", len), "webOS (unknown)";
return strlcpy_lit(s, "webOS (unknown)", len), "webOS (unknown)";
/* read whole file into buffer */
char buf[4096];
@@ -2282,7 +2282,7 @@ const char *retroarch_get_webos_version(char *s, size_t len,
fclose(f);
if (pretty[0] == '\0')
strlcpy(pretty, "webOS (unknown)", sizeof(pretty));
strlcpy_lit(pretty, "webOS (unknown)", sizeof(pretty));
return strlcpy(s, pretty, len), pretty;
}
@@ -2295,7 +2295,7 @@ static size_t frontend_unix_get_os(char *s,
#ifdef ANDROID
int rel;
frontend_android_get_version(major, minor, &rel);
_len = strlcpy(s, "Android", len);
_len = strlcpy_lit(s, "Android", len);
#else
char *ptr;
struct utsname buffer;
@@ -2304,21 +2304,21 @@ static size_t frontend_unix_get_os(char *s,
*major = (int)strtol(buffer.release, &ptr, 10);
*minor = (int)strtol(++ptr, NULL, 10);
#if defined(__FreeBSD__)
_len = strlcpy(s, "FreeBSD", len);
_len = strlcpy_lit(s, "FreeBSD", len);
#elif defined(__NetBSD__)
_len = strlcpy(s, "NetBSD", len);
_len = strlcpy_lit(s, "NetBSD", len);
#elif defined(__OpenBSD__)
_len = strlcpy(s, "OpenBSD", len);
_len = strlcpy_lit(s, "OpenBSD", len);
#elif defined(__DragonFly__)
_len = strlcpy(s, "DragonFly BSD", len);
_len = strlcpy_lit(s, "DragonFly BSD", len);
#elif defined(BSD)
_len = strlcpy(s, "BSD", len);
_len = strlcpy_lit(s, "BSD", len);
#elif defined(__HAIKU__)
_len = strlcpy(s, "Haiku", len);
_len = strlcpy_lit(s, "Haiku", len);
#elif defined(WEBOS)
_len = strlcpy(s, retroarch_get_webos_version(s, len, major, minor), len);
#else
_len = strlcpy(s, "Linux", len);
_len = strlcpy_lit(s, "Linux", len);
#endif
#endif
return _len;
@@ -2875,7 +2875,7 @@ static void frontend_unix_get_env(int *argc,
{
g_defaults.overlay_set = true;
g_defaults.overlay_enable = false;
strlcpy(g_defaults.settings_menu, "ozone", sizeof(g_defaults.settings_menu));
strlcpy_lit(g_defaults.settings_menu, "ozone", sizeof(g_defaults.settings_menu));
}
#else
char base_path[PATH_MAX] = {0};
@@ -2891,15 +2891,15 @@ static void frontend_unix_get_env(int *argc,
if (xdg)
{
size_t _len = strlcpy(base_path, xdg, sizeof(base_path));
strlcpy(base_path + _len, "/retroarch", sizeof(base_path) - _len);
strlcpy_lit(base_path + _len, "/retroarch", sizeof(base_path) - _len);
}
else if (home)
{
size_t _len = strlcpy(base_path, home, sizeof(base_path));
strlcpy(base_path + _len, "/.config/retroarch", sizeof(base_path) - _len);
strlcpy_lit(base_path + _len, "/.config/retroarch", sizeof(base_path) - _len);
}
else
strlcpy(base_path, "retroarch", sizeof(base_path));
strlcpy_lit(base_path, "retroarch", sizeof(base_path));
#endif
if (libretro_directory && *libretro_directory)
@@ -3578,20 +3578,20 @@ static int frontend_unix_parse_drive_list(void *data, bool load_content)
if (xdg)
{
size_t _len = strlcpy(base_path, xdg, sizeof(base_path));
strlcpy(base_path + _len, "/retroarch", sizeof(base_path) - _len);
strlcpy_lit(base_path + _len, "/retroarch", sizeof(base_path) - _len);
}
else if (home)
{
size_t _len = strlcpy(base_path, home, sizeof(base_path));
strlcpy(base_path + _len, "/.config/retroarch", sizeof(base_path) - _len);
strlcpy_lit(base_path + _len, "/.config/retroarch", sizeof(base_path) - _len);
}
#endif
{
size_t _len = strlcpy(udisks_media_path, "/run/media", sizeof(udisks_media_path));
size_t _len = strlcpy_lit(udisks_media_path, "/run/media", sizeof(udisks_media_path));
if (user)
{
_len += strlcpy(udisks_media_path + _len, "/", sizeof(udisks_media_path) - _len);
_len += strlcpy_lit(udisks_media_path + _len, "/", sizeof(udisks_media_path) - _len);
strlcpy(udisks_media_path + _len, user, sizeof(udisks_media_path) - _len);
}
}
+11 -11
View File
@@ -88,20 +88,20 @@ static size_t frontend_uwp_get_os(char *s, size_t len, int *major, int *minor)
if (server)
{
if ((vi.dwBuildNumber >= 14393) && (vi.dwBuildNumber < 17763))
_len = strlcpy(s, "Windows Server 2016", len);
_len = strlcpy_lit(s, "Windows Server 2016", len);
else if ((vi.dwBuildNumber >= 17763) && (vi.dwBuildNumber < 20348))
_len = strlcpy(s, "Windows Server 2019", len);
_len = strlcpy_lit(s, "Windows Server 2019", len);
else if ((vi.dwBuildNumber >= 20348) && (vi.dwBuildNumber < 26100))
_len = strlcpy(s, "Windows Server 2022", len);
_len = strlcpy_lit(s, "Windows Server 2022", len);
else if (vi.dwBuildNumber >= 26100)
_len = strlcpy(s, "Windows Server 2025", len);
_len = strlcpy_lit(s, "Windows Server 2025", len);
}
else
{
if ((vi.dwBuildNumber >= 10240) && (vi.dwBuildNumber < 22000))
_len = strlcpy(s, "Windows 10", len);
_len = strlcpy_lit(s, "Windows 10", len);
else if (vi.dwBuildNumber >= 22000)
_len = strlcpy(s, "Windows 11", len);
_len = strlcpy_lit(s, "Windows 11", len);
}
break;
default:
@@ -111,22 +111,22 @@ static size_t frontend_uwp_get_os(char *s, size_t len, int *major, int *minor)
if (arch && *arch)
{
_len += strlcpy(s + _len, " ", len - _len);
_len += strlcpy_lit(s + _len, " ", len - _len);
_len += strlcpy(s + _len, arch, len - _len);
}
_len += strlcpy(s + _len, " Build ", len - _len);
_len += strlcpy_lit(s + _len, " Build ", len - _len);
_len += strlcpy(s + _len, build_str, len - _len);
if (vi.szCSDVersion && *vi.szCSDVersion)
{
_len += strlcpy(s + _len, " ", len - _len);
_len += strlcpy_lit(s + _len, " ", len - _len);
_len += strlcpy(s + _len, vi.szCSDVersion, len - _len);
}
if (uwp_device_family && *uwp_device_family)
{
_len += strlcpy(s + _len, " ", len - _len);
_len += strlcpy_lit(s + _len, " ", len - _len);
strlcpy(s + _len, uwp_device_family, len - _len);
}
return _len;
@@ -304,7 +304,7 @@ static void frontend_uwp_env_get(int *argc, char *argv[],
#ifdef HAVE_MENU
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) || defined(HAVE_OPENGL_CORE)
if (string_is_equal(uwp_device_family, "Windows.Mobile"))
strlcpy(g_defaults.settings_menu, "glui", sizeof(g_defaults.settings_menu));
strlcpy_lit(g_defaults.settings_menu, "glui", sizeof(g_defaults.settings_menu));
#endif
#endif
+25 -25
View File
@@ -460,7 +460,7 @@ static size_t frontend_win32_get_os(char *s, size_t len, int *major, int *minor)
* so use build number to insert version label */
if (!server && vi.dwMajorVersion == 10 && vi.dwBuildNumber == 10240
&& !*display_version && !*release_id)
strlcpy(release_id, "1507", sizeof(release_id));
strlcpy_lit(release_id, "1507", sizeof(release_id));
}
/* Detect Windows version from build number, NT version, or platform ID.
@@ -475,15 +475,15 @@ static size_t frontend_win32_get_os(char *s, size_t len, int *major, int *minor)
if (server)
{
if (vi.dwBuildNumber >= 26040)
_len = strlcpy(s, "Windows Server 2025", len);
_len = strlcpy_lit(s, "Windows Server 2025", len);
else if (vi.dwBuildNumber >= 20201)
_len = strlcpy(s, "Windows Server 2022", len);
_len = strlcpy_lit(s, "Windows Server 2022", len);
else if (vi.dwBuildNumber >= 17623)
_len = strlcpy(s, "Windows Server 2019", len);
_len = strlcpy_lit(s, "Windows Server 2019", len);
/* Early Server 2016 preview builds shared build numbers with
* Windows 10 previews, so 10074 is used as a safe cutoff here */
else if (vi.dwBuildNumber >= 10074)
_len = strlcpy(s, "Windows Server 2016", len);
_len = strlcpy_lit(s, "Windows Server 2016", len);
else
_len = snprintf(s, len, "Windows Server NT kernel %lu.%lu",
(unsigned long)vi.dwMajorVersion, (unsigned long)vi.dwMinorVersion);
@@ -492,10 +492,10 @@ static size_t frontend_win32_get_os(char *s, size_t len, int *major, int *minor)
{
/* Detect Windows 11 starting from an early leaked preview build */
if (vi.dwBuildNumber >= 21996)
_len = strlcpy(s, "Windows 11", len);
_len = strlcpy_lit(s, "Windows 11", len);
/* Detect Windows 10 from the first NT 10.0-based preview build */
else if (vi.dwBuildNumber >= 9888)
_len = strlcpy(s, "Windows 10", len);
_len = strlcpy_lit(s, "Windows 10", len);
else
_len = snprintf(s, len, "Windows NT kernel %lu.%lu",
(unsigned long)vi.dwMajorVersion, (unsigned long)vi.dwMinorVersion);
@@ -540,22 +540,22 @@ static size_t frontend_win32_get_os(char *s, size_t len, int *major, int *minor)
case 2:
if (server || win32_is_server_from_registry())
{
_len = strlcpy(s, "Windows Server 2003", len);
_len = strlcpy_lit(s, "Windows Server 2003", len);
if (GetSystemMetrics(SM_SERVERR2))
_len += strlcpy(s + _len, " R2", len - _len);
_len += strlcpy_lit(s + _len, " R2", len - _len);
}
else
{
/* XP "x64 Edition" is NT 5.2 (XP is 5.1) and only ever had one
* edition, making it safe to use the full product name here */
_len = strlcpy(s, "Windows XP Professional x64 Edition", len);
_len = strlcpy_lit(s, "Windows XP Professional x64 Edition", len);
}
break;
case 1:
_len = strlcpy(s, "Windows XP", len);
_len = strlcpy_lit(s, "Windows XP", len);
break;
case 0:
_len = strlcpy(s, "Windows 2000", len);
_len = strlcpy_lit(s, "Windows 2000", len);
break;
default:
_len = snprintf(s, len, "Windows NT kernel %lu.%lu",
@@ -569,24 +569,24 @@ static size_t frontend_win32_get_os(char *s, size_t len, int *major, int *minor)
{
case 0:
if (vi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
_len = strlcpy(s, "Windows 95", len);
_len = strlcpy_lit(s, "Windows 95", len);
else if (vi.dwPlatformId == VER_PLATFORM_WIN32_NT)
_len = strlcpy(s, "Windows NT 4.0", len);
_len = strlcpy_lit(s, "Windows NT 4.0", len);
else
_len = strlcpy(s, "Unknown", len);
_len = strlcpy_lit(s, "Unknown", len);
break;
case 90:
/* Apparently it's not "ME". Official naming always uses "Me" */
_len = strlcpy(s, "Windows Me", len);
_len = strlcpy_lit(s, "Windows Me", len);
break;
case 10:
{
DWORD win98_build;
win98_build = (DWORD)(LOWORD(vi.dwBuildNumber));
_len = strlcpy(s, "Windows 98", len);
_len = strlcpy_lit(s, "Windows 98", len);
/* 98/98 SE are both Win9x 4.10, so detect SE by build number */
if (win98_build >= 2222)
_len += strlcpy(s + _len, " Second Edition", len - _len);
_len += strlcpy_lit(s + _len, " Second Edition", len - _len);
break;
}
default:
@@ -612,15 +612,15 @@ static size_t frontend_win32_get_os(char *s, size_t len, int *major, int *minor)
{
if (*display_version)
{
_len += strlcpy(s + _len, " (", len - _len);
_len += strlcpy_lit(s + _len, " (", len - _len);
_len += strlcpy(s + _len, display_version, len - _len);
_len += strlcpy(s + _len, ")", len - _len);
_len += strlcpy_lit(s + _len, ")", len - _len);
}
else if (*release_id)
{
_len += strlcpy(s + _len, " (", len - _len);
_len += strlcpy_lit(s + _len, " (", len - _len);
_len += strlcpy(s + _len, release_id, len - _len);
_len += strlcpy(s + _len, ")", len - _len);
_len += strlcpy_lit(s + _len, ")", len - _len);
}
}
/* Hide x86/x64 for XP x64 ("x64" is already shown in the OS name)
@@ -630,16 +630,16 @@ static size_t frontend_win32_get_os(char *s, size_t len, int *major, int *minor)
(vi.dwMajorVersion == 5 && vi.dwMinorVersion >= 1))
&& !(vi.dwMajorVersion == 5 && vi.dwMinorVersion == 2))
{
_len += strlcpy(s + _len, " ", len - _len);
_len += strlcpy_lit(s + _len, " ", len - _len);
_len += strlcpy(s + _len, arch, len - _len);
}
_len += strlcpy(s + _len, " - Build ", len - _len);
_len += strlcpy_lit(s + _len, " - Build ", len - _len);
_len += strlcpy(s + _len, build_str, len - _len);
if (*vi.szCSDVersion)
{
_len += strlcpy(s + _len, " ", len - _len);
_len += strlcpy_lit(s + _len, " ", len - _len);
strlcpy(s + _len, vi.szCSDVersion, len - _len);
}
+9 -9
View File
@@ -99,7 +99,7 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
#endif
#if defined(_XBOX1)
strlcpy(g_defaults.dirs[DEFAULT_DIR_CORE], "D:", g_defaults.dirs[DEFAULT_DIR_CORE]);
strlcpy_lit(g_defaults.dirs[DEFAULT_DIR_CORE], "D:", g_defaults.dirs[DEFAULT_DIR_CORE]);
fill_pathname_join(g_defaults.path_config, g_defaults.dirs[DEFAULT_DIR_CORE],
FILE_PATH_MAIN_CONFIG, sizeof(g_defaults.path_config));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SAVESTATE],
@@ -139,21 +139,21 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
g_defaults.dirs[DEFAULT_DIR_CORE],
"logs", sizeof(g_defaults.dirs[DEFAULT_DIR_LOGS]));
#elif defined(_XBOX360)
strlcpy(g_defaults.dirs[DEFAULT_DIR_CORE],
strlcpy_lit(g_defaults.dirs[DEFAULT_DIR_CORE],
"game:", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
strlcpy(g_defaults.path_config,
strlcpy_lit(g_defaults.path_config,
"game:\\retroarch.cfg", sizeof(g_defaults.path_config));
strlcpy(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT],
strlcpy_lit(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT],
"game:", sizeof(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT]));
strlcpy(g_defaults.dirs[DEFAULT_DIR_SAVESTATE],
strlcpy_lit(g_defaults.dirs[DEFAULT_DIR_SAVESTATE],
"game:\\savestates", sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE]));
strlcpy(g_defaults.dirs[DEFAULT_DIR_PLAYLIST],
strlcpy_lit(g_defaults.dirs[DEFAULT_DIR_PLAYLIST],
"game:\\playlists", sizeof(g_defaults.dirs[DEFAULT_DIR_PLAYLIST]));
strlcpy(g_defaults.dirs[DEFAULT_DIR_SRAM],
strlcpy_lit(g_defaults.dirs[DEFAULT_DIR_SRAM],
"game:\\savefiles", sizeof(g_defaults.dirs[DEFAULT_DIR_SRAM]));
strlcpy(g_defaults.dirs[DEFAULT_DIR_SYSTEM],
strlcpy_lit(g_defaults.dirs[DEFAULT_DIR_SYSTEM],
"game:\\system", sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM]));
strlcpy(g_defaults.dirs[DEFAULT_DIR_LOGS],
strlcpy_lit(g_defaults.dirs[DEFAULT_DIR_LOGS],
"game:\\logs", sizeof(g_defaults.dirs[DEFAULT_DIR_LOGS]));
#endif
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO],
+29 -29
View File
@@ -176,42 +176,42 @@ size_t frontend_driver_get_core_extension(char *s, size_t len)
{
#ifdef HAVE_DYNAMIC
#ifdef _WIN32
return strlcpy(s, "dll", len);
return strlcpy_lit(s, "dll", len);
#elif (defined(IOS) && defined(HAVE_FRAMEWORKS)) || (defined(OSX) && defined(HAVE_APPLE_STORE))
return strlcpy(s, "framework", len);
return strlcpy_lit(s, "framework", len);
#elif defined(__APPLE__) || defined(__MACH__)
return strlcpy(s, "dylib" ,len);
return strlcpy_lit(s, "dylib" ,len);
#else
return strlcpy(s, "so", len);
return strlcpy_lit(s, "so", len);
#endif
#else
#if defined(PSP)
return strlcpy(s, "pbp", len);
return strlcpy_lit(s, "pbp", len);
#elif defined(ORBIS) || defined(VITA) || defined(__PS3__)
return strlcpy(s, "self|bin", len);
return strlcpy_lit(s, "self|bin", len);
#elif defined(PS2)
return strlcpy(s, "elf", len);
return strlcpy_lit(s, "elf", len);
#elif defined(_XBOX1)
return strlcpy(s, "xbe", len);
return strlcpy_lit(s, "xbe", len);
#elif defined(_XBOX360)
return strlcpy(s, "xex", len);
return strlcpy_lit(s, "xex", len);
#elif defined(GEKKO)
return strlcpy(s, "dol", len);
return strlcpy_lit(s, "dol", len);
#elif defined(HW_WUP)
return strlcpy(s, "rpx|elf", len);
return strlcpy_lit(s, "rpx|elf", len);
#elif defined(__linux__)
return strlcpy(s, "elf", len);
return strlcpy_lit(s, "elf", len);
#elif defined(HAVE_LIBNX)
return strlcpy(s, "nro", len);
return strlcpy_lit(s, "nro", len);
#elif defined(DJGPP)
return strlcpy(s, "exe", len);
return strlcpy_lit(s, "exe", len);
#elif defined(_3DS)
if (envIsHomebrew())
return strlcpy(s, "3dsx", len);
return strlcpy(s, "cia", len);
return strlcpy_lit(s, "3dsx", len);
return strlcpy_lit(s, "cia", len);
#elif defined(__EMSCRIPTEN__)
/* may not contain the core */
return strlcpy(s, "core", len);
return strlcpy_lit(s, "core", len);
#else
return 0;
#endif
@@ -225,40 +225,40 @@ bool frontend_driver_get_salamander_basename(char *s, size_t len)
#else
#if defined(PSP)
strlcpy(s, "EBOOT.PBP", len);
strlcpy_lit(s, "EBOOT.PBP", len);
return true;
#elif defined(ORBIS)
strlcpy(s, "eboot.bin", len);
strlcpy_lit(s, "eboot.bin", len);
return true;
#elif defined(VITA)
strlcpy(s, "eboot.bin", len);
strlcpy_lit(s, "eboot.bin", len);
return true;
#elif defined(PS2)
strlcpy(s, "raboot.elf", len);
strlcpy_lit(s, "raboot.elf", len);
return true;
#elif defined(__PSL1GHT__) || defined(__PS3__)
strlcpy(s, "EBOOT.BIN", len);
strlcpy_lit(s, "EBOOT.BIN", len);
return true;
#elif defined(_XBOX1)
strlcpy(s, "default.xbe", len);
strlcpy_lit(s, "default.xbe", len);
return true;
#elif defined(_XBOX360)
strlcpy(s, "default.xex", len);
strlcpy_lit(s, "default.xex", len);
return true;
#elif defined(HW_RVL)
strlcpy(s, "boot.dol", len);
strlcpy_lit(s, "boot.dol", len);
return true;
#elif defined(HW_WUP)
strlcpy(s, "retroarch.rpx", len);
strlcpy_lit(s, "retroarch.rpx", len);
return true;
#elif defined(_3DS)
strlcpy(s, "retroarch.core", len);
strlcpy_lit(s, "retroarch.core", len);
return true;
#elif defined(DJGPP)
strlcpy(s, "retrodos.exe", len);
strlcpy_lit(s, "retrodos.exe", len);
return true;
#elif defined(SWITCH)
strlcpy(s, "retroarch_switch.nro", len);
strlcpy_lit(s, "retroarch_switch.nro", len);
return true;
#else
return false;
+2 -2
View File
@@ -296,7 +296,7 @@ static void xdg_screensaver_inhibit(Window wnd)
* the same, as if there's no title at all. */
size_t title_len = video_driver_get_window_title(title, sizeof(title));
if (title_len == 0)
title_len = strlcpy(title, " ", sizeof(title));
title_len = strlcpy_lit(title, " ", sizeof(title));
XChangeProperty(g_x11_dpy, g_x11_win, XA_WM_NAME, XA_STRING,
8, PropModeReplace, (const unsigned char*) title, title_len);
@@ -328,7 +328,7 @@ static void xdg_screensaver_inhibit(Window wnd)
#endif
}
_len = strlcpy(cmd, "xdg-screensaver suspend 0x", sizeof(cmd));
_len = strlcpy_lit(cmd, "xdg-screensaver suspend 0x", sizeof(cmd));
snprintf(cmd + _len, sizeof(cmd) - _len, "%x", (int)wnd);
if ((ret = system(cmd)) == -1)
+2 -2
View File
@@ -123,7 +123,7 @@ static bool x11_display_server_set_resolution(void *data,
dispserv->monitor_index = monitor_index;
dispserv->flags |= DISPSERV_X11_FLAG_CRT_EN;
dispserv->crt_name_id += 1;
_len = strlcpy(dispserv->crt_name, "CRT", sizeof(dispserv->crt_name));
_len = strlcpy_lit(dispserv->crt_name, "CRT", sizeof(dispserv->crt_name));
_len += snprintf(dispserv->crt_name + _len,
sizeof(dispserv->crt_name) - _len,
"%d", dispserv->crt_name_id);
@@ -580,7 +580,7 @@ static void x11_display_server_destroy(void *data)
Window window = RootWindow(dpy, screen);
bool crt_exists = false;
strlcpy(dmode, "d_mo", sizeof(dmode));
strlcpy_lit(dmode, "d_mo", sizeof(dmode));
dispserv->crt_rrmode.name = dmode;
dispserv->crt_rrmode.nameLength = strlen(dispserv->crt_name);
+4 -4
View File
@@ -923,7 +923,7 @@ static const char *ctr_texture_path(unsigned id)
_len = strlcpy(texture_path,
state_path, sizeof(texture_path));
strlcpy(texture_path + _len,
strlcpy_lit(texture_path + _len,
".png",
sizeof(texture_path) - _len);
return path_basename_nocompression(texture_path);
@@ -978,7 +978,7 @@ static bool ctr_update_state_date_from_file(void *data)
error:
ctr->state_data_exist = false;
strlcpy(ctr->state_date, "00/00/0000", sizeof(ctr->state_date));
strlcpy_lit(ctr->state_date, "00/00/0000", sizeof(ctr->state_date));
return false;
}
@@ -1370,7 +1370,7 @@ static void ctr_render_bottom_screen(void *data)
&params);
_len = strlcpy(str_path, dir_assets, sizeof(str_path));
strlcpy(str_path + _len,
strlcpy_lit(str_path + _len,
"\n/bottom_menu.png",
sizeof(str_path) - _len);
@@ -1733,7 +1733,7 @@ static void* ctr_init(const video_info_t* video,
ctr->idle_timestamp = 0;
ctr->state_slot = settings->ints.state_slot;
strlcpy(ctr->state_date, "00/00/0000", sizeof(ctr->state_date));
strlcpy_lit(ctr->state_date, "00/00/0000", sizeof(ctr->state_date));
ctr->rgb32 = video->rgb32;
ctr->texture_width = video->input_scale * RARCH_SCALE_BASE;
+4 -4
View File
@@ -1889,12 +1889,12 @@ static bool d3d10_shader_load_step(void *data,
ds->shader_preset->pass[i].source.string.fragment;
size_t _len = strlcpy(_path, slang_path, sizeof(_path));
strlcpy(_path + _len, ".vs.hlsl", sizeof(_path) - _len);
strlcpy_lit(_path + _len, ".vs.hlsl", sizeof(_path) - _len);
d3d10_init_shader(d3d10->device, vs_src, 0,
_path, "main", NULL, NULL, desc, countof(desc),
&ds->passes[i].shader);
strlcpy(_path + _len, ".ps.hlsl", sizeof(_path) - _len);
strlcpy_lit(_path + _len, ".ps.hlsl", sizeof(_path) - _len);
d3d10_init_shader(d3d10->device, ps_src, 0, _path,
NULL, "main", NULL, NULL, 0,
&ds->passes[i].shader);
@@ -2093,13 +2093,13 @@ static bool d3d10_gfx_set_shader(void* data,
const char *vs_src = d3d10->shader_preset->pass[i].source.string.vertex;
const char *ps_src = d3d10->shader_preset->pass[i].source.string.fragment;
size_t _len = strlcpy(_path, slang_path, sizeof(_path));
strlcpy(_path + _len, ".vs.hlsl", sizeof(_path) - _len);
strlcpy_lit(_path + _len, ".vs.hlsl", sizeof(_path) - _len);
d3d10_init_shader(d3d10->device, vs_src, 0,
_path, "main", NULL, NULL, desc,
countof(desc), &d3d10->pass[i].shader);
strlcpy(_path + _len, ".ps.hlsl", sizeof(_path) - _len);
strlcpy_lit(_path + _len, ".ps.hlsl", sizeof(_path) - _len);
d3d10_init_shader(d3d10->device, ps_src,
0, _path, NULL, "main",
+4 -4
View File
@@ -2389,12 +2389,12 @@ static bool d3d11_shader_load_step(void *data,
ds->shader_preset->pass[i].source.string.fragment;
size_t _len = strlcpy(_path, slang_path, sizeof(_path));
strlcpy(_path + _len, ".vs.hlsl", sizeof(_path) - _len);
strlcpy_lit(_path + _len, ".vs.hlsl", sizeof(_path) - _len);
d3d11_init_shader(d3d11->device, vs_src, 0,
_path, "main", NULL, NULL, desc, countof(desc),
&ds->passes[i].shader, ds->feat_level_hint);
strlcpy(_path + _len, ".ps.hlsl", sizeof(_path) - _len);
strlcpy_lit(_path + _len, ".ps.hlsl", sizeof(_path) - _len);
d3d11_init_shader(d3d11->device, ps_src, 0, _path,
NULL, "main", NULL, NULL, 0,
&ds->passes[i].shader, ds->feat_level_hint);
@@ -2722,13 +2722,13 @@ static bool d3d11_gfx_set_shader(void* data, enum rarch_shader_type type, const
const char *vs_src = d3d11->shader_preset->pass[i].source.string.vertex;
const char *ps_src = d3d11->shader_preset->pass[i].source.string.fragment;
size_t _len = strlcpy(_path, slang_path, sizeof(_path));
strlcpy(_path + _len, ".vs.hlsl", sizeof(_path) - _len);
strlcpy_lit(_path + _len, ".vs.hlsl", sizeof(_path) - _len);
d3d11_init_shader(d3d11->device, vs_src, 0,
_path, "main", NULL, NULL, desc, countof(desc),
&d3d11->pass[i].shader, feat_level_hint);
strlcpy(_path + _len, ".ps.hlsl", sizeof(_path) - _len);
strlcpy_lit(_path + _len, ".ps.hlsl", sizeof(_path) - _len);
d3d11_init_shader(d3d11->device, ps_src, 0, _path,
NULL, "main", NULL, NULL, 0,
+4 -4
View File
@@ -2712,10 +2712,10 @@ static bool d3d12_shader_load_step(void *data,
ds->shader_preset->pass[i].source.string.fragment;
size_t _len = strlcpy(_path, slang_path, sizeof(_path));
strlcpy(_path + _len, ".vs.hlsl", sizeof(_path) - _len);
strlcpy_lit(_path + _len, ".vs.hlsl", sizeof(_path) - _len);
d3d_compile(vs_src, 0, _path, "main", "vs_5_0", &vs_code);
strlcpy(_path + _len, ".ps.hlsl", sizeof(_path) - _len);
strlcpy_lit(_path + _len, ".ps.hlsl", sizeof(_path) - _len);
d3d_compile(ps_src, 0, _path, "main", "ps_5_0", &ps_code);
desc.BlendState.RenderTarget[0].RenderTargetWriteMask =
@@ -3070,11 +3070,11 @@ static bool d3d12_gfx_set_shader(void* data, enum rarch_shader_type type, const
const char *vs_src = d3d12->shader_preset->pass[i].source.string.vertex;
const char *ps_src = d3d12->shader_preset->pass[i].source.string.fragment;
size_t _len = strlcpy(_path, slang_path, sizeof(_path));
strlcpy(_path + _len, ".vs.hlsl", sizeof(_path) - _len);
strlcpy_lit(_path + _len, ".vs.hlsl", sizeof(_path) - _len);
/* TODO/FIXME - add error handling? */
d3d_compile(vs_src, 0, _path, "main", "vs_5_0", &vs_code);
strlcpy(_path + _len, ".ps.hlsl", sizeof(_path) - _len);
strlcpy_lit(_path + _len, ".ps.hlsl", sizeof(_path) - _len);
/* TODO/FIXME - add error handling? */
d3d_compile(ps_src, 0, _path, "main", "ps_5_0", &ps_code);
+8 -8
View File
@@ -2408,7 +2408,7 @@ static void d3d9_cg_renderchain_bind_prev(d3d9_cg_renderchain_t *chain,
video_size[1] = chain->prev.last_height[
(chain->prev.ptr - (i + 1)) & TEXTURESMASK];
strlcpy(attr + _len, ".texture", sizeof(attr) - _len);
strlcpy_lit(attr + _len, ".texture", sizeof(attr) - _len);
param = cgGetNamedParameter(fprg, attr);
if (param)
{
@@ -2428,7 +2428,7 @@ static void d3d9_cg_renderchain_bind_prev(d3d9_cg_renderchain_t *chain,
IDirect3DDevice9_SetSamplerState(chain->dev, index, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
}
strlcpy(attr + _len, ".tex_coord", sizeof(attr) - _len);
strlcpy_lit(attr + _len, ".tex_coord", sizeof(attr) - _len);
param = cgGetNamedParameter(vprg, attr);
if (param)
{
@@ -2443,7 +2443,7 @@ static void d3d9_cg_renderchain_bind_prev(d3d9_cg_renderchain_t *chain,
unsigned_vector_list_append(chain->bound_vert, index);
}
strlcpy(attr + _len, ".video_size", sizeof(attr) - _len);
strlcpy_lit(attr + _len, ".video_size", sizeof(attr) - _len);
param = cgGetNamedParameter(vprg, attr);
if (param)
@@ -2452,7 +2452,7 @@ static void d3d9_cg_renderchain_bind_prev(d3d9_cg_renderchain_t *chain,
if (param)
cgD3D9SetUniform(param, &video_size);
strlcpy(attr + _len, ".texture_size", sizeof(attr) - _len);
strlcpy_lit(attr + _len, ".texture_size", sizeof(attr) - _len);
param = cgGetNamedParameter(vprg, attr);
if (param)
cgD3D9SetUniform(param, &texture_size);
@@ -2486,7 +2486,7 @@ static void d3d9_cg_renderchain_bind_pass(
texture_size[0] = curr_pass->info.tex_w;
texture_size[1] = curr_pass->info.tex_h;
strlcpy(pass_base + _len, ".texture", sizeof(pass_base) - _len);
strlcpy_lit(pass_base + _len, ".texture", sizeof(pass_base) - _len);
param = cgGetNamedParameter(fprg, pass_base);
if (param)
{
@@ -2503,7 +2503,7 @@ static void d3d9_cg_renderchain_bind_pass(
IDirect3DDevice9_SetSamplerState(chain->dev, index, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
}
strlcpy(pass_base + _len, ".tex_coord", sizeof(pass_base) - _len);
strlcpy_lit(pass_base + _len, ".tex_coord", sizeof(pass_base) - _len);
param = cgGetNamedParameter(vprg, pass_base);
if (param)
{
@@ -2517,7 +2517,7 @@ static void d3d9_cg_renderchain_bind_pass(
unsigned_vector_list_append(chain->bound_vert, index);
}
strlcpy(pass_base + _len, ".video_size", sizeof(pass_base) - _len);
strlcpy_lit(pass_base + _len, ".video_size", sizeof(pass_base) - _len);
param = cgGetNamedParameter(vprg, pass_base);
if (param)
cgD3D9SetUniform(param, &video_size);
@@ -2525,7 +2525,7 @@ static void d3d9_cg_renderchain_bind_pass(
if (param)
cgD3D9SetUniform(param, &video_size);
strlcpy(pass_base + _len, ".texture_size", sizeof(pass_base) - _len);
strlcpy_lit(pass_base + _len, ".texture_size", sizeof(pass_base) - _len);
param = cgGetNamedParameter(vprg, pass_base);
if (param)
cgD3D9SetUniform(param, &texture_size);
+8 -8
View File
@@ -587,16 +587,16 @@ static void hlsl_uniform_map_from_bytecode(
for (i = 0; i < TEXTURES - 1; i++)
{
size_t _len = strlcpy(attr, prev_names[i], sizeof(attr));
strlcpy(attr + _len, ".video_size", sizeof(attr) - _len);
strlcpy_lit(attr + _len, ".video_size", sizeof(attr) - _len);
map->prev_video_size[i] = d3d9_hlsl_ctab_find_register(bytecode, bytecode_dwords, attr, NULL, NULL);
strlcpy(attr + _len, ".texture_size", sizeof(attr) - _len);
strlcpy_lit(attr + _len, ".texture_size", sizeof(attr) - _len);
map->prev_texture_size[i] = d3d9_hlsl_ctab_find_register(bytecode, bytecode_dwords, attr, NULL, NULL);
strlcpy(attr + _len, ".texture", sizeof(attr) - _len);
strlcpy_lit(attr + _len, ".texture", sizeof(attr) - _len);
map->prev_texture[i] = d3d9_hlsl_ctab_find_register(bytecode, bytecode_dwords, attr, NULL, NULL);
/* Fallback: decomposed sampler name */
if (map->prev_texture[i] < 0)
{
strlcpy(attr + _len, "__texture", sizeof(attr) - _len);
strlcpy_lit(attr + _len, "__texture", sizeof(attr) - _len);
map->prev_texture[i] = d3d9_hlsl_ctab_find_register(bytecode, bytecode_dwords, attr, NULL, NULL);
}
}
@@ -604,16 +604,16 @@ static void hlsl_uniform_map_from_bytecode(
for (i = 0; i < GFX_MAX_SHADERS; i++)
{
size_t _len = snprintf(attr, sizeof(attr), "PASS%u", i + 1);
strlcpy(attr + _len, ".video_size", sizeof(attr) - _len);
strlcpy_lit(attr + _len, ".video_size", sizeof(attr) - _len);
map->pass_video_size[i] = d3d9_hlsl_ctab_find_register(bytecode, bytecode_dwords, attr, NULL, NULL);
strlcpy(attr + _len, ".texture_size", sizeof(attr) - _len);
strlcpy_lit(attr + _len, ".texture_size", sizeof(attr) - _len);
map->pass_texture_size[i] = d3d9_hlsl_ctab_find_register(bytecode, bytecode_dwords, attr, NULL, NULL);
strlcpy(attr + _len, ".texture", sizeof(attr) - _len);
strlcpy_lit(attr + _len, ".texture", sizeof(attr) - _len);
map->pass_texture[i] = d3d9_hlsl_ctab_find_register(bytecode, bytecode_dwords, attr, NULL, NULL);
/* Fallback: decomposed sampler name */
if (map->pass_texture[i] < 0)
{
strlcpy(attr + _len, "__texture", sizeof(attr) - _len);
strlcpy_lit(attr + _len, "__texture", sizeof(attr) - _len);
map->pass_texture[i] = d3d9_hlsl_ctab_find_register(bytecode, bytecode_dwords, attr, NULL, NULL);
}
}
+4 -4
View File
@@ -1204,8 +1204,8 @@ void Pass::reflect_parameter_array(const char *name, std::vector<slang_texture_s
int vert, frag;
char vert_n[256];
char frag_n[256];
size_t _len = strlcpy(vert_n, "RARCH_UBO_VERTEX_INSTANCE.", sizeof(vert_n));
size_t _len2 = strlcpy(frag_n, "RARCH_UBO_FRAGMENT_INSTANCE.", sizeof(frag_n));
size_t _len = strlcpy_lit(vert_n, "RARCH_UBO_VERTEX_INSTANCE.", sizeof(vert_n));
size_t _len2 = strlcpy_lit(frag_n, "RARCH_UBO_FRAGMENT_INSTANCE.", sizeof(frag_n));
strlcpy(vert_n + _len, n, sizeof(vert_n) - _len);
strlcpy(frag_n + _len2, n, sizeof(frag_n) - _len2);
vert = glGetUniformLocation(pipeline, vert_n);
@@ -1222,8 +1222,8 @@ void Pass::reflect_parameter_array(const char *name, std::vector<slang_texture_s
int vert, frag;
char vert_n[256];
char frag_n[256];
size_t _len = strlcpy(vert_n, "RARCH_PUSH_VERTEX_INSTANCE.", sizeof(vert_n));
size_t _len2 = strlcpy(frag_n, "RARCH_PUSH_FRAGMENT_INSTANCE.", sizeof(frag_n));
size_t _len = strlcpy_lit(vert_n, "RARCH_PUSH_VERTEX_INSTANCE.", sizeof(vert_n));
size_t _len2 = strlcpy_lit(frag_n, "RARCH_PUSH_FRAGMENT_INSTANCE.", sizeof(frag_n));
strlcpy(vert_n + _len, n, sizeof(vert_n) - _len);
strlcpy(frag_n + _len2, n, sizeof(frag_n) - _len2);
vert = glGetUniformLocation(pipeline, vert_n);
+2 -2
View File
@@ -241,7 +241,7 @@ static void gl_cg_set_uniform_parameter(
if (param->lookup.add_prefix)
{
size_t _len = strlcpy(ident, "IN.", sizeof(ident));
size_t _len = strlcpy_lit(ident, "IN.", sizeof(ident));
strlcpy(ident + _len, param->lookup.ident, sizeof(ident) - _len);
}
location = cgGetNamedParameter(prog, param->lookup.add_prefix ? ident : param->lookup.ident);
@@ -921,7 +921,7 @@ static void gl_cg_set_program_attributes(void *data, unsigned i)
if (i > 1)
{
char pass_str[64];
size_t _len = strlcpy(pass_str, "PASSPREV", sizeof(pass_str));
size_t _len = strlcpy_lit(pass_str, "PASSPREV", sizeof(pass_str));
snprintf(pass_str + _len, sizeof(pass_str) - _len, "%u", i);
gl_cg_set_pass_attrib(&cg->prg[i], &cg->prg[i].orig, pass_str);
}
+4 -4
View File
@@ -748,25 +748,25 @@ static void gl_glsl_find_uniforms_frame(glsl_shader_data_t *glsl,
if (frame->texture < 0)
{
strlcpy(uni + _len, "Texture", sizeof(uni) - _len);
strlcpy_lit(uni + _len, "Texture", sizeof(uni) - _len);
frame->texture = gl_glsl_get_uniform(glsl, prog, uni);
}
if (frame->tex_coord < 0)
{
strlcpy(uni + _len, "TexCoord", sizeof(uni) - _len);
strlcpy_lit(uni + _len, "TexCoord", sizeof(uni) - _len);
frame->tex_coord = gl_glsl_get_attrib(glsl, prog, uni);
}
if (frame->input_size < 0)
{
strlcpy(uni + _len, "InputSize", sizeof(uni) - _len);
strlcpy_lit(uni + _len, "InputSize", sizeof(uni) - _len);
frame->input_size = gl_glsl_get_uniform(glsl, prog, uni);
}
if (frame->texture_size < 0)
{
strlcpy(uni + _len, "TextureSize", sizeof(uni) - _len);
strlcpy_lit(uni + _len, "TextureSize", sizeof(uni) - _len);
frame->texture_size = gl_glsl_get_uniform(glsl, prog, uni);
}
+1 -1
View File
@@ -505,7 +505,7 @@ static std::string build_stage_source(
if (stage && *stage)
{
char expected[128];
size_t _len = strlcpy(expected, "#pragma stage ", sizeof(expected));
size_t _len = strlcpy_lit(expected, "#pragma stage ", sizeof(expected));
strlcpy(expected + _len, stage, sizeof(expected) - _len);
active = !strcmp(expected, line);
}
+5 -5
View File
@@ -3422,7 +3422,7 @@ void gfx_thumbnail_fill_content_img(char *s,
while ((scrub_char_ptr = strpbrk(s, "&*/:`\"<>?\\|")))
*scrub_char_ptr = '_';
/* Add PNG extension */
strlcpy(s + _len, ".png", len - _len);
strlcpy_lit(s + _len, ".png", len - _len);
}
/* Resets thumbnail path data
@@ -3554,7 +3554,7 @@ bool gfx_thumbnail_set_system(gfx_thumbnail_path_data_t *path_data,
/* Hack: There is only one MAME thumbnail repo,
* so filter any input starting with 'MAME...' */
if (strncmp(system, "MAME", 4) == 0)
path_data->system_len = strlcpy(path_data->system, "MAME", sizeof(path_data->system));
path_data->system_len = strlcpy_lit(path_data->system, "MAME", sizeof(path_data->system));
else
path_data->system_len = strlcpy(path_data->system, system, sizeof(path_data->system));
@@ -3714,14 +3714,14 @@ bool gfx_thumbnail_set_content_image(
img_dir, img_name, sizeof(path_data->content_path));
/* Set core name to "imageviewer" */
strlcpy(path_data->content_core_name,
strlcpy_lit(path_data->content_core_name,
"imageviewer",
sizeof(path_data->content_core_name));
/* Set database name (arbitrarily) to "_images_"
* (required for compatibility with gfx_thumbnail_update_path(),
* but not actually used...) */
strlcpy(path_data->content_db_name,
strlcpy_lit(path_data->content_db_name,
"_images_", sizeof(path_data->content_db_name));
/* Redundant error check */
@@ -4202,7 +4202,7 @@ void gfx_savestate_thumbnail_get_path(
path_remove_extension(new_path);
_len = strlcpy(entry_basename, path_basename(new_path), PATH_MAX_LENGTH);
_len = strlcpy(entry_basename + _len, ".state", PATH_MAX_LENGTH - _len);
_len = strlcpy_lit(entry_basename + _len, ".state", PATH_MAX_LENGTH - _len);
/* Set temporary save redirection paths */
runloop_path_set_redirect(config_get_ptr(), old_savefile_dir, old_savestate_dir);
+1 -1
View File
@@ -170,7 +170,7 @@ static bool crt_sr2_init(videocrt_switch_t *p_switch,
if (monitor_index+1 >= 0 && monitor_index+1 < 10)
snprintf(index, sizeof(index), "%d", monitor_index);
else
strlcpy(index, "0", sizeof(index));
strlcpy_lit(index, "0", sizeof(index));
video_context_driver_get_ident(&gfxctx);
+1 -1
View File
@@ -5523,7 +5523,7 @@ void video_driver_frame(const void *data, unsigned width,
audio_stats.close_to_blocking,
audio_stats.samples);
__len += strlcpy(video_info.stat_text + __len, "LATENCY\n",
__len += strlcpy_lit(video_info.stat_text + __len, "LATENCY\n",
sizeof(video_info.stat_text) - __len);
__len += snprintf(video_info.stat_text + __len, sizeof(video_info.stat_text) - __len,
+1 -1
View File
@@ -140,7 +140,7 @@ static bool create_softfilter_graph(rarch_softfilter_t *filt,
struct config_file_userdata userdata;
char key[64], name[64];
name[0] = '\0';
strlcpy(key, "filter", sizeof(key));
strlcpy_lit(key, "filter", sizeof(key));
if (!config_get_array(filt->conf, key, name, sizeof(name)))
{
+51 -51
View File
@@ -236,7 +236,7 @@ static void video_shader_replace_wildcards_impl(
_len = strlcpy(replace_text, settings->arrays.video_driver, sizeof(replace_text));
break;
case RARCH_WILDCARD_CORE_REQUESTED_ROTATION:
_len = strlcpy(replace_text, "CORE-REQ-ROT-", sizeof(replace_text));
_len = strlcpy_lit(replace_text, "CORE-REQ-ROT-", sizeof(replace_text));
_len += snprintf(
replace_text + _len,
sizeof(replace_text) - _len,
@@ -244,15 +244,15 @@ static void video_shader_replace_wildcards_impl(
core_requested_rotation * 90);
break;
case RARCH_WILDCARD_VIDEO_ALLOW_CORE_ROTATION:
_len = strlcpy(replace_text, "VID-ALLOW-CORE-ROT-O",
_len = strlcpy_lit(replace_text, "VID-ALLOW-CORE-ROT-O",
sizeof(replace_text));
if (settings->bools.video_allow_rotate)
_len += strlcpy(replace_text + _len, "N", sizeof(replace_text) - _len);
_len += strlcpy_lit(replace_text + _len, "N", sizeof(replace_text) - _len);
else
_len += strlcpy(replace_text + _len, "FF", sizeof(replace_text) - _len);
_len += strlcpy_lit(replace_text + _len, "FF", sizeof(replace_text) - _len);
break;
case RARCH_WILDCARD_VIDEO_USER_ROTATION:
_len = strlcpy(replace_text, "VID-USER-ROT-", sizeof(replace_text));
_len = strlcpy_lit(replace_text, "VID-USER-ROT-", sizeof(replace_text));
_len += snprintf(
replace_text + _len,
sizeof(replace_text) - _len,
@@ -260,7 +260,7 @@ static void video_shader_replace_wildcards_impl(
settings->uints.video_rotation * 90);
break;
case RARCH_WILDCARD_VIDEO_FINAL_ROTATION:
_len = strlcpy(replace_text, "VID-FINAL-ROT-", sizeof(replace_text));
_len = strlcpy_lit(replace_text, "VID-FINAL-ROT-", sizeof(replace_text));
_len += snprintf(
replace_text + _len,
sizeof(replace_text) - _len,
@@ -268,7 +268,7 @@ static void video_shader_replace_wildcards_impl(
retroarch_get_rotation() * 90);
break;
case RARCH_WILDCARD_SCREEN_ORIENTATION:
_len = strlcpy(replace_text, "SCREEN-ORIENT-", sizeof(replace_text));
_len = strlcpy_lit(replace_text, "SCREEN-ORIENT-", sizeof(replace_text));
_len += snprintf(
replace_text + _len,
sizeof(replace_text) - _len,
@@ -325,20 +325,20 @@ static void video_shader_replace_wildcards_impl(
case RARCH_WILDCARD_VIDEO_DRIVER_SHADER_EXT:
/* Uses pre-fetched ctx_flags (#2) */
if (BIT32_GET(ctx_flags.flags, GFX_CTX_FLAGS_SHADERS_CG))
_len = strlcpy(replace_text, "cg", sizeof(replace_text));
_len = strlcpy_lit(replace_text, "cg", sizeof(replace_text));
else if (BIT32_GET(ctx_flags.flags, GFX_CTX_FLAGS_SHADERS_GLSL))
_len = strlcpy(replace_text, "glsl", sizeof(replace_text));
_len = strlcpy_lit(replace_text, "glsl", sizeof(replace_text));
else if (BIT32_GET(ctx_flags.flags, GFX_CTX_FLAGS_SHADERS_SLANG))
_len = strlcpy(replace_text, "slang", sizeof(replace_text));
_len = strlcpy_lit(replace_text, "slang", sizeof(replace_text));
break;
case RARCH_WILDCARD_VIDEO_DRIVER_PRESET_EXT:
/* Uses pre-fetched ctx_flags (#2) */
if (BIT32_GET(ctx_flags.flags, GFX_CTX_FLAGS_SHADERS_CG))
_len = strlcpy(replace_text, "cgp", sizeof(replace_text));
_len = strlcpy_lit(replace_text, "cgp", sizeof(replace_text));
else if (BIT32_GET(ctx_flags.flags, GFX_CTX_FLAGS_SHADERS_GLSL))
_len = strlcpy(replace_text, "glslp", sizeof(replace_text));
_len = strlcpy_lit(replace_text, "glslp", sizeof(replace_text));
else if (BIT32_GET(ctx_flags.flags, GFX_CTX_FLAGS_SHADERS_SLANG))
_len = strlcpy(replace_text, "slangp", sizeof(replace_text));
_len = strlcpy_lit(replace_text, "slangp", sizeof(replace_text));
break;
default:
break;
@@ -672,7 +672,7 @@ static bool video_shader_parse_pass(config_file_t *conf,
snprintf(formatted_num, sizeof(formatted_num), "%u", i);
/* Source */
_len = strlcpy(shader_var, "shader", sizeof(shader_var));
_len = strlcpy_lit(shader_var, "shader", sizeof(shader_var));
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
if (config_get_path(conf, shader_var, tmp_path, sizeof(tmp_path)) == 0)
@@ -689,7 +689,7 @@ static bool video_shader_parse_pass(config_file_t *conf,
PATH_MAX_LENGTH, conf->path);
/* Smooth */
_len = strlcpy(shader_var, "filter_linear", sizeof(shader_var));
_len = strlcpy_lit(shader_var, "filter_linear", sizeof(shader_var));
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
if (config_get_bool(conf, shader_var, &tmp_bool))
@@ -698,21 +698,21 @@ static bool video_shader_parse_pass(config_file_t *conf,
pass->filter = RARCH_FILTER_UNSPEC;
/* Wrapping mode */
_len = strlcpy(shader_var, "wrap_mode", sizeof(shader_var));
_len = strlcpy_lit(shader_var, "wrap_mode", sizeof(shader_var));
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
if ((entry = config_get_entry(conf, shader_var))
&& (entry->value && *entry->value))
pass->wrap = video_shader_wrap_str_to_mode(entry->value);
/* Frame count mod */
_len = strlcpy(shader_var, "frame_count_mod", sizeof(shader_var));
_len = strlcpy_lit(shader_var, "frame_count_mod", sizeof(shader_var));
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
if ((entry = config_get_entry(conf, shader_var))
&& (entry->value && *entry->value))
pass->frame_count_mod = (unsigned)strtoul(entry->value, NULL, 0);
/* FBO types and mipmapping */
_len = strlcpy(shader_var, "srgb_framebuffer", sizeof(shader_var));
_len = strlcpy_lit(shader_var, "srgb_framebuffer", sizeof(shader_var));
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
if (config_get_bool(conf, shader_var, &tmp_bool))
{
@@ -722,7 +722,7 @@ static bool video_shader_parse_pass(config_file_t *conf,
pass->fbo.flags &= ~FBO_SCALE_FLAG_SRGB_FBO;
}
_len = strlcpy(shader_var, "float_framebuffer", sizeof(shader_var));
_len = strlcpy_lit(shader_var, "float_framebuffer", sizeof(shader_var));
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
if (config_get_bool(conf, shader_var, &tmp_bool))
{
@@ -732,7 +732,7 @@ static bool video_shader_parse_pass(config_file_t *conf,
pass->fbo.flags &= ~FBO_SCALE_FLAG_FP_FBO;
}
_len = strlcpy(shader_var, "rgb10_framebuffer", sizeof(shader_var));
_len = strlcpy_lit(shader_var, "rgb10_framebuffer", sizeof(shader_var));
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
if (config_get_bool(conf, shader_var, &tmp_bool))
{
@@ -751,27 +751,27 @@ static bool video_shader_parse_pass(config_file_t *conf,
pass->fbo.flags &= ~FBO_SCALE_FLAG_RGB10_FBO;
}
_len = strlcpy(shader_var, "mipmap_input", sizeof(shader_var));
_len = strlcpy_lit(shader_var, "mipmap_input", sizeof(shader_var));
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
if (config_get_bool(conf, shader_var, &tmp_bool))
pass->mipmap = tmp_bool;
_len = strlcpy(shader_var, "alias", sizeof(shader_var));
_len = strlcpy_lit(shader_var, "alias", sizeof(shader_var));
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
if (!config_get_array(conf, shader_var, pass->alias, sizeof(pass->alias)))
*pass->alias = '\0';
/* Scale */
scale = &pass->fbo;
_len = strlcpy(shader_var, "scale_type", sizeof(shader_var));
_len = strlcpy_lit(shader_var, "scale_type", sizeof(shader_var));
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
config_get_array(conf, shader_var, scale_type, sizeof(scale_type));
_len = strlcpy(shader_var, "scale_type_x", sizeof(shader_var));
_len = strlcpy_lit(shader_var, "scale_type_x", sizeof(shader_var));
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
config_get_array(conf, shader_var, scale_type_x, sizeof(scale_type_x));
_len = strlcpy(shader_var, "scale_type_y", sizeof(shader_var));
_len = strlcpy_lit(shader_var, "scale_type_y", sizeof(shader_var));
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
config_get_array(conf, shader_var, scale_type_y, sizeof(scale_type_y));
@@ -819,7 +819,7 @@ static bool video_shader_parse_pass(config_file_t *conf,
}
}
_len = strlcpy(shader_var, "scale", sizeof(shader_var));
_len = strlcpy_lit(shader_var, "scale", sizeof(shader_var));
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
if (scale->type_x == RARCH_SCALE_ABSOLUTE)
@@ -832,7 +832,7 @@ static bool video_shader_parse_pass(config_file_t *conf,
scale->abs_x = (unsigned)roundf(fattr);
else
{
_len = strlcpy(shader_var, "scale_x", sizeof(shader_var));
_len = strlcpy_lit(shader_var, "scale_x", sizeof(shader_var));
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
if (config_get_int(conf, shader_var, &iattr))
scale->abs_x = iattr;
@@ -847,14 +847,14 @@ static bool video_shader_parse_pass(config_file_t *conf,
scale->scale_x = fattr;
else
{
_len = strlcpy(shader_var, "scale_x", sizeof(shader_var));
_len = strlcpy_lit(shader_var, "scale_x", sizeof(shader_var));
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
if (config_get_float(conf, shader_var, &fattr))
scale->scale_x = fattr;
}
}
_len = strlcpy(shader_var, "scale", sizeof(shader_var));
_len = strlcpy_lit(shader_var, "scale", sizeof(shader_var));
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
if (scale->type_y == RARCH_SCALE_ABSOLUTE)
@@ -867,7 +867,7 @@ static bool video_shader_parse_pass(config_file_t *conf,
scale->abs_y = (unsigned)roundf(fattr);
else
{
_len = strlcpy(shader_var, "scale_y", sizeof(shader_var));
_len = strlcpy_lit(shader_var, "scale_y", sizeof(shader_var));
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
if (config_get_int(conf, shader_var, &iattr))
scale->abs_y = iattr;
@@ -882,7 +882,7 @@ static bool video_shader_parse_pass(config_file_t *conf,
scale->scale_y = fattr;
else
{
_len = strlcpy(shader_var, "scale_y", sizeof(shader_var));
_len = strlcpy_lit(shader_var, "scale_y", sizeof(shader_var));
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
if (config_get_float(conf, shader_var, &fattr))
scale->scale_y = fattr;
@@ -967,7 +967,7 @@ static bool video_shader_parse_textures(config_file_t *conf,
strlcpy(idx, id_buf, sizeof(idx));
strlcpy(idx + id_len, "_linear", sizeof(idx) - id_len);
strlcpy_lit(idx + id_len, "_linear", sizeof(idx) - id_len);
if (config_get_bool(conf, idx, &smooth))
shader->lut[shader->luts].filter = smooth
? RARCH_FILTER_LINEAR
@@ -975,13 +975,13 @@ static bool video_shader_parse_textures(config_file_t *conf,
else
shader->lut[shader->luts].filter = RARCH_FILTER_UNSPEC;
strlcpy(idx + id_len, "_mipmap", sizeof(idx) - id_len);
strlcpy_lit(idx + id_len, "_mipmap", sizeof(idx) - id_len);
if (config_get_bool(conf, idx, &mipmap))
shader->lut[shader->luts].mipmap = mipmap;
else
shader->lut[shader->luts].mipmap = false;
strlcpy(idx + id_len, "_wrap_mode", sizeof(idx) - id_len);
strlcpy_lit(idx + id_len, "_wrap_mode", sizeof(idx) - id_len);
entry = NULL;
if ( (entry = config_get_entry(conf, idx))
&& (entry->value && *entry->value))
@@ -1285,11 +1285,11 @@ static void video_shader_write_scale_dim(config_file_t *conf,
size_t _len = strlcpy(dim_str, dim, sizeof(dim_str));
strlcpy(dim_str + _len, formatted_num, sizeof(dim_str) - _len);
_len = strlcpy(key, "scale_type_", sizeof(key));
_len = strlcpy_lit(key, "scale_type_", sizeof(key));
strlcpy(key + _len, dim_str, sizeof(key) - _len);
config_set_string(conf, key, video_shader_scale_type_to_str(type));
_len = strlcpy(key, "scale_", sizeof(key));
_len = strlcpy_lit(key, "scale_", sizeof(key));
strlcpy(key + _len, dim_str, sizeof(key) - _len);
if (type == RARCH_SCALE_ABSOLUTE)
config_set_int(conf, key, absolute);
@@ -1302,17 +1302,17 @@ static void video_shader_write_fbo(config_file_t *conf,
const struct gfx_fbo_scale *fbo)
{
char key[64];
size_t _len = strlcpy(key, "float_framebuffer", sizeof(key));
size_t _len = strlcpy_lit(key, "float_framebuffer", sizeof(key));
strlcpy(key + _len, formatted_num, sizeof(key) - _len);
config_set_string(conf, key, (fbo->flags & FBO_SCALE_FLAG_FP_FBO) ? "true" : "false");
_len = strlcpy(key, "srgb_framebuffer", sizeof(key));
_len = strlcpy_lit(key, "srgb_framebuffer", sizeof(key));
strlcpy(key + _len, formatted_num, sizeof(key) - _len);
config_set_string(conf, key, (fbo->flags & FBO_SCALE_FLAG_SRGB_FBO) ? "true" : "false");
/* Only emitted when set, so presets that do not use it stay
* byte-identical to what older builds wrote. */
if (fbo->flags & FBO_SCALE_FLAG_RGB10_FBO)
{
_len = strlcpy(key, "rgb10_framebuffer", sizeof(key));
_len = strlcpy_lit(key, "rgb10_framebuffer", sizeof(key));
strlcpy(key + _len, formatted_num, sizeof(key) - _len);
config_set_string(conf, key, "true");
}
@@ -1379,7 +1379,7 @@ static bool video_shader_write_root_preset(const struct video_shader *shader,
snprintf(formatted_num, sizeof(formatted_num), "%u", (unsigned)i);
_len = strlcpy(key, "shader", sizeof(key));
_len = strlcpy_lit(key, "shader", sizeof(key));
strlcpy(key + _len, formatted_num, sizeof(key) - _len);
strlcpy(tmp, pass->source.path, PATH_MAX_LENGTH);
@@ -1389,21 +1389,21 @@ static bool video_shader_write_root_preset(const struct video_shader *shader,
config_set_path(conf, key, tmp_rel);
_len = strlcpy(key, "alias", sizeof(key));
_len = strlcpy_lit(key, "alias", sizeof(key));
strlcpy(key + _len, formatted_num, sizeof(key) - _len);
config_set_string(conf, key, pass->alias);
_len = strlcpy(key, "wrap_mode", sizeof(key));
_len = strlcpy_lit(key, "wrap_mode", sizeof(key));
strlcpy(key + _len, formatted_num, sizeof(key) - _len);
config_set_string(conf, key, video_shader_wrap_mode_to_str(pass->wrap));
_len = strlcpy(key, "mipmap_input", sizeof(key));
_len = strlcpy_lit(key, "mipmap_input", sizeof(key));
strlcpy(key + _len, formatted_num, sizeof(key) - _len);
config_set_string(conf, key, pass->mipmap ? "true" : "false");
if (pass->filter != RARCH_FILTER_UNSPEC)
{
_len = strlcpy(key, "filter_linear", sizeof(key));
_len = strlcpy_lit(key, "filter_linear", sizeof(key));
strlcpy(key + _len, formatted_num, sizeof(key) - _len);
config_set_string(conf, key,
(pass->filter == RARCH_FILTER_LINEAR)
@@ -1413,7 +1413,7 @@ static bool video_shader_write_root_preset(const struct video_shader *shader,
if (pass->frame_count_mod)
{
_len = strlcpy(key, "frame_count_mod", sizeof(key));
_len = strlcpy_lit(key, "frame_count_mod", sizeof(key));
strlcpy(key + _len, formatted_num, sizeof(key) - _len);
config_set_int(conf, key, pass->frame_count_mod);
}
@@ -1445,7 +1445,7 @@ static bool video_shader_write_root_preset(const struct video_shader *shader,
if (_len + 1 + nlen >= sizeof(textures))
break;
_len += strlcpy(textures + _len, ";", sizeof(textures) - _len);
_len += strlcpy_lit(textures + _len, ";", sizeof(textures) - _len);
_len += strlcpy(textures + _len, shader->lut[i].id, sizeof(textures) - _len);
}
@@ -1464,7 +1464,7 @@ static bool video_shader_write_root_preset(const struct video_shader *shader,
_len = strlcpy(k, shader->lut[i].id, sizeof(k));
/* Mipmap On or Off */
strlcpy(k + _len, "_mipmap", sizeof(k) - _len);
strlcpy_lit(k + _len, "_mipmap", sizeof(k) - _len);
config_set_string(conf, k, shader->lut[i].mipmap
? "true"
: "false");
@@ -1472,7 +1472,7 @@ static bool video_shader_write_root_preset(const struct video_shader *shader,
/* Linear filter ON or OFF */
if (shader->lut[i].filter != RARCH_FILTER_UNSPEC)
{
strlcpy(k + _len, "_linear", sizeof(k) - _len);
strlcpy_lit(k + _len, "_linear", sizeof(k) - _len);
config_set_string(conf, k,
(shader->lut[i].filter == RARCH_FILTER_LINEAR)
? "true"
@@ -1480,7 +1480,7 @@ static bool video_shader_write_root_preset(const struct video_shader *shader,
}
/* Wrap Mode */
strlcpy(k + _len, "_wrap_mode", sizeof(k) - _len);
strlcpy_lit(k + _len, "_wrap_mode", sizeof(k) - _len);
config_set_string(conf, k,
video_shader_wrap_mode_to_str(shader->lut[i].wrap));
}
@@ -3170,7 +3170,7 @@ bool video_shader_combine_preset_and_apply(
return false;
}
_len = strlcpy(combined_preset_name, "retroarch", sizeof(combined_preset_name));
_len = strlcpy_lit(combined_preset_name, "retroarch", sizeof(combined_preset_name));
strlcpy(combined_preset_name + _len, preset_ext, sizeof(combined_preset_name) - _len);
fill_pathname_join(combined_preset_path, temp_dir, combined_preset_name, PATH_MAX_LENGTH);
@@ -3273,7 +3273,7 @@ bool video_shader_apply_shader(
if (message)
{
size_t _len = strlcpy(msg, "Loading shader...", sizeof(msg));
size_t _len = strlcpy_lit(msg, "Loading shader...", sizeof(msg));
#ifdef HAVE_GFX_WIDGETS
if (dispwidget_get_ptr()->active)
gfx_widget_set_generic_message(msg, 2000);
@@ -461,7 +461,7 @@ bool gfx_widget_start_load_content_animation(void)
state->content_name_len = strlcpy(state->content_name,
core_info->display_name, sizeof(state->content_name));
else
state->content_name_len = strlcpy(state->content_name,
state->content_name_len = strlcpy_lit(state->content_name,
"RetroArch", sizeof(state->content_name));
}
@@ -475,7 +475,7 @@ bool gfx_widget_start_load_content_animation(void)
core_info->display_name, sizeof(state->system_name));
/* Otherwise, just use 'RetroArch' as a fallback */
else
state->system_name_len = strlcpy(state->system_name,
state->system_name_len = strlcpy_lit(state->system_name,
"RetroArch", sizeof(state->system_name));
}
@@ -540,7 +540,7 @@ bool gfx_widget_start_load_content_animation(void)
* use default 'retroarch' icon as a fallback */
if (!state->has_icon)
{
strlcpy(state->icon_file, "retroarch.png", sizeof(state->icon_file));
strlcpy_lit(state->icon_file, "retroarch.png", sizeof(state->icon_file));
fill_pathname_join_special(state->icon_path,
state->icon_directory, state->icon_file,
sizeof(state->icon_path));
+12 -12
View File
@@ -1857,9 +1857,9 @@ static void handle_hotplug(android_input_t *android,
/* if the actual controller has not been mapped yet,
* then configure Virtual device for now */
if (strstr(device_name, "Virtual") && android->pads_connected==0)
strlcpy (name_buf, "SHIELD Virtual Controller", sizeof(name_buf));
strlcpy_lit(name_buf, "SHIELD Virtual Controller", sizeof(name_buf));
else
strlcpy (name_buf, "NVIDIA SHIELD Controller", sizeof(name_buf));
strlcpy_lit(name_buf, "NVIDIA SHIELD Controller", sizeof(name_buf));
/* apply the hack only for the first controller
* store the id for later use
@@ -1890,7 +1890,7 @@ static void handle_hotplug(android_input_t *android,
if ( pad_id2 > 0)
return;
strlcpy (name_buf, "NVIDIA SHIELD Portable", sizeof(name_buf));
strlcpy_lit(name_buf, "NVIDIA SHIELD Portable", sizeof(name_buf));
}
}
@@ -1909,7 +1909,7 @@ static void handle_hotplug(android_input_t *android,
id = pad_id1;
return;
}
strlcpy (name_buf, "NVIDIA SHIELD Gamepad", sizeof(name_buf));
strlcpy_lit(name_buf, "NVIDIA SHIELD Gamepad", sizeof(name_buf));
}
}
@@ -1919,7 +1919,7 @@ static void handle_hotplug(android_input_t *android,
*/
/* to-do: add DS4 on Bravia ATV */
else if (strstr(device_name, "NVIDIA"))
strlcpy (name_buf, "Android Gamepad", sizeof(name_buf));
strlcpy_lit(name_buf, "Android Gamepad", sizeof(name_buf));
/* GPD XD
* This is a simple hack, basically groups the "back"
@@ -1940,7 +1940,7 @@ static void handle_hotplug(android_input_t *android,
if ( pad_id2 > 0)
return;
strlcpy (name_buf, "GPD XD", sizeof(name_buf));
strlcpy_lit(name_buf, "GPD XD", sizeof(name_buf));
*port = 0;
}
}
@@ -1973,7 +1973,7 @@ static void handle_hotplug(android_input_t *android,
if ( pad_id2 > 0)
return;
strlcpy (name_buf, "XPERIA Play", sizeof(name_buf));
strlcpy_lit(name_buf, "XPERIA Play", sizeof(name_buf));
*port = 0;
}
}
@@ -1996,7 +1996,7 @@ static void handle_hotplug(android_input_t *android,
if ( pad_id2 > 0)
return;
strlcpy (name_buf, "ARCHOS GamePad", sizeof(name_buf));
strlcpy_lit(name_buf, "ARCHOS GamePad", sizeof(name_buf));
*port = 0;
}
}
@@ -2048,17 +2048,17 @@ static void handle_hotplug(android_input_t *android,
}
else if (strstr(device_name, "iControlPad-"))
strlcpy(name_buf, "iControlPad HID Joystick profile", sizeof(name_buf));
strlcpy_lit(name_buf, "iControlPad HID Joystick profile", sizeof(name_buf));
else if (strstr(device_name, "TTT THT Arcade console 2P USB Play"))
{
if (*port == 0)
strlcpy(name_buf, "TTT THT Arcade (User 1)", sizeof(name_buf));
strlcpy_lit(name_buf, "TTT THT Arcade (User 1)", sizeof(name_buf));
else if (*port == 1)
strlcpy(name_buf, "TTT THT Arcade (User 2)", sizeof(name_buf));
strlcpy_lit(name_buf, "TTT THT Arcade (User 2)", sizeof(name_buf));
}
else if (strstr(device_name, "MOGA"))
strlcpy(name_buf, "Moga IME", sizeof(name_buf));
strlcpy_lit(name_buf, "Moga IME", sizeof(name_buf));
/* If device is keyboard only and didn't match any of the devices above
* then assume it is a keyboard, register the id, and return unless the
+3 -3
View File
@@ -231,9 +231,9 @@ static void qnx_input_autodetect_gamepad(qnx_input_t *qnx,
if (controller && controller->type == SCREEN_EVENT_GAMEPAD)
{
if (strstr(controller->id, "0-054C-05C4-1.0"))
strlcpy(name_buf, "DS4 Controller", sizeof(name_buf));
strlcpy_lit(name_buf, "DS4 Controller", sizeof(name_buf));
else
strlcpy(name_buf, "QNX Gamepad", sizeof(name_buf));
strlcpy_lit(name_buf, "QNX Gamepad", sizeof(name_buf));
}
if (name_buf && *name_buf)
@@ -655,7 +655,7 @@ static void *qnx_input_init(const char *joypad_driver)
qnx_discover_controllers(qnx);
#else
/* Initialize Playbook keyboard. */
strlcpy(qnx->devices[0].id, "0A5C-8502",
strlcpy_lit(qnx->devices[0].id, "0A5C-8502",
sizeof(qnx->devices[0].id));
qnx_input_autodetect_gamepad(qnx, &qnx->devices[0]);
qnx->pads_connected = 1;
+1 -1
View File
@@ -4149,7 +4149,7 @@ static void *udev_input_init(const char *joypad_driver)
* video context driver), and on next boot user would be stuck with a
* possibly nonworking configuration.
*/
strlcpy(settings->arrays.input_driver, "linuxraw",
strlcpy_lit(settings->arrays.input_driver, "linuxraw",
sizeof(settings->arrays.input_driver));
RARCH_WARN("[udev] First boot and without input devices, forcing fallback to linuxraw.\n");
goto error;
+1 -1
View File
@@ -230,7 +230,7 @@ static void winraw_mouse_names_handler(retro_task_t *task)
}
if (!name[0])
strlcpy(name, "<name not found>",
strlcpy_lit(name, "<name not found>",
sizeof(h->entries[i].name));
}
}
+2 -2
View File
@@ -197,7 +197,7 @@ retry:
else if (event->mask & (IN_CREATE | IN_ATTRIB))
{
char path[256];
size_t _len = strlcpy(path, "/dev/input/", sizeof(path));
size_t _len = strlcpy_lit(path, "/dev/input/", sizeof(path));
strlcpy(path + _len, event->name, sizeof(path) - _len);
RARCH_DBG("[LinuxRaw] Reconnecting \"%s\".\n",path);
@@ -233,7 +233,7 @@ static void *linuxraw_joypad_init(void *data)
return NULL;
linuxraw_epoll = fd;
_len = strlcpy(path, "/dev/input/js", sizeof(path));
_len = strlcpy_lit(path, "/dev/input/js", sizeof(path));
for (i = 0; i < MAX_USERS; i++)
{
+1 -1
View File
@@ -238,7 +238,7 @@ static void *parport_joypad_init(void *data)
char buf[PARPORT_NUM_BUTTONS * 3 + 1] = {0};
char pin[3 + 1] = {0};
size_t _len =
strlcpy(path, "/dev/parport", sizeof(path));
strlcpy_lit(path, "/dev/parport", sizeof(path));
memset(buf, 0, PARPORT_NUM_BUTTONS * 3 + 1);
+10 -10
View File
@@ -4632,7 +4632,7 @@ size_t input_config_get_bind_string(
else if (*key != '\0')
{
if (delim)
_len += strlcpy(s + _len, ", ", len - _len);
_len += strlcpy_lit(s + _len, ", ", len - _len);
_len += snprintf(s + _len, len - _len,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_KEY), key);
delim = 1;
@@ -4677,7 +4677,7 @@ size_t input_config_get_bind_string(
if (tag != 0)
{
if (delim)
_len += strlcpy(s + _len, ", ", len - _len);
_len += strlcpy_lit(s + _len, ", ", len - _len);
_len += strlcpy(s + _len, msg_hash_to_str((enum msg_hash_enums)tag), len - _len);
}
}
@@ -4709,19 +4709,19 @@ size_t input_config_get_bind_string_joykey(
switch (GET_HAT_DIR(bind->joykey))
{
case HAT_UP_MASK:
_len += strlcpy(s + _len, "Up", len - _len);
_len += strlcpy_lit(s + _len, "Up", len - _len);
break;
case HAT_DOWN_MASK:
_len += strlcpy(s + _len, "Down", len - _len);
_len += strlcpy_lit(s + _len, "Down", len - _len);
break;
case HAT_LEFT_MASK:
_len += strlcpy(s + _len, "Left", len - _len);
_len += strlcpy_lit(s + _len, "Left", len - _len);
break;
case HAT_RIGHT_MASK:
_len += strlcpy(s + _len, "Right", len - _len);
_len += strlcpy_lit(s + _len, "Right", len - _len);
break;
default:
_len += strlcpy(s + _len, "?", len - _len);
_len += strlcpy_lit(s + _len, "?", len - _len);
break;
}
}
@@ -4734,7 +4734,7 @@ size_t input_config_get_bind_string_joykey(
joykey_label, suffix, ' ', len);
/* TODO/FIXME - localize */
_len = strlcpy(s, "Button ", len);
_len = strlcpy_lit(s, "Button ", len);
_len += snprintf(s + _len, len - _len, "%u",
(unsigned)bind->joykey);
}
@@ -4760,7 +4760,7 @@ size_t input_config_get_bind_string_joyaxis(
joyaxis_label, suffix, ' ', len);
/* TODO/FIXME - localize */
_len = strlcpy(s, "Axis ", len);
_len = strlcpy_lit(s, "Axis ", len);
if (AXIS_NEG_GET(bind->joyaxis) != AXIS_DIR_NONE)
_len += snprintf(s + _len, len - _len, "-%u",
@@ -6565,7 +6565,7 @@ static const char *input_overlay_path(bool want_osk)
char *ext = path_get_extension_mutable(system_overlay_path);
if (!ext)
ext = system_overlay_path + _len;
strlcpy(ext, ".cfg", 5);
strlcpy_lit(ext, ".cfg", 5);
if (path_is_valid(system_overlay_path))
return system_overlay_path;
}
+1 -1
View File
@@ -79,7 +79,7 @@ static int setup_gpio(int gpio)
if (!(fp = fopen(buf, "w")))
{
strlcpy(buf, "/sys/class/gpio/export", sizeof(buf));
strlcpy_lit(buf, "/sys/class/gpio/export", sizeof(buf));
/* Failed to export GPIO? */
if (!(fp = fopen(buf, "w")))
+9 -1
View File
@@ -16,6 +16,9 @@ TEST_GENERIC_QUEUE_SRC = test/queues/test_generic_queue.c queues/generic_queue.c
TEST_LINKED_LIST = test/lists/test_linked_list
TEST_LINKED_LIST_SRC = test/lists/test_linked_list.c lists/linked_list.c
TEST_STRL = test/compat/test_strl
TEST_STRL_SRC = test/compat/test_strl.c compat/compat_strl.c
TEST_MENU_STR = test/menu/test_menu_str
TEST_MENU_STR_SRC = test/menu/test_menu_str.c ../menu/menu_str.c \
string/stdstring.c encodings/encoding_utf.c compat/compat_strl.c
@@ -209,6 +212,10 @@ all:
$(CC) $(TEST_UNIT_CFLAGS) $(TEST_FILE_LIST_SRC) $(LIBCHECK_LIBS) -o $(TEST_FILE_LIST)
$(TEST_FILE_LIST)
lcov -c -d . -o `dirname $(TEST_FILE_LIST)`/file_list_coverage.info
# strl
$(CC) $(TEST_UNIT_CFLAGS) $(TEST_STRL_SRC) $(LIBCHECK_LIBS) -o $(TEST_STRL)
$(TEST_STRL)
lcov -c -d . -o `dirname $(TEST_STRL)`/coverage.info
# menu_str
$(CC) $(TEST_UNIT_CFLAGS) -I.. $(TEST_MENU_STR_SRC) $(LIBCHECK_LIBS) -o $(TEST_MENU_STR)
$(TEST_MENU_STR)
@@ -246,6 +253,7 @@ all:
-a test/lists/file_list_coverage.info \
-a test/memory/coverage.info \
-a test/menu/coverage.info \
-a test/compat/coverage.info \
-a test/queues/coverage.info \
-a test/formats/coverage.info
genhtml -o test/coverage/ test/coverage.info
@@ -254,7 +262,7 @@ clean:
rm -f *.gcda *.gcno
rm -f $(TEST_STDSTRING) $(TEST_UTILS) $(TEST_HASH) \
$(TEST_LINKED_LIST) $(TEST_FILE_LIST) $(TEST_MEMPOOL) \
$(TEST_MENU_STR) \
$(TEST_MENU_STR) $(TEST_STRL) \
$(TEST_GENERIC_QUEUE) \
$(TEST_RPNG) $(TEST_RWAV) $(TEST_RJPEG) $(TEST_RWEBM_AUDIO)
rm -f test/*/*.gcda test/*/*.gcno test/*/coverage.info \
+9 -9
View File
@@ -1749,7 +1749,7 @@ struct string_list* cdrom_get_available_drives(void)
if (*drive_model)
strlcpy(drive_string, drive_model, sizeof(drive_string));
else
strlcpy(drive_string, "Unknown Drive", sizeof(drive_string));
strlcpy_lit(drive_string, "Unknown Drive", sizeof(drive_string));
string_list_append(list, drive_string, attr);
}
@@ -1850,7 +1850,7 @@ struct string_list* cdrom_get_available_drives(void)
if (*drive_model)
strlcpy(drive_string, drive_model, sizeof(drive_string));
else
strlcpy(drive_string, "Unknown Drive", sizeof(drive_string));
strlcpy_lit(drive_string, "Unknown Drive", sizeof(drive_string));
string_list_append(list, drive_string, attr);
}
@@ -1891,7 +1891,7 @@ struct string_list* cdrom_get_available_drives(void)
if (*drive_model)
strlcpy(drive_string, drive_model, sizeof(drive_string));
else
strlcpy(drive_string, "Unknown Drive", sizeof(drive_string));
strlcpy_lit(drive_string, "Unknown Drive", sizeof(drive_string));
string_list_append(list, drive_string, attr);
}
@@ -2100,20 +2100,20 @@ size_t cdrom_device_fillpath(char *s, size_t len, char drive, unsigned char trac
if (is_cue)
{
#ifdef _WIN32
size_t _len = strlcpy(s, "cdrom://", len);
size_t _len = strlcpy_lit(s, "cdrom://", len);
if (len > _len)
s[_len++] = drive;
_len += strlcpy(s + _len, ":/drive.cue", len - _len);
_len += strlcpy_lit(s + _len, ":/drive.cue", len - _len);
return _len;
#else
#if defined(__linux__) || defined(__APPLE__)
size_t _len = strlcpy(s, "cdrom://drive", len);
size_t _len = strlcpy_lit(s, "cdrom://drive", len);
if (len > _len + 1)
{
s[_len++] = drive;
s[_len] = '\0';
}
_len += strlcpy(s + _len, ".cue", len - _len);
_len += strlcpy_lit(s + _len, ".cue", len - _len);
return _len;
#endif
#endif
@@ -2121,7 +2121,7 @@ size_t cdrom_device_fillpath(char *s, size_t len, char drive, unsigned char trac
else
{
#ifdef _WIN32
size_t _len = strlcpy(s, "cdrom://", len);
size_t _len = strlcpy_lit(s, "cdrom://", len);
if (len > _len + 1)
{
s[_len++] = drive;
@@ -2131,7 +2131,7 @@ size_t cdrom_device_fillpath(char *s, size_t len, char drive, unsigned char trac
return _len;
#else
#if defined(__linux__) || defined(__APPLE__)
size_t _len = strlcpy(s, "cdrom://drive", len);
size_t _len = strlcpy_lit(s, "cdrom://drive", len);
if (len > _len)
s[_len++] = drive;
_len += snprintf(s + _len, len - _len, "-track%02d.bin", track);
+1 -1
View File
@@ -138,7 +138,7 @@ dylib_t dylib_load(const char *path)
char fw_path[PATH_MAX_LENGTH];
const char *fw_name = path_basename(path);
size_t _len = strlcpy(fw_path, path, sizeof(fw_path));
_len += strlcpy(fw_path + _len, "/", sizeof(fw_path) - _len);
_len += strlcpy_lit(fw_path + _len, "/", sizeof(fw_path) - _len);
/* Assume every framework binary is named for the framework. Not always
* a great assumption but correct enough for our uses. */
strlcpy(fw_path + _len, fw_name, strlen(fw_name) - STRLEN_CONST(fw_suffix) + 1);
+44
View File
@@ -40,6 +40,7 @@
#endif
#include <retro_common_api.h>
#include <retro_inline.h>
RETRO_BEGIN_DECLS
@@ -70,6 +71,49 @@ size_t strlcat(char *s, const char *source, size_t len);
#endif
/**
* @brief Copy a string \b literal, without scanning it at runtime.
*
* \c strlcpy() begins with \c strlen() of its source, and because it
* lives in another translation unit that scan happens at runtime even
* when the source is a literal whose length the compiler already knows.
* The scan is roughly half the cost of a \c strlcpy() of a short string
* -- there is a fixed setup cost before a single byte is compared -- so
* for a literal it is pure overhead.
*
* @param dst Destination buffer.
* @param lit A string \b literal. Anything else is a compile error:
* the \c "" concatenation below only parses for a literal,
* which is what keeps \c sizeof from silently measuring a
* pointer instead of the characters.
* @param size Size of @p dst, exactly as for \c strlcpy().
*
* @return The length of @p lit, matching \c strlcpy().
*
* The destination bound is not dropped: when the literal (with its
* terminator) does not fit, this defers to \c strlcpy() so the copy
* truncates rather than overruns. With a compile-time @p size the test
* folds away and only one arm survives; with a runtime @p size it costs
* a comparison that predicts perfectly.
*/
static INLINE size_t strlcpy_lit_(char *s, const char *lit,
size_t lit_size, size_t len)
{
/* lit_size is sizeof() of a literal, so it is a constant at every
* call site and this branch folds away; when @len is a constant too
* -- sizeof(buf), the common case -- the whole call becomes the
* stores memcpy() compiles to. */
if (lit_size <= len)
{
memcpy(s, lit, lit_size);
return lit_size - 1;
}
return strlcpy(s, lit, len);
}
#define strlcpy_lit(dst, lit, size) \
strlcpy_lit_((dst), "" lit, sizeof("" lit), (size))
/**
* A version of \c strndup(3) that guarantees the result will be null-terminated.
*
+10 -10
View File
@@ -355,7 +355,7 @@ bool media_detect_cd_info(const char *path, uint64_t pregap_bytes, media_detect_
* but I have not seen any real examples of them. */
info->system_id = MEDIA_CD_SYSTEM_MEGA_CD;
strlcpy(info->system, "Sega CD / Mega CD", sizeof(info->system));
strlcpy_lit(info->system, "Sega CD / Mega CD", sizeof(info->system));
title_pos = buf + offset + 0x150;
@@ -365,7 +365,7 @@ bool media_detect_cd_info(const char *path, uint64_t pregap_bytes, media_detect_
media_zero_trailing_spaces(info->title, sizeof(info->title));
}
else
strlcpy(info->title, "N/A", sizeof(info->title));
strlcpy_lit(info->title, "N/A", sizeof(info->title));
serial_pos = buf + offset + 0x183;
@@ -392,7 +392,7 @@ bool media_detect_cd_info(const char *path, uint64_t pregap_bytes, media_detect_
info->system_id = MEDIA_CD_SYSTEM_SATURN;
strlcpy(info->system, "Sega Saturn", sizeof(info->system));
strlcpy_lit(info->system, "Sega Saturn", sizeof(info->system));
title_pos = buf + offset + 0x60;
@@ -402,7 +402,7 @@ bool media_detect_cd_info(const char *path, uint64_t pregap_bytes, media_detect_
media_zero_trailing_spaces(info->title, sizeof(info->title));
}
else
strlcpy(info->title, "N/A", sizeof(info->title));
strlcpy_lit(info->title, "N/A", sizeof(info->title));
serial_pos = buf + offset + 0x20;
@@ -458,7 +458,7 @@ bool media_detect_cd_info(const char *path, uint64_t pregap_bytes, media_detect_
info->system_id = MEDIA_CD_SYSTEM_DREAMCAST;
strlcpy(info->system, "Sega Dreamcast", sizeof(info->system));
strlcpy_lit(info->system, "Sega Dreamcast", sizeof(info->system));
title_pos = buf + offset + 0x80;
@@ -468,7 +468,7 @@ bool media_detect_cd_info(const char *path, uint64_t pregap_bytes, media_detect_
media_zero_trailing_spaces(info->title, sizeof(info->title));
}
else
strlcpy(info->title, "N/A", sizeof(info->title));
strlcpy_lit(info->title, "N/A", sizeof(info->title));
serial_pos = buf + offset + 0x40;
@@ -522,7 +522,7 @@ bool media_detect_cd_info(const char *path, uint64_t pregap_bytes, media_detect_
info->system_id = MEDIA_CD_SYSTEM_PSX;
strlcpy(info->system, "Sony PlayStation", sizeof(info->system));
strlcpy_lit(info->system, "Sony PlayStation", sizeof(info->system));
title_pos = buf + offset + (16 * sector_size) + 40;
@@ -532,17 +532,17 @@ bool media_detect_cd_info(const char *path, uint64_t pregap_bytes, media_detect_
media_zero_trailing_spaces(info->title, sizeof(info->title));
}
else
strlcpy(info->title, "N/A", sizeof(info->title));
strlcpy_lit(info->title, "N/A", sizeof(info->title));
}
else if (!memcmp(buf + offset, "\x01\x5a\x5a\x5a\x5a\x5a\x01\x00\x00\x00\x00\x00", 12))
{
info->system_id = MEDIA_CD_SYSTEM_3DO;
strlcpy(info->system, "3DO", sizeof(info->system));
strlcpy_lit(info->system, "3DO", sizeof(info->system));
}
else if (!memcmp(buf + offset + 0x950, "PC Engine CD-ROM SYSTEM", 23))
{
info->system_id = MEDIA_CD_SYSTEM_PC_ENGINE_CD;
strlcpy(info->system, "TurboGrafx-CD / PC-Engine CD", sizeof(info->system));
strlcpy_lit(info->system, "TurboGrafx-CD / PC-Engine CD", sizeof(info->system));
}
free(buf);
+5 -5
View File
@@ -168,13 +168,13 @@ failure:
return false;
}
strlcpy(list->entries[0].name, "lo", sizeof(list->entries[0].name));
strlcpy(list->entries[0].host, "127.0.0.1", sizeof(list->entries[0].host));
strlcpy_lit(list->entries[0].name, "lo", sizeof(list->entries[0].name));
strlcpy_lit(list->entries[0].host, "127.0.0.1", sizeof(list->entries[0].host));
list->size = 1;
if (!sceNetCtlInetGetInfo(SCE_NETCTL_INFO_GET_IP_ADDRESS, &info))
{
strlcpy(list->entries[1].name, "wlan", sizeof(list->entries[1].name));
strlcpy_lit(list->entries[1].name, "wlan", sizeof(list->entries[1].name));
strlcpy(list->entries[1].host, info.ip_address,
sizeof(list->entries[1].host));
list->size++;
@@ -189,8 +189,8 @@ failure:
return false;
}
strlcpy(list->entries[0].name, "lo", sizeof(list->entries[0].name));
strlcpy(list->entries[0].host, "127.0.0.1", sizeof(list->entries[0].host));
strlcpy_lit(list->entries[0].name, "lo", sizeof(list->entries[0].name));
strlcpy_lit(list->entries[0].host, "127.0.0.1", sizeof(list->entries[0].host));
list->size = 1;
#if defined(HAVE_LIBNX)
+1 -1
View File
@@ -296,7 +296,7 @@ chdstream_get_meta(chd_file *chd, int idx, metadata_t *md)
if (err == CHDERR_NONE)
{
md->track = 1;
strlcpy(md->type, "DVD", sizeof(md->type));
strlcpy_lit(md->type, "DVD", sizeof(md->type));
return true;
}
+122
View File
@@ -0,0 +1,122 @@
/* Tests for strlcpy_lit(), the literal-source form of strlcpy().
*
* strlcpy() opens with strlen() of its source, and because it lives in
* another translation unit that scan happens at runtime even when the
* source is a literal the compiler has already measured. strlcpy_lit()
* hands the length over as sizeof(), so the copy folds to stores.
*
* The property that matters is that it is a drop-in: for every literal
* length against every destination size, the bytes written, the
* terminator and the return value all have to match what strlcpy()
* would have produced -- including when the literal does not fit, where
* dropping the bound would turn a truncation into an overrun. The
* exhaustive case below pins that across the whole small-size matrix
* rather than at a few hand-picked points.
*/
#include <check.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <compat/strl.h>
#define SUITE_NAME "strl"
/* Compares strlcpy_lit() against strlcpy() for one literal, over every
* destination size from 0 up past the literal's length. The buffer is
* poisoned first so an unwritten tail is visible, and the full buffer
* is compared so an overrun past the terminator is caught. */
#define CHECK_LIT(lit) \
do { \
size_t sz; \
for (sz = 0; sz <= sizeof("" lit) + 4; sz++) \
{ \
char a[64], b[64]; \
size_t ra, rb; \
memset(a, '\xA5', sizeof(a)); \
memset(b, '\xA5', sizeof(b)); \
ra = strlcpy(a, "" lit, sz); \
rb = strlcpy_lit(b, lit, sz); \
ck_assert_uint_eq(ra, rb); \
ck_assert_mem_eq(a, b, sizeof(a)); \
} \
} while (0)
START_TEST (test_lit_matches_strlcpy)
{
CHECK_LIT("");
CHECK_LIT("a");
CHECK_LIT("ab");
CHECK_LIT("core_options");
CHECK_LIT("input_player1_analog_dpad_mode");
CHECK_LIT("/");
CHECK_LIT(".lpl");
/* Adjacent literals concatenate, so sizeof still measures the
* characters and not a pointer. */
CHECK_LIT("smb:" "//");
/* Embedded escapes must not confuse sizeof. */
CHECK_LIT("a\tb\\c");
}
END_TEST
START_TEST (test_lit_return_is_source_length)
{
char s[8];
/* Fits. */
ck_assert_uint_eq(strlcpy_lit(s, "abc", sizeof(s)), 3);
ck_assert_str_eq(s, "abc");
/* Exactly fits: 7 characters plus the terminator. */
ck_assert_uint_eq(strlcpy_lit(s, "abcdefg", sizeof(s)), 7);
ck_assert_str_eq(s, "abcdefg");
/* Does not fit: truncates and reports the source length, as
* strlcpy() does. */
ck_assert_uint_eq(strlcpy_lit(s, "abcdefgh", sizeof(s)), 8);
ck_assert_str_eq(s, "abcdefg");
}
END_TEST
START_TEST (test_lit_runtime_size)
{
char s[16];
/* A size the compiler cannot fold, which is what a 'len' parameter
* looks like from inside a function. */
size_t n = 4;
memset(s, '\xA5', sizeof(s));
ck_assert_uint_eq(strlcpy_lit(s, "abcdefgh", n), 8);
ck_assert_str_eq(s, "abc");
ck_assert_int_eq(s[4], '\xA5');
}
END_TEST
START_TEST (test_lit_zero_size_writes_nothing)
{
char s[4];
memset(s, '\xA5', sizeof(s));
ck_assert_uint_eq(strlcpy_lit(s, "abc", 0), strlcpy(s, "abc", 0));
ck_assert_int_eq(s[0], '\xA5');
}
END_TEST
Suite *create_suite(void)
{
Suite *s = suite_create(SUITE_NAME);
TCase *tc_core = tcase_create("Core");
tcase_add_test(tc_core, test_lit_matches_strlcpy);
tcase_add_test(tc_core, test_lit_return_is_source_length);
tcase_add_test(tc_core, test_lit_runtime_size);
tcase_add_test(tc_core, test_lit_zero_size_writes_nothing);
suite_add_tcase(s, tc_core);
return s;
}
int main(void)
{
int num_fail;
Suite *s = create_suite();
SRunner *sr = srunner_create(s);
srunner_run_all(sr, CK_NORMAL);
num_fail = srunner_ntests_failed(sr);
srunner_free(sr);
return (num_fail == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
+5 -5
View File
@@ -876,7 +876,7 @@ static struct buffer query_parse_table(
{
if (argi >= QUERY_MAX_ARGS)
{
strlcpy(s, "Too many arguments in function call.", len);
strlcpy_lit(s, "Too many arguments in function call.", len);
*err = s;
goto clean;
}
@@ -892,7 +892,7 @@ static struct buffer query_parse_table(
_len + 1, sizeof(char));
if (!args[argi].a.value.val.string.buff)
{
strlcpy(s, "OOM", len);
strlcpy_lit(s, "OOM", len);
*err = s;
goto clean;
}
@@ -919,7 +919,7 @@ static struct buffer query_parse_table(
buff = query_chomp(buff);
if (argi >= QUERY_MAX_ARGS)
{
strlcpy(s, "Too many arguments in function call.", len);
strlcpy_lit(s, "Too many arguments in function call.", len);
*err = s;
goto clean;
}
@@ -945,7 +945,7 @@ static struct buffer query_parse_table(
malloc(sizeof(struct argument) * argi);
if (!invocation->argv)
{
strlcpy(s, "Out of memory.", len);
strlcpy_lit(s, "Out of memory.", len);
*err = s;
goto clean;
}
@@ -1002,7 +1002,7 @@ static struct buffer query_parse_method_call(
{
if (argi >= QUERY_MAX_ARGS)
{
strlcpy(s, "Too many arguments in function call.", len);
strlcpy_lit(s, "Too many arguments in function call.", len);
*err = s;
goto clean;
}
+11 -11
View File
@@ -102,7 +102,7 @@ static size_t menu_action_setting_audio_mixer_stream_volume(
if (offset >= AUDIO_MIXER_MAX_SYSTEM_STREAMS)
return 0;
_len = snprintf(s, len, "%.2f", audio_driver_mixer_get_stream_volume(offset));
_len += strlcpy(s + _len, " dB", len - _len);
_len += strlcpy_lit(s + _len, " dB", len - _len);
return _len;
}
#endif
@@ -453,10 +453,10 @@ static size_t menu_action_setting_disp_set_label_core_updater_entry(
if ((core_info->flags & CORE_INFO_FLAG_IS_LOCKED))
{
*w = (unsigned)STRLEN_CONST("[#!]");
return strlcpy(s, "[#!]", len);
return strlcpy_lit(s, "[#!]", len);
}
*w = (unsigned)STRLEN_CONST("[#]");
return strlcpy(s, "[#]", len);
return strlcpy_lit(s, "[#]", len);
}
}
return 0;
@@ -487,7 +487,7 @@ static size_t menu_action_setting_disp_set_label_core_manager_entry(
&& (core_info->flags & CORE_INFO_FLAG_IS_LOCKED))
{
*w = (unsigned)STRLEN_CONST("[!]");
return strlcpy(s, "[!]", len);
return strlcpy_lit(s, "[!]", len);
}
*s = '\0';
*w = 0;
@@ -530,7 +530,7 @@ static size_t menu_action_setting_disp_set_label_core_manager_steam_entry(
if (dlc_installed)
{
*w = (unsigned)STRLEN_CONST("[#]");
return strlcpy(s, "[#]", len);
return strlcpy_lit(s, "[#]", len);
}
}
}
@@ -619,7 +619,7 @@ static size_t menu_action_setting_disp_set_label_cpu_policy(
if (d->affected_cpus)
{
_len += strlcpy(s2 + _len, " [CPU(s) ", len2 - _len);
_len += strlcpy_lit(s2 + _len, " [CPU(s) ", len2 - _len);
_len += strlcpy(s2 + _len, d->affected_cpus, len2 - _len);
s2[ _len] = ']' ;
s2[++_len] = '\0';
@@ -654,9 +654,9 @@ static size_t menu_action_cpu_managed_freq_label(
}
if (freq == 1)
return strlcpy(s, "Min.", len);
return strlcpy_lit(s, "Min.", len);
else if (freq == ~0U)
return strlcpy(s, "Max.", len);
return strlcpy_lit(s, "Max.", len);
return snprintf(s, len, "%u MHz", freq / 1000);
}
@@ -801,9 +801,9 @@ static size_t menu_action_setting_disp_set_label_input_desc(
if (remap_idx < RARCH_FIRST_CUSTOM_BIND)
return _len;
else if (remap_idx % 2 == 0)
return strlcpy(s + _len, "+", len - _len);
return strlcpy_lit(s + _len, "+", len - _len);
else
return strlcpy(s + _len, "-", len - _len);
return strlcpy_lit(s + _len, "-", len - _len);
}
}
/* If descriptor was not found, set this instead */
@@ -844,7 +844,7 @@ static size_t menu_action_setting_disp_set_label_input_desc_kbd(
if (key_descriptors[key_id].key != RETROK_FIRST)
{
/* TODO/FIXME - Localize */
_len = strlcpy(s, "Keyboard ", len);
_len = strlcpy_lit(s, "Keyboard ", len);
_len += strlcpy(s + _len, key_descriptors[key_id].desc, len - _len);
}
else
+6 -6
View File
@@ -2530,7 +2530,7 @@ static int generic_action_ok(const char *path,
if (input_remapping_load_file(conf, action_path))
{
unsigned port;
size_t _len = strlcpy(conf_key, "input_libretro_device_p", sizeof(conf_key));
size_t _len = strlcpy_lit(conf_key, "input_libretro_device_p", sizeof(conf_key));
for (port = 0; port < MAX_USERS; port++)
{
unsigned current_device;
@@ -4567,7 +4567,7 @@ static int action_ok_set_switch_cpu_profile(const char *path,
clkrstCloseSession(&session);
}
/* TODO/FIXME - localize */
_len = strlcpy(command, "Current clock set to", sizeof(command));
_len = strlcpy_lit(command, "Current clock set to", sizeof(command));
_len += snprintf(command + _len, sizeof(command) - _len, "%i", profile_clock);
runloop_msg_queue_push(command, _len, 1, 90, true, NULL,
@@ -4718,7 +4718,7 @@ int action_ok_core_option_dropdown_list(const char *path,
push_dropdown_list:
/* If this option is not a boolean toggle,
* push drop-down list */
_len = strlcpy(option_path_str, "core_option_",
_len = strlcpy_lit(option_path_str, "core_option_",
sizeof(option_path_str));
snprintf(option_path_str + _len,
sizeof(option_path_str) - _len,
@@ -5555,7 +5555,7 @@ void cb_generic_download(retro_task_t *task,
if (subdir_options && *subdir_options)
{
size_t __len = strlcpy(buf, subdir_options, sizeof(buf));
strlcpy(buf + __len, "|", sizeof(buf) - __len);
strlcpy_lit(buf + __len, "|", sizeof(buf) - __len);
subdir = buf;
}
}
@@ -6594,7 +6594,7 @@ static void action_input_add_entry_to_new_playlist(void *userdata, const char *l
/* Create path for new file */
_len = fill_pathname_join_special(path, settings->paths.directory_playlist, line, sizeof(path));
strlcpy(path + _len, ".lpl", sizeof(path) - _len);
strlcpy_lit(path + _len, ".lpl", sizeof(path) - _len);
action_ok_add_entry_to_playlist(NULL, path, 0, 0, 0);
}
@@ -6611,7 +6611,7 @@ static void action_input_add_entry_to_new_playlist_quickmenu(void *userdata, con
/* Create path for new file */
_len = fill_pathname_join_special(path, settings->paths.directory_playlist, line, sizeof(path));
strlcpy(path + _len, ".lpl", sizeof(path) - _len);
strlcpy_lit(path + _len, ".lpl", sizeof(path) - _len);
action_ok_add_entry_to_playlist_quickmenu(NULL, path, 0, 0, 0);
}
+3 -3
View File
@@ -248,7 +248,7 @@ static int action_scan_video_font_path(const char *path,
{
settings_t *settings = config_get_ptr();
strlcpy(settings->paths.path_font, "null", sizeof(settings->paths.path_font));
strlcpy_lit(settings->paths.path_font, "null", sizeof(settings->paths.path_font));
/* Same route as the value-change handler: rebuild the OSD font in
* place, and reinitialise only where a driver keeps its own. */
@@ -267,7 +267,7 @@ static int action_scan_video_xmb_font(const char *path,
/* The menu driver watches this path and rebuilds its fonts on
* the next frame. */
strlcpy(settings->paths.path_menu_xmb_font, "null", sizeof(settings->paths.path_menu_xmb_font));
strlcpy_lit(settings->paths.path_menu_xmb_font, "null", sizeof(settings->paths.path_menu_xmb_font));
return 0;
}
@@ -281,7 +281,7 @@ static int action_scan_video_ozone_font(const char *path,
/* The menu driver watches this path and rebuilds its fonts on
* the next frame. */
strlcpy(settings->paths.path_menu_ozone_font, "null", sizeof(settings->paths.path_menu_ozone_font));
strlcpy_lit(settings->paths.path_menu_ozone_font, "null", sizeof(settings->paths.path_menu_ozone_font));
return 0;
}
+1 -1
View File
@@ -646,7 +646,7 @@ static int action_start_video_resolution(
video_driver_set_video_mode(width, height, true);
#ifdef GEKKO
if (width == 0 || height == 0)
_len = strlcpy(msg, "Resetting to: DEFAULT", sizeof(msg));
_len = strlcpy_lit(msg, "Resetting to: DEFAULT", sizeof(msg));
else
#endif
{
+4 -4
View File
@@ -867,7 +867,7 @@ static int action_bind_sublabel_subsystem_load(
{
if (_len + 1 >= sizeof(buf))
break;
_len += strlcpy(buf + _len, "\n", sizeof(buf) - _len);
_len += strlcpy_lit(buf + _len, "\n", sizeof(buf) - _len);
}
}
if (*buf)
@@ -1061,9 +1061,9 @@ static int action_bind_sublabel_netplay_room(file_list_t *list,
(unsigned long)(unsigned)room->gamecrc);
else
{
_len += strlcpy(s + _len, "(", len - _len);
_len += strlcpy_lit(s + _len, "(", len - _len);
_len += strlcpy(s + _len, room->subsystem_name, len - _len);
_len += strlcpy(s + _len, ")\n", len - _len);
_len += strlcpy_lit(s + _len, ")\n", len - _len);
}
if (room->spectator_count > 0)
@@ -1391,7 +1391,7 @@ static int action_bind_sublabel_core_updater_entry(
{
_len += strlcpy(s + _len, entry->licenses_list->elems[i].data, len - _len);
if ((i + 1) < entry->licenses_list->size)
_len += strlcpy(s + _len, ", ", len - _len);
_len += strlcpy_lit(s + _len, ", ", len - _len);
}
}
else /* No license found - set to N/A */
+1 -1
View File
@@ -12710,7 +12710,7 @@ static void materialui_list_insert(void *userdata,
char val[NAME_MAX_LENGTH];
unsigned user_value = i + 1;
size_t _len = snprintf(val, sizeof(val), "%d", user_value);
strlcpy(val + _len,
strlcpy_lit(val + _len,
"_input_binds_list",
sizeof(val) - _len);
+5 -5
View File
@@ -4562,7 +4562,7 @@ static void ozone_update_content_metadata(ozone_handle_t *ozone)
_len = strlcpy(ozone->selection_core_name,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_CORE),
sizeof(ozone->selection_core_name));
_len += strlcpy(ozone->selection_core_name + _len, " ",
_len += strlcpy_lit(ozone->selection_core_name + _len, " ",
sizeof(ozone->selection_core_name) - _len);
strlcpy(ozone->selection_core_name + _len, core_label,
sizeof(ozone->selection_core_name) - _len);
@@ -4605,14 +4605,14 @@ static void ozone_update_content_metadata(ozone_handle_t *ozone)
size_t _len = strlcpy(ozone->selection_playtime,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_RUNTIME),
sizeof(ozone->selection_playtime));
_len += strlcpy(ozone->selection_playtime + _len, " ",
_len += strlcpy_lit(ozone->selection_playtime + _len, " ",
sizeof(ozone->selection_playtime) - _len);
strlcpy(ozone->selection_playtime + _len, disabled_str, sizeof(ozone->selection_playtime) - _len);
_len = strlcpy(ozone->selection_lastplayed,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED),
sizeof(ozone->selection_lastplayed));
_len += strlcpy(ozone->selection_lastplayed + _len, " ",
_len += strlcpy_lit(ozone->selection_lastplayed + _len, " ",
sizeof(ozone->selection_lastplayed) - _len);
strlcpy(ozone->selection_lastplayed + _len, disabled_str, sizeof(ozone->selection_lastplayed) - _len);
}
@@ -5320,7 +5320,7 @@ static void ozone_context_reset_horizontal_list(ozone_handle_t *ozone)
__len = fill_pathname_join_special(texturepath,
ozone->icons_path, sysname,
sizeof(texturepath));
strlcpy(texturepath + __len, ".png", sizeof(texturepath) - __len);
strlcpy_lit(texturepath + __len, ".png", sizeof(texturepath) - __len);
/* If the playlist icon doesn't exist, return default */
if (!path_is_valid(texturepath))
@@ -5333,7 +5333,7 @@ static void ozone_context_reset_horizontal_list(ozone_handle_t *ozone)
texturepath, &node->icon,
gfx_display_texture_filter(), NULL, NULL);
strlcpy(sysname + syslen, "-content.png", sizeof(sysname) - syslen);
strlcpy_lit(sysname + syslen, "-content.png", sizeof(sysname) - syslen);
fill_pathname_join_special(
texturepath, ozone->icons_path, sysname,
sizeof(texturepath));
+4 -4
View File
@@ -1800,7 +1800,7 @@ static void xmb_path_dynamic_wallpaper(xmb_handle_t *xmb, char *s, size_t len)
dir_dynamic_wallpapers,
xmb->title_name,
len);
strlcpy(s + _len, ".png", len - _len);
strlcpy_lit(s + _len, ".png", len - _len);
}
if (s && *s && path_is_valid(s))
@@ -3690,20 +3690,20 @@ static void xmb_context_reset_horizontal_list(xmb_handle_t *xmb)
sizeof(sysname));
__len = fill_pathname_join_special(texturepath, iconpath, sysname,
sizeof(texturepath));
strlcpy(texturepath + __len, ".png", sizeof(texturepath) - __len);
strlcpy_lit(texturepath + __len, ".png", sizeof(texturepath) - __len);
if (!path_is_valid(texturepath))
{
__len = fill_pathname_join_special(texturepath, iconpath, "default",
sizeof(texturepath));
strlcpy(texturepath + __len, ".png", sizeof(texturepath) - __len);
strlcpy_lit(texturepath + __len, ".png", sizeof(texturepath) - __len);
}
gfx_display_load_icon(texturepath, supports_rgba,
&node->icon, xmb_icon_load_gen,
&xmb_icon_load_gen);
strlcpy(sysname + syslen, "-content.png", sizeof(sysname) - syslen);
strlcpy_lit(sysname + syslen, "-content.png", sizeof(sysname) - syslen);
fill_pathname_join_special(texturepath, iconpath, sysname,
sizeof(texturepath));
+100 -100
View File
@@ -196,7 +196,7 @@ bool menu_displaylist_build_smb_root(char *s, size_t len)
if (!settings->bools.smb_client_enable || !*server)
return false;
_len = strlcpy(s, "smb://", len);
_len = strlcpy_lit(s, "smb://", len);
if (_len >= len)
return false;
_len += strlcpy(s + _len, server, len - _len);
@@ -205,7 +205,7 @@ bool menu_displaylist_build_smb_root(char *s, size_t len)
if (*share)
{
_len += strlcpy(s + _len, "/", len - _len);
_len += strlcpy_lit(s + _len, "/", len - _len);
if (_len >= len)
return false;
_len += strlcpy(s + _len, share, len - _len);
@@ -217,7 +217,7 @@ bool menu_displaylist_build_smb_root(char *s, size_t len)
{
if (subdir[0] != '/')
{
_len += strlcpy(s + _len, "/", len - _len);
_len += strlcpy_lit(s + _len, "/", len - _len);
if (_len >= len)
return false;
}
@@ -606,14 +606,14 @@ static int filebrowser_parse(
char dir[DIR_MAX_LENGTH];
size_t _len = fill_pathname_application_dir(dir, sizeof(dir));
if (string_ends_with(full_path, "/") && !string_ends_with(dir, "/"))
strlcpy(dir + _len, "/", sizeof(dir) - _len);
strlcpy_lit(dir + _len, "/", sizeof(dir) - _len);
if (string_is_equal(dir, full_path))
allow_parent_directory = false;
else
{
_len = fill_pathname_home_dir(dir, sizeof(dir));
if (string_ends_with(full_path, "/") && !string_ends_with(dir, "/"))
strlcpy(dir + _len, "/", sizeof(dir) - _len);
strlcpy_lit(dir + _len, "/", sizeof(dir) - _len);
if (string_is_equal(dir, full_path))
allow_parent_directory = false;
}
@@ -794,7 +794,7 @@ static int menu_displaylist_parse_core_info(
_len = strlcpy(tmp,
msg_hash_to_str(info_list[i].msg),
sizeof(tmp));
_len += strlcpy(tmp + _len, ": ", sizeof(tmp) - _len);
_len += strlcpy_lit(tmp + _len, ": ", sizeof(tmp) - _len);
strlcpy(tmp + _len, info_list[i].name, sizeof(tmp) - _len);
if (menu_entries_append(list, tmp, "",
MENU_ENUM_LABEL_CORE_INFO_ENTRY,
@@ -808,7 +808,7 @@ static int menu_displaylist_parse_core_info(
size_t _len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_CATEGORIES),
sizeof(tmp));
_len += strlcpy(tmp + _len, ": ", sizeof(tmp) - _len);
_len += strlcpy_lit(tmp + _len, ": ", sizeof(tmp) - _len);
string_list_join_concat_special(tmp + _len, sizeof(tmp) - _len,
core_info->categories_list, ", ");
if (menu_entries_append(list, tmp, "",
@@ -821,7 +821,7 @@ static int menu_displaylist_parse_core_info(
size_t _len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_AUTHORS),
sizeof(tmp));
_len += strlcpy(tmp + _len, ": ", sizeof(tmp) - _len);
_len += strlcpy_lit(tmp + _len, ": ", sizeof(tmp) - _len);
string_list_join_concat_special(tmp + _len, sizeof(tmp) - _len,
core_info->authors_list, ", ");
if (menu_entries_append(list, tmp, "",
@@ -834,7 +834,7 @@ static int menu_displaylist_parse_core_info(
size_t _len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_PERMISSIONS),
sizeof(tmp));
_len += strlcpy(tmp + _len, ": ", sizeof(tmp) - _len);
_len += strlcpy_lit(tmp + _len, ": ", sizeof(tmp) - _len);
string_list_join_concat_special(tmp + _len, sizeof(tmp) - _len,
core_info->permissions_list, ", ");
if (menu_entries_append(list, tmp, "",
@@ -847,7 +847,7 @@ static int menu_displaylist_parse_core_info(
size_t _len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_LICENSES),
sizeof(tmp));
_len += strlcpy(tmp + _len, ": ", sizeof(tmp) - _len);
_len += strlcpy_lit(tmp + _len, ": ", sizeof(tmp) - _len);
string_list_join_concat_special(tmp + _len, sizeof(tmp) - _len,
core_info->licenses_list, ", ");
if (menu_entries_append(list, tmp, "",
@@ -861,7 +861,7 @@ static int menu_displaylist_parse_core_info(
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_CORE_INFO_SUPPORTED_EXTENSIONS),
sizeof(tmp));
_len += strlcpy(tmp + _len, ": ", sizeof(tmp) - _len);
_len += strlcpy_lit(tmp + _len, ": ", sizeof(tmp) - _len);
string_list_join_concat_special(tmp + _len, sizeof(tmp) - _len,
core_info->supported_extensions_list, ", ");
if (menu_entries_append(list, tmp, "",
@@ -874,7 +874,7 @@ static int menu_displaylist_parse_core_info(
size_t _len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_REQUIRED_HW_API),
sizeof(tmp));
_len += strlcpy(tmp + _len, ": ", sizeof(tmp) - _len);
_len += strlcpy_lit(tmp + _len, ": ", sizeof(tmp) - _len);
string_list_join_concat_special(tmp + _len, sizeof(tmp) - _len,
core_info->required_hw_api_list, ", ");
if (menu_entries_append(list, tmp, "",
@@ -910,7 +910,7 @@ static int menu_displaylist_parse_core_info(
size_t _len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_SAVESTATE_SUPPORT_LEVEL),
sizeof(tmp));
_len += strlcpy(tmp + _len, ": ", sizeof(tmp) - _len);
_len += strlcpy_lit(tmp + _len, ": ", sizeof(tmp) - _len);
strlcpy(tmp + _len, savestate_support, sizeof(tmp) - _len);
}
@@ -925,7 +925,7 @@ static int menu_displaylist_parse_core_info(
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_CORE_PATH),
sizeof(tmp));
_len += strlcpy(tmp + _len, ": ", sizeof(tmp) - _len);
_len += strlcpy_lit(tmp + _len, ": ", sizeof(tmp) - _len);
#if IOS
shortened_path[0] = '\0';
@@ -1030,7 +1030,7 @@ static int menu_displaylist_parse_core_info(
MENU_ENUM_LABEL_CORE_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0, NULL))
count++;
__len = strlcpy(tmp, "- ", sizeof(tmp));
__len = strlcpy_lit(tmp, "- ", sizeof(tmp));
strlcpy(tmp + __len, tmp_desc, sizeof(tmp) - __len);
tmp_desc[0] = '\0';
tmp_desc_len = 0;
@@ -1052,7 +1052,7 @@ static int menu_displaylist_parse_core_info(
}
else
{
tmp_desc_len += strlcpy(tmp_desc + tmp_desc_len, "\n", sizeof(tmp_desc) - tmp_desc_len);
tmp_desc_len += strlcpy_lit(tmp_desc + tmp_desc_len, "\n", sizeof(tmp_desc) - tmp_desc_len);
strlcpy(tmp_desc + tmp_desc_len,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_FIRMWARE_IN_CONTENT_DIRECTORY),
sizeof(tmp_desc) - tmp_desc_len);
@@ -1108,7 +1108,7 @@ static int menu_displaylist_parse_core_info(
if (pos)
{
core_info_list_hide[j] = true;
__len = strlcpy(tmp, "- ", sizeof(tmp));
__len = strlcpy_lit(tmp, "- ", sizeof(tmp));
strlcpy( tmp + __len,
core_info->note_list->elems[j].data + pos,
sizeof(tmp) - __len);
@@ -1329,7 +1329,7 @@ static unsigned menu_displaylist_parse_core_backup_list(
/* Append 'auto backup' tag to timestamp, if required */
if (entry->backup_mode == CORE_BACKUP_MODE_AUTO)
{
_len += strlcpy(timestamp + _len, " ", sizeof(timestamp) - _len);
_len += strlcpy_lit(timestamp + _len, " ", sizeof(timestamp) - _len);
strlcpy(timestamp + _len, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_BACKUP_MODE_AUTO),
sizeof(timestamp) - _len);
}
@@ -1939,11 +1939,11 @@ static unsigned menu_displaylist_parse_supported_cores(
char entry_alt_text[NAME_MAX_LENGTH];
size_t _len = strlcpy(entry_alt_text, detect_core_str,
sizeof(entry_alt_text));
_len += strlcpy(entry_alt_text + _len, " (", sizeof(entry_alt_text) - _len);
_len += strlcpy_lit(entry_alt_text + _len, " (", sizeof(entry_alt_text) - _len);
_len += strlcpy(entry_alt_text + _len,
pending_core_name,
sizeof(entry_alt_text) - _len);
strlcpy(entry_alt_text + _len, ")", sizeof(entry_alt_text) - _len);
strlcpy_lit(entry_alt_text + _len, ")", sizeof(entry_alt_text) - _len);
menu_entries_prepend(info->list, pending_core_path,
msg_hash_to_str(current_core_enum_label),
@@ -2054,7 +2054,7 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
size_t _len = strlcpy(entry,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RETROARCH_VERSION),
sizeof(entry));
_len += strlcpy(entry + _len, ": ", sizeof(entry) - _len);
_len += strlcpy_lit(entry + _len, ": ", sizeof(entry) - _len);
strlcpy(entry + _len, PACKAGE_VERSION, sizeof(entry) - _len);
if (menu_entries_append(list, entry, "",
MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE,
@@ -2066,7 +2066,7 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
_len = strlcpy(entry,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_GIT_VERSION),
sizeof(entry));
_len += strlcpy(entry + _len, ": ", sizeof(entry) - _len);
_len += strlcpy_lit(entry + _len, ": ", sizeof(entry) - _len);
strlcpy(entry + _len, retroarch_git_version, sizeof(entry) - _len);
if (menu_entries_append(list, entry, "",
MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE,
@@ -2081,7 +2081,7 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
_len = strlcpy(entry,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_MOLTENVK_VERSION),
sizeof(entry));
_len += strlcpy(entry + _len, ": ", sizeof(entry) - _len);
_len += strlcpy_lit(entry + _len, ": ", sizeof(entry) - _len);
if (!moltenvk_version || !*moltenvk_version)
strlcpy(entry + _len,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE),
@@ -2099,10 +2099,10 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
_len = strlcpy(entry,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_BUILD_DATE),
sizeof(entry));
_len += strlcpy(entry + _len, ": ", sizeof(entry) - _len);
_len += strlcpy_lit(entry + _len, ": ", sizeof(entry) - _len);
_len += strlcpy(entry + _len, __DATE__, sizeof(entry) - _len);
#ifdef DEBUG
_len += strlcpy(entry + _len, " (DEBUG)", sizeof(entry) - _len);
_len += strlcpy_lit(entry + _len, " (DEBUG)", sizeof(entry) - _len);
#endif
if (menu_entries_append(list, entry, "",
MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE,
@@ -2139,7 +2139,7 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
_len = strlcpy(entry,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_CPU_MODEL),
sizeof(entry));
_len += strlcpy(entry + _len, ": ", sizeof(entry) - _len);
_len += strlcpy_lit(entry + _len, ": ", sizeof(entry) - _len);
if (!cpu_model || !*cpu_model)
strlcpy(entry + _len,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE),
@@ -2156,7 +2156,7 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
_len = strlcpy(entry,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_CPU_FEATURES),
sizeof(entry));
_len += strlcpy(entry + _len, ": ", sizeof(entry) - _len);
_len += strlcpy_lit(entry + _len, ": ", sizeof(entry) - _len);
retroarch_get_capabilities(RARCH_CAPABILITIES_CPU, entry + _len, sizeof(entry) - _len);
if (menu_entries_append(list, entry, "",
MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE,
@@ -2167,7 +2167,7 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
_len = strlcpy(entry,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CPU_ARCHITECTURE),
sizeof(entry));
_len += strlcpy(entry + _len, ": ", sizeof(entry) - _len);
_len += strlcpy_lit(entry + _len, ": ", sizeof(entry) - _len);
frontend_driver_get_cpu_architecture_str(entry + _len, sizeof(entry) - _len);
if (menu_entries_append(list, entry, "",
MENU_ENUM_LABEL_CPU_ARCHITECTURE, MENU_SETTINGS_CORE_INFO_NONE,
@@ -2196,7 +2196,7 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
size_t _len = strlcpy(entry,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_JIT_AVAILABLE),
sizeof(entry));
_len += strlcpy(entry + _len, ": ", sizeof(entry) - _len);
_len += strlcpy_lit(entry + _len, ": ", sizeof(entry) - _len);
if (jit_available())
strlcpy(entry + _len, val_yes_str, sizeof(entry) - _len);
else
@@ -2218,7 +2218,7 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
size_t _len = strlcpy(entry,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_BUNDLE_IDENTIFIER),
sizeof(entry));
_len += strlcpy(entry + _len, ": ", sizeof(entry) - _len);
_len += strlcpy_lit(entry + _len, ": ", sizeof(entry) - _len);
Boolean result = CFStringGetCString(bundleIdentifier, entry + _len, sizeof(entry) - _len, kCFStringEncodingUTF8);
if (result) {
if (menu_entries_append(list, entry, "",
@@ -2297,7 +2297,7 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
_len = strlcpy(entry,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FRONTEND_IDENTIFIER),
sizeof(entry));
_len += strlcpy(entry + _len, ": ", sizeof(entry) - _len);
_len += strlcpy_lit(entry + _len, ": ", sizeof(entry) - _len);
strlcpy(entry + _len, frontend->ident, sizeof(entry) - _len);
if (menu_entries_append(list, entry, "",
MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE,
@@ -2310,7 +2310,7 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
_len = strlcpy(entry,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_LAKKA_VERSION),
sizeof(entry));
_len += strlcpy(entry + _len, ": ", sizeof(entry) - _len);
_len += strlcpy_lit(entry + _len, ": ", sizeof(entry) - _len);
frontend->get_lakka_version(entry + _len, sizeof(entry) - _len);
if (menu_entries_append(list, entry, "",
MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE,
@@ -2324,7 +2324,7 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
_len = strlcpy(entry,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FRONTEND_NAME),
sizeof(entry));
_len += strlcpy(entry + _len, ": ", sizeof(entry) - _len);
_len += strlcpy_lit(entry + _len, ": ", sizeof(entry) - _len);
frontend->get_name(entry + _len, sizeof(entry) - _len);
if (menu_entries_append(list, entry, "",
MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE,
@@ -2340,7 +2340,7 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
_len = strlcpy(entry,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FRONTEND_OS),
sizeof(entry));
_len += strlcpy(entry + _len, ": ", sizeof(entry) - _len);
_len += strlcpy_lit(entry + _len, ": ", sizeof(entry) - _len);
_len += frontend->get_os(entry + _len,
sizeof(entry) - _len, &major, &minor);
snprintf(entry + _len,
@@ -2381,7 +2381,7 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
size_t _len = strlcpy(entry,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE),
sizeof(entry));
_len += strlcpy(entry + _len, ": ", sizeof(entry) - _len);
_len += strlcpy_lit(entry + _len, ": ", sizeof(entry) - _len);
/* N/A */
if (state == FRONTEND_POWERSTATE_NONE)
strlcpy(entry + _len,
@@ -2421,7 +2421,7 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
_len = strlcpy(entry,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_VIDEO_CONTEXT_DRIVER),
sizeof(entry));
_len += strlcpy(entry + _len, ": ", sizeof(entry) - _len);
_len += strlcpy_lit(entry + _len, ": ", sizeof(entry) - _len);
strlcpy(entry + _len,
(ident_info.ident && *ident_info.ident)
? ident_info.ident
@@ -2704,7 +2704,7 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
size_t _len = strlcpy(entry,
info_list[info_idx].msg,
sizeof(entry));
_len += strlcpy(entry + _len, ": ", sizeof(entry) - _len);
_len += strlcpy_lit(entry + _len, ": ", sizeof(entry) - _len);
_len += strlcpy(entry + _len,
(info_list[info_idx].enabled) ? val_yes_str : val_no_str, sizeof(entry) - _len);
@@ -3024,7 +3024,7 @@ static int menu_displaylist_parse_database_entry(menu_handle_t *menu,
gfx_thumbnail_set_system(menu_st->thumbnail_path_data,
path_base, playlist_get_cached());
strlcpy(path_base + _len, ".lpl", sizeof(path_base) - _len);
strlcpy_lit(path_base + _len, ".lpl", sizeof(path_base) - _len);
fill_pathname_join_special(menu->db_playlist_file,
dir_playlist, path_base,
@@ -3125,7 +3125,7 @@ static int menu_displaylist_parse_database_entry(menu_handle_t *menu,
tmp_len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_NAME),
sizeof(tmp));
tmp_len += strlcpy(tmp + tmp_len, ": ", sizeof(tmp) - tmp_len);
tmp_len += strlcpy_lit(tmp + tmp_len, ": ", sizeof(tmp) - tmp_len);
strlcpy(tmp + tmp_len, db_info_entry->name, sizeof(tmp) - tmp_len);
menu_entries_append(info->list, tmp,
MENU_ENUM_LABEL_RDB_ENTRY_NAME_STR,
@@ -3138,7 +3138,7 @@ static int menu_displaylist_parse_database_entry(menu_handle_t *menu,
tmp_len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_DESCRIPTION),
sizeof(tmp));
tmp_len += strlcpy(tmp + tmp_len, ": ", sizeof(tmp) - tmp_len);
tmp_len += strlcpy_lit(tmp + tmp_len, ": ", sizeof(tmp) - tmp_len);
strlcpy(tmp + tmp_len, db_info_entry->description,
sizeof(tmp) - tmp_len);
menu_entries_append(info->list, tmp,
@@ -5430,7 +5430,7 @@ static unsigned menu_displaylist_parse_content_information(
size_t _len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_CORE_NAME),
sizeof(tmp));
_len += strlcpy(tmp + _len, ": ", sizeof(tmp) - _len);
_len += strlcpy_lit(tmp + _len, ": ", sizeof(tmp) - _len);
strlcpy(tmp + _len, core_name, sizeof(tmp) - _len);
if (menu_entries_append(info_list, tmp,
@@ -5477,7 +5477,7 @@ static unsigned menu_displaylist_parse_content_information(
size_t _len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_DATABASE),
sizeof(tmp));
_len += strlcpy(tmp + _len, ": ", sizeof(tmp) - _len);
_len += strlcpy_lit(tmp + _len, ": ", sizeof(tmp) - _len);
fill_pathname(tmp + _len, db_name, "", sizeof(tmp) - _len);
if (menu_entries_append(info_list, tmp,
MENU_ENUM_LABEL_CONTENT_INFO_DATABASE_STR,
@@ -5495,7 +5495,7 @@ static unsigned menu_displaylist_parse_content_information(
size_t _len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_LABEL),
sizeof(tmp));
_len += strlcpy(tmp + _len, ": ", sizeof(tmp) - _len);
_len += strlcpy_lit(tmp + _len, ": ", sizeof(tmp) - _len);
strlcpy(tmp + _len, *content_label
? content_label
: msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE),
@@ -5510,7 +5510,7 @@ static unsigned menu_displaylist_parse_content_information(
_len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_PATH),
sizeof(tmp));
_len += strlcpy(tmp + _len, ": ", sizeof(tmp) - _len);
_len += strlcpy_lit(tmp + _len, ": ", sizeof(tmp) - _len);
strlcpy(tmp + _len, *content_path
? content_path
: msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE),
@@ -6518,7 +6518,7 @@ static int menu_displaylist_parse_input_description_kbd_list(
else
{
/* TODO/FIXME: Localize 'Keyboard' */
size_t _len = strlcpy(input_description, "Keyboard ", sizeof(input_description));
size_t _len = strlcpy_lit(input_description, "Keyboard ", sizeof(input_description));
strlcpy(input_description + _len, key_label, sizeof(input_description) - _len);
}
@@ -7121,7 +7121,7 @@ static int menu_displaylist_parse_disc_info(file_list_t *info_list,
? sizeof(drive_string) - 1
: (size_t)_ret;
_len += strlcpy(drive_string + _len, ": ",
_len += strlcpy_lit(drive_string + _len, ": ",
sizeof(drive_string) - _len);
if (_len < sizeof(drive_string))
@@ -7472,20 +7472,20 @@ static unsigned menu_displaylist_netplay_refresh_rooms(file_list_t *list)
{
if (!show_passworded)
continue;
_len += strlcpy(s, "[", sizeof(s) - _len);
_len += strlcpy_lit(s, "[", sizeof(s) - _len);
_len += strlcpy(s + _len, msg_room_pwd, sizeof(s) - _len);
_len += strlcpy(s + _len, "] ", sizeof(s) - _len);
_len += strlcpy_lit(s + _len, "] ", sizeof(s) - _len);
}
_len += strlcpy(s + _len, room_type, sizeof(s) - _len);
_len += strlcpy(s + _len, ": ", sizeof(s) - _len);
_len += strlcpy_lit(s + _len, ": ", sizeof(s) - _len);
_len += strlcpy(s + _len, room->nickname, sizeof(s) - _len);
if (!room->lan && *room->country)
{
_len += strlcpy(s + _len, " (", sizeof(s) - _len);
_len += strlcpy_lit(s + _len, " (", sizeof(s) - _len);
_len += strlcpy(s + _len, room->country, sizeof(s) - _len);
strlcpy(s + _len, ")", sizeof(s) - _len);
strlcpy_lit(s + _len, ")", sizeof(s) - _len);
}
if (menu_entries_append(list, s, cnc_netplay_room,
@@ -8346,7 +8346,7 @@ unsigned menu_displaylist_build_list(
{
#ifdef HAVE_AUDIOMIXER
char msg_lbl[128];
size_t _len = strlcpy(msg_lbl, "audio_mixer_stream_", sizeof(msg_lbl));
size_t _len = strlcpy_lit(msg_lbl, "audio_mixer_stream_", sizeof(msg_lbl));
#if 1
/* TODO - for developers -
* turn this into #if 0 if you want to be able to see
@@ -9822,7 +9822,7 @@ unsigned menu_displaylist_build_list(
* not '0' */
if (*image_label)
{
_len += strlcpy(current_image_str + _len,
_len += strlcpy_lit(current_image_str + _len,
": ",
sizeof(current_image_str) - _len);
strlcpy(current_image_str + _len,
@@ -13347,7 +13347,7 @@ static bool menu_displaylist_ctl_internal(
_len = strlcpy(desc_lbl,
msg_hash_to_str(keyptr->enum_idx),
sizeof(desc_lbl));
_len += strlcpy(desc_lbl + _len, ", ", sizeof(desc_lbl) - _len);
_len += strlcpy_lit(desc_lbl + _len, ", ", sizeof(desc_lbl) - _len);
strlcpy(desc_lbl + _len, descriptor, sizeof(desc_lbl) - _len);
desc_len = strlcpy(descriptor, desc_lbl, sizeof(descriptor));
}
@@ -13359,7 +13359,7 @@ static bool menu_displaylist_ctl_internal(
&& max_users > 1
&& !settings->bools.menu_show_sublabels)
{
desc_len += strlcpy(descriptor + desc_len, " [", sizeof(descriptor) - desc_len);
desc_len += strlcpy_lit(descriptor + desc_len, " [", sizeof(descriptor) - desc_len);
snprintf(descriptor + desc_len, sizeof(descriptor) - desc_len," %s %u]",
val_port, port + 1);
}
@@ -13443,7 +13443,7 @@ static bool menu_displaylist_ctl_internal(
{
/* TODO/FIXME - localize */
char title[NAME_MAX_LENGTH];
size_t _len = strlcpy(title, "Title: ", sizeof(title));
size_t _len = strlcpy_lit(title, "Title: ", sizeof(title));
strlcpy(title + _len, cd_info.title, sizeof(title) - _len);
if (menu_entries_append(info->list,
@@ -13458,7 +13458,7 @@ static bool menu_displaylist_ctl_internal(
{
char system[NAME_MAX_LENGTH];
/* TODO/FIXME - Localize */
size_t _len = strlcpy(system, "System: ", sizeof(system));
size_t _len = strlcpy_lit(system, "System: ", sizeof(system));
strlcpy(system + _len, cd_info.system, sizeof(system) - _len);
if (menu_entries_append(info->list,
@@ -13475,7 +13475,7 @@ static bool menu_displaylist_ctl_internal(
size_t _len = strlcpy(serial,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_SERIAL),
sizeof(serial));
_len += strlcpy(serial + _len, "#: ", sizeof(serial) - _len);
_len += strlcpy_lit(serial + _len, "#: ", sizeof(serial) - _len);
strlcpy(serial + _len, cd_info.serial, sizeof(serial) - _len);
if (menu_entries_append(info->list,
@@ -13490,7 +13490,7 @@ static bool menu_displaylist_ctl_internal(
{
char version[NAME_MAX_LENGTH];
/* TODO/FIXME - localize */
size_t _len = strlcpy(version, "Version: ", sizeof(version));
size_t _len = strlcpy_lit(version, "Version: ", sizeof(version));
strlcpy(version + _len, cd_info.version, sizeof(version) - _len);
if (menu_entries_append(info->list,
@@ -13505,7 +13505,7 @@ static bool menu_displaylist_ctl_internal(
{
char release_date[NAME_MAX_LENGTH];
/* TODO/FIXME - Localize */
size_t _len = strlcpy(release_date, "Release Date: ",
size_t _len = strlcpy_lit(release_date, "Release Date: ",
sizeof(release_date));
strlcpy(release_date + _len, cd_info.release_date,
sizeof(release_date) - _len);
@@ -13796,7 +13796,7 @@ static bool menu_displaylist_ctl_internal(
clkrstCloseSession(&session);
}
/* TODO/FIXME - localize */
_len = strlcpy(text, "Current clock: ", sizeof(text));
_len = strlcpy_lit(text, "Current clock: ", sizeof(text));
snprintf(text + _len, sizeof(text) - _len, "%i", currentClock);
}
if (menu_entries_append(info->list,
@@ -13809,10 +13809,10 @@ static bool menu_displaylist_ctl_internal(
char title[NAME_MAX_LENGTH];
size_t _len = strlcpy(title, SWITCH_CPU_PROFILES[i],
sizeof(title));
_len += strlcpy(title + _len, " (", sizeof(title) - _len);
_len += strlcpy_lit(title + _len, " (", sizeof(title) - _len);
_len += strlcpy(title + _len, SWITCH_CPU_SPEEDS[i],
sizeof(title) - _len);
_len += strlcpy(title + _len, ")", sizeof(title) - _len);
_len += strlcpy_lit(title + _len, ")", sizeof(title) - _len);
if (menu_entries_append(info->list, title, "", 0,
MENU_SET_SWITCH_CPU_PROFILE, 0, i, NULL))
count++;
@@ -13899,10 +13899,10 @@ static bool menu_displaylist_ctl_internal(
{
char lbl[128];
unsigned id = info->type - MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_BEGIN;
size_t _len = strlcpy(lbl, "mixer_stream_", sizeof(lbl));
size_t _len = strlcpy_lit(lbl, "mixer_stream_", sizeof(lbl));
_len += snprintf(lbl + _len, sizeof(lbl) - _len, "%d", id);
strlcpy(lbl + _len, "_action_play", sizeof(lbl) - _len);
strlcpy_lit(lbl + _len, "_action_play", sizeof(lbl) - _len);
if (menu_entries_append(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY),
lbl,
@@ -13910,7 +13910,7 @@ static bool menu_displaylist_ctl_internal(
(MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_PLAY_BEGIN + id),
0, 0, NULL))
count++;
strlcpy(lbl + _len, "_action_play_looped", sizeof(lbl) - _len);
strlcpy_lit(lbl + _len, "_action_play_looped", sizeof(lbl) - _len);
if (menu_entries_append(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY_LOOPED),
lbl,
@@ -13918,7 +13918,7 @@ static bool menu_displaylist_ctl_internal(
(MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_PLAY_LOOPED_BEGIN + id),
0, 0, NULL))
count++;
strlcpy(lbl + _len, "_action_play_sequential",sizeof(lbl) - _len);
strlcpy_lit(lbl + _len, "_action_play_sequential",sizeof(lbl) - _len);
if (menu_entries_append(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_PLAY_SEQUENTIAL),
lbl,
@@ -13926,7 +13926,7 @@ static bool menu_displaylist_ctl_internal(
(MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_PLAY_SEQUENTIAL_BEGIN + id),
0, 0, NULL))
count++;
strlcpy(lbl + _len, "_action_stop", sizeof(lbl) - _len);
strlcpy_lit(lbl + _len, "_action_stop", sizeof(lbl) - _len);
if (menu_entries_append(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_STOP),
lbl,
@@ -13934,7 +13934,7 @@ static bool menu_displaylist_ctl_internal(
(MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_STOP_BEGIN + id),
0, 0, NULL))
count++;
strlcpy(lbl + _len, "_action_remove", sizeof(lbl) - _len);
strlcpy_lit(lbl + _len, "_action_remove", sizeof(lbl) - _len);
if (menu_entries_append(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_REMOVE),
lbl,
@@ -13942,7 +13942,7 @@ static bool menu_displaylist_ctl_internal(
(MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_REMOVE_BEGIN + id),
0, 0, NULL))
count++;
strlcpy(lbl + _len, "_action_volume", sizeof(lbl) - _len);
strlcpy_lit(lbl + _len, "_action_volume", sizeof(lbl) - _len);
if (menu_entries_append(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MIXER_ACTION_VOLUME),
lbl,
@@ -14985,7 +14985,7 @@ static bool menu_displaylist_ctl_internal(
char val[8];
if (i < 0)
strlcpy(val, "Auto", sizeof(val));
strlcpy_lit(val, "Auto", sizeof(val));
else
snprintf(val, sizeof(val), "%u", i);
@@ -16252,18 +16252,18 @@ static bool menu_displaylist_ctl_internal(
{
info->type_default = FILE_TYPE_SHADER_PRESET;
if (BIT32_GET(flags.flags, GFX_CTX_FLAGS_SHADERS_CG))
_len += strlcpy(new_exts + _len, "cgp", sizeof(new_exts) - _len);
_len += strlcpy_lit(new_exts + _len, "cgp", sizeof(new_exts) - _len);
if (BIT32_GET(flags.flags, GFX_CTX_FLAGS_SHADERS_GLSL))
{
if (_len > 0)
_len += strlcpy(new_exts + _len, "|", sizeof(new_exts) - _len);
_len += strlcpy(new_exts + _len, "glslp", sizeof(new_exts) - _len);
_len += strlcpy_lit(new_exts + _len, "|", sizeof(new_exts) - _len);
_len += strlcpy_lit(new_exts + _len, "glslp", sizeof(new_exts) - _len);
}
if (BIT32_GET(flags.flags, GFX_CTX_FLAGS_SHADERS_SLANG))
{
if (_len > 0)
_len += strlcpy(new_exts + _len, "|", sizeof(new_exts) - _len);
strlcpy(new_exts + _len, "slangp", sizeof(new_exts) - _len);
_len += strlcpy_lit(new_exts + _len, "|", sizeof(new_exts) - _len);
strlcpy_lit(new_exts + _len, "slangp", sizeof(new_exts) - _len);
}
}
break;
@@ -16272,18 +16272,18 @@ static bool menu_displaylist_ctl_internal(
{
info->type_default = FILE_TYPE_SHADER;
if (BIT32_GET(flags.flags, GFX_CTX_FLAGS_SHADERS_CG))
_len += strlcpy(new_exts + _len, "cg", sizeof(new_exts) - _len);
_len += strlcpy_lit(new_exts + _len, "cg", sizeof(new_exts) - _len);
if (BIT32_GET(flags.flags, GFX_CTX_FLAGS_SHADERS_GLSL))
{
if (_len > 0)
_len += strlcpy(new_exts + _len, "|", sizeof(new_exts) - _len);
_len += strlcpy(new_exts + _len, "glsl", sizeof(new_exts) - _len);
_len += strlcpy_lit(new_exts + _len, "|", sizeof(new_exts) - _len);
_len += strlcpy_lit(new_exts + _len, "glsl", sizeof(new_exts) - _len);
}
if (BIT32_GET(flags.flags, GFX_CTX_FLAGS_SHADERS_SLANG))
{
if (_len > 0)
_len += strlcpy(new_exts + _len, "|", sizeof(new_exts) - _len);
strlcpy(new_exts + _len, "slang", sizeof(new_exts) - _len);
_len += strlcpy_lit(new_exts + _len, "|", sizeof(new_exts) - _len);
strlcpy_lit(new_exts + _len, "slang", sizeof(new_exts) - _len);
}
}
break;
@@ -16316,18 +16316,18 @@ static bool menu_displaylist_ctl_internal(
info->type_default = FILE_TYPE_SHADER_PRESET;
if (BIT32_GET(flags.flags, GFX_CTX_FLAGS_SHADERS_CG))
_len += strlcpy(new_exts + _len, "cgp", sizeof(new_exts) - _len);
_len += strlcpy_lit(new_exts + _len, "cgp", sizeof(new_exts) - _len);
if (BIT32_GET(flags.flags, GFX_CTX_FLAGS_SHADERS_GLSL))
{
if (_len > 0)
_len += strlcpy(new_exts + _len, "|", sizeof(new_exts) - _len);
_len += strlcpy(new_exts + _len, "glslp", sizeof(new_exts) - _len);
_len += strlcpy_lit(new_exts + _len, "|", sizeof(new_exts) - _len);
_len += strlcpy_lit(new_exts + _len, "glslp", sizeof(new_exts) - _len);
}
if (BIT32_GET(flags.flags, GFX_CTX_FLAGS_SHADERS_SLANG))
{
if (_len > 0)
_len += strlcpy(new_exts + _len, "|", sizeof(new_exts) - _len);
strlcpy(new_exts + _len, "slangp", sizeof(new_exts) - _len);
_len += strlcpy_lit(new_exts + _len, "|", sizeof(new_exts) - _len);
strlcpy_lit(new_exts + _len, "slangp", sizeof(new_exts) - _len);
}
if (info->exts && *info->exts)
free(info->exts);
@@ -16347,35 +16347,35 @@ static bool menu_displaylist_ctl_internal(
size_t _len = 0;
new_exts[0] = '\0';
#ifdef HAVE_RBMP
_len += strlcpy(new_exts + _len, "bmp", sizeof(new_exts) - _len);
_len += strlcpy_lit(new_exts + _len, "bmp", sizeof(new_exts) - _len);
#endif
#ifdef HAVE_RPNG
if (_len > 0)
_len += strlcpy(new_exts + _len, "|", sizeof(new_exts) - _len);
_len += strlcpy(new_exts + _len, "png", sizeof(new_exts) - _len);
_len += strlcpy_lit(new_exts + _len, "|", sizeof(new_exts) - _len);
_len += strlcpy_lit(new_exts + _len, "png", sizeof(new_exts) - _len);
#endif
#ifdef HAVE_RJPEG
if (_len > 0)
_len += strlcpy(new_exts + _len, "|", sizeof(new_exts) - _len);
_len += strlcpy(new_exts + _len, "jpeg", sizeof(new_exts) - _len);
_len += strlcpy_lit(new_exts + _len, "|", sizeof(new_exts) - _len);
_len += strlcpy_lit(new_exts + _len, "jpeg", sizeof(new_exts) - _len);
if (_len > 0)
_len += strlcpy(new_exts + _len, "|", sizeof(new_exts) - _len);
_len += strlcpy(new_exts + _len, "jpg", sizeof(new_exts) - _len);
_len += strlcpy_lit(new_exts + _len, "|", sizeof(new_exts) - _len);
_len += strlcpy_lit(new_exts + _len, "jpg", sizeof(new_exts) - _len);
#endif
#ifdef HAVE_RTGA
if (_len > 0)
_len += strlcpy(new_exts + _len, "|", sizeof(new_exts) - _len);
strlcpy(new_exts + _len, "tga", sizeof(new_exts) - _len);
_len += strlcpy_lit(new_exts + _len, "|", sizeof(new_exts) - _len);
strlcpy_lit(new_exts + _len, "tga", sizeof(new_exts) - _len);
#endif
#ifdef HAVE_RWEBP
if (_len > 0)
_len += strlcpy(new_exts + _len, "|", sizeof(new_exts) - _len);
_len += strlcpy(new_exts + _len, "webp", sizeof(new_exts) - _len);
_len += strlcpy_lit(new_exts + _len, "|", sizeof(new_exts) - _len);
_len += strlcpy_lit(new_exts + _len, "webp", sizeof(new_exts) - _len);
#endif
#ifdef HAVE_RDDS
if (_len > 0)
_len += strlcpy(new_exts + _len, "|", sizeof(new_exts) - _len);
_len += strlcpy(new_exts + _len, "dds", sizeof(new_exts) - _len);
_len += strlcpy_lit(new_exts + _len, "|", sizeof(new_exts) - _len);
_len += strlcpy_lit(new_exts + _len, "dds", sizeof(new_exts) - _len);
#endif
if (info->exts && *info->exts)
free(info->exts);
@@ -16531,7 +16531,7 @@ static bool menu_displaylist_ctl_internal(
_len = frontend_driver_get_core_extension(ext_names, sizeof(ext_names));
if (_len > 0)
{
_len += strlcpy(ext_names + _len, "|", sizeof(ext_names) - _len);
_len += strlcpy_lit(ext_names + _len, "|", sizeof(ext_names) - _len);
strlcpy(ext_names + _len, FILE_PATH_CORE_BACKUP_EXTENSION_NO_DOT, sizeof(ext_names) - _len);
}
else
+6 -6
View File
@@ -3114,7 +3114,7 @@ static bool menu_shader_manager_save_preset_internal(
if (basename && *basename)
_len = strlcpy(fullname, basename, sizeof(fullname));
else
_len = strlcpy(fullname, "retroarch", sizeof(fullname));
_len = strlcpy_lit(fullname, "retroarch", sizeof(fullname));
strlcpy(fullname + _len,
video_shader_get_preset_extension(type),
sizeof(fullname) - _len);
@@ -3272,7 +3272,7 @@ static bool menu_shader_manager_operate_auto_preset(
switch (type)
{
case SHADER_PRESET_GLOBAL:
strlcpy(file, "global", sizeof(file));
strlcpy_lit(file, "global", sizeof(file));
break;
case SHADER_PRESET_CORE:
fill_pathname_join_special(file, core_name, core_name, sizeof(file));
@@ -4078,7 +4078,7 @@ void menu_entries_search_append_terms_string(char *s, size_t len)
if (_len + 3 >= len)
break;
_len += strlcpy(s + _len, " > ", len - _len);
_len += strlcpy_lit(s + _len, " > ", len - _len);
if (_len + tlen >= len)
{
@@ -4674,13 +4674,13 @@ void menu_entries_get_core_title(char *s, size_t len)
#if defined(_MSC_VER)
_len += strlcpy(s + _len, msvc_vercode_to_str(_MSC_VER), len - _len);
#endif
_len += strlcpy(s + _len, " - ", len - _len);
_len += strlcpy_lit(s + _len, " - ", len - _len);
_len += strlcpy(s + _len, core_name, len - _len);
if (core_version && *core_version)
{
_len += strlcpy(s + _len, " (", len - _len);
_len += strlcpy_lit(s + _len, " (", len - _len);
_len += strlcpy(s + _len, core_version, len - _len);
strlcpy(s + _len, ")", len - _len);
strlcpy_lit(s + _len, ")", len - _len);
}
}
+2 -2
View File
@@ -463,7 +463,7 @@ static void explore_load_icons(explore_state_t *state)
__len += strlcpy(path + _len,
state->by[EXPLORE_BY_SYSTEM][i]->str,
sizeof(path) - _len);
strlcpy(path + __len, ".png", sizeof(path) - __len);
strlcpy_lit(path + __len, ".png", sizeof(path) - __len);
if (!path_is_valid(path))
continue;
@@ -1104,7 +1104,7 @@ static void explore_action_saveview_complete(void *userdata, const char *name)
settings = config_get_ptr();
_len = fill_pathname_join_special(lvwpath,
settings->paths.directory_playlist, name, sizeof(lvwpath));
strlcpy(lvwpath + _len, ".lvw", sizeof(lvwpath) - _len);
strlcpy_lit(lvwpath + _len, ".lvw", sizeof(lvwpath) - _len);
if (filestream_exists(lvwpath))
{
+50 -50
View File
@@ -1130,7 +1130,7 @@ static size_t setting_get_string_representation_int_gpu_index(
&& list->elems[*setting->value.target.integer].data
&& *list->elems[*setting->value.target.integer].data)
{
_len += strlcpy(s + _len, " - ", len - _len);
_len += strlcpy_lit(s + _len, " - ", len - _len);
_len += strlcpy(s + _len, list->elems[*setting->value.target.integer].data, len - _len);
}
}
@@ -3090,7 +3090,7 @@ static int setting_string_action_start_audio_device(rarch_setting_t *setting)
if (!setting)
return -1;
strlcpy(setting->value.target.string, "", setting->size);
strlcpy_lit(setting->value.target.string, "", setting->size);
command_event(CMD_EVENT_AUDIO_REINIT, NULL);
return 0;
@@ -3129,7 +3129,7 @@ static int setting_string_action_start_microphone_device(rarch_setting_t *settin
if (!setting)
return -1;
strlcpy(setting->value.target.string, "", setting->size);
strlcpy_lit(setting->value.target.string, "", setting->size);
command_event(CMD_EVENT_MICROPHONE_REINIT, NULL);
return 0;
@@ -3359,7 +3359,7 @@ static size_t setting_get_string_representation_state_slot(
if (!setting)
return 0;
if (*setting->value.target.integer == -1)
return strlcpy(s, "Auto", len);
return strlcpy_lit(s, "Auto", len);
return snprintf(s, len, "%d", *setting->value.target.integer);
}
@@ -3395,9 +3395,9 @@ static size_t setting_get_string_representation_password(
{
if ( setting->value.target.string
&& setting->value.target.string[0] != '\0')
return strlcpy(s, "********", len);
return strlcpy_lit(s, "********", len);
if (config_get_ptr()->arrays.cheevos_token[0])
return strlcpy(s, "********", len);
return strlcpy_lit(s, "********", len);
*setting->value.target.string = '\0';
}
return 0;
@@ -3415,11 +3415,11 @@ static size_t setting_get_string_representation_uint_keyboard_gamepad_mapping_ty
case 0:
return strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NONE), len);
case 1:
return strlcpy(s, "iPega PG-9017", len);
return strlcpy_lit(s, "iPega PG-9017", len);
case 2:
return strlcpy(s, "8-bitty", len);
return strlcpy_lit(s, "8-bitty", len);
case 3:
return strlcpy(s, "SNES30 8bitdo", len);
return strlcpy_lit(s, "SNES30 8bitdo", len);
}
}
return 0;
@@ -3890,11 +3890,11 @@ static size_t setting_get_string_representation_uint_menu_timedate_date_separato
switch (*setting->value.target.unsigned_integer)
{
case MENU_TIMEDATE_DATE_SEPARATOR_HYPHEN:
return strlcpy(s, "'-'", len);
return strlcpy_lit(s, "'-'", len);
case MENU_TIMEDATE_DATE_SEPARATOR_SLASH:
return strlcpy(s, "'/'", len);
return strlcpy_lit(s, "'/'", len);
case MENU_TIMEDATE_DATE_SEPARATOR_PERIOD:
return strlcpy(s, "'.'", len);
return strlcpy_lit(s, "'.'", len);
}
}
return 0;
@@ -4460,9 +4460,9 @@ static size_t setting_get_string_representation_uint_menu_xmb_animation_move_up_
switch (*setting->value.target.unsigned_integer)
{
case 0:
return strlcpy(s, "Easing Out Quad", len);
return strlcpy_lit(s, "Easing Out Quad", len);
case 1:
return strlcpy(s, "Easing Out Expo", len);
return strlcpy_lit(s, "Easing Out Expo", len);
case 2:
return strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NONE), len);
}
@@ -4478,13 +4478,13 @@ static size_t setting_get_string_representation_uint_menu_xmb_animation_opening_
switch (*setting->value.target.unsigned_integer)
{
case 0:
return strlcpy(s, "Easing Out Quad", len);
return strlcpy_lit(s, "Easing Out Quad", len);
case 1:
return strlcpy(s, "Easing Out Circ", len);
return strlcpy_lit(s, "Easing Out Circ", len);
case 2:
return strlcpy(s, "Easing Out Expo", len);
return strlcpy_lit(s, "Easing Out Expo", len);
case 3:
return strlcpy(s, "Easing Out Bounce", len);
return strlcpy_lit(s, "Easing Out Bounce", len);
}
}
return 0;
@@ -4498,11 +4498,11 @@ static size_t setting_get_string_representation_uint_menu_xmb_animation_horizont
switch (*setting->value.target.unsigned_integer)
{
case 0:
return strlcpy(s, "Easing Out Quad", len);
return strlcpy_lit(s, "Easing Out Quad", len);
case 1:
return strlcpy(s, "Easing In Sine", len);
return strlcpy_lit(s, "Easing In Sine", len);
case 2:
return strlcpy(s, "Easing Out Bounce", len);
return strlcpy_lit(s, "Easing Out Bounce", len);
}
}
return 0;
@@ -4566,11 +4566,11 @@ static size_t setting_get_string_representation_uint_xmb_layout(
switch (*setting->value.target.unsigned_integer)
{
case 0:
return strlcpy(s, "Auto", len);
return strlcpy_lit(s, "Auto", len);
case 1:
return strlcpy(s, "Console", len);
return strlcpy_lit(s, "Console", len);
case 2:
return strlcpy(s, "Handheld", len);
return strlcpy_lit(s, "Handheld", len);
}
}
return 0;
@@ -5225,7 +5225,7 @@ static size_t setting_get_string_representation_uint_video_monitor_index(
if (setting && *setting->value.target.unsigned_integer)
return snprintf(s, len, "%u",
*setting->value.target.unsigned_integer);
return strlcpy(s, "0 (Auto)", len);
return strlcpy_lit(s, "0 (Auto)", len);
}
static size_t setting_get_string_representation_uint_custom_vp_width(
@@ -5296,22 +5296,22 @@ static size_t setting_get_string_representation_uint_audio_wasapi_sh_buffer_leng
{
case WASAPI_SH_BUFFER_AUDIO_LATENCY:
/* TODO/FIXME - localize */
_len += strlcpy(s + _len, "Audio Latency", len - _len);
_len += strlcpy_lit(s + _len, "Audio Latency", len - _len);
break;
case WASAPI_SH_BUFFER_DEVICE_PERIOD:
/* TODO/FIXME - localize */
_len += strlcpy(s + _len, "Device Period", len - _len);
_len += strlcpy_lit(s + _len, "Device Period", len - _len);
break;
case WASAPI_SH_BUFFER_CLIENT_BUFFER:
/* TODO/FIXME - localize */
_len += strlcpy(s + _len, "Client Buffer", len - _len);
_len += strlcpy_lit(s + _len, "Client Buffer", len - _len);
break;
default:
_len += snprintf(s + _len, len - _len, "%.1f ms",
(float)*setting->value.target.integer * 1000 / settings->uints.audio_output_sample_rate);
break;
}
_len += strlcpy(s + _len, ")", len - _len);
_len += strlcpy_lit(s + _len, ")", len - _len);
return _len;
}
@@ -5326,7 +5326,7 @@ static size_t setting_get_string_representation_uint_microphone_wasapi_sh_buffer
return snprintf(s, len, "%u (%.1f ms)",
*setting->value.target.integer,
(float)*setting->value.target.integer * 1000 / settings->uints.audio_output_sample_rate);
return strlcpy(s, "Auto", len);
return strlcpy_lit(s, "Auto", len);
}
#endif
#endif
@@ -5349,9 +5349,9 @@ static size_t setting_get_string_representation_crt_switch_resolution_super(
if (!setting)
return 0;
if (*setting->value.target.unsigned_integer == 0)
return strlcpy(s, "NATIVE", len);
return strlcpy_lit(s, "NATIVE", len);
else if (*setting->value.target.unsigned_integer == 1)
return strlcpy(s, "DYNAMIC", len);
return strlcpy_lit(s, "DYNAMIC", len);
return snprintf(s, len, "%d", *setting->value.target.unsigned_integer);
}
@@ -6257,7 +6257,7 @@ static int setting_string_action_left_audio_device(
audio_device_index = (int)(ptr->size - 1);
if (audio_device_index < 0)
strlcpy(setting->value.target.string,
strlcpy_lit(setting->value.target.string,
"", setting->size);
else
strlcpy(setting->value.target.string,
@@ -6290,7 +6290,7 @@ static int setting_string_action_left_microphone_device(
mic_device_index = (int)(ptr->size - 1);
if (mic_device_index < 0)
strlcpy(setting->value.target.string,
strlcpy_lit(setting->value.target.string,
"", setting->size);
else
strlcpy(setting->value.target.string,
@@ -6575,7 +6575,7 @@ static int setting_string_action_right_audio_device(
audio_device_index = -1;
if (audio_device_index < 0)
strlcpy(setting->value.target.string,
strlcpy_lit(setting->value.target.string,
"", setting->size);
else
strlcpy(setting->value.target.string,
@@ -6607,7 +6607,7 @@ static int setting_string_action_right_microphone_device(
mic_device_index = -1;
if (mic_device_index < 0)
strlcpy(setting->value.target.string,
strlcpy_lit(setting->value.target.string,
"", setting->size);
else
strlcpy(setting->value.target.string,
@@ -7047,13 +7047,13 @@ static size_t setting_get_string_representation_uint_crt_switch_resolutions(
case CRT_SWITCH_NONE:
return strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF), len);
case CRT_SWITCH_15KHZ:
return strlcpy(s, "15 KHz", len);
return strlcpy_lit(s, "15 KHz", len);
case CRT_SWITCH_31KHZ:
return strlcpy(s, "31 KHz, Standard", len);
return strlcpy_lit(s, "31 KHz, Standard", len);
case CRT_SWITCH_32_120:
return strlcpy(s, "31 KHz, 120Hz", len);
return strlcpy_lit(s, "31 KHz, 120Hz", len);
case CRT_SWITCH_INI:
return strlcpy(s, "INI", len);
return strlcpy_lit(s, "INI", len);
}
}
return 0;
@@ -7593,7 +7593,7 @@ static size_t setting_get_string_representation_uint_quit_on_close_content(
case QUIT_ON_CLOSE_CONTENT_ENABLED:
return strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON), len);
case QUIT_ON_CLOSE_CONTENT_CLI:
return strlcpy(s, "CLI", len);
return strlcpy_lit(s, "CLI", len);
}
}
return 0;
@@ -7607,18 +7607,18 @@ static size_t setting_get_string_representation_uint_video_scale_integer_axis(
switch (*setting->value.target.unsigned_integer)
{
case VIDEO_SCALE_INTEGER_AXIS_Y_X:
return strlcpy(s, "Y + X", len);
return strlcpy_lit(s, "Y + X", len);
case VIDEO_SCALE_INTEGER_AXIS_Y_XHALF:
return strlcpy(s, "Y + X.5", len);
return strlcpy_lit(s, "Y + X.5", len);
case VIDEO_SCALE_INTEGER_AXIS_YHALF_XHALF:
return strlcpy(s, "Y.5 + X.5", len);
return strlcpy_lit(s, "Y.5 + X.5", len);
case VIDEO_SCALE_INTEGER_AXIS_X:
return strlcpy(s, "X", len);
return strlcpy_lit(s, "X", len);
case VIDEO_SCALE_INTEGER_AXIS_XHALF:
return strlcpy(s, "X.5", len);
return strlcpy_lit(s, "X.5", len);
case VIDEO_SCALE_INTEGER_AXIS_Y:
default:
return strlcpy(s, "Y", len);
return strlcpy_lit(s, "Y", len);
}
}
return 0;
@@ -8624,11 +8624,11 @@ static size_t setting_get_string_representation_smb_auth(
switch (val)
{
case RETRO_SMB2_SEC_NTLMSSP: /* SMB2_SEC_NTLMSSP */
return strlcpy(s, "NTLMSSP", len);
return strlcpy_lit(s, "NTLMSSP", len);
case RETRO_SMB2_SEC_KRB5: /* SMB2_SEC_KRB5 */
return strlcpy(s, "Kerberos", len);
return strlcpy_lit(s, "Kerberos", len);
default:
return strlcpy(s, "KRB if available, NTLM if not", len);
return strlcpy_lit(s, "KRB if available, NTLM if not", len);
}
}
+5 -5
View File
@@ -241,7 +241,7 @@ static bool s3_parse_url(const char *url, char *bucket, char *region,
}
/* Cloudflare R2 uses region "auto" for AWS SigV4. */
strlcpy(region, "auto", NAME_MAX_LENGTH);
strlcpy_lit(region, "auto", NAME_MAX_LENGTH);
}
else if (strstr(host, ".amazonaws.com"))
{
@@ -262,7 +262,7 @@ static bool s3_parse_url(const char *url, char *bucket, char *region,
/* Transfer acceleration endpoints do not encode bucket region in hostname.
* Keep fallback-compatible behavior by using us-east-1 here. */
strlcpy(region, "us-east-1", NAME_MAX_LENGTH);
strlcpy_lit(region, "us-east-1", NAME_MAX_LENGTH);
}
else if (s3pos)
{
@@ -371,7 +371,7 @@ static bool s3_parse_url(const char *url, char *bucket, char *region,
}
if (!region || !*region)
strlcpy(region, "us-east-1", NAME_MAX_LENGTH);
strlcpy_lit(region, "us-east-1", NAME_MAX_LENGTH);
if (!*bucket)
RARCH_WARN(S3_PFX "Could not extract bucket from URL: %s\n", url);
@@ -1010,7 +1010,7 @@ static bool s3_build_canonical_uri_from_url(const char *url, char *canonical_uri
path_start = strchr(authority, '/');
if (!path_start)
{
strlcpy(canonical_uri, "/", canonical_uri_size);
strlcpy_lit(canonical_uri, "/", canonical_uri_size);
return true;
}
@@ -1019,7 +1019,7 @@ static bool s3_build_canonical_uri_from_url(const char *url, char *canonical_uri
if (path_len == 0)
{
strlcpy(canonical_uri, "/", canonical_uri_size);
strlcpy_lit(canonical_uri, "/", canonical_uri_size);
return true;
}
+2 -2
View File
@@ -199,10 +199,10 @@ static bool smb_sync_begin(cloud_sync_complete_handler_t cb, void *user_data)
{
_len = strlcpy(smb_st.subdir, subdir, sz);
if (_len < sz)
_len += strlcpy(smb_st.subdir + _len, "/", sz - _len);
_len += strlcpy_lit(smb_st.subdir + _len, "/", sz - _len);
}
if (_len < sz)
strlcpy(smb_st.subdir + _len, "cloud_sync", sz - _len);
strlcpy_lit(smb_st.subdir + _len, "cloud_sync", sz - _len);
}
/* Ensure subdir exists */
+13 -13
View File
@@ -85,7 +85,7 @@ static char *webdav_create_basic_auth(void)
_len += strlcpy(userpass + _len, settings->arrays.webdav_password, sizeof(userpass) - _len);
userpass[_len] = '\0';
base64auth = base64(userpass, (int)_len, &flen);
_len = strlcpy(userpass, "Authorization: Basic ", sizeof(userpass));
_len = strlcpy_lit(userpass, "Authorization: Basic ", sizeof(userpass));
_len += strlcpy(userpass + _len, base64auth, sizeof(userpass) - _len);
free(base64auth);
userpass[_len++] = '\r';
@@ -397,28 +397,28 @@ static char *webdav_create_digest_auth_header(const char *method, const char *ur
total = _len;
_len = 0;
header = (char*)malloc(total);
_len = strlcpy(header, "Authorization: Digest username=\"", total - _len);
_len = strlcpy_lit(header, "Authorization: Digest username=\"", total - _len);
_len += strlcpy(header + _len, webdav_st->username, total - _len);
_len += strlcpy(header + _len, "\", realm=\"", total - _len);
_len += strlcpy_lit(header + _len, "\", realm=\"", total - _len);
_len += strlcpy(header + _len, webdav_st->realm, total - _len);
_len += strlcpy(header + _len, "\", nonce=\"", total - _len);
_len += strlcpy_lit(header + _len, "\", nonce=\"", total - _len);
_len += strlcpy(header + _len, webdav_st->nonce, total - _len);
_len += strlcpy(header + _len, "\", uri=\"", total - _len);
_len += strlcpy_lit(header + _len, "\", uri=\"", total - _len);
_len += strlcpy(header + _len, path, total - _len);
_len += strlcpy(header + _len, "\", nc=\"", total - _len);
_len += strlcpy_lit(header + _len, "\", nc=\"", total - _len);
_len += strlcpy(header + _len, nonceCount, total - _len);
_len += strlcpy(header + _len, "\", cnonce=\"", total - _len);
_len += strlcpy_lit(header + _len, "\", cnonce=\"", total - _len);
_len += strlcpy(header + _len, webdav_st->cnonce, total - _len);
if (webdav_st->qop_auth)
_len += strlcpy(header + _len, "\", qop=\"auth", total - _len);
_len += strlcpy_lit(header + _len, "\", qop=\"auth", total - _len);
if (webdav_st->opaque)
{
_len += strlcpy(header + _len, "\", opaque=\"", total - _len);
_len += strlcpy_lit(header + _len, "\", opaque=\"", total - _len);
_len += strlcpy(header + _len, webdav_st->opaque, total - _len);
}
_len += strlcpy(header + _len, "\", response=\"", total - _len);
_len += strlcpy_lit(header + _len, "\", response=\"", total - _len);
_len += strlcpy(header + _len, response, total - _len);
strlcpy(header + _len, "\"\r\n", total - _len);
strlcpy_lit(header + _len, "\"\r\n", total - _len);
free(response);
return header;
}
@@ -533,7 +533,7 @@ static bool webdav_sync_begin(cloud_sync_complete_handler_t cb, void *user_data)
#endif
/* TODO/FIXME: LOCK? */
if (!strstr(url, "://"))
_len += strlcpy(webdav_st->url, "http://", (sizeof("http://")-1));
_len += strlcpy_lit(webdav_st->url, "http://", (sizeof("http://")-1));
strlcpy(webdav_st->url + _len, url, sizeof(webdav_st->url) - _len);
fill_pathname_slash(webdav_st->url, sizeof(webdav_st->url));
@@ -945,7 +945,7 @@ static bool webdav_delete(const char *path, cloud_sync_complete_handler_t cb, vo
else
{
char dir[DIR_MAX_LENGTH];
size_t _len = strlcpy(dir, "deleted/", sizeof(dir));
size_t _len = strlcpy_lit(dir, "deleted/", sizeof(dir));
fill_pathname_basedir(dir + _len, path, sizeof(dir) - _len);
webdav_ensure_dir(dir, webdav_do_backup, webdav_cb_st);
}
+4 -4
View File
@@ -954,7 +954,7 @@ static rjson_t *discord_rpc_read(struct discord_rpc *rpc, char **json_buf_out)
if (!rpc->is_open)
{
rpc->last_error_code = DISCORD_ERR_PIPE_CLOSED;
strlcpy(rpc->last_error_message, "Pipe closed",
strlcpy_lit(rpc->last_error_message, "Pipe closed",
sizeof(rpc->last_error_message));
discord_rpc_close(rpc);
}
@@ -966,7 +966,7 @@ static rjson_t *discord_rpc_read(struct discord_rpc *rpc, char **json_buf_out)
if (read_frame.hdr.length > sizeof(read_frame.message) - 1)
{
rpc->last_error_code = DISCORD_ERR_READ_CORRUPT;
strlcpy(rpc->last_error_message, "Frame too large",
strlcpy_lit(rpc->last_error_message, "Frame too large",
sizeof(rpc->last_error_message));
discord_rpc_close(rpc);
return NULL;
@@ -975,7 +975,7 @@ static rjson_t *discord_rpc_read(struct discord_rpc *rpc, char **json_buf_out)
read_frame.hdr.length))
{
rpc->last_error_code = DISCORD_ERR_READ_CORRUPT;
strlcpy(rpc->last_error_message, "Partial data in frame",
strlcpy_lit(rpc->last_error_message, "Partial data in frame",
sizeof(rpc->last_error_message));
discord_rpc_close(rpc);
return NULL;
@@ -1053,7 +1053,7 @@ static rjson_t *discord_rpc_read(struct discord_rpc *rpc, char **json_buf_out)
case DISCORD_OP_HANDSHAKE:
default:
rpc->last_error_code = DISCORD_ERR_READ_CORRUPT;
strlcpy(rpc->last_error_message, "Bad ipc frame",
strlcpy_lit(rpc->last_error_message, "Bad ipc frame",
sizeof(rpc->last_error_message));
discord_rpc_close(rpc);
return NULL;
+3 -3
View File
@@ -402,7 +402,7 @@ static bool connmanctl_connect_ssid(
connmanctl_tether_toggle(connman, false, "", "");
}
strlcpy(connman->command, "connmanctl connect ", sizeof(connman->command));
strlcpy_lit(connman->command, "connmanctl connect ", sizeof(connman->command));
strlcat(connman->command, netinfo->netid, sizeof(connman->command));
pclose(popen(connman->command, "r"));
@@ -642,8 +642,8 @@ static void connmanctl_tether_start_stop(void *data, bool start, char* configfil
RARCH_LOG("[CONNMANCTL] Tether start stop: creating new config \"%s\"\n",
configfile);
strlcpy(ap_name, "LakkaAccessPoint", sizeof(ap_name));
strlcpy(pass_key, "RetroArch", sizeof(pass_key));
strlcpy_lit(ap_name, "LakkaAccessPoint", sizeof(ap_name));
strlcpy_lit(pass_key, "RetroArch", sizeof(pass_key));
fprintf(command_file, "APNAME=%s\nPASSWORD=%s", ap_name, pass_key);
+1 -1
View File
@@ -251,7 +251,7 @@ static bool natt_build_control_url(
if (control_path)
*control_path = '\0';
if (control_url->data[0] != '/')
strlcpy(device->control + _len, "/",
strlcpy_lit(device->control + _len, "/",
sizeof(device->control) - _len);
/* Make sure the control URL isn't too long. */
if (strlcat(device->control, control_url->data,
+4 -4
View File
@@ -778,7 +778,7 @@ static bool netplay_lan_ad_server(netplay_t *netplay)
}
}
else
strlcpy(ad_packet_buffer.frontend, "N/A",
strlcpy_lit(ad_packet_buffer.frontend, "N/A",
sizeof(ad_packet_buffer.frontend));
strlcpy(ad_packet_buffer.core, sysinfo->library_name,
@@ -827,7 +827,7 @@ static bool netplay_lan_ad_server(netplay_t *netplay)
strlcpy(ad_packet_buffer.content,
(basename && *basename) ? basename : "N/A",
sizeof(ad_packet_buffer.content));
strlcpy(ad_packet_buffer.subsystem_name, "N/A",
strlcpy_lit(ad_packet_buffer.subsystem_name, "N/A",
sizeof(ad_packet_buffer.subsystem_name));
ad_packet_buffer.content_crc = (int32_t)htonl(netplay_content_crc());
@@ -1408,9 +1408,9 @@ static bool netplay_handshake_info(netplay_t *netplay,
}
else
{
strlcpy(info_buf.core_name,
strlcpy_lit(info_buf.core_name,
"UNKNOWN", sizeof(info_buf.core_name));
strlcpy(info_buf.core_version,
strlcpy_lit(info_buf.core_version,
"UNKNOWN", sizeof(info_buf.core_version));
}
@@ -347,7 +347,7 @@ struct string_list *play_feature_delivery_available_cores(void)
char core_file[256];
/* Generate core file name */
size_t _len = strlcpy(core_file, core_name, sizeof(core_file));
strlcpy(core_file + _len,
strlcpy_lit(core_file + _len,
"_libretro_android.so",
sizeof(core_file) - _len);
/* Add entry to list */
+3 -3
View File
@@ -1970,7 +1970,7 @@ void playlist_write_runtime_file(playlist_t *playlist)
playlist->config.path);
return;
}
strlcpy(write_path + _len, ".tmp", sizeof(write_path) - _len);
strlcpy_lit(write_path + _len, ".tmp", sizeof(write_path) - _len);
if (!(file = intfstream_open_file(write_path,
RETRO_VFS_FILE_ACCESS_WRITE, RETRO_VFS_FILE_ACCESS_HINT_NONE)))
@@ -2168,7 +2168,7 @@ static bool playlist_replace_file(const char *from, const char *to)
_len = strlcpy(saved, to, sizeof(saved));
if (_len + STRLEN_CONST(".old") >= sizeof(saved))
return false;
strlcpy(saved + _len, ".old", sizeof(saved) - _len);
strlcpy_lit(saved + _len, ".old", sizeof(saved) - _len);
filestream_delete(saved); /* a leftover from a previous run */
if (filestream_rename(to, saved) != 0)
@@ -2227,7 +2227,7 @@ void playlist_write_file(playlist_t *playlist)
playlist->config.path);
return;
}
strlcpy(write_path + _len, ".tmp", sizeof(write_path) - _len);
strlcpy_lit(write_path + _len, ".tmp", sizeof(write_path) - _len);
#if defined(HAVE_COMPRESSION)
if (playlist->config.compress)
+27 -27
View File
@@ -642,8 +642,8 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params,
params->audio_global_quality = 75;
params->out_pix_fmt = AV_PIX_FMT_YUV420P;
strlcpy(params->vcodec, "libx264", sizeof(params->vcodec));
strlcpy(params->acodec, "aac", sizeof(params->acodec));
strlcpy_lit(params->vcodec, "libx264", sizeof(params->vcodec));
strlcpy_lit(params->acodec, "aac", sizeof(params->acodec));
av_dict_set(&params->video_opts, "preset", "ultrafast", 0);
av_dict_set(&params->video_opts, "tune", "film", 0);
@@ -658,8 +658,8 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params,
params->audio_global_quality = 75;
params->out_pix_fmt = AV_PIX_FMT_YUV420P;
strlcpy(params->vcodec, "libx264", sizeof(params->vcodec));
strlcpy(params->acodec, "aac", sizeof(params->acodec));
strlcpy_lit(params->vcodec, "libx264", sizeof(params->vcodec));
strlcpy_lit(params->acodec, "aac", sizeof(params->acodec));
av_dict_set(&params->video_opts, "preset", "superfast", 0);
av_dict_set(&params->video_opts, "tune", "film", 0);
@@ -674,8 +674,8 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params,
params->audio_global_quality = 100;
params->out_pix_fmt = AV_PIX_FMT_YUV420P;
strlcpy(params->vcodec, "libx264", sizeof(params->vcodec));
strlcpy(params->acodec, "aac", sizeof(params->acodec));
strlcpy_lit(params->vcodec, "libx264", sizeof(params->vcodec));
strlcpy_lit(params->acodec, "aac", sizeof(params->acodec));
av_dict_set(&params->video_opts, "preset", "superfast", 0);
av_dict_set(&params->video_opts, "tune", "film", 0);
@@ -689,8 +689,8 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params,
params->audio_global_quality = 80;
params->out_pix_fmt = AV_PIX_FMT_BGR24;
strlcpy(params->vcodec, "libx264rgb", sizeof(params->vcodec));
strlcpy(params->acodec, "flac", sizeof(params->acodec));
strlcpy_lit(params->vcodec, "libx264rgb", sizeof(params->vcodec));
strlcpy_lit(params->acodec, "flac", sizeof(params->acodec));
av_dict_set(&params->video_opts, "qp", "0", 0);
av_dict_set(&params->audio_opts, "audio_global_quality", "100", 0);
@@ -702,8 +702,8 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params,
params->audio_global_quality = 50;
params->out_pix_fmt = AV_PIX_FMT_YUV420P;
strlcpy(params->vcodec, "libvpx", sizeof(params->vcodec));
strlcpy(params->acodec, "libopus", sizeof(params->acodec));
strlcpy_lit(params->vcodec, "libvpx", sizeof(params->vcodec));
strlcpy_lit(params->acodec, "libopus", sizeof(params->acodec));
av_dict_set(&params->video_opts, "deadline", "realtime", 0);
av_dict_set(&params->video_opts, "crf", "14", 0);
@@ -716,8 +716,8 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params,
params->audio_global_quality = 75;
params->out_pix_fmt = AV_PIX_FMT_YUV420P;
strlcpy(params->vcodec, "libvpx", sizeof(params->vcodec));
strlcpy(params->acodec, "libopus", sizeof(params->acodec));
strlcpy_lit(params->vcodec, "libvpx", sizeof(params->vcodec));
strlcpy_lit(params->acodec, "libopus", sizeof(params->acodec));
av_dict_set(&params->video_opts, "deadline", "realtime", 0);
av_dict_set(&params->video_opts, "crf", "4", 0);
@@ -730,8 +730,8 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params,
params->audio_global_quality = 0;
params->out_pix_fmt = AV_PIX_FMT_RGB8;
strlcpy(params->vcodec, "gif", sizeof(params->vcodec));
strlcpy(params->acodec, "", sizeof(params->acodec));
strlcpy_lit(params->vcodec, "gif", sizeof(params->vcodec));
strlcpy_lit(params->acodec, "", sizeof(params->acodec));
av_dict_set(&params->video_opts, "framerate", "30", 0);
av_dict_set(&params->audio_opts, "audio_global_quality", "0", 0);
@@ -743,8 +743,8 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params,
params->audio_global_quality = 0;
params->out_pix_fmt = AV_PIX_FMT_RGB24;
strlcpy(params->vcodec, "apng", sizeof(params->vcodec));
strlcpy(params->acodec, "", sizeof(params->acodec));
strlcpy_lit(params->vcodec, "apng", sizeof(params->vcodec));
strlcpy_lit(params->acodec, "", sizeof(params->acodec));
av_dict_set(&params->video_opts, "pred", "avg", 0);
av_dict_set(&params->audio_opts, "audio_global_quality", "0", 0);
@@ -756,8 +756,8 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params,
params->audio_global_quality = 50;
params->out_pix_fmt = AV_PIX_FMT_YUV420P;
strlcpy(params->vcodec, "libx264", sizeof(params->vcodec));
strlcpy(params->acodec, "aac", sizeof(params->acodec));
strlcpy_lit(params->vcodec, "libx264", sizeof(params->vcodec));
strlcpy_lit(params->acodec, "aac", sizeof(params->acodec));
av_dict_set(&params->video_opts, "preset", "ultrafast", 0);
av_dict_set(&params->video_opts, "tune", "zerolatency", 0);
@@ -765,8 +765,8 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params,
av_dict_set(&params->audio_opts, "audio_global_quality", "50", 0);
/* TO-DO: detect if hwaccel is available and use it instead of the preset above
strlcpy(params->vcodec, "h264_nvenc", sizeof(params->vcodec));
strlcpy(params->acodec, "aac", sizeof(params->acodec));
strlcpy_lit(params->vcodec, "h264_nvenc", sizeof(params->vcodec));
strlcpy_lit(params->acodec, "aac", sizeof(params->acodec));
av_dict_set(&params->video_opts, "preset", "llhp", 0);
av_dict_set(&params->video_opts, "tune", "zerolatency", 0);
@@ -788,7 +788,7 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params,
video_record_scale_factor : 1;
else
params->scale_factor = 1;
strlcpy(params->format, "matroska", sizeof(params->format));
strlcpy_lit(params->format, "matroska", sizeof(params->format));
}
else if (preset >= RECORD_CONFIG_TYPE_RECORDING_WEBM_FAST && preset < RECORD_CONFIG_TYPE_RECORDING_GIF)
{
@@ -797,7 +797,7 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params,
video_record_scale_factor : 1;
else
params->scale_factor = 1;
strlcpy(params->format, "webm", sizeof(params->format));
strlcpy_lit(params->format, "webm", sizeof(params->format));
}
else if (preset >= RECORD_CONFIG_TYPE_RECORDING_GIF && preset < RECORD_CONFIG_TYPE_RECORDING_APNG)
{
@@ -806,12 +806,12 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params,
video_record_scale_factor : 1;
else
params->scale_factor = 1;
strlcpy(params->format, "gif", sizeof(params->format));
strlcpy_lit(params->format, "gif", sizeof(params->format));
}
else if (preset < RECORD_CONFIG_TYPE_STREAMING_LOW_QUALITY)
{
params->scale_factor = 1;
strlcpy(params->format, "apng", sizeof(params->format));
strlcpy_lit(params->format, "apng", sizeof(params->format));
}
else if (preset <= RECORD_CONFIG_TYPE_STREAMING_HIGH_QUALITY)
{
@@ -824,14 +824,14 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params,
|| streaming_mode == STREAMING_MODE_TWITCH
|| streaming_mode == STREAMING_MODE_FACEBOOK
|| streaming_mode == STREAMING_MODE_KICK)
strlcpy(params->format, "flv", sizeof(params->format));
strlcpy_lit(params->format, "flv", sizeof(params->format));
else
strlcpy(params->format, "mpegts", sizeof(params->format));
strlcpy_lit(params->format, "mpegts", sizeof(params->format));
}
else if (preset == RECORD_CONFIG_TYPE_STREAMING_NETPLAY)
{
params->scale_factor = 1;
strlcpy(params->format, "mpegts", sizeof(params->format));
strlcpy_lit(params->format, "mpegts", sizeof(params->format));
}
return true;
+2 -2
View File
@@ -235,7 +235,7 @@ bool recording_init(void)
else
{
/* Fallback, stream locally to 127.0.0.1 */
size_t _len = strlcpy(output, "udp://127.0.0.1:", sizeof(output));
size_t _len = strlcpy_lit(output, "udp://127.0.0.1:", sizeof(output));
snprintf(output + _len, sizeof(output) - _len, "%u",
video_stream_port);
}
@@ -467,7 +467,7 @@ void recording_driver_update_streaming_url(void)
case STREAMING_MODE_LOCAL:
{
/* TODO: figure out default interface and bind to that instead */
size_t _len = strlcpy(settings->paths.path_stream_url, "udp://127.0.0.1:",
size_t _len = strlcpy_lit(settings->paths.path_stream_url, "udp://127.0.0.1:",
sizeof(settings->paths.path_stream_url));
snprintf(settings->paths.path_stream_url + _len,
sizeof(settings->paths.path_stream_url) - _len,
+17 -17
View File
@@ -2256,27 +2256,27 @@ struct string_list *dir_list_new_special(const char *input_dir,
if (BIT32_GET(flags.flags, GFX_CTX_FLAGS_SHADERS_CG))
{
_len += strlcpy(ext_shaders + _len, "cgp", sizeof(ext_shaders) - _len);
_len += strlcpy(ext_shaders + _len, "|", sizeof(ext_shaders) - _len);
_len += strlcpy(ext_shaders + _len, "cg", sizeof(ext_shaders) - _len);
_len += strlcpy_lit(ext_shaders + _len, "cgp", sizeof(ext_shaders) - _len);
_len += strlcpy_lit(ext_shaders + _len, "|", sizeof(ext_shaders) - _len);
_len += strlcpy_lit(ext_shaders + _len, "cg", sizeof(ext_shaders) - _len);
}
if (BIT32_GET(flags.flags, GFX_CTX_FLAGS_SHADERS_GLSL))
{
if (_len > 0)
_len += strlcpy(ext_shaders + _len, "|", sizeof(ext_shaders) - _len);
_len += strlcpy(ext_shaders + _len, "glslp", sizeof(ext_shaders) - _len);
_len += strlcpy(ext_shaders + _len, "|", sizeof(ext_shaders) - _len);
_len += strlcpy(ext_shaders + _len, "glsl", sizeof(ext_shaders) - _len);
_len += strlcpy_lit(ext_shaders + _len, "|", sizeof(ext_shaders) - _len);
_len += strlcpy_lit(ext_shaders + _len, "glslp", sizeof(ext_shaders) - _len);
_len += strlcpy_lit(ext_shaders + _len, "|", sizeof(ext_shaders) - _len);
_len += strlcpy_lit(ext_shaders + _len, "glsl", sizeof(ext_shaders) - _len);
}
if (BIT32_GET(flags.flags, GFX_CTX_FLAGS_SHADERS_SLANG))
{
if (_len > 0)
_len += strlcpy(ext_shaders + _len, "|", sizeof(ext_shaders) - _len);
_len += strlcpy(ext_shaders + _len, "slangp", sizeof(ext_shaders) - _len);
_len += strlcpy(ext_shaders + _len, "|", sizeof(ext_shaders) - _len);
strlcpy(ext_shaders + _len, "slang", sizeof(ext_shaders) - _len);
_len += strlcpy_lit(ext_shaders + _len, "|", sizeof(ext_shaders) - _len);
_len += strlcpy_lit(ext_shaders + _len, "slangp", sizeof(ext_shaders) - _len);
_len += strlcpy_lit(ext_shaders + _len, "|", sizeof(ext_shaders) - _len);
strlcpy_lit(ext_shaders + _len, "slang", sizeof(ext_shaders) - _len);
}
exts = ext_shaders;
@@ -6840,7 +6840,7 @@ static void retroarch_print_features(void)
frontend_driver_attach_console();
_len = strlcpy(buf, "Features:\n", sizeof(buf));
_len = strlcpy_lit(buf, "Features:\n", sizeof(buf));
#ifdef HAVE_DYLIB
_len += _PSUPP_BUF(buf, _len, SUPPORTS_DYLIB, "Dylib", "External filter and plugin support");
#endif
@@ -7473,7 +7473,7 @@ static void retroarch_parse_input_libretro_path(
_len = strlcpy(tmp_path, path, sizeof(tmp_path));
if (!string_ends_with_size(tmp_path, "_libretro",
_len, STRLEN_CONST("_libretro")))
strlcpy(tmp_path + _len,
strlcpy_lit(tmp_path + _len,
"_libretro",
sizeof(tmp_path) - _len);
if ( !core_info_find(tmp_path, &core_info)
@@ -7614,7 +7614,7 @@ static bool retroarch_parse_input_and_config(
{
_len += strlcpy(p_rarch->launch_arguments + _len,
argv[i], sizeof(p_rarch->launch_arguments) - _len);
_len += strlcpy(p_rarch->launch_arguments + _len,
_len += strlcpy_lit(p_rarch->launch_arguments + _len,
" ", sizeof(p_rarch->launch_arguments) - _len);
}
string_trim_whitespace_left(p_rarch->launch_arguments);
@@ -8469,7 +8469,7 @@ bool retroarch_main_init(int argc, char *argv[])
{
char str_output[384];
const char *cpu_model = frontend_driver_get_cpu_model_name();
size_t _len = strlcpy(str_output,
size_t _len = strlcpy_lit(str_output,
"=== Build =================================================\n",
sizeof(str_output));
@@ -9394,9 +9394,9 @@ size_t retroarch_get_capabilities(enum rarch_capabilities type,
__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
#elif defined(__clang__)
_len += strlcpy(s + _len, msg_hash_to_str(MSG_COMPILER), len - _len);
_len += strlcpy(s + _len, ": Clang/LLVM (", len - _len);
_len += strlcpy_lit(s + _len, ": Clang/LLVM (", len - _len);
_len += strlcpy(s + _len, __clang_version__, len - _len);
_len += strlcpy(s + _len, ")", len - _len);
_len += strlcpy_lit(s + _len, ")", len - _len);
#elif defined(__GNUC__)
_len += strlcpy (s + _len, msg_hash_to_str(MSG_COMPILER), len - _len);
_len += snprintf(s + _len, len - _len, ": GCC (%d.%d.%d)",
+5 -5
View File
@@ -5414,7 +5414,7 @@ void runloop_path_fill_names(void)
size_t _len = strlcpy(runloop_st->name.ups,
runloop_st->runtime_content_path_basename,
sizeof(runloop_st->name.ups));
strlcpy(runloop_st->name.ups + _len,
strlcpy_lit(runloop_st->name.ups + _len,
".ups",
sizeof(runloop_st->name.ups) - _len);
}
@@ -5424,7 +5424,7 @@ void runloop_path_fill_names(void)
size_t _len = strlcpy(runloop_st->name.bps,
runloop_st->runtime_content_path_basename,
sizeof(runloop_st->name.bps));
strlcpy(runloop_st->name.bps + _len,
strlcpy_lit(runloop_st->name.bps + _len,
".bps",
sizeof(runloop_st->name.bps) - _len);
}
@@ -5434,7 +5434,7 @@ void runloop_path_fill_names(void)
size_t _len = strlcpy(runloop_st->name.ips,
runloop_st->runtime_content_path_basename,
sizeof(runloop_st->name.ips));
strlcpy(runloop_st->name.ips + _len,
strlcpy_lit(runloop_st->name.ips + _len,
".ips",
sizeof(runloop_st->name.ips) - _len);
}
@@ -5444,7 +5444,7 @@ void runloop_path_fill_names(void)
size_t _len = strlcpy(runloop_st->name.xdelta,
runloop_st->runtime_content_path_basename,
sizeof(runloop_st->name.xdelta));
strlcpy(runloop_st->name.xdelta + _len,
strlcpy_lit(runloop_st->name.xdelta + _len,
".xdelta",
sizeof(runloop_st->name.xdelta) - _len);
}
@@ -7715,7 +7715,7 @@ static enum runloop_state_enum runloop_check_state(
": %d", settings->ints.replay_slot);
if (cur_replay_slot < 0)
_len += strlcpy(msg + _len, " (Auto)", sizeof(msg) - _len);
_len += strlcpy_lit(msg + _len, " (Auto)", sizeof(msg) - _len);
#ifdef HAVE_GFX_WIDGETS
if (dispwidget_get_ptr()->active)
+1 -1
View File
@@ -616,7 +616,7 @@ size_t runtime_log_get_runtime_str(runtime_log_t *runtime_log,
runtime_log->runtime.hours, runtime_log->runtime.minutes,
runtime_log->runtime.seconds);
else
_len += strlcpy(s + _len, " 00:00:00", len - _len);
_len += strlcpy_lit(s + _len, " 00:00:00", len - _len);
return _len;
}
@@ -131,8 +131,8 @@ static void test_two_concurrent_task_bars(void)
return;
}
strlcpy(title_a, "Downloading: database-rdb.zip", sizeof(title_a));
strlcpy(title_b, "Extracting database-rdb.zip", sizeof(title_b));
strlcpy_lit(title_a, "Downloading: database-rdb.zip", sizeof(title_a));
strlcpy_lit(title_b, "Extracting database-rdb.zip", sizeof(title_b));
harness_task_init(&task_a, 1, title_a, 80, true);
harness_task_init(&task_b, 2, title_b, 24, true);
@@ -205,7 +205,7 @@ static void test_title_churn(bool alternative)
}
/* Multi-byte title, and one with nothing to wrap on. */
strlcpy(title,
strlcpy_lit(title,
"\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e\xe3\x81\xae\xe3\x83\xa1"
"\xe3\x83\x83\xe3\x82\xbb\xe3\x83\xbc\xe3\x82\xb8", sizeof(title));
task_push(&task);
+1 -1
View File
@@ -682,7 +682,7 @@ static void lane_budgeted_autofix(void)
config_defaults(&config, path);
config.capacity = 8192;
config.autofix_paths = true;
strlcpy(config.base_content_directory, "/mnt/newgames",
strlcpy_lit(config.base_content_directory, "/mnt/newgames",
sizeof(config.base_content_directory));
blocking = playlist_init(&config);
@@ -255,7 +255,7 @@ bool core_info_get_core_lock(const char *core_path, bool validate_path)
* silently while the suite still reported PASSED. */
bool frontend_driver_get_core_extension(char *s, size_t len)
{
strlcpy(s, "so", len);
strlcpy_lit(s, "so", len);
return true;
}
@@ -312,7 +312,7 @@ static uint8_t *read_file_bytes(const char *path, size_t *out_len)
static int setup_tmpdir(void)
{
strlcpy(g_tmpdir, "/tmp/ra_core_backup_XXXXXX", sizeof(g_tmpdir));
strlcpy_lit(g_tmpdir, "/tmp/ra_core_backup_XXXXXX", sizeof(g_tmpdir));
if (!mkdtemp(g_tmpdir))
return 0;
snprintf(g_core_path, sizeof(g_core_path), "%s/testcore_libretro.so",
@@ -350,13 +350,13 @@ static bool configure_scan(const char *content_dir, const char *dat_path,
return false;
/* For the CUSTOM type the setter only records the type; the name
* itself lives in the menu-backed buffer. */
strlcpy(manual_content_scan_get_system_name_custom_ptr(), "ScanBench",
strlcpy_lit(manual_content_scan_get_system_name_custom_ptr(), "ScanBench",
manual_content_scan_get_system_name_custom_size());
if (!manual_content_scan_set_menu_scan_use_db(
MANUAL_CONTENT_SCAN_USE_DB_DAT_LOOSE))
return false;
strlcpy(manual_content_scan_get_file_exts_custom_ptr(), "bin",
strlcpy_lit(manual_content_scan_get_file_exts_custom_ptr(), "bin",
manual_content_scan_get_file_exts_custom_size());
strlcpy(manual_content_scan_get_dat_file_path_ptr(), dat_path,
manual_content_scan_get_dat_file_path_size());
@@ -105,10 +105,10 @@ bool natt_device_next(struct natt_discovery *discovery,
/* Enough of a device for the handler to accept: a description, a
* service type, and a loopback address that find_local_address()
* can connect a UDP socket to in order to learn a local address. */
strlcpy(device->desc, "fake-device", sizeof(device->desc));
strlcpy(device->service_type, "fake-service",
strlcpy_lit(device->desc, "fake-device", sizeof(device->desc));
strlcpy_lit(device->service_type, "fake-service",
sizeof(device->service_type));
strlcpy(device->control, "fake-control", sizeof(device->control));
strlcpy_lit(device->control, "fake-control", sizeof(device->control));
device->addr.sin_family = AF_INET;
device->addr.sin_port = htons(1900);
device->addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+1 -1
View File
@@ -564,7 +564,7 @@ static bool dump_to_file_desperate(const void *data,
time(&time_);
rtime_localtime(&time_, &tm_);
_len += strlcpy(path + _len, "/RetroArch-recovery-", sizeof(path) - _len);
_len += strlcpy_lit(path + _len, "/RetroArch-recovery-", sizeof(path) - _len);
_len += snprintf(path + _len, sizeof(path) - _len, "%u-", type);
strftime(path + _len, sizeof(path) - _len,
"%Y-%m-%d-%H-%M-%S", &tm_);
+9 -9
View File
@@ -244,21 +244,21 @@ static unsigned input_autoconfigure_get_config_file_affinity(
"_alt%d",i);
/* Parse config file */
_len = strlcpy(config_key, "input_vendor_id",
_len = strlcpy_lit(config_key, "input_vendor_id",
sizeof(config_key));
strlcpy(config_key + _len, config_key_postfix,
sizeof(config_key) - _len);
if (config_get_int(config, config_key, &tmp_int))
config_vid = (uint16_t)tmp_int;
_len = strlcpy(config_key, "input_product_id",
_len = strlcpy_lit(config_key, "input_product_id",
sizeof(config_key));
strlcpy(config_key + _len, config_key_postfix,
sizeof(config_key) - _len);
if (config_get_int(config, config_key, &tmp_int))
config_pid = (uint16_t)tmp_int;
_len = strlcpy(config_key, "input_device",
_len = strlcpy_lit(config_key, "input_device",
sizeof(config_key));
strlcpy(config_key + _len, config_key_postfix,
sizeof(config_key) - _len);
@@ -266,7 +266,7 @@ static unsigned input_autoconfigure_get_config_file_affinity(
&& (entry->value))
config_device = entry->value;
_len = strlcpy(config_key, "input_phys",
_len = strlcpy_lit(config_key, "input_phys",
sizeof(config_key));
_len += strlcpy(config_key + _len, config_key_postfix,
sizeof(config_key) - _len);
@@ -309,7 +309,7 @@ static void input_autoconfigure_set_config_file(
}
/* Parse config file */
_len = strlcpy(config_key, "input_device_display_name",
_len = strlcpy_lit(config_key, "input_device_display_name",
sizeof(config_key));
/* Read device display name */
if (alternative > 0)
@@ -452,21 +452,21 @@ static void input_autoconfigure_index_collect(
snprintf(config_key_postfix, sizeof(config_key_postfix),
"_alt%d", i);
_len = strlcpy(config_key, "input_vendor_id",
_len = strlcpy_lit(config_key, "input_vendor_id",
sizeof(config_key));
strlcpy(config_key + _len, config_key_postfix,
sizeof(config_key) - _len);
if (config_get_int(config, config_key, &tmp_int))
config_vid = (uint16_t)tmp_int;
_len = strlcpy(config_key, "input_product_id",
_len = strlcpy_lit(config_key, "input_product_id",
sizeof(config_key));
strlcpy(config_key + _len, config_key_postfix,
sizeof(config_key) - _len);
if (config_get_int(config, config_key, &tmp_int))
config_pid = (uint16_t)tmp_int;
_len = strlcpy(config_key, "input_device",
_len = strlcpy_lit(config_key, "input_device",
sizeof(config_key));
strlcpy(config_key + _len, config_key_postfix,
sizeof(config_key) - _len);
@@ -474,7 +474,7 @@ static void input_autoconfigure_index_collect(
&& (entry->value))
config_device = entry->value;
_len = strlcpy(config_key, "input_phys",
_len = strlcpy_lit(config_key, "input_phys",
sizeof(config_key));
strlcpy(config_key + _len, config_key_postfix,
sizeof(config_key) - _len);
+4 -4
View File
@@ -535,11 +535,11 @@ static bool input_autoconfigure_hidraw_vid_pid_match(
if (!hidraw_name || !*hidraw_name)
return false;
_len = strlcpy(uevent_path, "/sys/class/hidraw/", sizeof(uevent_path));
_len = strlcpy_lit(uevent_path, "/sys/class/hidraw/", sizeof(uevent_path));
_len += strlcpy(uevent_path + _len, hidraw_name, sizeof(uevent_path) - _len);
if (_len >= sizeof(uevent_path) - 1)
return false;
strlcpy(uevent_path + _len, "/device/uevent", sizeof(uevent_path) - _len);
strlcpy_lit(uevent_path + _len, "/device/uevent", sizeof(uevent_path) - _len);
if (!(file = filestream_open(uevent_path,
RETRO_VFS_FILE_ACCESS_READ,
@@ -627,7 +627,7 @@ static const blissbox_pad_type_t* input_autoconfigure_get_blissbox_pad_type_hidr
vid, pid, &reported_vid, &reported_pid))
continue;
_len = strlcpy(device_path, "/dev/", sizeof(device_path));
_len = strlcpy_lit(device_path, "/dev/", sizeof(device_path));
strlcpy(device_path + _len, dir_entry->d_name, sizeof(device_path) - _len);
RARCH_DBG("[Autoconf] [Blissbox] Probing hidraw candidate %s (sysfs=%04x:%04x).\n",
@@ -818,7 +818,7 @@ void input_autoconfigure_blissbox_override_handler(int vid, int pid,
/* override name given to autoconfig so it knows what kind of pad this is */
if (len > 0)
{
size_t _len = strlcpy(s, "Bliss-Box 4-Play ", len);
size_t _len = strlcpy_lit(s, "Bliss-Box 4-Play ", len);
strlcpy(s + _len, pad->name, len - _len);
}
+6 -6
View File
@@ -1443,15 +1443,15 @@ static void task_cloud_sync_end_handler(void *user_data, const char *path, bool
if ((sync_state = (task_cloud_sync_state_t *)task->state))
{
char title[128];
size_t _len = strlcpy(title, "Cloud Sync finished", sizeof(title));
size_t _len = strlcpy_lit(title, "Cloud Sync finished", sizeof(title));
if (sync_state->failures || sync_state->conflicts)
_len += strlcpy(title + _len, " with ", sizeof(title) - _len);
_len += strlcpy_lit(title + _len, " with ", sizeof(title) - _len);
if (sync_state->failures)
_len += strlcpy(title + _len, "failures", sizeof(title) - _len);
_len += strlcpy_lit(title + _len, "failures", sizeof(title) - _len);
if (sync_state->failures && sync_state->conflicts)
_len += strlcpy(title + _len, " and ", sizeof(title) - _len);
_len += strlcpy_lit(title + _len, " and ", sizeof(title) - _len);
if (sync_state->conflicts)
strlcpy(title + _len, "conflicts", sizeof(title) - _len);
strlcpy_lit(title + _len, "conflicts", sizeof(title) - _len);
task_free_title(task);
task_set_title(task, strdup(title));
@@ -1610,7 +1610,7 @@ static void task_push_cloud_sync_with_mode(int conflict_resolution)
sync_state->start_time = cpu_features_get_time_usec();
sync_state->conflict_resolution = conflict_resolution;
strlcpy(task_title, "Cloud Sync in progress", sizeof(task_title));
strlcpy_lit(task_title, "Cloud Sync in progress", sizeof(task_title));
task->state = sync_state;
task->title = strdup(task_title);
+1 -1
View File
@@ -1557,7 +1557,7 @@ static bool content_file_load(
"but cache directory was not set or found. "
"Setting cache directory to root of writable app directory...\n");
_len = strlcpy(new_basedir, uwp_dir_data, sizeof(new_basedir));
strlcpy(new_basedir + _len,
strlcpy_lit(new_basedir + _len,
"VFSCACHE\\",
sizeof(new_basedir) - _len);
basedir_attribs = GetFileAttributes(new_basedir);
+7 -7
View File
@@ -408,9 +408,9 @@ static void task_database_scan_console_output(const char *label, const char *db_
unsigned green = FOREGROUND_GREEN;
unsigned yellow = FOREGROUND_RED | FOREGROUND_GREEN;
unsigned reset = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE;
size_t _len = strlcpy(string, " ", sizeof(string));
size_t _len = strlcpy_lit(string, " ", sizeof(string));
_len += strlcpy(string + _len, prefix, sizeof(string) - _len);
_len += strlcpy(string + _len, " ", sizeof(string) - _len);
_len += strlcpy_lit(string + _len, " ", sizeof(string) - _len);
SetConsoleTextAttribute(con, (add) ? green : (db_name) ? yellow : red);
WriteConsole(con, string, _len, NULL, NULL);
SetConsoleTextAttribute(con, reset);
@@ -427,18 +427,18 @@ static void task_database_scan_console_output(const char *label, const char *db_
_len += strlcpy(string + _len, green, sizeof(string) - _len);
else
_len += strlcpy(string + _len, (db_name) ? yellow : red, sizeof(string) - _len);
_len += strlcpy(string + _len, " ", sizeof(string) - _len);
_len += strlcpy_lit(string + _len, " ", sizeof(string) - _len);
_len += strlcpy(string + _len, prefix, sizeof(string) - _len);
_len += strlcpy(string + _len, " ", sizeof(string) - _len);
_len += strlcpy_lit(string + _len, " ", sizeof(string) - _len);
strlcpy(string + _len, reset, sizeof(string) - _len);
fputs(string, stdout);
}
#endif
else
{
size_t _len = strlcpy(string, " ", sizeof(string));
size_t _len = strlcpy_lit(string, " ", sizeof(string));
_len += strlcpy(string + _len, prefix, sizeof(string) - _len);
strlcpy(string + _len, " ", sizeof(string) - _len);
strlcpy_lit(string + _len, " ", sizeof(string) - _len);
fputs(string, stdout);
}
@@ -1144,7 +1144,7 @@ static enum scan_verdict database_info_list_iterate_found_match(
if (*db_state->serial)
{
size_t _len = strlcpy(db_crc, db_state->serial, db_crc_len);
strlcpy(db_crc + _len,
strlcpy_lit(db_crc + _len,
"|serial",
db_crc_len - _len);
}
+10 -10
View File
@@ -780,7 +780,7 @@ size_t detect_gc_game(intfstream_t *fd, char *s, size_t len,
will not match redump.**/
/** insert prefix **/
_len = strlcpy(pre_game_id, "DL-DOL-", sizeof(pre_game_id));
_len = strlcpy_lit(pre_game_id, "DL-DOL-", sizeof(pre_game_id));
/** add raw serial **/
strlcpy(pre_game_id + _len, raw_game_id, sizeof(pre_game_id) - _len);
@@ -794,32 +794,32 @@ size_t detect_gc_game(intfstream_t *fd, char *s, size_t len,
switch (region_id)
{
case 'E':
_len += strlcpy(s + _len, "-USA", len - _len);
_len += strlcpy_lit(s + _len, "-USA", len - _len);
break;
case 'J':
_len += strlcpy(s + _len, "-JPN", len - _len);
_len += strlcpy_lit(s + _len, "-JPN", len - _len);
break;
case 'P': /** NYI: P can also be P-UKV, P-AUS **/
case 'X': /** NYI: X can also be X-UKV, X-EUU **/
_len += strlcpy(s + _len, "-EUR", len - _len);
_len += strlcpy_lit(s + _len, "-EUR", len - _len);
break;
case 'Y':
_len += strlcpy(s + _len, "-FAH", len - _len);
_len += strlcpy_lit(s + _len, "-FAH", len - _len);
break;
case 'D':
_len += strlcpy(s + _len, "-NOE", len - _len);
_len += strlcpy_lit(s + _len, "-NOE", len - _len);
break;
case 'S':
_len += strlcpy(s + _len, "-ESP", len - _len);
_len += strlcpy_lit(s + _len, "-ESP", len - _len);
break;
case 'F':
_len += strlcpy(s + _len, "-FRA", len - _len);
_len += strlcpy_lit(s + _len, "-FRA", len - _len);
break;
case 'I':
_len += strlcpy(s + _len, "-ITA", len - _len);
_len += strlcpy_lit(s + _len, "-ITA", len - _len);
break;
case 'H':
_len += strlcpy(s + _len, "-HOL", len - _len);
_len += strlcpy_lit(s + _len, "-HOL", len - _len);
break;
default:
return 0;
+2 -2
View File
@@ -151,7 +151,7 @@ static int file_decompressed_subdir(const char *name,
* NULL-safe. */
if (userdata->dec->callback_error)
{
_len = strlcpy(userdata->dec->callback_error,
_len = strlcpy_lit(userdata->dec->callback_error,
"Failed to deflate ",
CALLBACK_ERROR_SIZE);
_len += strlcpy(
@@ -198,7 +198,7 @@ static int file_decompressed(const char *name, const char *valid_exts,
/* NULL-check: see twin in file_archived for reasoning. */
if (dec->callback_error)
{
_len = strlcpy(dec->callback_error, "Failed to deflate ",
_len = strlcpy_lit(dec->callback_error, "Failed to deflate ",
CALLBACK_ERROR_SIZE);
_len += strlcpy(dec->callback_error + _len,
path, CALLBACK_ERROR_SIZE - _len);
+3 -3
View File
@@ -546,7 +546,7 @@ void* task_push_webdav_put(const char *url,
if (!(conn = net_http_connection_new(url, "PUT", NULL)))
return NULL;
_len = strlcpy(expect, "Expect: 100-continue\r\n", sizeof(expect));
_len = strlcpy_lit(expect, "Expect: 100-continue\r\n", sizeof(expect));
if (headers)
{
strlcpy(expect + _len, headers, sizeof(expect) - _len);
@@ -591,9 +591,9 @@ void *task_push_webdav_move(const char *url,
if (!(conn = net_http_connection_new(url, "MOVE", NULL)))
return NULL;
_len = strlcpy(dest_header, "Destination: ", sizeof(dest_header));
_len = strlcpy_lit(dest_header, "Destination: ", sizeof(dest_header));
_len += strlcpy(dest_header + _len, dest, sizeof(dest_header) - _len);
_len += strlcpy(dest_header + _len, "\r\n", sizeof(dest_header) - _len);
_len += strlcpy_lit(dest_header + _len, "\r\n", sizeof(dest_header) - _len);
if (headers)
strlcpy(dest_header + _len, headers, sizeof(dest_header) - _len);
+4 -4
View File
@@ -621,9 +621,9 @@ void *task_push_webdav_move(const char *url,
size_t _len;
char dest_header[PATH_MAX_LENGTH + 512];
_len = strlcpy(dest_header, "Destination: ", sizeof(dest_header));
_len = strlcpy_lit(dest_header, "Destination: ", sizeof(dest_header));
_len += strlcpy(dest_header + _len, dest, sizeof(dest_header) - _len);
_len += strlcpy(dest_header + _len, "\r\n", sizeof(dest_header) - _len);
_len += strlcpy_lit(dest_header + _len, "\r\n", sizeof(dest_header) - _len);
if (headers)
strlcpy(dest_header + _len, headers, sizeof(dest_header) - _len);
@@ -724,9 +724,9 @@ void *task_push_http_transfer_with_content(const char *url,
hdr[0] = '\0';
if (content_type && *content_type)
{
_len += strlcpy(hdr + _len, "Content-Type: ", sizeof(hdr) - _len);
_len += strlcpy_lit(hdr + _len, "Content-Type: ", sizeof(hdr) - _len);
_len += strlcpy(hdr + _len, content_type, sizeof(hdr) - _len);
_len += strlcpy(hdr + _len, "\r\n", sizeof(hdr) - _len);
_len += strlcpy_lit(hdr + _len, "\r\n", sizeof(hdr) - _len);
}
if (headers)
strlcpy(hdr + _len, headers, sizeof(hdr) - _len);
+33 -33
View File
@@ -470,28 +470,28 @@ static void task_overlay_desc_populate_eightway_config(
/* Redefine eightway vals if specified in conf
*/
strlcpy(conf_key + _len, "_up", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_up", sizeof(conf_key) - _len);
if (config_get_string(loader->conf, conf_key, &str))
{
task_overlay_redefine_eightway_direction(str, &eightway->up);
free(str);
}
strlcpy(conf_key + _len, "_down", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_down", sizeof(conf_key) - _len);
if (config_get_string(loader->conf, conf_key, &str))
{
task_overlay_redefine_eightway_direction(str, &eightway->down);
free(str);
}
strlcpy(conf_key + _len, "_left", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_left", sizeof(conf_key) - _len);
if (config_get_string(loader->conf, conf_key, &str))
{
task_overlay_redefine_eightway_direction(str, &eightway->left);
free(str);
}
strlcpy(conf_key + _len, "_right", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_right", sizeof(conf_key) - _len);
if (config_get_string(loader->conf, conf_key, &str))
{
task_overlay_redefine_eightway_direction(str, &eightway->right);
@@ -552,7 +552,7 @@ static bool task_overlay_load_desc(
"overlay%u_desc%u", ol_idx, desc_idx);
_len = strlcpy(overlay_key, overlay_desc_key, sizeof(overlay_key));
strlcpy(overlay_key + _len, "_normalized", sizeof(overlay_key) - _len);
strlcpy_lit(overlay_key + _len, "_normalized", sizeof(overlay_key) - _len);
if (config_get_bool(conf, overlay_key, &tmp_bool))
normalized = tmp_bool;
@@ -654,7 +654,7 @@ static bool task_overlay_load_desc(
if (BIT256_GET(desc->button_mask, RARCH_OVERLAY_NEXT))
{
strlcpy(overlay_key + _len, "_next_target",
strlcpy_lit(overlay_key + _len, "_next_target",
sizeof(overlay_key) - _len);
config_get_array(conf, overlay_key,
desc->next_index_name, sizeof(desc->next_index_name));
@@ -699,7 +699,7 @@ static bool task_overlay_load_desc(
return false;
}
strlcpy(overlay_key + _len, "_saturate_pct",
strlcpy_lit(overlay_key + _len, "_saturate_pct",
sizeof(overlay_key) - _len);
if (config_get_float(conf, overlay_key,
&tmp_float))
@@ -721,7 +721,7 @@ static bool task_overlay_load_desc(
_len = strlcpy(conf_key, overlay_desc_key, sizeof(conf_key));
strlcpy(conf_key + _len, "_reach_x", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_reach_x", sizeof(conf_key) - _len);
desc->reach_right = 1.0f;
desc->reach_left = 1.0f;
if (config_get_float(conf, conf_key, &tmp_float))
@@ -730,7 +730,7 @@ static bool task_overlay_load_desc(
desc->reach_left = tmp_float;
}
strlcpy(conf_key + _len, "_reach_y", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_reach_y", sizeof(conf_key) - _len);
desc->reach_up = 1.0f;
desc->reach_down = 1.0f;
if (config_get_float(conf, conf_key, &tmp_float))
@@ -739,7 +739,7 @@ static bool task_overlay_load_desc(
desc->reach_down = tmp_float;
}
strlcpy(conf_key + _len, "_movable", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_movable", sizeof(conf_key) - _len);
desc->flags &= ~OVERLAY_DESC_MOVABLE;
desc->delta_x = 0.0f;
desc->delta_y = 0.0f;
@@ -747,39 +747,39 @@ static bool task_overlay_load_desc(
&& tmp_bool)
desc->flags |= OVERLAY_DESC_MOVABLE;
strlcpy(conf_key + _len, "_reach_up", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_reach_up", sizeof(conf_key) - _len);
if (config_get_float(conf, conf_key, &tmp_float))
desc->reach_up = tmp_float;
strlcpy(conf_key + _len, "_alpha_mod", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_alpha_mod", sizeof(conf_key) - _len);
desc->alpha_mod = alpha_mod;
if (config_get_float(conf, conf_key, &tmp_float))
desc->alpha_mod = tmp_float;
strlcpy(conf_key + _len, "_range_mod", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_range_mod", sizeof(conf_key) - _len);
desc->range_mod = range_mod;
if (config_get_float(conf, conf_key, &tmp_float))
desc->range_mod = tmp_float;
strlcpy(conf_key + _len, "_exclusive", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_exclusive", sizeof(conf_key) - _len);
desc->flags &= ~OVERLAY_DESC_EXCLUSIVE;
if (config_get_bool(conf, conf_key, &tmp_bool)
&& tmp_bool)
desc->flags |= OVERLAY_DESC_EXCLUSIVE;
strlcpy(conf_key + _len, "_reach_down", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_reach_down", sizeof(conf_key) - _len);
if (config_get_float(conf, conf_key, &tmp_float))
desc->reach_down = tmp_float;
strlcpy(conf_key + _len, "_reach_left", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_reach_left", sizeof(conf_key) - _len);
if (config_get_float(conf, conf_key, &tmp_float))
desc->reach_left = tmp_float;
strlcpy(conf_key + _len, "_reach_right", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_reach_right", sizeof(conf_key) - _len);
if (config_get_float(conf, conf_key, &tmp_float))
desc->reach_right = tmp_float;
strlcpy(conf_key + _len, "_range_mod_exclusive", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_range_mod_exclusive", sizeof(conf_key) - _len);
desc->flags &= ~OVERLAY_DESC_RANGE_MOD_EXCLUSIVE;
if (config_get_bool(conf, conf_key, &tmp_bool)
&& tmp_bool)
@@ -988,19 +988,19 @@ static void task_overlay_deferred_load(retro_task_t *task, void *budget)
_len = snprintf(conf_key, sizeof(conf_key), "overlay%u", loader->pos);
strlcpy(conf_key + _len, "_rect", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_rect", sizeof(conf_key) - _len);
strlcpy(overlay->config.rect.key, conf_key,
sizeof(overlay->config.rect.key));
strlcpy(conf_key + _len, "_name", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_name", sizeof(conf_key) - _len);
strlcpy(overlay->config.names.key, conf_key,
sizeof(overlay->config.names.key));
strlcpy(conf_key + _len, "_descs", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_descs", sizeof(conf_key) - _len);
strlcpy(overlay->config.descs.key, conf_key,
sizeof(overlay->config.descs.key));
strlcpy(conf_key + _len, "_overlay", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_overlay", sizeof(conf_key) - _len);
strlcpy(overlay->config.paths.key, conf_key,
sizeof(overlay->config.paths.key));
@@ -1024,26 +1024,26 @@ static void task_overlay_deferred_load(retro_task_t *task, void *budget)
overlay->descs = overlay_desc;
overlay->size = overlay->config.descs.size;
strlcpy(conf_key + _len, "_alpha_mod", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_alpha_mod", sizeof(conf_key) - _len);
if (config_get_float(conf, conf_key, &tmp_float))
overlay->config.alpha_mod = tmp_float;
else
overlay->config.alpha_mod = 1.0f;
strlcpy(conf_key + _len, "_range_mod", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_range_mod", sizeof(conf_key) - _len);
if (config_get_float(conf, conf_key, &tmp_float))
overlay->config.range_mod = tmp_float;
else
overlay->config.range_mod = 1.0f;
strlcpy(conf_key + _len, "_normalized", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_normalized", sizeof(conf_key) - _len);
if (config_get_bool(conf, conf_key, &tmp_bool)
&& tmp_bool)
overlay->config.normalized = tmp_bool;
else
overlay->config.normalized = false;
strlcpy(conf_key + _len, "_full_screen", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_full_screen", sizeof(conf_key) - _len);
if (config_get_bool(conf, conf_key, &tmp_bool)
&& tmp_bool)
overlay->flags |= OVERLAY_FULL_SCREEN;
@@ -1091,7 +1091,7 @@ static void task_overlay_deferred_load(retro_task_t *task, void *budget)
overlay->name, sizeof(overlay->name));
/* Attempt to determine native aspect ratio */
strlcpy(conf_key + _len, "_aspect_ratio", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_aspect_ratio", sizeof(conf_key) - _len);
if (config_get_float(conf, conf_key, &tmp_float))
overlay->aspect_ratio = tmp_float;
else
@@ -1162,7 +1162,7 @@ static void task_overlay_deferred_load(retro_task_t *task, void *budget)
overlay->center_y = overlay->y + 0.5f * overlay->h;
/* Parse viewport override (optional) */
strlcpy(conf_key + _len, "_viewport", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_viewport", sizeof(conf_key) - _len);
if (config_get_array(conf, conf_key, tmp_str, sizeof(tmp_str)))
{
@@ -1205,7 +1205,7 @@ static void task_overlay_deferred_load(retro_task_t *task, void *budget)
}
/* Parse viewport_fill option (optional, default false) */
strlcpy(conf_key + _len, "_viewport_fill", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_viewport_fill", sizeof(conf_key) - _len);
if (config_get_bool(conf, conf_key, &tmp_bool) && tmp_bool)
overlay->flags |= OVERLAY_VIEWPORT_FILL;
else
@@ -1213,14 +1213,14 @@ static void task_overlay_deferred_load(retro_task_t *task, void *budget)
/* Check whether x/y separation are force disabled
* for this overlay */
strlcpy(conf_key + _len, "_block_x_separation", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_block_x_separation", sizeof(conf_key) - _len);
if (config_get_bool(conf, conf_key, &tmp_bool)
&& tmp_bool)
overlay->flags |= OVERLAY_BLOCK_X_SEPARATION;
else
overlay->flags &= ~OVERLAY_BLOCK_X_SEPARATION;
strlcpy(conf_key + _len, "_block_y_separation", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_block_y_separation", sizeof(conf_key) - _len);
if (config_get_bool(conf, conf_key, &tmp_bool)
&& tmp_bool)
overlay->flags |= OVERLAY_BLOCK_Y_SEPARATION;
@@ -1229,7 +1229,7 @@ static void task_overlay_deferred_load(retro_task_t *task, void *budget)
/* Check whether x/y separation are enabled
* for this overlay in auto-scale mode */
strlcpy(conf_key + _len, "_auto_x_separation", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_auto_x_separation", sizeof(conf_key) - _len);
overlay->flags |= OVERLAY_AUTO_X_SEPARATION;
if (config_get_bool(conf, conf_key, &tmp_bool))
{
@@ -1243,7 +1243,7 @@ static void task_overlay_deferred_load(retro_task_t *task, void *budget)
overlay->flags &= ~OVERLAY_AUTO_X_SEPARATION;
}
strlcpy(conf_key + _len, "_auto_y_separation", sizeof(conf_key) - _len);
strlcpy_lit(conf_key + _len, "_auto_y_separation", sizeof(conf_key) - _len);
if (config_get_bool(conf, conf_key, &tmp_bool)
&& tmp_bool)
overlay->flags |= OVERLAY_AUTO_Y_SEPARATION;
+2 -2
View File
@@ -574,7 +574,7 @@ static bool screenshot_dump(
{
size_t _len = strlcpy(state->filename,
name_base, sizeof(state->filename));
strlcpy(state->filename + _len,
strlcpy_lit(state->filename + _len,
".png",
sizeof(state->filename) - _len);
}
@@ -634,7 +634,7 @@ static bool screenshot_dump(
size_t _len = strlcpy(state->shotname,
path_basename_nocompression(name_base),
sizeof(state->shotname));
strlcpy(state->shotname + _len,
strlcpy_lit(state->shotname + _len,
".png",
sizeof(state->shotname) - _len);
}
Loaded 100 of 107 files, more files were not shown because too many files have changed in this diff. Show more