Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/intern/bpy_props.c22
-rw-r--r--source/blender/python/intern/bpy_rna.c31
-rw-r--r--source/blender/python/intern/bpy_rna.h11
-rw-r--r--source/blender/python/intern/bpy_rna_callback.c2
-rw-r--r--source/blender/python/intern/bpy_util.c4
-rw-r--r--source/blender/python/intern/bpy_util.h2
6 files changed, 39 insertions, 33 deletions
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index b84fe84c2b6..daef323058c 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -60,7 +60,7 @@ enum {
extern BPy_StructRNA *bpy_context_module;
-static EnumPropertyItem property_flag_items[] = {
+static const EnumPropertyItem property_flag_items[] = {
{PROP_HIDDEN, "HIDDEN", 0, "Hidden", ""},
{PROP_SKIP_SAVE, "SKIP_SAVE", 0, "Skip Save", ""},
{PROP_ANIMATABLE, "ANIMATABLE", 0, "Animatable", ""},
@@ -74,7 +74,7 @@ static EnumPropertyItem property_flag_items[] = {
"'TEXTEDIT_UPDATE'].\n" \
" :type options: set\n" \
-static EnumPropertyItem property_flag_enum_items[] = {
+static const EnumPropertyItem property_flag_enum_items[] = {
{PROP_HIDDEN, "HIDDEN", 0, "Hidden", ""},
{PROP_SKIP_SAVE, "SKIP_SAVE", 0, "Skip Save", ""},
{PROP_ANIMATABLE, "ANIMATABLE", 0, "Animatable", ""},
@@ -90,7 +90,7 @@ static EnumPropertyItem property_flag_enum_items[] = {
/* XXX Keep in sync with rna_rna.c's rna_enum_property_subtype_items ???
* Currently it is not...
*/
-static EnumPropertyItem property_subtype_string_items[] = {
+static const EnumPropertyItem property_subtype_string_items[] = {
{PROP_FILEPATH, "FILE_PATH", 0, "File Path", ""},
{PROP_DIRPATH, "DIR_PATH", 0, "Directory Path", ""},
{PROP_FILENAME, "FILE_NAME", 0, "Filename", ""},
@@ -104,7 +104,7 @@ static EnumPropertyItem property_subtype_string_items[] = {
" :arg subtype: Enumerator in ['FILE_PATH', 'DIR_PATH', 'FILE_NAME', 'BYTE_STRING', 'PASSWORD', 'NONE'].\n" \
" :type subtype: string\n" \
-static EnumPropertyItem property_subtype_number_items[] = {
+static const EnumPropertyItem property_subtype_number_items[] = {
{PROP_PIXEL, "PIXEL", 0, "Pixel", ""},
{PROP_UNSIGNED, "UNSIGNED", 0, "Unsigned", ""},
{PROP_PERCENTAGE, "PERCENTAGE", 0, "Percentage", ""},
@@ -120,7 +120,7 @@ static EnumPropertyItem property_subtype_number_items[] = {
" :arg subtype: Enumerator in ['PIXEL', 'UNSIGNED', 'PERCENTAGE', 'FACTOR', 'ANGLE', 'TIME', 'DISTANCE', 'NONE'].\n" \
" :type subtype: string\n" \
-static EnumPropertyItem property_subtype_array_items[] = {
+static const EnumPropertyItem property_subtype_array_items[] = {
{PROP_COLOR, "COLOR", 0, "Color", ""},
{PROP_TRANSLATION, "TRANSLATION", 0, "Translation", ""},
{PROP_DIRECTION, "DIRECTION", 0, "Direction", ""},
@@ -1335,7 +1335,7 @@ static size_t strswapbufcpy(char *buf, const char **orig)
static int icon_id_from_name(const char *name)
{
- EnumPropertyItem *item;
+ const EnumPropertyItem *item;
int id;
if (name[0]) {
@@ -1349,7 +1349,7 @@ static int icon_id_from_name(const char *name)
return 0;
}
-static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, int *defvalue, const bool is_enum_flag)
+static const EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, int *defvalue, const bool is_enum_flag)
{
EnumPropertyItem *items;
PyObject *item;
@@ -1505,7 +1505,7 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i
return items;
}
-static EnumPropertyItem *bpy_prop_enum_itemf_cb(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free)
+static const EnumPropertyItem *bpy_prop_enum_itemf_cb(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free)
{
PyGILState_STATE gilstate;
@@ -1514,7 +1514,7 @@ static EnumPropertyItem *bpy_prop_enum_itemf_cb(struct bContext *C, PointerRNA *
PyObject *args;
PyObject *items; /* returned from the function call */
- EnumPropertyItem *eitems = NULL;
+ const EnumPropertyItem *eitems = NULL;
int err = 0;
if (C) {
@@ -2748,7 +2748,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
int id_len;
int defvalue = 0;
PyObject *items, *items_fast;
- EnumPropertyItem *eitems;
+ const EnumPropertyItem *eitems;
PropertyRNA *prop;
PyObject *pyopts = NULL;
int opts = 0;
@@ -2841,7 +2841,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
* otherwise if this is a generator it may free the strings before we copy them */
Py_DECREF(items_fast);
- MEM_freeN(eitems);
+ MEM_freeN((void *)eitems);
}
}
Py_RETURN_NONE;
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 398d2631f6c..d17117a4e37 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -758,7 +758,7 @@ thick_wrap_slice:
/* same as RNA_enum_value_from_id but raises an exception */
int pyrna_enum_value_from_id(
- EnumPropertyItem *item, const char *identifier, int *r_value,
+ const EnumPropertyItem *item, const char *identifier, int *r_value,
const char *error_prefix)
{
if (RNA_enum_value_from_id(item, identifier, r_value) == 0) {
@@ -1167,7 +1167,7 @@ static void pyrna_prop_array_dealloc(BPy_PropertyRNA *self)
static const char *pyrna_enum_as_string(PointerRNA *ptr, PropertyRNA *prop)
{
- EnumPropertyItem *item;
+ const EnumPropertyItem *item;
const char *result;
bool free = false;
@@ -1179,8 +1179,9 @@ static const char *pyrna_enum_as_string(PointerRNA *ptr, PropertyRNA *prop)
result = "";
}
- if (free)
- MEM_freeN(item);
+ if (free) {
+ MEM_freeN((void *)item);
+ }
return result;
}
@@ -1221,7 +1222,7 @@ static int pyrna_string_to_enum(
* needed when we want to use the full range of a signed short/char.
*/
BLI_bitmap *pyrna_set_to_enum_bitmap(
- EnumPropertyItem *items, PyObject *value,
+ const EnumPropertyItem *items, PyObject *value,
int type_size, bool type_convert_sign,
int bitmap_size,
const char *error_prefix)
@@ -1277,7 +1278,7 @@ error:
/* 'value' _must_ be a set type, error check before calling */
int pyrna_set_to_enum_bitfield(
- EnumPropertyItem *items, PyObject *value, int *r_value,
+ const EnumPropertyItem *items, PyObject *value, int *r_value,
const char *error_prefix)
{
/* set of enum items, concatenate all values with OR */
@@ -1315,7 +1316,7 @@ static int pyrna_prop_to_enum_bitfield(
PointerRNA *ptr, PropertyRNA *prop, PyObject *value, int *r_value,
const char *error_prefix)
{
- EnumPropertyItem *item;
+ const EnumPropertyItem *item;
int ret;
bool free = false;
@@ -1346,13 +1347,14 @@ static int pyrna_prop_to_enum_bitfield(
}
}
- if (free)
- MEM_freeN(item);
+ if (free) {
+ MEM_freeN((void *)item);
+ }
return ret;
}
-PyObject *pyrna_enum_bitfield_to_py(EnumPropertyItem *items, int value)
+PyObject *pyrna_enum_bitfield_to_py(const EnumPropertyItem *items, int value)
{
PyObject *ret = PySet_New(NULL);
const char *identifier[RNA_ENUM_BITFLAG_SIZE + 1];
@@ -1396,7 +1398,7 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
ret = PyUnicode_FromString(identifier);
}
else {
- EnumPropertyItem *enum_item;
+ const EnumPropertyItem *enum_item;
bool free;
/* don't throw error here, can't trust blender 100% to give the
@@ -1407,7 +1409,7 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
}
else {
if (free) {
- MEM_freeN(enum_item);
+ MEM_freeN((void *)enum_item);
}
RNA_property_enum_items(NULL, ptr, prop, &enum_item, NULL, &free);
@@ -1439,8 +1441,9 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
ret = PyUnicode_FromString("");
}
- if (free)
- MEM_freeN(enum_item);
+ if (free) {
+ MEM_freeN((void *)enum_item);
+ }
#if 0
PyErr_Format(PyExc_AttributeError,
"RNA Error: Current value \"%d\" matches no enum", val);
diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h
index 605f79b1ad8..f666294666e 100644
--- a/source/blender/python/intern/bpy_rna.h
+++ b/source/blender/python/intern/bpy_rna.h
@@ -186,14 +186,17 @@ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, const bool all_args, co
PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop);
unsigned int *pyrna_set_to_enum_bitmap(
- struct EnumPropertyItem *items, PyObject *value,
+ const struct EnumPropertyItem *items, PyObject *value,
int type_size, bool type_convert_sign,
int bitmap_size,
const char *error_prefix);
-PyObject *pyrna_enum_bitfield_to_py(struct EnumPropertyItem *items, int value);
-int pyrna_set_to_enum_bitfield(EnumPropertyItem *items, PyObject *value, int *r_value, const char *error_prefix);
+PyObject *pyrna_enum_bitfield_to_py(
+ const struct EnumPropertyItem *items, int value);
+int pyrna_set_to_enum_bitfield(
+ const struct EnumPropertyItem *items, PyObject *value, int *r_value, const char *error_prefix);
-int pyrna_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int *value, const char *error_prefix);
+int pyrna_enum_value_from_id(
+ const EnumPropertyItem *item, const char *identifier, int *value, const char *error_prefix);
int pyrna_deferred_register_class(struct StructRNA *srna, PyTypeObject *py_class);
diff --git a/source/blender/python/intern/bpy_rna_callback.c b/source/blender/python/intern/bpy_rna_callback.c
index df1c4155a6d..fe3565fc44e 100644
--- a/source/blender/python/intern/bpy_rna_callback.c
+++ b/source/blender/python/intern/bpy_rna_callback.c
@@ -53,7 +53,7 @@
#define RNA_CAPSULE_ID "RNA_HANDLE"
#define RNA_CAPSULE_ID_INVALID "RNA_HANDLE_REMOVED"
-static EnumPropertyItem region_draw_mode_items[] = {
+static const EnumPropertyItem region_draw_mode_items[] = {
{REGION_DRAW_POST_PIXEL, "POST_PIXEL", 0, "Post Pixel", ""},
{REGION_DRAW_POST_VIEW, "POST_VIEW", 0, "Post View", ""},
{REGION_DRAW_PRE_VIEW, "PRE_VIEW", 0, "Pre View", ""},
diff --git a/source/blender/python/intern/bpy_util.c b/source/blender/python/intern/bpy_util.c
index 2b8ad6ccb90..c15ff50df04 100644
--- a/source/blender/python/intern/bpy_util.c
+++ b/source/blender/python/intern/bpy_util.c
@@ -47,10 +47,10 @@ static bContext *__py_context = NULL;
bContext *BPy_GetContext(void) { return __py_context; }
void BPy_SetContext(bContext *C) { __py_context = C; }
-char *BPy_enum_as_string(EnumPropertyItem *item)
+char *BPy_enum_as_string(const EnumPropertyItem *item)
{
DynStr *dynstr = BLI_dynstr_new();
- EnumPropertyItem *e;
+ const EnumPropertyItem *e;
char *cstring;
for (e = item; item->identifier; item++) {
diff --git a/source/blender/python/intern/bpy_util.h b/source/blender/python/intern/bpy_util.h
index 6000bf94aef..466941359a8 100644
--- a/source/blender/python/intern/bpy_util.h
+++ b/source/blender/python/intern/bpy_util.h
@@ -34,7 +34,7 @@
struct EnumPropertyItem;
struct ReportList;
-char *BPy_enum_as_string(struct EnumPropertyItem *item);
+char *BPy_enum_as_string(const struct EnumPropertyItem *item);
#define BLANK_PYTHON_TYPE {PyVarObject_HEAD_INIT(NULL, 0) NULL}