Cleanup: Use const for internal file data of asset-handle

Note that the current asset-handle design is temporary, see
35affaa971. I still prefer this to be const, as code outside the
asset-list/file-list code should never mess with the file data of an
asset.
This commit is contained in:
Julian Eisel 2021-07-20 20:06:15 +02:00
parent 36fb03e2b9
commit 207df439e1
3 changed files with 7 additions and 3 deletions

View File

@ -116,7 +116,7 @@ typedef struct AssetLibraryReference {
#
#
typedef struct AssetHandle {
struct FileDirEntry *file_data;
const struct FileDirEntry *file_data;
} AssetHandle;
#ifdef __cplusplus

View File

@ -129,7 +129,9 @@ static void rna_AssetMetaData_active_tag_range(
static PointerRNA rna_AssetHandle_file_data_get(PointerRNA *ptr)
{
AssetHandle *asset_handle = ptr->data;
return rna_pointer_inherit_refine(ptr, &RNA_FileSelectEntry, asset_handle->file_data);
/* Have to cast away const, but the file entry API doesn't allow modifications anyway. */
return rna_pointer_inherit_refine(
ptr, &RNA_FileSelectEntry, (FileDirEntry *)asset_handle->file_data);
}
static void rna_AssetHandle_file_data_set(PointerRNA *ptr,

View File

@ -146,7 +146,9 @@ static PointerRNA rna_Context_asset_file_handle_get(PointerRNA *ptr)
}
PointerRNA newptr;
RNA_pointer_create(NULL, &RNA_FileSelectEntry, asset_handle.file_data, &newptr);
/* Have to cast away const, but the file entry API doesn't allow modifications anyway. */
RNA_pointer_create(
NULL, &RNA_FileSelectEntry, (struct FileDirEntry *)asset_handle.file_data, &newptr);
return newptr;
}