diff options
author | Julian Eisel <julian@blender.org> | 2021-02-06 04:18:38 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-02-06 21:27:55 +0300 |
commit | ef29ebb31bd4bad47f55f45d6b4a2ab40fe09caf (patch) | |
tree | 67736e49c577a9fdfd5f88501bb5b130bd25d2fc /source/blender/blenkernel | |
parent | 4cca64f4ad32f3c5509e40f931afdab550ff32d2 (diff) |
Code quality: Port recently added asset files to C++
It seems generally preferred to have new files be created with C++.
The only reason I didn't do that when I initially created the files is that I
was unsure about some C-API aspect.
Also includes some minor C++ related cleanup (nullptr instead of NULL, remove
redundant `struct` keyword).
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/CMakeLists.txt | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/asset.cc (renamed from source/blender/blenkernel/intern/asset.c) | 16 |
2 files changed, 9 insertions, 9 deletions
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 0da9598f0ad..3f22612652c 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -78,7 +78,7 @@ set(SRC intern/armature.c intern/armature_deform.c intern/armature_update.c - intern/asset.c + intern/asset.cc intern/attribute.c intern/attribute_access.cc intern/autoexec.c diff --git a/source/blender/blenkernel/intern/asset.c b/source/blender/blenkernel/intern/asset.cc index 7ccb0aa2b57..89c3523285d 100644 --- a/source/blender/blenkernel/intern/asset.c +++ b/source/blender/blenkernel/intern/asset.cc @@ -20,6 +20,10 @@ #include <string.h> +#include "DNA_ID.h" +#include "DNA_asset_types.h" +#include "DNA_defaults.h" + #include "BLI_listbase.h" #include "BLI_string.h" #include "BLI_string_utils.h" @@ -29,17 +33,13 @@ #include "BKE_icons.h" #include "BKE_idprop.h" -#include "DNA_ID.h" -#include "DNA_asset_types.h" -#include "DNA_defaults.h" - #include "BLO_read_write.h" #include "MEM_guardedalloc.h" AssetMetaData *BKE_asset_metadata_create(void) { - AssetMetaData *asset_data = MEM_callocN(sizeof(*asset_data), __func__); + AssetMetaData *asset_data = (AssetMetaData *)MEM_callocN(sizeof(*asset_data), __func__); memcpy(asset_data, DNA_struct_default_get(AssetMetaData), sizeof(*asset_data)); return asset_data; } @@ -57,7 +57,7 @@ void BKE_asset_metadata_free(AssetMetaData **asset_data) static AssetTag *asset_metadata_tag_add(AssetMetaData *asset_data, const char *const name) { - AssetTag *tag = MEM_callocN(sizeof(*tag), __func__); + AssetTag *tag = (AssetTag *)MEM_callocN(sizeof(*tag), __func__); BLI_strncpy(tag->name, name, sizeof(tag->name)); BLI_addtail(&asset_data->tags, tag); @@ -81,12 +81,12 @@ AssetTag *BKE_asset_metadata_tag_add(AssetMetaData *asset_data, const char *name struct AssetTagEnsureResult BKE_asset_metadata_tag_ensure(AssetMetaData *asset_data, const char *name) { - struct AssetTagEnsureResult result = {.tag = NULL}; + struct AssetTagEnsureResult result = {nullptr}; if (!name[0]) { return result; } - AssetTag *tag = BLI_findstring(&asset_data->tags, name, offsetof(AssetTag, name)); + AssetTag *tag = (AssetTag *)BLI_findstring(&asset_data->tags, name, offsetof(AssetTag, name)); if (tag) { result.tag = tag; |