from looking at patch 4934 made all user preference paths settable with Blender.Set('val', data), also added exception errors which were on the todo.

image.filename was being limited to FILE_MAXDIR rather then FILE_MAXDIR + FILE_MAXFILE when setting.
This commit is contained in:
Campbell Barton
2006-09-21 18:25:40 +00:00
parent 95c185c4c5
commit d82f1f5f91
3 changed files with 65 additions and 32 deletions

View File

@@ -1036,17 +1036,17 @@ static PyObject *Image_setFilename( BPy_Image * self, PyObject * args )
char *name;
int namelen = 0;
/* max len is FILE_MAXDIR = 160 chars like done in DNA_image_types.h */
/* max len is FILE_MAXDIR == 160, FILE_MAXFILE == 80 chars like done in DNA_image_types.h */
if( !PyArg_ParseTuple( args, "s#", &name, &namelen ) )
return ( EXPP_ReturnPyObjError( PyExc_TypeError,
"expected a string argument" ) );
if( namelen >= FILE_MAXDIR )
if( namelen >= FILE_MAXDIR + FILE_MAXFILE )
return ( EXPP_ReturnPyObjError( PyExc_TypeError,
"string argument is limited to 160 chars at most" ) );
"string argument is limited to 240 chars at most" ) );
PyOS_snprintf( self->image->name, FILE_MAXDIR * sizeof( char ), "%s",
PyOS_snprintf( self->image->name, (FILE_MAXDIR + FILE_MAXFILE) * sizeof( char ), "%s",
name );
Py_RETURN_NONE;