diff options
author | Willian Padovani Germano <wpgermano@gmail.com> | 2004-04-19 14:19:41 +0400 |
---|---|---|
committer | Willian Padovani Germano <wpgermano@gmail.com> | 2004-04-19 14:19:41 +0400 |
commit | fb4f255c15cdc5616c8b00cd74c59e7002f38f5a (patch) | |
tree | 1cc7a2ceaec563dc5d965999e5bb518f03f73e45 /source | |
parent | 630a0536f836e2cd198a843960b2f04f3d47baf5 (diff) |
BPython:
- Scripts that ended without an [eol] (end of line char) would give syntax errors when called from menus.
Now all loaded menu scripts have '\\n\\0' appended to them, not only '\\0' as before.
- bug #1146: Kester reported a Valgrind warning, should be fixed now.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/python/BPY_interface.c | 3 | ||||
-rw-r--r-- | source/blender/python/BPY_menus.c | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/python/BPY_interface.c b/source/blender/python/BPY_interface.c index 9eb82b619aa..53a3b6f91d4 100644 --- a/source/blender/python/BPY_interface.c +++ b/source/blender/python/BPY_interface.c @@ -608,9 +608,10 @@ int BPY_menu_do_python(short menutype, int event) len = ftell(fp); fseek(fp, 0L, SEEK_SET); - buffer = MEM_mallocN(len+1, "pyfilebuf"); /* len+1 to add '\0' */ + buffer = MEM_mallocN(len+2, "pyfilebuf"); /* len+2 to add '\n\0' */ len = fread(buffer, 1, len, fp); + buffer[len-1] = '\n'; /* to fix potential syntax error */ buffer[len] = '\0'; /* fast clean-up of dos cr/lf line endings: change '\r' to space */ diff --git a/source/blender/python/BPY_menus.c b/source/blender/python/BPY_menus.c index d947eaa12e1..628f24b35f2 100644 --- a/source/blender/python/BPY_menus.c +++ b/source/blender/python/BPY_menus.c @@ -668,8 +668,8 @@ int BPyMenu_Init(int usedir) char fname[FILE_MAXDIR+FILE_MAXFILE]; char dirname[FILE_MAXDIR]; char *upydir = U.pythondir; - time_t tdir1, tdir2, tfile; - int res1, res2, resf = 0; + time_t tdir1 = 0, tdir2 = 0, tfile = 0; + int res1 = 0, res2 = 0, resf = 0; DEBUG = G.f & G_DEBUG; /* is Blender in debug mode (started with -d) ? */ |