Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2015-10-23 17:01:10 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-10-23 17:01:10 +0300
commit08706122682507fd8f994109305f4120d54648ff (patch)
treed8da899bf4637be367e66dff1fad49d79162df9d /source/blender/blenkernel/intern/image.c
parent23848a70de47273496111e29c53d1d7b64c4c090 (diff)
Cleanup: use int for view_id's & view count
`size_t` is useful for memory sizes or offsets, the number of views wont realistically exceed an int.
Diffstat (limited to 'source/blender/blenkernel/intern/image.c')
-rw-r--r--source/blender/blenkernel/intern/image.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 8f8ce6eeebc..ff305434b1b 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -100,7 +100,7 @@
static SpinLock image_spin;
/* prototypes */
-static size_t image_num_files(struct Image *ima);
+static int image_num_files(struct Image *ima);
static ImBuf *image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock);
static void image_update_views_format(Image *ima, ImageUser *iuser);
static void image_add_view(Image *ima, const char *viewname, const char *filepath);
@@ -837,7 +837,7 @@ Image *BKE_image_add_generated(Main *bmain, unsigned int width, unsigned int hei
Image *ima = image_alloc(bmain, name, IMA_SRC_GENERATED, IMA_TYPE_UV_TEST);
if (ima) {
- size_t view_id;
+ int view_id;
const char *names[2] = {STEREO_LEFT_NAME, STEREO_RIGHT_NAME};
/* BLI_strncpy(ima->name, name, FILE_MAX); */ /* don't do this, this writes in ain invalid filepath! */
@@ -895,7 +895,7 @@ Image *BKE_image_add_from_imbuf(ImBuf *ibuf, const char *name)
static void image_memorypack_multiview(Image *ima)
{
ImageView *iv;
- size_t i;
+ int i;
image_free_packedfiles(ima);
@@ -996,7 +996,7 @@ void BKE_image_memorypack(Image *ima)
void BKE_image_packfiles(ReportList *reports, Image *ima, const char *basepath)
{
- const size_t totfiles = image_num_files(ima);
+ const int totfiles = image_num_files(ima);
if (totfiles == 1) {
ImagePackedFile *imapf = MEM_mallocN(sizeof(ImagePackedFile), "Image packed file");
@@ -1028,7 +1028,7 @@ void BKE_image_packfiles(ReportList *reports, Image *ima, const char *basepath)
void BKE_image_packfiles_from_mem(ReportList *reports, Image *ima, char *data, const size_t data_len)
{
- const size_t totfiles = image_num_files(ima);
+ const int totfiles = image_num_files(ima);
if (totfiles != 1) {
BKE_report(reports, RPT_ERROR, "Cannot pack multiview images from raw data currently...");
@@ -2665,7 +2665,7 @@ void BKE_image_signal(Image *ima, ImageUser *iuser, int signal)
case IMA_SIGNAL_RELOAD:
/* try to repack file */
if (BKE_image_has_packedfile(ima)) {
- const size_t totfiles = image_num_files(ima);
+ const int totfiles = image_num_files(ima);
if (totfiles != BLI_listbase_count_ex(&ima->packedfiles, totfiles + 1)) {
/* in case there are new available files to be loaded */
@@ -2948,7 +2948,7 @@ void BKE_image_backup_render(Scene *scene, Image *ima)
/**************************** multiview save openexr *********************************/
#ifdef WITH_OPENEXR
-static const char *image_get_view_cb(void *base, const size_t view_id)
+static const char *image_get_view_cb(void *base, const int view_id)
{
Image *ima = base;
ImageView *iv = BLI_findlink(&ima->views, view_id);
@@ -2957,7 +2957,7 @@ static const char *image_get_view_cb(void *base, const size_t view_id)
#endif /* WITH_OPENEXR */
#ifdef WITH_OPENEXR
-static ImBuf *image_get_buffer_cb(void *base, const size_t view_id)
+static ImBuf *image_get_buffer_cb(void *base, const int view_id)
{
Image *ima = base;
ImageUser iuser = {0};
@@ -3033,7 +3033,7 @@ static void image_add_view_cb(void *base, const char *str)
static void image_add_buffer_cb(void *base, const char *str, ImBuf *ibuf, const int frame)
{
Image *ima = base;
- size_t id;
+ int id;
bool predivide = (ima->alpha_mode == IMA_ALPHA_PREMUL);
const char *colorspace = ima->colorspace_settings.name;
const char *to_colorspace = IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_SCENE_LINEAR);
@@ -3123,7 +3123,7 @@ static int imbuf_alpha_flags_for_image(Image *ima)
}
/* the number of files will vary according to the stereo format */
-static size_t image_num_files(Image *ima)
+static int image_num_files(Image *ima)
{
const bool is_multiview = BKE_image_is_multiview(ima);
@@ -3139,7 +3139,7 @@ static size_t image_num_files(Image *ima)
}
}
-static ImBuf *load_sequence_single(Image *ima, ImageUser *iuser, int frame, const size_t view_id, bool *r_assign)
+static ImBuf *load_sequence_single(Image *ima, ImageUser *iuser, int frame, const int view_id, bool *r_assign)
{
struct ImBuf *ibuf;
char name[FILE_MAX];
@@ -3208,7 +3208,7 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame)
{
struct ImBuf *ibuf = NULL;
const bool is_multiview = BKE_image_is_multiview(ima);
- const size_t totfiles = image_num_files(ima);
+ const int totfiles = image_num_files(ima);
bool assign = false;
if (!is_multiview) {
@@ -3218,9 +3218,9 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame)
}
}
else {
- size_t i;
+ const int totviews = BLI_listbase_count(&ima->views);
+ int i;
struct ImBuf **ibuf_arr;
- const size_t totviews = BLI_listbase_count(&ima->views);
ibuf_arr = MEM_mallocN(sizeof(ImBuf *) * totviews, "Image Views Imbufs");
@@ -3305,7 +3305,7 @@ static ImBuf *image_load_sequence_multilayer(Image *ima, ImageUser *iuser, int f
return ibuf;
}
-static ImBuf *load_movie_single(Image *ima, ImageUser *iuser, int frame, const size_t view_id)
+static ImBuf *load_movie_single(Image *ima, ImageUser *iuser, int frame, const int view_id)
{
struct ImBuf *ibuf = NULL;
ImageAnim *ia;
@@ -3365,8 +3365,8 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame)
{
struct ImBuf *ibuf = NULL;
const bool is_multiview = BKE_image_is_multiview(ima);
- const size_t totfiles = image_num_files(ima);
- size_t i;
+ const int totfiles = image_num_files(ima);
+ int i;
if (totfiles != BLI_listbase_count_ex(&ima->anims, totfiles + 1)) {
image_free_anims(ima);
@@ -3384,7 +3384,7 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame)
}
else {
struct ImBuf **ibuf_arr;
- const size_t totviews = BLI_listbase_count(&ima->views);
+ const int totviews = BLI_listbase_count(&ima->views);
ibuf_arr = MEM_mallocN(sizeof(ImBuf *) * totviews, "Image Views (movie) Imbufs");
@@ -3426,7 +3426,7 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame)
static ImBuf *load_image_single(
Image *ima, ImageUser *iuser, int cfra,
- const size_t view_id,
+ const int view_id,
const bool has_packed,
bool *r_assign)
{
@@ -3521,7 +3521,7 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
struct ImBuf *ibuf = NULL;
bool assign = false;
const bool is_multiview = BKE_image_is_multiview(ima);
- const size_t totfiles = image_num_files(ima);
+ const int totfiles = image_num_files(ima);
bool has_packed = BKE_image_has_packedfile(ima);
/* always ensure clean ima */
@@ -3542,9 +3542,9 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
}
}
else {
- size_t i;
struct ImBuf **ibuf_arr;
- const size_t totviews = BLI_listbase_count(&ima->views);
+ const int totviews = BLI_listbase_count(&ima->views);
+ int i;
BLI_assert(totviews > 0);
ibuf_arr = MEM_callocN(sizeof(ImBuf *) * totviews, "Image Views Imbufs");
@@ -3817,7 +3817,7 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **r_loc
return ibuf;
}
-static size_t image_get_multiview_index(Image *ima, ImageUser *iuser)
+static int image_get_multiview_index(Image *ima, ImageUser *iuser)
{
const bool is_multilayer = BKE_image_is_multilayer(ima);
const bool is_backdrop = (ima->source == IMA_SRC_VIEWER) && (ima->type == IMA_TYPE_COMPOSITE) && (iuser == NULL);
@@ -4617,7 +4617,7 @@ static void image_update_views_format(Image *ima, ImageUser *iuser)
/* nothing to do */
}
else if (ima->views_format == R_IMF_VIEWS_STEREO_3D) {
- size_t i;
+ int i;
const char *names[2] = {STEREO_LEFT_NAME, STEREO_RIGHT_NAME};
for (i = 0; i < 2; i++) {