[Bf-blender-cvs] [102cd75ff48] soc-2020-info-editor: Fix compiler waring

Mateusz Grzeliński noreply at git.blender.org
Thu Jul 23 16:58:38 CEST 2020


Commit: 102cd75ff483dec1c45c20bcb203b97963c6bd9c
Author: Mateusz Grzeliński
Date:   Thu Jul 23 16:58:32 2020 +0200
Branches: soc-2020-info-editor
https://developer.blender.org/rB102cd75ff483dec1c45c20bcb203b97963c6bd9c

Fix compiler waring

===================================================================

M	source/blender/python/intern/bpy_interface_inoutwrapper.c
M	source/blender/python/intern/bpy_interface_inoutwrapper.h

===================================================================

diff --git a/source/blender/python/intern/bpy_interface_inoutwrapper.c b/source/blender/python/intern/bpy_interface_inoutwrapper.c
index 61fae8f05e2..3757e970948 100644
--- a/source/blender/python/intern/bpy_interface_inoutwrapper.c
+++ b/source/blender/python/intern/bpy_interface_inoutwrapper.c
@@ -37,7 +37,7 @@ PyObject *string_io_buf = NULL;
 PyObject *string_io_getvalue = NULL;
 
 /* TODO (grzelins) move this whole implementation to bpy_capi_utils? */
-PyObject *BPY_intern_init_io_wrapper()
+bool BPY_intern_init_io_wrapper()
 {
   PyImport_ImportModule("sys");
   stdout_backup = PySys_GetObject("stdout"); /* borrowed */
@@ -45,26 +45,25 @@ PyObject *BPY_intern_init_io_wrapper()
   BLI_assert(stderr_backup != NULL);
 
   if (!(string_io_mod = PyImport_ImportModule("io"))) {
-    return NULL;
+    return false;
   }
   else if (!(string_io = PyObject_CallMethod(string_io_mod, "StringIO", NULL))) {
-    return NULL;
+    return false;
   }
   else if (!(string_io_getvalue = PyObject_GetAttrString(string_io, "getvalue"))) {
-    return NULL;
+    return false;
   }
   Py_INCREF(stdout_backup);  // since these were borrowed we don't want them freed when replaced.
   Py_INCREF(stderr_backup);
 
   if (PySys_SetObject("stdout", string_io) == -1) {
-    return NULL;
+    return false;
   }
   if (PySys_SetObject("stderr", string_io) == -1) {
-    return NULL;
+    return false;
   }
 
-  // TODO (grzelins) fix return warning
-  return 1;
+  return true;
 }
 
 PyObject *BPY_intern_get_io_buffer()
diff --git a/source/blender/python/intern/bpy_interface_inoutwrapper.h b/source/blender/python/intern/bpy_interface_inoutwrapper.h
index 10f2869ea4a..b0efa81331d 100644
--- a/source/blender/python/intern/bpy_interface_inoutwrapper.h
+++ b/source/blender/python/intern/bpy_interface_inoutwrapper.h
@@ -19,6 +19,6 @@
 
 void BPY_intern_free_io_twrapper(void);
 PyObject *BPY_intern_get_io_buffer(void);
-PyObject *BPY_intern_init_io_wrapper(void);
+bool BPY_intern_init_io_wrapper(void);
 
 #endif /* __BPY_INTERFACE_INOUTWRAPPER__ */



More information about the Bf-blender-cvs mailing list