Cleanup: remove redundant const qualifiers for POD types

MSVC used to warn about const mismatch for arguments passed by value.
Remove these as newer versions of MSVC no longer show this warning.
This commit is contained in:
Campbell Barton
2022-01-07 11:38:08 +11:00
parent bb69c19f08
commit 3d3bc74884
373 changed files with 3058 additions and 3644 deletions

View File

@@ -81,7 +81,7 @@ void BPY_text_free_code(struct Text *text);
void BPY_modules_update(void);
void BPY_modules_load_user(struct bContext *C);
void BPY_app_handlers_reset(const short do_all);
void BPY_app_handlers_reset(short do_all);
/**
* Update function, it gets rid of py-drivers global dictionary, forcing

View File

@@ -88,10 +88,8 @@ bool BPY_run_filepath(struct bContext *C, const char *filepath, struct ReportLis
* This is done so error messages give useful output however there are rare cases causes problems
* with introspection tools which attempt to load `__file__`.
*/
bool BPY_run_text(struct bContext *C,
struct Text *text,
struct ReportList *reports,
const bool do_jump) ATTR_NONNULL(1, 2);
bool BPY_run_text(struct bContext *C, struct Text *text, struct ReportList *reports, bool do_jump)
ATTR_NONNULL(1, 2);
/** \} */

View File

@@ -141,7 +141,7 @@ PyObject *BPy_BMVert_CreatePyObject(BMesh *bm, BMVert *v);
PyObject *BPy_BMEdge_CreatePyObject(BMesh *bm, BMEdge *e);
PyObject *BPy_BMFace_CreatePyObject(BMesh *bm, BMFace *f);
PyObject *BPy_BMLoop_CreatePyObject(BMesh *bm, BMLoop *l);
PyObject *BPy_BMElemSeq_CreatePyObject(BMesh *bm, BPy_BMElem *py_ele, const char itype);
PyObject *BPy_BMElemSeq_CreatePyObject(BMesh *bm, BPy_BMElem *py_ele, char itype);
PyObject *BPy_BMVertSeq_CreatePyObject(BMesh *bm);
PyObject *BPy_BMEdgeSeq_CreatePyObject(BMesh *bm);
PyObject *BPy_BMFaceSeq_CreatePyObject(BMesh *bm);
@@ -162,18 +162,18 @@ void *BPy_BMElem_PySeq_As_Array_FAST(BMesh **r_bm,
Py_ssize_t min,
Py_ssize_t max,
Py_ssize_t *r_size,
const char htype,
const bool do_unique_check,
const bool do_bm_check,
char htype,
bool do_unique_check,
bool do_bm_check,
const char *error_prefix);
void *BPy_BMElem_PySeq_As_Array(BMesh **r_bm,
PyObject *seq,
Py_ssize_t min,
Py_ssize_t max,
Py_ssize_t *r_size,
const char htype,
const bool do_unique_check,
const bool do_bm_check,
char htype,
bool do_unique_check,
bool do_bm_check,
const char *error_prefix);
PyObject *BPy_BMElem_Array_As_Tuple(BMesh *bm, BMHeader **elem, Py_ssize_t elem_len);
@@ -182,14 +182,14 @@ PyObject *BPy_BMEdge_Array_As_Tuple(BMesh *bm, BMEdge **elem, Py_ssize_t elem_le
PyObject *BPy_BMFace_Array_As_Tuple(BMesh *bm, BMFace **elem, Py_ssize_t elem_len);
PyObject *BPy_BMLoop_Array_As_Tuple(BMesh *bm, BMLoop **elem, Py_ssize_t elem_len);
int BPy_BMElem_CheckHType(PyTypeObject *type, const char htype);
int BPy_BMElem_CheckHType(PyTypeObject *type, char htype);
/**
* Use for error strings only, not thread safe,
*
* \return a string like '(BMVert/BMEdge/BMFace/BMLoop)'
*/
char *BPy_BMElem_StringFromHType_ex(const char htype, char ret[32]);
char *BPy_BMElem_StringFromHType(const char htype);
char *BPy_BMElem_StringFromHType_ex(char htype, char ret[32]);
char *BPy_BMElem_StringFromHType(char htype);
// void bpy_bm_generic_invalidate(BPy_BMGeneric *self);
int bpy_bm_generic_valid_check(BPy_BMGeneric *self);

View File

@@ -61,9 +61,9 @@ typedef struct BPy_BMLayerItem {
int index; /* index of this layer type */
} BPy_BMLayerItem;
PyObject *BPy_BMLayerAccess_CreatePyObject(BMesh *bm, const char htype);
PyObject *BPy_BMLayerCollection_CreatePyObject(BMesh *bm, const char htype, int type);
PyObject *BPy_BMLayerItem_CreatePyObject(BMesh *bm, const char htype, int type, int index);
PyObject *BPy_BMLayerAccess_CreatePyObject(BMesh *bm, char htype);
PyObject *BPy_BMLayerCollection_CreatePyObject(BMesh *bm, char htype, int type);
PyObject *BPy_BMLayerItem_CreatePyObject(BMesh *bm, char htype, int type, int index);
void BPy_BM_init_types_customdata(void);

View File

@@ -73,7 +73,7 @@ int PyC_AsArray_Multi_FAST(void *array,
const size_t array_item_size,
PyObject *value_fast,
const int *dims,
const int dims_len,
int dims_len,
const PyTypeObject *type,
const char *error_prefix);
@@ -81,7 +81,7 @@ int PyC_AsArray_Multi(void *array,
const size_t array_item_size,
PyObject *value,
const int *dims,
const int dims_len,
int dims_len,
const PyTypeObject *type,
const char *error_prefix);
@@ -102,10 +102,10 @@ PyObject *PyC_Tuple_PackArray_Bool(const bool *array, uint len);
#define PyC_Tuple_Pack_Bool(...) \
PyC_Tuple_PackArray_Bool(((const bool[]){__VA_ARGS__}), VA_NARGS_COUNT(__VA_ARGS__))
PyObject *PyC_Tuple_PackArray_Multi_F32(const float *array, const int dims[], const int dims_len);
PyObject *PyC_Tuple_PackArray_Multi_F64(const double *array, const int dims[], const int dims_len);
PyObject *PyC_Tuple_PackArray_Multi_I32(const int *array, const int dims[], const int dims_len);
PyObject *PyC_Tuple_PackArray_Multi_Bool(const bool *array, const int dims[], const int dims_len);
PyObject *PyC_Tuple_PackArray_Multi_F32(const float *array, const int dims[], int dims_len);
PyObject *PyC_Tuple_PackArray_Multi_F64(const double *array, const int dims[], int dims_len);
PyObject *PyC_Tuple_PackArray_Multi_I32(const int *array, const int dims[], int dims_len);
PyObject *PyC_Tuple_PackArray_Multi_Bool(const bool *array, const int dims[], int dims_len);
/**
* Caller needs to ensure tuple is uninitialized.
@@ -219,8 +219,7 @@ struct PyC_StringEnum {
* Use with PyArg_ParseTuple's "O&" formatting.
*/
int PyC_ParseStringEnum(PyObject *o, void *p);
const char *PyC_StringEnum_FindIDFromValue(const struct PyC_StringEnumItems *items,
const int value);
const char *PyC_StringEnum_FindIDFromValue(const struct PyC_StringEnumItems *items, int value);
int PyC_CheckArgs_DeepCopy(PyObject *args);

View File

@@ -55,7 +55,7 @@ size_t bpygpu_Buffer_size(BPyGPUBuffer *buffer);
* \param buffer: When not NULL holds a contiguous buffer
* with the correct format from which the buffer will be initialized
*/
BPyGPUBuffer *BPyGPU_Buffer_CreatePyObject(const int format,
BPyGPUBuffer *BPyGPU_Buffer_CreatePyObject(int format,
const Py_ssize_t *shape,
const int shape_len,
int shape_len,
void *buffer);

View File

@@ -32,15 +32,15 @@ struct EnumPropertyItem;
struct ReportList;
/* error reporting */
short BPy_reports_to_error(struct ReportList *reports, PyObject *exception, const bool clear);
short BPy_reports_to_error(struct ReportList *reports, PyObject *exception, bool clear);
/**
* A version of #BKE_report_write_file_fp that uses Python's stdout.
*/
void BPy_reports_write_stdout(const struct ReportList *reports, const char *header);
bool BPy_errors_to_report_ex(struct ReportList *reports,
const char *error_prefix,
const bool use_full,
const bool use_location);
bool use_full,
bool use_location);
bool BPy_errors_to_report_brief_with_prefix(struct ReportList *reports, const char *error_prefix);
bool BPy_errors_to_report(struct ReportList *reports);

View File

@@ -178,7 +178,7 @@ typedef struct {
} BPy_FunctionRNA;
StructRNA *srna_from_self(PyObject *self, const char *error_prefix);
StructRNA *pyrna_struct_as_srna(PyObject *self, const bool parent, const char *error_prefix);
StructRNA *pyrna_struct_as_srna(PyObject *self, bool parent, const char *error_prefix);
void BPY_rna_init(void);
void BPY_rna_exit(void);
@@ -196,10 +196,7 @@ bool pyrna_id_FromPyObject(PyObject *obj, struct ID **id);
bool pyrna_id_CheckPyObject(PyObject *obj);
/* operators also need this to set args */
int pyrna_pydict_to_props(PointerRNA *ptr,
PyObject *kw,
const bool all_args,
const char *error_prefix);
int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, bool all_args, const char *error_prefix);
PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop);
int pyrna_deferred_register_class(struct StructRNA *srna, PyTypeObject *py_class);

View File

@@ -37,14 +37,14 @@ typedef struct {
/* prototypes */
PyObject *Euler_CreatePyObject(const float eul[3],
const short order,
short order,
PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT;
PyObject *Euler_CreatePyObject_wrap(float eul[3],
const short order,
short order,
PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT
ATTR_NONNULL(1);
PyObject *Euler_CreatePyObject_cb(PyObject *cb_user,
const short order,
short order,
unsigned char cb_type,
unsigned char cb_subtype) ATTR_WARN_UNUSED_RESULT;

View File

@@ -61,17 +61,17 @@ typedef struct {
/* prototypes */
PyObject *Matrix_CreatePyObject(const float *mat,
const ushort num_col,
const ushort num_row,
ushort num_col,
ushort num_row,
PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT;
PyObject *Matrix_CreatePyObject_wrap(float *mat,
const ushort num_col,
const ushort num_row,
ushort num_col,
ushort num_row,
PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT
ATTR_NONNULL(1);
PyObject *Matrix_CreatePyObject_cb(PyObject *user,
const unsigned short num_col,
const unsigned short num_row,
unsigned short num_col,
unsigned short num_row,
unsigned char cb_type,
unsigned char cb_subtype) ATTR_WARN_UNUSED_RESULT;
@@ -79,8 +79,8 @@ PyObject *Matrix_CreatePyObject_cb(PyObject *user,
* \param mat: Initialized matrix value to use in-place, allocated with #PyMem_Malloc
*/
PyObject *Matrix_CreatePyObject_alloc(float *mat,
const ushort num_col,
const ushort num_row,
ushort num_col,
ushort num_row,
PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT;
/* PyArg_ParseTuple's "O&" formatting helpers. */

View File

@@ -33,7 +33,7 @@ typedef struct {
/*prototypes*/
PyObject *Vector_CreatePyObject(const float *vec,
const int size,
int size,
PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT;
/**
* Create a vector that wraps existing memory.
@@ -41,7 +41,7 @@ PyObject *Vector_CreatePyObject(const float *vec,
* \param vec: Use this vector in-place.
*/
PyObject *Vector_CreatePyObject_wrap(float *vec,
const int size,
int size,
PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT
ATTR_NONNULL(1);
/**
@@ -56,6 +56,6 @@ PyObject *Vector_CreatePyObject_cb(PyObject *user,
* \param vec: Initialized vector value to use in-place, allocated with #PyMem_Malloc
*/
PyObject *Vector_CreatePyObject_alloc(float *vec,
const int size,
int size,
PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT
ATTR_NONNULL(1);