Blender Git Loki
Git Commits -> Revision 89dae55
Revision 89dae55 by Campbell Barton (master) August 27, 2021, 07:02 (GMT) |
Cleanup: utf8 stepping functions Various changes to reduce risk of out of bounds errors in utf8 seeking. - Remove BLI_str_prev_char_utf8 This function could potentially scan past the beginning of a string. Use BLI_str_find_prev_char_utf8 instead which takes a limiting string start argument. - Swap arguments for BLI_str_find_prev_char_utf8 so the stepping argument is first and the limiting argument is last. This matches BLI_str_find_next_char_utf8. - Change behavior of these functions to return it the start or end pointers instead of NULL, which complicated use of these functions to calculate offsets. Callers that need to check if the limits were reached can compare the return value with the start/end pointers. - Return 'const char *' from these functions so they don't remove const from the input arguments. |
Commit Details:
Full Hash: 89dae554f9d5ae0204ad9c51c5ba00e14b16e858
Parent Commit: 523bc98
Lines Changed: +64, -97
10 Modified Paths:
/source/blender/blenfont/intern/blf_font.c (+7, -7) (Diff)
/source/blender/blenkernel/intern/text.c (+3, -2) (Diff)
/source/blender/blenkernel/intern/unit.c (+1, -1) (Diff)
/source/blender/blenlib/BLI_string_utf8.h (+4, -5) (Diff)
/source/blender/blenlib/intern/string_cursor_utf8.c (+4, -6) (Diff)
/source/blender/blenlib/intern/string_utf8.c (+30, -63) (Diff)
/source/blender/editors/interface/interface_handlers.c (+2, -1) (Diff)
/source/blender/editors/interface/interface_widgets.c (+9, -8) (Diff)
/source/blender/editors/space_text/text_draw.c (+3, -3) (Diff)
/source/blender/editors/space_text/text_ops.c (+1, -1) (Diff)
/source/blender/blenkernel/intern/text.c (+3, -2) (Diff)
/source/blender/blenkernel/intern/unit.c (+1, -1) (Diff)
/source/blender/blenlib/BLI_string_utf8.h (+4, -5) (Diff)
/source/blender/blenlib/intern/string_cursor_utf8.c (+4, -6) (Diff)
/source/blender/blenlib/intern/string_utf8.c (+30, -63) (Diff)
/source/blender/editors/interface/interface_handlers.c (+2, -1) (Diff)
/source/blender/editors/interface/interface_widgets.c (+9, -8) (Diff)
/source/blender/editors/space_text/text_draw.c (+3, -3) (Diff)
/source/blender/editors/space_text/text_ops.c (+1, -1) (Diff)