diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-02-12 19:54:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-02-12 19:54:24 +0300 |
commit | 55f68c36574779ae2fac3652466584628b22c633 (patch) | |
tree | e2f55301dda8897bf17f8b8459229d8fa5a67816 /source/blender/blenlib | |
parent | 9eee1f962d49f14d92c8da4e677e4ee140f4f440 (diff) |
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).
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/fileops.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 462e3ed9d01..5ee652264c0 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -271,7 +271,7 @@ int BLI_rename(const char *from, const char *to) { * timer, and... We implement a callback mechanism. The system will * have to initialise the callback before the functions will work! * */ -static char str[MAXPATHLEN+12]; +static char str[12 + (MAXPATHLEN * 2)]; int BLI_delete(const char *file, int dir, int recursive) { @@ -280,34 +280,34 @@ int BLI_delete(const char *file, int dir, int recursive) } else { if (recursive) { - sprintf(str, "/bin/rm -rf \"%s\"", file); + BLI_snprintf(str, sizeof(str), "/bin/rm -rf \"%s\"", file); return system(str); } else if (dir) { - sprintf(str, "/bin/rmdir \"%s\"", file); + BLI_snprintf(str, sizeof(str), "/bin/rmdir \"%s\"", file); return system(str); } else { - return remove(file); //sprintf(str, "/bin/rm -f \"%s\"", file); + return remove(file); //BLI_snprintf(str, sizeof(str), "/bin/rm -f \"%s\"", file); } } return -1; } int BLI_move(const char *file, const char *to) { - sprintf(str, "/bin/mv -f \"%s\" \"%s\"", file, to); + BLI_snprintf(str, sizeof(str), "/bin/mv -f \"%s\" \"%s\"", file, to); return system(str); } int BLI_copy_fileops(const char *file, const char *to) { - sprintf(str, "/bin/cp -rf \"%s\" \"%s\"", file, to); + BLI_snprintf(str, sizeof(str), "/bin/cp -rf \"%s\" \"%s\"", file, to); return system(str); } int BLI_link(const char *file, const char *to) { - sprintf(str, "/bin/ln -f \"%s\" \"%s\"", file, to); + BLI_snprintf(str, sizeof(str), "/bin/ln -f \"%s\" \"%s\"", file, to); return system(str); } |