Cleanup: order string size argument after the string

This is the convention almost everywhere.
This commit is contained in:
Campbell Barton
2023-05-09 15:06:41 +10:00
parent 788a57c6ef
commit 47149d2532
2 changed files with 10 additions and 10 deletions

View File

@@ -62,7 +62,7 @@ static void draw_background(const rcti *rect)
}
static void get_current_time_str(
const Scene *scene, bool display_seconds, int frame, uint str_maxncpy, char *r_str)
const Scene *scene, bool display_seconds, int frame, char *r_str, uint str_maxncpy)
{
if (display_seconds) {
BLI_timecode_string_from_time(r_str, str_maxncpy, 0, FRA2TIME(frame), FPS, U.timecode_style);
@@ -82,7 +82,7 @@ static void draw_current_frame(const Scene *scene,
int frame_x = UI_view2d_view_to_region_x(v2d, current_frame);
char frame_str[64];
get_current_time_str(scene, display_seconds, current_frame, sizeof(frame_str), frame_str);
get_current_time_str(scene, display_seconds, current_frame, frame_str, sizeof(frame_str));
float text_width = UI_fontstyle_string_width(fstyle, frame_str);
float box_width = MAX2(text_width + 8 * UI_SCALE_FAC, 24 * UI_SCALE_FAC);
float box_padding = 3 * UI_SCALE_FAC;

View File

@@ -264,7 +264,7 @@ static void view2d_draw_lines(const View2D *v2d,
**************************************************/
using PositionToString =
void (*)(void *user_data, float v2d_pos, float v2d_step, uint str_maxncpy, char *r_str);
void (*)(void *user_data, float v2d_pos, float v2d_step, char *r_str, uint str_maxncpy);
static void draw_horizontal_scale_indicators(const ARegion *region,
const View2D *v2d,
@@ -312,9 +312,9 @@ static void draw_horizontal_scale_indicators(const ARegion *region,
/* Calculate max_label_count and draw_frequency based on largest visible label. */
int draw_frequency;
{
to_string(to_string_data, start, 0, sizeof(text), text);
to_string(to_string_data, start, 0, text, sizeof(text));
const float left_text_width = BLF_width(font_id, text, strlen(text));
to_string(to_string_data, start + steps * distance, 0, sizeof(text), text);
to_string(to_string_data, start + steps * distance, 0, text, sizeof(text));
const float right_text_width = BLF_width(font_id, text, strlen(text));
const float max_text_width = max_ff(left_text_width, right_text_width);
const float max_label_count = BLI_rcti_size_x(&v2d->mask) / (max_text_width + 10.0f);
@@ -326,7 +326,7 @@ static void draw_horizontal_scale_indicators(const ARegion *region,
for (uint i = start_index; i < steps; i += draw_frequency) {
const float xpos_view = start + i * distance;
const float xpos_region = UI_view2d_view_to_region_x(v2d, xpos_view);
to_string(to_string_data, xpos_view, distance, sizeof(text), text);
to_string(to_string_data, xpos_view, distance, text, sizeof(text));
const float text_width = BLF_width(font_id, text, strlen(text));
if (xpos_region - text_width / 2.0f >= xmin && xpos_region + text_width / 2.0f <= xmax) {
@@ -392,7 +392,7 @@ static void draw_vertical_scale_indicators(const ARegion *region,
const float ypos_view = start + i * distance;
const float ypos_region = UI_view2d_view_to_region_y(v2d, ypos_view + display_offset);
char text[32];
to_string(to_string_data, ypos_view, distance, sizeof(text), text);
to_string(to_string_data, ypos_view, distance, text, sizeof(text));
if (ypos_region - y_offset >= ymin && ypos_region + y_offset <= ymax) {
BLF_draw_default(xpos, ypos_region - y_offset, 0.0f, text, sizeof(text));
@@ -407,13 +407,13 @@ static void draw_vertical_scale_indicators(const ARegion *region,
}
static void view_to_string__frame_number(
void * /*user_data*/, float v2d_pos, float /*v2d_step*/, uint str_maxncpy, char *r_str)
void * /*user_data*/, float v2d_pos, float /*v2d_step*/, char *r_str, uint str_maxncpy)
{
BLI_snprintf(r_str, str_maxncpy, "%d", int(v2d_pos));
}
static void view_to_string__time(
void *user_data, float v2d_pos, float v2d_step, uint str_maxncpy, char *r_str)
void *user_data, float v2d_pos, float v2d_step, char *r_str, uint str_maxncpy)
{
const Scene *scene = (const Scene *)user_data;
@@ -427,7 +427,7 @@ static void view_to_string__time(
}
static void view_to_string__value(
void * /*user_data*/, float v2d_pos, float v2d_step, uint str_maxncpy, char *r_str)
void * /*user_data*/, float v2d_pos, float v2d_step, char *r_str, uint str_maxncpy)
{
if (v2d_step >= 1.0f) {
BLI_snprintf(r_str, str_maxncpy, "%d", int(v2d_pos));