From 3c9a11f24ed9bd131e049e98e86aaee1bcaeb53a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 16 Dec 2006 03:36:54 +0000 Subject: [PATCH] Sys.c was getting the path seperator out of the python dict and converting it to a char for all path functions. made DIRSEP a constant and refer to that directly. Draw.c's PupBlock limit was 24, made 120 to match blenders internal limit. --- source/blender/python/api2_2x/Draw.c | 4 +- source/blender/python/api2_2x/Sys.c | 73 ++++++++-------------------- 2 files changed, 21 insertions(+), 56 deletions(-) diff --git a/source/blender/python/api2_2x/Draw.c b/source/blender/python/api2_2x/Draw.c index 9728d8ec5b0..ae51f85744e 100644 --- a/source/blender/python/api2_2x/Draw.c +++ b/source/blender/python/api2_2x/Draw.c @@ -1416,8 +1416,8 @@ static PyObject *Method_PupBlock( PyObject * self, PyObject * args ) if (len == 0) return EXPP_ReturnPyObjError( PyExc_ValueError, "expected a string and a non-empty sequence." ); - if (len > 24) /* LIMIT DEFINED IN toolbox.c */ - return EXPP_ReturnPyObjError( PyExc_ValueError, "sequence cannot have more than 24 elements" ); + if (len > 120) /* LIMIT DEFINED IN toolbox.c */ + return EXPP_ReturnPyObjError( PyExc_ValueError, "sequence cannot have more than 120 elements" ); for ( i=0 ; i dot ) @@ -318,9 +289,7 @@ static PyObject *M_sys_makename( PyObject * self, PyObject * args, int strip = 0; static char *kwlist[] = { "path", "ext", "strip", NULL }; char *dot = NULL, *p = NULL, basename[FILE_MAXDIR + FILE_MAXFILE]; - char sep; int n, len, lenext = 0; - PyObject *c; if( !PyArg_ParseTupleAndKeywords( args, kw, "|ssi", kwlist, &path, &ext, &strip ) ) @@ -335,11 +304,7 @@ static PyObject *M_sys_makename( PyObject * self, PyObject * args, return EXPP_ReturnPyObjError( PyExc_RuntimeError, "path too long" ); - c = PyObject_GetAttrString( g_sysmodule, "dirsep" ); - sep = PyString_AsString( c )[0]; - Py_DECREF( c ); - - p = strrchr( path, sep ); + p = strrchr( path, DIRSEP ); if( p && strip ) { n = path + len - p;