Cleanup: use named unsigned types in the Python API
This commit is contained in:
		@@ -66,7 +66,7 @@
 | 
			
		||||
#ifdef BUILD_DATE
 | 
			
		||||
extern char build_date[];
 | 
			
		||||
extern char build_time[];
 | 
			
		||||
extern unsigned long build_commit_timestamp;
 | 
			
		||||
extern ulong build_commit_timestamp;
 | 
			
		||||
extern char build_commit_date[];
 | 
			
		||||
extern char build_commit_time[];
 | 
			
		||||
extern char build_hash[];
 | 
			
		||||
 
 | 
			
		||||
@@ -80,10 +80,10 @@ static GHashKey *_ghashutil_keyalloc(const void *msgctxt, const void *msgid)
 | 
			
		||||
  return key;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static unsigned int _ghashutil_keyhash(const void *ptr)
 | 
			
		||||
static uint _ghashutil_keyhash(const void *ptr)
 | 
			
		||||
{
 | 
			
		||||
  const GHashKey *key = ptr;
 | 
			
		||||
  unsigned int hash = BLI_ghashutil_strhash(key->msgctxt);
 | 
			
		||||
  uint hash = BLI_ghashutil_strhash(key->msgctxt);
 | 
			
		||||
  return hash ^ BLI_ghashutil_strhash(key->msgid);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1040,12 +1040,12 @@ bool BPY_string_is_keyword(const char *str)
 | 
			
		||||
 | 
			
		||||
/* EVIL, define text.c functions here... */
 | 
			
		||||
/* BKE_text.h */
 | 
			
		||||
int text_check_identifier_unicode(const unsigned int ch)
 | 
			
		||||
int text_check_identifier_unicode(const uint ch)
 | 
			
		||||
{
 | 
			
		||||
  return (ch < 255 && text_check_identifier((char)ch)) || Py_UNICODE_ISALNUM(ch);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int text_check_identifier_nodigit_unicode(const unsigned int ch)
 | 
			
		||||
int text_check_identifier_nodigit_unicode(const uint ch)
 | 
			
		||||
{
 | 
			
		||||
  return (ch < 255 && text_check_identifier_nodigit((char)ch)) || Py_UNICODE_ISALPHA(ch);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -49,7 +49,7 @@ PyObject *bpy_intern_str_unregister;
 | 
			
		||||
 | 
			
		||||
void bpy_intern_string_init(void)
 | 
			
		||||
{
 | 
			
		||||
  unsigned int i = 0;
 | 
			
		||||
  uint i = 0;
 | 
			
		||||
 | 
			
		||||
#define BPY_INTERN_STR(var, str) \
 | 
			
		||||
  { \
 | 
			
		||||
@@ -81,7 +81,7 @@ void bpy_intern_string_init(void)
 | 
			
		||||
 | 
			
		||||
void bpy_intern_string_exit(void)
 | 
			
		||||
{
 | 
			
		||||
  unsigned int i = ARRAY_SIZE(bpy_intern_str_arr);
 | 
			
		||||
  uint i = ARRAY_SIZE(bpy_intern_str_arr);
 | 
			
		||||
  while (i--) {
 | 
			
		||||
    Py_DECREF(bpy_intern_str_arr[i]);
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -130,8 +130,8 @@ struct gc_generation {
 | 
			
		||||
 | 
			
		||||
static void id_release_gc(struct ID *id)
 | 
			
		||||
{
 | 
			
		||||
  unsigned int j;
 | 
			
		||||
  // unsigned int i = 0;
 | 
			
		||||
  uint j;
 | 
			
		||||
  // uint i = 0;
 | 
			
		||||
  for (j = 0; j < 3; j++) {
 | 
			
		||||
    /* Hack below to get the 2 other lists from _PyGC_generation0 that are normally not exposed. */
 | 
			
		||||
    PyGC_Head *gen = (PyGC_Head *)(((char *)_PyGC_generation0) + (sizeof(gc_generation) * j));
 | 
			
		||||
@@ -382,7 +382,7 @@ static short pyrna_rotation_euler_order_get(PointerRNA *ptr,
 | 
			
		||||
                                            PropertyRNA **r_prop_eul_order);
 | 
			
		||||
 | 
			
		||||
/* bpyrna vector/euler/quat callbacks. */
 | 
			
		||||
static unsigned char mathutils_rna_array_cb_index = -1; /* Index for our callbacks. */
 | 
			
		||||
static uchar mathutils_rna_array_cb_index = -1; /* Index for our callbacks. */
 | 
			
		||||
 | 
			
		||||
/* Subtype not used much yet. */
 | 
			
		||||
#  define MATHUTILS_CB_SUBTYPE_EUL 0
 | 
			
		||||
@@ -532,7 +532,7 @@ static Mathutils_Callback mathutils_rna_array_cb = {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/* bpyrna matrix callbacks */
 | 
			
		||||
static unsigned char mathutils_rna_matrix_cb_index = -1; /* Index for our callbacks. */
 | 
			
		||||
static uchar mathutils_rna_matrix_cb_index = -1; /* Index for our callbacks. */
 | 
			
		||||
 | 
			
		||||
static int mathutils_rna_matrix_get(BaseMathObject *bmo, int UNUSED(subtype))
 | 
			
		||||
{
 | 
			
		||||
@@ -1302,7 +1302,7 @@ BLI_bitmap *pyrna_set_to_enum_bitmap(const EnumPropertyItem *items,
 | 
			
		||||
      if (type_size == 2) {
 | 
			
		||||
        union {
 | 
			
		||||
          signed short as_signed;
 | 
			
		||||
          unsigned short as_unsigned;
 | 
			
		||||
          ushort as_unsigned;
 | 
			
		||||
        } ret_convert;
 | 
			
		||||
        ret_convert.as_signed = (signed short)ret;
 | 
			
		||||
        index = (int)ret_convert.as_unsigned;
 | 
			
		||||
@@ -1310,7 +1310,7 @@ BLI_bitmap *pyrna_set_to_enum_bitmap(const EnumPropertyItem *items,
 | 
			
		||||
      else if (type_size == 1) {
 | 
			
		||||
        union {
 | 
			
		||||
          signed char as_signed;
 | 
			
		||||
          unsigned char as_unsigned;
 | 
			
		||||
          uchar as_unsigned;
 | 
			
		||||
        } ret_convert;
 | 
			
		||||
        ret_convert.as_signed = (signed char)ret;
 | 
			
		||||
        index = (int)ret_convert.as_unsigned;
 | 
			
		||||
 
 | 
			
		||||
@@ -202,12 +202,12 @@ int pyrna_pydict_to_props(PointerRNA *ptr,
 | 
			
		||||
                          const char *error_prefix);
 | 
			
		||||
PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop);
 | 
			
		||||
 | 
			
		||||
unsigned int *pyrna_set_to_enum_bitmap(const struct EnumPropertyItem *items,
 | 
			
		||||
                                       PyObject *value,
 | 
			
		||||
                                       int type_size,
 | 
			
		||||
                                       bool type_convert_sign,
 | 
			
		||||
                                       int bitmap_size,
 | 
			
		||||
                                       const char *error_prefix);
 | 
			
		||||
uint *pyrna_set_to_enum_bitmap(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(const struct EnumPropertyItem *items, int value);
 | 
			
		||||
int pyrna_set_to_enum_bitfield(const struct EnumPropertyItem *items,
 | 
			
		||||
                               PyObject *value,
 | 
			
		||||
 
 | 
			
		||||
@@ -433,7 +433,7 @@ static char *copy_value_single(PyObject *item,
 | 
			
		||||
                               PointerRNA *ptr,
 | 
			
		||||
                               PropertyRNA *prop,
 | 
			
		||||
                               char *data,
 | 
			
		||||
                               unsigned int item_size,
 | 
			
		||||
                               uint item_size,
 | 
			
		||||
                               int *index,
 | 
			
		||||
                               const ItemConvert_FuncArg *convert_item,
 | 
			
		||||
                               RNA_SetIndexFunc rna_set_index)
 | 
			
		||||
@@ -462,7 +462,7 @@ static char *copy_values(PyObject *seq,
 | 
			
		||||
                         PropertyRNA *prop,
 | 
			
		||||
                         int dim,
 | 
			
		||||
                         char *data,
 | 
			
		||||
                         unsigned int item_size,
 | 
			
		||||
                         uint item_size,
 | 
			
		||||
                         int *index,
 | 
			
		||||
                         const ItemConvert_FuncArg *convert_item,
 | 
			
		||||
                         RNA_SetIndexFunc rna_set_index)
 | 
			
		||||
 
 | 
			
		||||
@@ -70,7 +70,7 @@ typedef struct IDUserMapData {
 | 
			
		||||
 | 
			
		||||
static int id_code_as_index(const short idcode)
 | 
			
		||||
{
 | 
			
		||||
  return (int)*((unsigned short *)&idcode);
 | 
			
		||||
  return (int)*((ushort *)&idcode);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static bool id_check_type(const ID *id, const BLI_bitmap *types_bitmap)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user