* Add some TODO/FIXME localize notes

* some snprintf refactors
This commit is contained in:
libretroadmin 2023-05-01 20:49:32 +02:00
parent e7e647d181
commit 6b93152253
2 changed files with 20 additions and 17 deletions

View File

@ -166,7 +166,10 @@ static void gl_cg_set_uniform_parameter(
}
if (param->lookup.add_prefix)
snprintf(ident, sizeof(ident), "IN.%s", param->lookup.ident);
{
strlcpy(ident, "IN.", sizeof(ident));
strlcat(ident, param->lookup.ident, sizeof(ident));
}
location = cgGetNamedParameter(prog, param->lookup.add_prefix ? ident : param->lookup.ident);
}
else
@ -747,28 +750,27 @@ static void gl_cg_set_pass_attrib(
const char *attr)
{
char attr_buf[64];
attr_buf[0] = '\0';
snprintf(attr_buf, sizeof(attr_buf), "%s.texture", attr);
size_t _len = strlcpy(attr_buf, attr, sizeof(attr_buf));
snprintf(attr_buf + _len, sizeof(attr_buf) - _len, ".texture");
if (!fbo->tex)
fbo->tex = cgGetNamedParameter(program->fprg, attr_buf);
snprintf(attr_buf, sizeof(attr_buf), "%s.video_size", attr);
snprintf(attr_buf + _len, sizeof(attr_buf) - _len, ".tex_coord");
if (!fbo->coord)
fbo->coord = cgGetNamedParameter(program->vprg, attr_buf);
snprintf(attr_buf + _len, sizeof(attr_buf) - _len, ".video_size");
if (!fbo->vid_size_v)
fbo->vid_size_v = cgGetNamedParameter(program->vprg, attr_buf);
if (!fbo->vid_size_f)
fbo->vid_size_f = cgGetNamedParameter(program->fprg, attr_buf);
snprintf(attr_buf, sizeof(attr_buf), "%s.texture_size", attr);
snprintf(attr_buf + _len, sizeof(attr_buf) - _len, ".texture_size");
if (!fbo->tex_size_v)
fbo->tex_size_v = cgGetNamedParameter(program->vprg, attr_buf);
if (!fbo->tex_size_f)
fbo->tex_size_f = cgGetNamedParameter(program->fprg, attr_buf);
snprintf(attr_buf, sizeof(attr_buf), "%s.tex_coord", attr);
if (!fbo->coord)
fbo->coord = cgGetNamedParameter(program->vprg, attr_buf);
}
static INLINE void gl_cg_set_shaders(CGprogram frag, CGprogram vert)
@ -823,10 +825,8 @@ static void gl_cg_set_program_attributes(void *data, unsigned i)
if (i > 1)
{
char pass_str[64];
pass_str[0] = '\0';
snprintf(pass_str, sizeof(pass_str), "PASSPREV%u", i);
size_t _len = strlcpy(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);
}

View File

@ -104,7 +104,8 @@ static void menu_action_setting_audio_mixer_stream_volume(
if (offset >= AUDIO_MIXER_MAX_SYSTEM_STREAMS)
return;
snprintf(s, len, "%.2f dB", audio_driver_mixer_get_stream_volume(offset));
snprintf(s, len, "%.2f", audio_driver_mixer_get_stream_volume(offset));
strlcat(s, " dB", len);
}
#endif
@ -653,9 +654,9 @@ static void menu_action_setting_disp_set_label_cpu_policy(
const char *path,
char *s2, size_t len2)
{
unsigned policyid = atoi(path);
unsigned policyid = atoi(path);
cpu_scaling_driver_t **drivers = get_cpu_scaling_drivers(false);
cpu_scaling_driver_t *d = drivers[policyid];
cpu_scaling_driver_t *d = drivers[policyid];
*s = '\0';
*w = 0;
@ -970,6 +971,7 @@ static void menu_action_setting_disp_set_label_cheat_match(
unsigned int curr_val = 0;
cheat_manager_match_action(CHEAT_MATCH_ACTION_TYPE_VIEW, cheat_manager_state.match_idx, &address, &address_mask, &prev_val, &curr_val);
/* TODO/FIXME - localize */
snprintf(s, len, "Prev: %u Curr: %u", prev_val, curr_val);
*w = 19;
strlcpy(s2, path, len2);
@ -986,6 +988,7 @@ static void menu_action_setting_disp_set_label_perf_counters_common(
if (!counters[offset]->call_cnt)
return;
/* TODO/FIXME - localize */
snprintf(s, len,
"%" PRIu64 " ticks, %" PRIu64 " runs.",
((uint64_t)counters[offset]->total /