[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53622] trunk/blender/source/blender: code cleanup: warnings and use stdbool for bpy* funcs.
Campbell Barton
ideasman42 at gmail.com
Mon Jan 7 06:26:22 CET 2013
Revision: 53622
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53622
Author: campbellbarton
Date: 2013-01-07 05:26:12 +0000 (Mon, 07 Jan 2013)
Log Message:
-----------
code cleanup: warnings and use stdbool for bpy* funcs.
Modified Paths:
--------------
trunk/blender/source/blender/python/BPY_extern.h
trunk/blender/source/blender/python/generic/py_capi_utils.c
trunk/blender/source/blender/python/generic/py_capi_utils.h
trunk/blender/source/blender/python/intern/bpy.c
trunk/blender/source/blender/python/intern/bpy_driver.c
trunk/blender/source/blender/python/intern/bpy_interface.c
trunk/blender/source/blender/python/intern/bpy_interface_atexit.c
trunk/blender/source/blender/python/intern/bpy_library.c
trunk/blender/source/blender/python/intern/bpy_operator.c
trunk/blender/source/blender/python/intern/bpy_operator_wrap.c
trunk/blender/source/blender/python/intern/bpy_path.c
trunk/blender/source/blender/python/intern/bpy_props.c
trunk/blender/source/blender/python/intern/bpy_rna.c
trunk/blender/source/blender/python/intern/bpy_rna.h
trunk/blender/source/blender/python/intern/bpy_rna_anim.c
trunk/blender/source/blender/python/intern/bpy_rna_callback.c
trunk/blender/source/blender/python/intern/bpy_util.c
trunk/blender/source/blender/python/intern/bpy_util.h
trunk/blender/source/blender/render/intern/source/multires_bake.c
Modified: trunk/blender/source/blender/python/BPY_extern.h
===================================================================
--- trunk/blender/source/blender/python/BPY_extern.h 2013-01-07 03:29:03 UTC (rev 53621)
+++ trunk/blender/source/blender/python/BPY_extern.h 2013-01-07 05:26:12 UTC (rev 53622)
@@ -66,7 +66,7 @@
/* 2.5 UI Scripts */
int BPY_filepath_exec(struct bContext *C, const char *filepath, struct ReportList *reports);
-int BPY_text_exec(struct bContext *C, struct Text *text, struct ReportList *reports, const short do_jump);
+int BPY_text_exec(struct bContext *C, struct Text *text, struct ReportList *reports, const bool do_jump);
void BPY_text_free_code(struct Text *text);
void BPY_modules_update(struct bContext *C); // XXX - annoying, need this for pointers that get out of date
void BPY_modules_load_user(struct bContext *C);
Modified: trunk/blender/source/blender/python/generic/py_capi_utils.c
===================================================================
--- trunk/blender/source/blender/python/generic/py_capi_utils.c 2013-01-07 03:29:03 UTC (rev 53621)
+++ trunk/blender/source/blender/python/generic/py_capi_utils.c 2013-01-07 05:26:12 UTC (rev 53622)
@@ -33,6 +33,8 @@
#include <Python.h>
#include <frameobject.h>
+#include "BLI_utildefines.h" /* for bool */
+
#include "py_capi_utils.h"
/* only for BLI_strncpy_wchar_from_utf8, should replace with py funcs but too late in release now */
@@ -44,7 +46,7 @@
/* array utility function */
int PyC_AsArray(void *array, PyObject *value, const Py_ssize_t length,
- const PyTypeObject *type, const short is_double, const char *error_prefix)
+ const PyTypeObject *type, const bool is_double, const char *error_prefix)
{
PyObject *value_fast;
Py_ssize_t value_len;
@@ -114,7 +116,7 @@
/* array utility function */
PyObject *PyC_FromArray(const void *array, int length, const PyTypeObject *type,
- const short is_double, const char *error_prefix)
+ const bool is_double, const char *error_prefix)
{
PyObject *tuple;
int i;
Modified: trunk/blender/source/blender/python/generic/py_capi_utils.h
===================================================================
--- trunk/blender/source/blender/python/generic/py_capi_utils.h 2013-01-07 03:29:03 UTC (rev 53621)
+++ trunk/blender/source/blender/python/generic/py_capi_utils.h 2013-01-07 05:26:12 UTC (rev 53622)
@@ -38,9 +38,9 @@
void PyC_FileAndNum(const char **filename, int *lineno);
void PyC_FileAndNum_Safe(const char **filename, int *lineno); /* checks python is running */
int PyC_AsArray(void *array, PyObject *value, const Py_ssize_t length,
- const PyTypeObject *type, const short is_double, const char *error_prefix);
-PyObject * PyC_FromArray(const void *array, int length, const PyTypeObject *type,
- const short is_double, const char *error_prefix);
+ const PyTypeObject *type, const bool is_double, const char *error_prefix);
+PyObject * PyC_FromArray(const void *array, int length, const PyTypeObject *type,
+ const bool is_double, const char *error_prefix);
/* follow http://www.python.org/dev/peps/pep-0383/ */
PyObject * PyC_UnicodeFromByte(const char *str);
Modified: trunk/blender/source/blender/python/intern/bpy.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy.c 2013-01-07 03:29:03 UTC (rev 53621)
+++ trunk/blender/source/blender/python/intern/bpy.c 2013-01-07 05:26:12 UTC (rev 53622)
@@ -35,19 +35,19 @@
#include "RNA_types.h"
#include "RNA_access.h"
-#include "bpy.h"
-#include "bpy_util.h"
+#include "BLI_path_util.h"
+#include "BLI_string.h"
+#include "BKE_bpath.h"
+#include "BLI_utildefines.h"
+
+#include "bpy.h"
+#include "bpy_util.h"
#include "bpy_rna.h"
#include "bpy_app.h"
#include "bpy_props.h"
#include "bpy_library.h"
#include "bpy_operator.h"
-#include "BLI_path_util.h"
-#include "BLI_string.h"
-#include "BKE_bpath.h"
-#include "BLI_utildefines.h"
-
#include "BKE_main.h"
#include "BKE_global.h" /* XXX, G.main only */
#include "BKE_blender.h"
@@ -94,7 +94,7 @@
PyObject *item = PyUnicode_DecodeFSDefault(path_src);
PyList_Append(list, item);
Py_DECREF(item);
- return FALSE; /* never edits the path */
+ return false; /* never edits the path */
}
PyDoc_STRVAR(bpy_blend_paths_doc,
@@ -116,9 +116,9 @@
int flag = 0;
PyObject *list;
- int absolute = FALSE;
- int packed = FALSE;
- int local = FALSE;
+ int absolute = false;
+ int packed = false;
+ int local = false;
static const char *kwlist[] = {"absolute", "packed", "local", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kw, "|iii:blend_paths",
@@ -205,7 +205,7 @@
return NULL;
}
- path = BLI_get_folder_version(folder_id, (major * 100) + minor, FALSE);
+ path = BLI_get_folder_version(folder_id, (major * 100) + minor, false);
return PyUnicode_DecodeFSDefault(path ? path : "");
}
Modified: trunk/blender/source/blender/python/intern/bpy_driver.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_driver.c 2013-01-07 03:29:03 UTC (rev 53621)
+++ trunk/blender/source/blender/python/intern/bpy_driver.c 2013-01-07 05:26:12 UTC (rev 53622)
@@ -122,7 +122,7 @@
void BPY_driver_reset(void)
{
PyGILState_STATE gilstate;
- int use_gil = TRUE; /* !PYC_INTERPRETER_ACTIVE; */
+ bool use_gil = true; /* !PYC_INTERPRETER_ACTIVE; */
if (use_gil)
gilstate = PyGILState_Ensure();
@@ -175,7 +175,7 @@
PyObject *expr_vars; /* speed up by pre-hashing string & avoids re-converting unicode strings for every execution */
PyObject *expr_code;
PyGILState_STATE gilstate;
- int use_gil;
+ bool use_gil;
DriverVar *dvar;
double result = 0.0; /* default return */
@@ -193,7 +193,7 @@
return 0.0f;
}
- use_gil = TRUE; /* !PYC_INTERPRETER_ACTIVE; */
+ use_gil = true; /* !PYC_INTERPRETER_ACTIVE; */
if (use_gil)
gilstate = PyGILState_Ensure();
Modified: trunk/blender/source/blender/python/intern/bpy_interface.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_interface.c 2013-01-07 03:29:03 UTC (rev 53621)
+++ trunk/blender/source/blender/python/intern/bpy_interface.c 2013-01-07 05:26:12 UTC (rev 53622)
@@ -39,6 +39,15 @@
#include "MEM_guardedalloc.h"
+#include "BLI_path_util.h"
+#include "BLI_fileops.h"
+#include "BLI_listbase.h"
+#include "BLI_math_base.h"
+#include "BLI_string.h"
+#include "BLI_string_utf8.h"
+#include "BLI_utildefines.h"
+#include "BLI_threads.h"
+
#include "RNA_types.h"
#include "bpy.h"
@@ -52,15 +61,6 @@
#include "DNA_space_types.h"
#include "DNA_text_types.h"
-#include "BLI_path_util.h"
-#include "BLI_fileops.h"
-#include "BLI_listbase.h"
-#include "BLI_math_base.h"
-#include "BLI_string.h"
-#include "BLI_string_utf8.h"
-#include "BLI_utildefines.h"
-#include "BLI_threads.h"
-
#include "BKE_context.h"
#include "BKE_text.h"
#include "BKE_main.h"
@@ -166,7 +166,7 @@
{
if (text->compiled) {
PyGILState_STATE gilstate;
- int use_gil = !PYC_INTERPRETER_ACTIVE;
+ bool use_gil = !PYC_INTERPRETER_ACTIVE;
if (use_gil)
gilstate = PyGILState_Ensure();
@@ -378,8 +378,8 @@
python_script_error_jump(text->id.name + 2, &lineno, &offset);
if (lineno != -1) {
/* select the line with the error */
- txt_move_to(text, lineno - 1, INT_MAX, FALSE);
- txt_move_to(text, lineno - 1, offset, TRUE);
+ txt_move_to(text, lineno - 1, INT_MAX, false);
+ txt_move_to(text, lineno - 1, offset, true);
}
}
@@ -397,7 +397,7 @@
#endif
static int python_script_exec(bContext *C, const char *fn, struct Text *text,
- struct ReportList *reports, const short do_jump)
+ struct ReportList *reports, const bool do_jump)
{
Main *bmain_old = CTX_data_main(C);
PyObject *main_mod = NULL;
@@ -514,11 +514,11 @@
/* Can run a file or text block */
int BPY_filepath_exec(bContext *C, const char *filepath, struct ReportList *reports)
{
- return python_script_exec(C, filepath, NULL, reports, FALSE);
+ return python_script_exec(C, filepath, NULL, reports, false);
}
-int BPY_text_exec(bContext *C, struct Text *text, struct ReportList *reports, const short do_jump)
+int BPY_text_exec(bContext *C, struct Text *text, struct ReportList *reports, const bool do_jump)
{
return python_script_exec(C, NULL, text, reports, do_jump);
}
@@ -719,12 +719,12 @@
int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *result)
{
PyGILState_STATE gilstate;
- int use_gil = !PYC_INTERPRETER_ACTIVE;
+ bool use_gil = !PYC_INTERPRETER_ACTIVE;
PyObject *pyctx;
PyObject *item;
PointerRNA *ptr = NULL;
- int done = FALSE;
+ bool done = false;
if (use_gil)
gilstate = PyGILState_Ensure();
@@ -743,7 +743,7 @@
//result->ptr = ((BPy_StructRNA *)item)->ptr;
CTX_data_pointer_set(result, ptr->id.data, ptr->type, ptr->data);
- done = TRUE;
+ done = true;
}
else if (PySequence_Check(item)) {
PyObject *seq_fast = PySequence_Fast(item, "bpy_context_get sequence conversion");
@@ -774,7 +774,7 @@
}
Py_DECREF(seq_fast);
- done = TRUE;
+ done = true;
}
}
Modified: trunk/blender/source/blender/python/intern/bpy_interface_atexit.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_interface_atexit.c 2013-01-07 03:29:03 UTC (rev 53621)
+++ trunk/blender/source/blender/python/intern/bpy_interface_atexit.c 2013-01-07 05:26:12 UTC (rev 53622)
@@ -31,13 +31,13 @@
#include <Python.h>
+#include "BLI_utildefines.h"
+
#include "bpy_util.h"
#include "bpy.h" /* own include */
#include "WM_api.h"
-#include "BLI_utildefines.h"
-
static PyObject *bpy_atexit(PyObject *UNUSED(self), PyObject *UNUSED(args), PyObject *UNUSED(kw))
{
/* close down enough of blender at least not to crash */
Modified: trunk/blender/source/blender/python/intern/bpy_library.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_library.c 2013-01-07 03:29:03 UTC (rev 53621)
+++ trunk/blender/source/blender/python/intern/bpy_library.c 2013-01-07 05:26:12 UTC (rev 53622)
@@ -244,7 +244,7 @@
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list