diff options
Diffstat (limited to 'source/blender/editors/space_info/textview.c')
-rw-r--r-- | source/blender/editors/space_info/textview.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c index 19ada4779a0..c842fa8b4ac 100644 --- a/source/blender/editors/space_info/textview.c +++ b/source/blender/editors/space_info/textview.c @@ -102,28 +102,29 @@ static void textview_draw_sel(const char *str, } /** - * \warning Allocated memory for 'offsets' must be freed by caller. + * \warning Allocated memory for 'r_offsets' must be freed by caller. * \return The length in bytes. */ -static int textview_wrap_offsets(const char *str, int len, int width, int *lines, int **offsets) +static int textview_wrap_offsets( + const char *str, int len, int width, int *r_lines, int **r_offsets) { int i, end; /* Offset as unicode code-point. */ int j; /* Offset as bytes. */ - *lines = 1; + *r_lines = 1; - *offsets = MEM_callocN( - sizeof(**offsets) * + *r_offsets = MEM_callocN( + sizeof(**r_offsets) * (len * BLI_UTF8_WIDTH_MAX / MAX2(1, width - (BLI_UTF8_WIDTH_MAX - 1)) + 1), __func__); - (*offsets)[0] = 0; + (*r_offsets)[0] = 0; for (i = 0, end = width, j = 0; j < len && str[j]; j += BLI_str_utf8_size_safe(str + j)) { int columns = BLI_str_utf8_char_width_safe(str + j); if (i + columns > end) { - (*offsets)[*lines] = j; - (*lines)++; + (*r_offsets)[*r_lines] = j; + (*r_lines)++; end = i + width; } |