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:
authorCampbell Barton <campbell@blender.org>2022-04-07 08:43:23 +0300
committerCampbell Barton <campbell@blender.org>2022-04-07 08:45:20 +0300
commite2f4c4db8d6cbe4694c24d599e16ee3889871bdd (patch)
treea3be9aecfcac72e0ddaf45471b56a29900101ebf /source/blender/python/intern
parentf49a736ff4023231483c7e535ca2a7f2869d641d (diff)
Cleanup: pass the buffer length into `txt_insert_buf`
Also remove redundant NULL check.
Diffstat (limited to 'source/blender/python/intern')
-rw-r--r--source/blender/python/intern/bpy_rna_text.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/python/intern/bpy_rna_text.c b/source/blender/python/intern/bpy_rna_text.c
index 44568ad30a6..fedb914256a 100644
--- a/source/blender/python/intern/bpy_rna_text.c
+++ b/source/blender/python/intern/bpy_rna_text.c
@@ -6,6 +6,8 @@
* This file extends the text editor with C/Python API methods and attributes.
*/
+#define PY_SSIZE_T_CLEAN
+
#include <Python.h>
#include "DNA_text_types.h"
@@ -103,9 +105,16 @@ static PyObject *bpy_rna_region_from_string(PyObject *self, PyObject *args)
/* Parse the region range. */
const char *buf;
+ Py_ssize_t buf_len;
TextRegion region;
- if (!PyArg_ParseTuple(
- args, "s|((ii)(ii))", &buf, &region.curl, &region.curc, &region.sell, &region.selc)) {
+ if (!PyArg_ParseTuple(args,
+ "s#|((ii)(ii))",
+ &buf,
+ &buf_len,
+ &region.curl,
+ &region.curc,
+ &region.sell,
+ &region.selc)) {
return NULL;
}
@@ -114,7 +123,7 @@ static PyObject *bpy_rna_region_from_string(PyObject *self, PyObject *args)
}
/* Set the selected text. */
- txt_insert_buf(text, buf);
+ txt_insert_buf(text, buf, buf_len);
/* Update the text editor. */
WM_main_add_notifier(NC_TEXT | NA_EDITED, text);