Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-01-11 16:33:51 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-01-11 16:33:51 +0400
commite10fd04db0bdcdbc326fce6cddc8af1179a5de5c (patch)
treea8f3a08b35101e30a0e5d4d1a94e0b2ef50c7122 /source/blender/editors/interface
parentdcef7346eb3f16c27b3f952b6452396e66f5e996 (diff)
use BLI_strncpy and BLI_snprintf when the size of the string is known.
fix for sequencer unique naming which was missed with string length update.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r--source/blender/editors/interface/interface_style.c6
-rw-r--r--source/blender/editors/interface/interface_templates.c9
-rw-r--r--source/blender/editors/interface/view2d.c6
3 files changed, 12 insertions, 9 deletions
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index 0e9dbaf3022..16b543737d0 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -180,7 +180,7 @@ void uiStyleFontDrawExt(uiFontStyle *fs, rcti *rect, const char *str,
if (fs->kerning == 1)
BLF_enable(fs->uifont_id, BLF_KERNING_DEFAULT);
- BLF_draw(fs->uifont_id, str, 65535); /* XXX, use real length */
+ BLF_draw(fs->uifont_id, str, BLF_DRAW_STR_DUMMY_MAX);
BLF_disable(fs->uifont_id, BLF_CLIPPING);
if (fs->shadow)
BLF_disable(fs->uifont_id, BLF_SHADOW);
@@ -243,7 +243,7 @@ void uiStyleFontDrawRotated(uiFontStyle *fs, rcti *rect, const char *str)
if (fs->kerning == 1)
BLF_enable(fs->uifont_id, BLF_KERNING_DEFAULT);
- BLF_draw(fs->uifont_id, str, 65535); /* XXX, use real length */
+ BLF_draw(fs->uifont_id, str, BLF_DRAW_STR_DUMMY_MAX);
BLF_disable(fs->uifont_id, BLF_ROTATION);
BLF_disable(fs->uifont_id, BLF_CLIPPING);
if (fs->shadow)
@@ -291,7 +291,7 @@ void UI_DrawString(float x, float y, const char *str)
uiStyleFontSet(&style->widget);
BLF_position(style->widget.uifont_id, x, y, 0.0f);
- BLF_draw(style->widget.uifont_id, str, 65535); /* XXX, use real length */
+ BLF_draw(style->widget.uifont_id, str, BLF_DRAW_STR_DUMMY_MAX);
if (style->widget.kerning == 1)
BLF_disable(style->widget.uifont_id, BLF_KERNING_DEFAULT);
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index ccca0c8f7cf..379a253a5c9 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -2471,12 +2471,15 @@ static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char
int len= strlen(ot->name);
/* display name for menu, can hold hotkey */
- BLI_strncpy(name, ot->name, 256);
+ BLI_strncpy(name, ot->name, sizeof(name));
/* check for hotkey */
- if(len < 256-6) {
- if(WM_key_event_operator_string(C, ot->idname, WM_OP_EXEC_DEFAULT, NULL, TRUE, &name[len+1], 256-len-1))
+ if(len < sizeof(name)-6) {
+ if (WM_key_event_operator_string(C, ot->idname, WM_OP_EXEC_DEFAULT, NULL, TRUE,
+ &name[len+1], sizeof(name)-len-1))
+ {
name[len]= '|';
+ }
}
if(0==uiSearchItemAdd(items, name, ot, 0))
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 81ea3370331..b8201d762df 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -1541,7 +1541,7 @@ static void scroll_printstr(Scene *scene, float x, float y, float val, int power
}
/* draw it */
- BLF_draw_default_ascii(x, y, 0.0f, timecode_str, sizeof(timecode_str)-1);
+ BLF_draw_default_ascii(x, y, 0.0f, timecode_str, sizeof(timecode_str));
}
/* Draw scrollbars in the given 2d-region */
@@ -2093,11 +2093,11 @@ void UI_view2d_text_cache_draw(ARegion *ar)
}
if(v2s->rect.xmin >= v2s->rect.xmax)
- BLF_draw_default((float)v2s->mval[0]+xofs, (float)v2s->mval[1]+yofs, 0.0, str, 65535);
+ BLF_draw_default((float)v2s->mval[0]+xofs, (float)v2s->mval[1]+yofs, 0.0, str, BLF_DRAW_STR_DUMMY_MAX);
else {
BLF_clipping_default(v2s->rect.xmin-4, v2s->rect.ymin-4, v2s->rect.xmax+4, v2s->rect.ymax+4);
BLF_enable_default(BLF_CLIPPING);
- BLF_draw_default(v2s->rect.xmin+xofs, v2s->rect.ymin+yofs, 0.0f, str, 65535);
+ BLF_draw_default(v2s->rect.xmin+xofs, v2s->rect.ymin+yofs, 0.0f, str, BLF_DRAW_STR_DUMMY_MAX);
BLF_disable_default(BLF_CLIPPING);
}
}