[Bf-blender-cvs] [b882257fbd3] blender2.8: BLF: Reduce the size of the buffer requested to IMM.

Clément Foucault noreply at git.blender.org
Thu Mar 29 21:32:33 CEST 2018


Commit: b882257fbd38f56b512a79027f91f8ff282f31b5
Author: Clément Foucault
Date:   Thu Mar 29 20:45:22 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBb882257fbd38f56b512a79027f91f8ff282f31b5

BLF: Reduce the size of the buffer requested to IMM.

There is no point to not call strlen if the number of char is large.

===================================================================

M	source/blender/blenfont/intern/blf_font.c

===================================================================

diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index fe94270f530..1f304d208e6 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -176,7 +176,8 @@ static void blf_font_ensure_ascii_table(FontBLF *font)
 
 static unsigned int verts_needed(const FontBLF *font, const char *str, size_t len)
 {
-	unsigned int length = (unsigned int)((len == INT_MAX) ? strlen(str) : len);
+	size_t str_len = (len > 50) ? strlen(str) : INT_MAX; /* Arbitrary. */
+	unsigned int length = (unsigned int)MIN2(str_len, len);
 	unsigned int quad_ct = 1;
 
 	if (font->flags & BLF_SHADOW) {



More information about the Bf-blender-cvs mailing list