Cleanup: Add const keyword to `BKE_packedfile_id_check`.

This commit is contained in:
Jeroen Bakker 2021-10-11 09:40:22 +02:00
parent bdd2a7f466
commit a282efecbc
4 changed files with 10 additions and 10 deletions

View File

@ -355,7 +355,7 @@ bool BKE_image_is_dirty_writable(struct Image *image, bool *is_format_writable);
/* Guess offset for the first frame in the sequence */
int BKE_image_sequence_guess_offset(struct Image *image);
bool BKE_image_has_anim(struct Image *image);
bool BKE_image_has_packedfile(struct Image *image);
bool BKE_image_has_packedfile(const struct Image *image);
bool BKE_image_has_filepath(struct Image *ima);
bool BKE_image_is_animated(struct Image *image);
bool BKE_image_has_multiple_ibufs(struct Image *image);

View File

@ -121,8 +121,8 @@ int BKE_packedfile_seek(struct PackedFile *pf, int offset, int whence);
void BKE_packedfile_rewind(struct PackedFile *pf);
int BKE_packedfile_read(struct PackedFile *pf, void *data, int size);
/* ID should be not NULL, return 1 if there's a packed file */
bool BKE_packedfile_id_check(struct ID *id);
/* ID should be not NULL, return true if there's a packed file */
bool BKE_packedfile_id_check(const struct ID *id);
/* ID should be not NULL, throws error when ID is Library */
void BKE_packedfile_id_unpack(struct Main *bmain,
struct ID *id,

View File

@ -5749,7 +5749,7 @@ bool BKE_image_has_anim(Image *ima)
return (BLI_listbase_is_empty(&ima->anims) == false);
}
bool BKE_image_has_packedfile(Image *ima)
bool BKE_image_has_packedfile(const Image *ima)
{
return (BLI_listbase_is_empty(&ima->packedfiles) == false);
}

View File

@ -805,27 +805,27 @@ void BKE_packedfile_unpack_all(Main *bmain, ReportList *reports, enum ePF_FileSt
}
/* ID should be not NULL, return 1 if there's a packed file */
bool BKE_packedfile_id_check(ID *id)
bool BKE_packedfile_id_check(const ID *id)
{
switch (GS(id->name)) {
case ID_IM: {
Image *ima = (Image *)id;
const Image *ima = (const Image *)id;
return BKE_image_has_packedfile(ima);
}
case ID_VF: {
VFont *vf = (VFont *)id;
const VFont *vf = (const VFont *)id;
return vf->packedfile != NULL;
}
case ID_SO: {
bSound *snd = (bSound *)id;
const bSound *snd = (const bSound *)id;
return snd->packedfile != NULL;
}
case ID_VO: {
Volume *volume = (Volume *)id;
const Volume *volume = (const Volume *)id;
return volume->packedfile != NULL;
}
case ID_LI: {
Library *li = (Library *)id;
const Library *li = (const Library *)id;
return li->packedfile != NULL;
}
default: