diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_utildefines.h | 7 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_view.c | 9 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 5 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_props.c | 6 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 38 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 6 | ||||
-rw-r--r-- | source/creator/buildinfo.c | 5 | ||||
-rw-r--r-- | source/creator/creator.c | 2 |
8 files changed, 34 insertions, 44 deletions
diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h index 925b1d7171a..5a6a151afee 100644 --- a/source/blender/blenkernel/BKE_utildefines.h +++ b/source/blender/blenkernel/BKE_utildefines.h @@ -38,8 +38,11 @@ #define TRUE 1 #endif -/* Macro to convert a value to string in the preprocessor */ -#define QUOTE(x) #x +/* Macro to convert a value to string in the preprocessor + * STRINGIFY_ARG: gives the defined name in the string + * STRINGIFY: gives the defined value. */ +#define STRINGIFY_ARG(x) #x +#define STRINGIFY(x) STRINGIFY_ARG(x) /* these values need to be hardcoded in structs, dna does not recognize defines */ /* also defined in DNA_space_types.h */ diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index ebfa77a4a15..d66144b2c30 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -2177,15 +2177,6 @@ static int flyEnd(bContext *C, FlyInfo *fly) object_mat3_to_rot(v3d->camera, mat3, TRUE); DAG_id_flush_update(&v3d->camera->id, OB_RECALC_OB); } - -#if 0 //XXX2.5 - if (IS_AUTOKEY_MODE(NORMAL)) { - allqueue(REDRAWIPO, 0); - allspace(REMAKEIPO, 0); - allqueue(REDRAWNLA, 0); - allqueue(REDRAWTIME, 0); - } -#endif } else { /* not camera */ /* Apply the fly mode view */ diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 36385759c5a..a97033200de 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -515,15 +515,12 @@ static void init(void) { memset(nodes, 0, sizeof nodes); - #define Str(x) #x - #define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \ - reg_node(ID, Category_##Category, EnumName, Str(Category##StructName), #Category, UIName, UIDesc); + reg_node(ID, Category_##Category, EnumName, STRINGIFY_ARG(Category##StructName), #Category, UIName, UIDesc); #include "rna_nodetree_types.h" #undef DefNode - #undef Str reg_node(NODE_GROUP, Category_GroupNode, "GROUP", "NodeGroup", "Node", "Group", ""); } diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index 104027c0997..ec5bb595810 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -246,7 +246,7 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject } if(size < 1 || size > PYRNA_STACK_ARRAY) { - PyErr_Format(PyExc_TypeError, "BoolVectorProperty(size=%d): size must be between 0 and %d.", size, PYRNA_STACK_ARRAY); + PyErr_Format(PyExc_TypeError, "BoolVectorProperty(size=%d): size must be between 0 and " STRINGIFY(PYRNA_STACK_ARRAY), size); return NULL; } @@ -369,7 +369,7 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject } if(size < 1 || size > PYRNA_STACK_ARRAY) { - PyErr_Format(PyExc_TypeError, "IntVectorProperty(size=%d): size must be between 0 and %d.", size, PYRNA_STACK_ARRAY); + PyErr_Format(PyExc_TypeError, "IntVectorProperty(size=%d): size must be between 0 and " STRINGIFY(PYRNA_STACK_ARRAY), size); return NULL; } @@ -503,7 +503,7 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec } if(size < 1 || size > PYRNA_STACK_ARRAY) { - PyErr_Format(PyExc_TypeError, "FloatVectorProperty(size=%d): size must be between 0 and %d.", size, PYRNA_STACK_ARRAY); + PyErr_Format(PyExc_TypeError, "FloatVectorProperty(size=%d): size must be between 0 and " STRINGIFY(PYRNA_STACK_ARRAY), size); return NULL; } diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index a663fc79598..238201c7cf0 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -962,7 +962,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *p if(RNA_property_flag(prop) & PROP_OUTPUT) param = PyObject_IsTrue( value ); else - param = PyLong_AsSsize_t( value ); + param = PyLong_AsLong( value ); if( param < 0 || param > 1) { PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected True/False or 0/1", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop)); @@ -975,14 +975,20 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *p } case PROP_INT: { - int param = PyLong_AsSsize_t(value); - if (param==-1 && PyErr_Occurred()) { + int overflow; + long param= PyLong_AsLongAndOverflow(value, &overflow); + if(overflow || (param > INT_MAX) || (param < INT_MIN)) { + PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s value not in 'int' range (" STRINGIFY(INT_MIN) ", " STRINGIFY(INT_MAX) ")", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop)); + return -1; + } + else if (param==-1 && PyErr_Occurred()) { PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected an int type", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop)); return -1; } else { - RNA_property_int_clamp(ptr, prop, ¶m); - if(data) *((int*)data)= param; - else RNA_property_int_set(ptr, prop, param); + int param_i= (int)param; + RNA_property_int_clamp(ptr, prop, ¶m_i); + if(data) *((int*)data)= param_i; + else RNA_property_int_set(ptr, prop, param_i); } break; } @@ -1261,7 +1267,7 @@ static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, P switch (type) { case PROP_BOOLEAN: { - int param = PyLong_AsSsize_t( value ); + int param = PyLong_AsLong( value ); if( param < 0 || param > 1) { PyErr_SetString(PyExc_TypeError, "expected True/False or 0/1"); @@ -1273,7 +1279,7 @@ static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, P } case PROP_INT: { - int param = PyLong_AsSsize_t(value); + int param = PyLong_AsLong(value); if (param==-1 && PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "expected an int type"); ret = -1; @@ -1529,7 +1535,7 @@ static PyObject *pyrna_prop_array_subscript(BPy_PropertyArrayRNA *self, PyObject Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError); if (i == -1 && PyErr_Occurred()) return NULL; - return pyrna_prop_array_subscript_int(self, PyLong_AsSsize_t(key)); + return pyrna_prop_array_subscript_int(self, PyLong_AsLong(key)); } else if (PySlice_Check(key)) { Py_ssize_t start, stop, step, slicelength; @@ -1613,7 +1619,7 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop, in RNA_property_boolean_get_array(ptr, prop, values); for(count=start; count<stop; count++) - values[count] = PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, count-start)); + values[count] = PyLong_AsLong(PySequence_Fast_GET_ITEM(value, count-start)); if(PyErr_Occurred()) ret= -1; else RNA_property_boolean_set_array(ptr, prop, values); @@ -1634,7 +1640,7 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop, in RNA_property_int_get_array(ptr, prop, values); for(count=start; count<stop; count++) { - ival = PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, count-start)); + ival = PyLong_AsLong(PySequence_Fast_GET_ITEM(value, count-start)); CLAMP(ival, min, max); values[count] = ival; } @@ -2854,7 +2860,7 @@ static PyObject *pyrna_prop_collection_idprop_add(BPy_PropertyRNA *self) static PyObject *pyrna_prop_collection_idprop_remove(BPy_PropertyRNA *self, PyObject *value) { - int key= PyLong_AsSsize_t(value); + int key= PyLong_AsLong(value); if (key==-1 && PyErr_Occurred()) { PyErr_SetString( PyExc_TypeError, "bpy_prop_collection.remove(): expected one int argument"); @@ -3201,13 +3207,13 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set) item= PySequence_GetItem(seq, i); switch(raw_type) { case PROP_RAW_CHAR: - ((char *)array)[i]= (char)PyLong_AsSsize_t(item); + ((char *)array)[i]= (char)PyLong_AsLong(item); break; case PROP_RAW_SHORT: - ((short *)array)[i]= (short)PyLong_AsSsize_t(item); + ((short *)array)[i]= (short)PyLong_AsLong(item); break; case PROP_RAW_INT: - ((int *)array)[i]= (int)PyLong_AsSsize_t(item); + ((int *)array)[i]= (int)PyLong_AsLong(item); break; case PROP_RAW_FLOAT: ((float *)array)[i]= (float)PyFloat_AsDouble(item); @@ -4971,7 +4977,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun if (func_arg_count >= 0) { /* -1 if we dont care*/ py_arg_count = PyObject_GetAttrString(PyFunction_GET_CODE(item), "co_argcount"); - arg_count = PyLong_AsSsize_t(py_arg_count); + arg_count = PyLong_AsLong(py_arg_count); Py_DECREF(py_arg_count); /* note, the number of args we check for and the number of args we give to diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index a5294f170f3..5b7d952de77 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -893,12 +893,6 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op) op->properties= IDP_New(IDP_GROUP, val, "wmOperatorProperties"); } - // XXX - hack, only for editing docs - if(strcmp(op->type->idname, "WM_OT_doc_edit")==0) { - columns= 1; - width= 500; - } - RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, width, 20, style); uiItemL(layout, op->type->name, 0); diff --git a/source/creator/buildinfo.c b/source/creator/buildinfo.c index d745d826bd6..a14cb94b859 100644 --- a/source/creator/buildinfo.c +++ b/source/creator/buildinfo.c @@ -27,10 +27,9 @@ * ***** END GPL LICENSE BLOCK ***** */ -#define STRINGIFY(x) XSTRINGIFY(x) -#define XSTRINGIFY(x) #x - #ifdef BUILD_DATE +#include "BKE_utildefines.h" + char build_date[]= STRINGIFY(BUILD_DATE); char build_time[]= STRINGIFY(BUILD_TIME); char build_rev[]= STRINGIFY(BUILD_REV); diff --git a/source/creator/creator.c b/source/creator/creator.c index 4066d16186b..8e17bec361f 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -993,7 +993,7 @@ void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle) BLI_argsAdd(ba, 4, "-E", "--engine", "<engine>\n\tSpecify the render engine\n\tuse -E help to list available engines", set_engine, C); BLI_argsAdd(ba, 4, "-F", "--render-format", format_doc, set_image_type, C); - BLI_argsAdd(ba, 4, "-t", "--threads", "<threads>\n\tUse amount of <threads> for rendering in background\n\t[1-" QUOTE(BLENDER_MAX_THREADS) "], 0 for systems processor count.", set_threads, NULL); + BLI_argsAdd(ba, 4, "-t", "--threads", "<threads>\n\tUse amount of <threads> for rendering in background\n\t[1-" STRINGIFY(BLENDER_MAX_THREADS) "], 0 for systems processor count.", set_threads, NULL); BLI_argsAdd(ba, 4, "-x", "--use-extension", "<bool>\n\tSet option to add the file extension to the end of the file", set_extension, C); } |