mirror of
https://github.com/libretro/RetroArch
synced 2025-03-01 07:13:35 +00:00
Use strlcpy when no formatting is required
This commit is contained in:
parent
3e2e53ba7f
commit
af11f8f54c
@ -940,7 +940,7 @@ public:
|
|||||||
{
|
{
|
||||||
simulate_scanline = simulate;
|
simulate_scanline = simulate;
|
||||||
}
|
}
|
||||||
#endif // GL3_ROLLING_SCANLINE_SIMULATION
|
#endif /* GL3_ROLLING_SCANLINE_SIMULATION */
|
||||||
|
|
||||||
void set_name(const char *name)
|
void set_name(const char *name)
|
||||||
{
|
{
|
||||||
@ -1045,7 +1045,7 @@ private:
|
|||||||
uint32_t current_subframe = 1;
|
uint32_t current_subframe = 1;
|
||||||
#ifdef GL3_ROLLING_SCANLINE_SIMULATION
|
#ifdef GL3_ROLLING_SCANLINE_SIMULATION
|
||||||
bool simulate_scanline = false;
|
bool simulate_scanline = false;
|
||||||
#endif // GL3_ROLLING_SCANLINE_SIMULATION
|
#endif /* GL3_ROLLING_SCANLINE_SIMULATION */
|
||||||
|
|
||||||
size_t ubo_offset = 0;
|
size_t ubo_offset = 0;
|
||||||
std::string pass_name;
|
std::string pass_name;
|
||||||
@ -1170,7 +1170,8 @@ void Pass::reflect_parameter_array(const char *name, std::vector<slang_texture_s
|
|||||||
for (i = 0; i < meta.size(); i++)
|
for (i = 0; i < meta.size(); i++)
|
||||||
{
|
{
|
||||||
char n[128];
|
char n[128];
|
||||||
snprintf(n, sizeof(n), "%s%u", name, (unsigned)i);
|
size_t _len = strlcpy(n, name, sizeof(n));
|
||||||
|
snprintf(n + _len, sizeof(n) - _len, "%u", (unsigned)i);
|
||||||
slang_texture_semantic_meta *m = (slang_texture_semantic_meta*)&meta[i];
|
slang_texture_semantic_meta *m = (slang_texture_semantic_meta*)&meta[i];
|
||||||
|
|
||||||
if (m->uniform)
|
if (m->uniform)
|
||||||
@ -1178,13 +1179,15 @@ void Pass::reflect_parameter_array(const char *name, std::vector<slang_texture_s
|
|||||||
int vert, frag;
|
int vert, frag;
|
||||||
char vert_n[256];
|
char vert_n[256];
|
||||||
char frag_n[256];
|
char frag_n[256];
|
||||||
snprintf(vert_n, sizeof(vert_n), "RARCH_UBO_VERTEX_INSTANCE.%s", n);
|
size_t _len = strlcpy(vert_n, "RARCH_UBO_VERTEX_INSTANCE.", sizeof(vert_n));
|
||||||
snprintf(frag_n, sizeof(frag_n), "RARCH_UBO_FRAGMENT_INSTANCE.%s", n);
|
size_t _len2 = strlcpy(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);
|
vert = glGetUniformLocation(pipeline, vert_n);
|
||||||
frag = glGetUniformLocation(pipeline, frag_n);
|
frag = glGetUniformLocation(pipeline, frag_n);
|
||||||
|
|
||||||
if (vert >= 0)
|
if (vert >= 0)
|
||||||
m->location.ubo_vertex = vert;
|
m->location.ubo_vertex = vert;
|
||||||
if (frag >= 0)
|
if (frag >= 0)
|
||||||
m->location.ubo_fragment = frag;
|
m->location.ubo_fragment = frag;
|
||||||
}
|
}
|
||||||
@ -1194,8 +1197,10 @@ void Pass::reflect_parameter_array(const char *name, std::vector<slang_texture_s
|
|||||||
int vert, frag;
|
int vert, frag;
|
||||||
char vert_n[256];
|
char vert_n[256];
|
||||||
char frag_n[256];
|
char frag_n[256];
|
||||||
snprintf(vert_n, sizeof(vert_n), "RARCH_PUSH_VERTEX_INSTANCE.%s", n);
|
size_t _len = strlcpy(vert_n, "RARCH_PUSH_VERTEX_INSTANCE.", sizeof(vert_n));
|
||||||
snprintf(frag_n, sizeof(frag_n), "RARCH_PUSH_FRAGMENT_INSTANCE.%s", n);
|
size_t _len2 = strlcpy(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);
|
vert = glGetUniformLocation(pipeline, vert_n);
|
||||||
frag = glGetUniformLocation(pipeline, frag_n);
|
frag = glGetUniformLocation(pipeline, frag_n);
|
||||||
|
|
||||||
@ -1805,7 +1810,7 @@ void Pass::build_commands(
|
|||||||
{
|
{
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
}
|
}
|
||||||
#endif // GL3_ROLLING_SCANLINE_SIMULATION
|
#endif /* GL3_ROLLING_SCANLINE_SIMULATION */
|
||||||
|
|
||||||
if (final_pass)
|
if (final_pass)
|
||||||
{
|
{
|
||||||
@ -1826,7 +1831,7 @@ void Pass::build_commands(
|
|||||||
glScissor( current_viewport.x, current_viewport.y,
|
glScissor( current_viewport.x, current_viewport.y,
|
||||||
current_viewport.width, current_viewport.height);
|
current_viewport.width, current_viewport.height);
|
||||||
}
|
}
|
||||||
#endif // GL3_ROLLING_SCANLINE_SIMULATION
|
#endif /* GL3_ROLLING_SCANLINE_SIMULATION */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1846,7 +1851,7 @@ void Pass::build_commands(
|
|||||||
{
|
{
|
||||||
glScissor(0, 0, size.width, size.height);
|
glScissor(0, 0, size.width, size.height);
|
||||||
}
|
}
|
||||||
#endif // GL3_ROLLING_SCANLINE_SIMULATION
|
#endif /* GL3_ROLLING_SCANLINE_SIMULATION */
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(HAVE_OPENGLES)
|
#if !defined(HAVE_OPENGLES)
|
||||||
@ -1876,7 +1881,7 @@ void Pass::build_commands(
|
|||||||
{
|
{
|
||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
}
|
}
|
||||||
#endif // GL3_ROLLING_SCANLINE_SIMULATION
|
#endif /* GL3_ROLLING_SCANLINE_SIMULATION */
|
||||||
|
|
||||||
#if !defined(HAVE_OPENGLES)
|
#if !defined(HAVE_OPENGLES)
|
||||||
glDisable(GL_FRAMEBUFFER_SRGB);
|
glDisable(GL_FRAMEBUFFER_SRGB);
|
||||||
@ -1931,7 +1936,7 @@ public:
|
|||||||
void set_current_shader_subframe(uint32_t cur_subframe);
|
void set_current_shader_subframe(uint32_t cur_subframe);
|
||||||
#ifdef GL3_ROLLING_SCANLINE_SIMULATION
|
#ifdef GL3_ROLLING_SCANLINE_SIMULATION
|
||||||
void set_simulate_scanline(bool simulate);
|
void set_simulate_scanline(bool simulate);
|
||||||
#endif // GL3_ROLLING_SCANLINE_SIMULATION
|
#endif /* GL3_ROLLING_SCANLINE_SIMULATION */
|
||||||
void set_pass_name(unsigned pass, const char *name);
|
void set_pass_name(unsigned pass, const char *name);
|
||||||
|
|
||||||
void add_static_texture(std::unique_ptr<gl3_shader::StaticTexture> texture);
|
void add_static_texture(std::unique_ptr<gl3_shader::StaticTexture> texture);
|
||||||
@ -2442,7 +2447,7 @@ void gl3_filter_chain::set_simulate_scanline(bool simulate_scanline)
|
|||||||
for (i = 0; i < passes.size(); i++)
|
for (i = 0; i < passes.size(); i++)
|
||||||
passes[i]->set_simulate_scanline(simulate_scanline);
|
passes[i]->set_simulate_scanline(simulate_scanline);
|
||||||
}
|
}
|
||||||
#endif // GL3_ROLLING_SCANLINE_SIMULATION
|
#endif /* GL3_ROLLING_SCANLINE_SIMULATION */
|
||||||
|
|
||||||
void gl3_filter_chain::set_pass_name(unsigned pass, const char *name)
|
void gl3_filter_chain::set_pass_name(unsigned pass, const char *name)
|
||||||
{
|
{
|
||||||
@ -2885,7 +2890,7 @@ void gl3_filter_chain_set_simulate_scanline(
|
|||||||
{
|
{
|
||||||
chain->set_simulate_scanline(simulate_scanline);
|
chain->set_simulate_scanline(simulate_scanline);
|
||||||
}
|
}
|
||||||
#endif // GL3_ROLLING_SCANLINE_SIMULATION
|
#endif /* GL3_ROLLING_SCANLINE_SIMULATION */
|
||||||
|
|
||||||
void gl3_filter_chain_set_frame_count_period(
|
void gl3_filter_chain_set_frame_count_period(
|
||||||
gl3_filter_chain_t *chain,
|
gl3_filter_chain_t *chain,
|
||||||
|
@ -232,7 +232,10 @@ static bool slang_process_reflection(
|
|||||||
{
|
{
|
||||||
size = sizeof(names) / sizeof(*names);
|
size = sizeof(names) / sizeof(*names);
|
||||||
if (semantic < size)
|
if (semantic < size)
|
||||||
snprintf(texture.id, sizeof(texture.id), "%s%d", names[_semantic], index);
|
{
|
||||||
|
size_t _len = strlcpy(texture.id, names[_semantic], sizeof(texture.id));
|
||||||
|
snprintf(texture.id + _len, sizeof(texture.id) - _len, "%d", index);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
strlcpy(texture.id, get_semantic_name(sl_reflection.texture_semantic_map, _semantic, index), sizeof(texture.id));
|
strlcpy(texture.id, get_semantic_name(sl_reflection.texture_semantic_map, _semantic, index), sizeof(texture.id));
|
||||||
}
|
}
|
||||||
@ -279,7 +282,10 @@ static bool slang_process_reflection(
|
|||||||
{
|
{
|
||||||
int size = sizeof(names) / sizeof(*names);
|
int size = sizeof(names) / sizeof(*names);
|
||||||
if (semantic < size)
|
if (semantic < size)
|
||||||
snprintf(uniform.id, sizeof(uniform.id), "%s%d", names[_semantic], index);
|
{
|
||||||
|
size_t _len = strlcpy(uniform.id, names[_semantic], sizeof(uniform.id));
|
||||||
|
snprintf(uniform.id + _len, sizeof(uniform.id) - _len, "%d", index);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
strlcpy(uniform.id, get_semantic_name(sl_reflection.texture_semantic_uniform_map, _semantic, index), sizeof(uniform.id));
|
strlcpy(uniform.id, get_semantic_name(sl_reflection.texture_semantic_uniform_map, _semantic, index), sizeof(uniform.id));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user