diff options
author | Bastien Montagne <bastien@blender.org> | 2020-06-30 12:22:18 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-06-30 13:19:11 +0300 |
commit | 34027506f855ff506151953311d762235122b66d (patch) | |
tree | 45ccec48d9681727ee1797be71c85fcc4001c6e1 /source/blender/makesdna | |
parent | 737b0fd762f16660d340ad8f33e1accf725f600d (diff) |
Cleanup: ID macros: cast to `const ID *` instead of `ID *`.
Allows to pass const pointers without getting complains from the
compiler.
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r-- | source/blender/makesdna/DNA_ID.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 138bbcf7ff2..ed2d3671b6b 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -449,9 +449,9 @@ typedef enum ID_Type { /* fluidsim Ipo */ #define ID_FLUIDSIM MAKE_ID2('F', 'S') -#define ID_FAKE_USERS(id) ((((ID *)id)->flag & LIB_FAKEUSER) ? 1 : 0) -#define ID_REAL_USERS(id) (((ID *)id)->us - ID_FAKE_USERS(id)) -#define ID_EXTRA_USERS(id) (((ID *)id)->tag & LIB_TAG_EXTRAUSER ? 1 : 0) +#define ID_FAKE_USERS(id) ((((const ID *)id)->flag & LIB_FAKEUSER) ? 1 : 0) +#define ID_REAL_USERS(id) (((const ID *)id)->us - ID_FAKE_USERS(id)) +#define ID_EXTRA_USERS(id) (((const ID *)id)->tag & LIB_TAG_EXTRAUSER ? 1 : 0) #define ID_CHECK_UNDO(id) \ ((GS((id)->name) != ID_SCR) && (GS((id)->name) != ID_WM) && (GS((id)->name) != ID_WS)) @@ -461,17 +461,17 @@ typedef enum ID_Type { #define ID_BLEND_PATH_FROM_GLOBAL(_id) \ ((_id)->lib ? (_id)->lib->filepath_abs : BKE_main_blendfile_path_from_global()) -#define ID_MISSING(_id) ((((ID *)(_id))->tag & LIB_TAG_MISSING) != 0) +#define ID_MISSING(_id) ((((const ID *)(_id))->tag & LIB_TAG_MISSING) != 0) -#define ID_IS_LINKED(_id) (((ID *)(_id))->lib != NULL) +#define ID_IS_LINKED(_id) (((const ID *)(_id))->lib != NULL) /* Note that this is a fairly high-level check, should be used at user interaction level, not in * BKE_library_override typically (especially due to the check on LIB_TAG_EXTERN). */ #define ID_IS_OVERRIDABLE_LIBRARY(_id) \ - (ID_IS_LINKED(_id) && !ID_MISSING(_id) && (((ID *)(_id))->tag & LIB_TAG_EXTERN) != 0) + (ID_IS_LINKED(_id) && !ID_MISSING(_id) && (((const ID *)(_id))->tag & LIB_TAG_EXTERN) != 0) #define ID_IS_OVERRIDE_LIBRARY(_id) \ - (((ID *)(_id))->override_library != NULL && ((ID *)(_id))->override_library->reference != NULL) + (((const ID *)(_id))->override_library != NULL && ((const ID *)(_id))->override_library->reference != NULL) #define ID_IS_OVERRIDE_LIBRARY_TEMPLATE(_id) \ (((ID *)(_id))->override_library != NULL && ((ID *)(_id))->override_library->reference == NULL) |