From 55f68c36574779ae2fac3652466584628b22c633 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 12 Feb 2011 16:54:24 +0000 Subject: fix for more warnings. - modifier code was using sizeof() without knowing the sizeof the array when clearing the modifier type array. - use BLI_snprintf rather then sprintf where the size of the string is known. - particle drawing code kept a reference to stack float values (not a problem at the moment but would crash if accessed later). --- source/blender/windowmanager/intern/wm_files.c | 14 +++++++------- source/blender/windowmanager/intern/wm_window.c | 7 +------ 2 files changed, 8 insertions(+), 13 deletions(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 644320b0566..8e5658865d2 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -543,18 +543,18 @@ static void do_history(char *name, ReportList *reports) if(strlen(name)<2) return; while(hisnr > 1) { - sprintf(tempname1, "%s%d", name, hisnr-1); - sprintf(tempname2, "%s%d", name, hisnr); + BLI_snprintf(tempname1, sizeof(tempname1), "%s%d", name, hisnr-1); + BLI_snprintf(tempname2, sizeof(tempname2), "%s%d", name, hisnr); if(BLI_rename(tempname1, tempname2)) BKE_report(reports, RPT_ERROR, "Unable to make version backup"); hisnr--; } - + /* is needed when hisnr==1 */ - sprintf(tempname1, "%s%d", name, hisnr); - + BLI_snprintf(tempname1, sizeof(tempname1), "%s%d", name, hisnr); + if(BLI_rename(name, tempname1)) BKE_report(reports, RPT_ERROR, "Unable to make version backup"); } @@ -744,8 +744,8 @@ void wm_autosave_location(char *filename) char *savedir; #endif - sprintf(pidstr, "%d.blend", abs(getpid())); - + BLI_snprintf(pidstr, sizeof(pidstr), "%d.blend", abs(getpid())); + #ifdef WIN32 /* XXX Need to investigate how to handle default location of '/tmp/' * This is a relative directory on Windows, and it may be diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index db427ea68d1..97495213559 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -273,12 +273,7 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win) /* this is set to 1 if you don't have startup.blend open */ if(G.save_over && G.main->name[0]) { char str[sizeof(G.main->name) + 12]; - - if(wm->file_saved) - sprintf(str, "Blender [%s]", G.main->name); - else - sprintf(str, "Blender* [%s]", G.main->name); - + BLI_snprintf(str, sizeof(str), "Blender%s [%s]", wm->file_saved ? "":"*", G.main->name); GHOST_SetTitle(win->ghostwin, str); } else -- cgit v1.2.3