Cleanup: use 'r_' prefix for return arguments

This commit is contained in:
Campbell Barton
2022-05-05 10:41:00 +10:00
parent d3c895fc41
commit d0c2fd0570
5 changed files with 36 additions and 34 deletions

View File

@@ -295,16 +295,16 @@ static void init_functions(OpenSubdiv_Converter *converter)
static void initialize_manifold_index_array(const BLI_bitmap *used_map,
const int num_elements,
int **indices_r,
int **indices_reverse_r,
int *num_manifold_elements_r)
int **r_indices,
int **r_indices_reverse,
int *r_num_manifold_elements)
{
int *indices = NULL;
if (indices_r != NULL) {
if (r_indices != NULL) {
indices = MEM_malloc_arrayN(num_elements, sizeof(int), "manifold indices");
}
int *indices_reverse = NULL;
if (indices_reverse_r != NULL) {
if (r_indices_reverse != NULL) {
indices_reverse = MEM_malloc_arrayN(num_elements, sizeof(int), "manifold indices reverse");
}
int offset = 0;
@@ -324,13 +324,13 @@ static void initialize_manifold_index_array(const BLI_bitmap *used_map,
offset++;
}
}
if (indices_r != NULL) {
*indices_r = indices;
if (r_indices != NULL) {
*r_indices = indices;
}
if (indices_reverse_r != NULL) {
*indices_reverse_r = indices_reverse;
if (r_indices_reverse != NULL) {
*r_indices_reverse = indices_reverse;
}
*num_manifold_elements_r = num_elements - offset;
*r_num_manifold_elements = num_elements - offset;
}
static void initialize_manifold_indices(ConverterStorage *storage)

View File

@@ -21,12 +21,12 @@
typedef double Vec2[2];
static int point_markers_correspondences_on_both_image(
MovieTrackingPlaneTrack *plane_track, int frame1, int frame2, Vec2 **x1_r, Vec2 **x2_r)
MovieTrackingPlaneTrack *plane_track, int frame1, int frame2, Vec2 **r_x1, Vec2 **r_x2)
{
Vec2 *x1, *x2;
*x1_r = x1 = MEM_mallocN(sizeof(*x1) * plane_track->point_tracksnr, "point correspondences x1");
*x2_r = x2 = MEM_mallocN(sizeof(*x1) * plane_track->point_tracksnr, "point correspondences x2");
*r_x1 = x1 = MEM_mallocN(sizeof(*x1) * plane_track->point_tracksnr, "point correspondences x1");
*r_x2 = x2 = MEM_mallocN(sizeof(*x1) * plane_track->point_tracksnr, "point correspondences x2");
int correspondence_index = 0;
for (int i = 0; i < plane_track->point_tracksnr; i++) {

View File

@@ -36,15 +36,17 @@ typedef struct ImFileType {
char colorspace[IM_MAX_SPACE]);
/** Load an image from a file. */
struct ImBuf *(*load_filepath)(const char *filepath, int flags, char colorspace[IM_MAX_SPACE]);
/** Load/Create a thumbnail image from a filepath. `max_thumb_size` is maximum size of either
/**
* Load/Create a thumbnail image from a filepath. `max_thumb_size` is maximum size of either
* dimension, so can return less on either or both. Should, if possible and performant, return
* dimensions of the full-size image in width_r & height_r. */
* dimensions of the full-size image in r_width & r_height.
*/
struct ImBuf *(*load_filepath_thumbnail)(const char *filepath,
const int flags,
const size_t max_thumb_size,
size_t *width_r,
size_t *height_r,
char colorspace[IM_MAX_SPACE]);
char colorspace[IM_MAX_SPACE],
size_t *r_width,
size_t *r_height);
/** Save to a file (or memory if #IB_mem is set in `flags` and the format supports it). */
bool (*save)(struct ImBuf *ibuf, const char *filepath, int flags);
void (*load_tile)(struct ImBuf *ibuf,
@@ -155,9 +157,9 @@ struct ImBuf *imb_load_jpeg(const unsigned char *buffer,
struct ImBuf *imb_thumbnail_jpeg(const char *filepath,
const int flags,
const size_t max_thumb_size,
size_t *width_r,
size_t *height_r,
char colorspace[IM_MAX_SPACE]);
char colorspace[IM_MAX_SPACE],
size_t *r_width,
size_t *r_height);
/** \} */

View File

@@ -42,8 +42,8 @@ static boolean handle_app1(j_decompress_ptr cinfo);
static ImBuf *ibJpegImageFromCinfo(struct jpeg_decompress_struct *cinfo,
int flags,
int max_size,
size_t *width_r,
size_t *height_r);
size_t *r_width,
size_t *r_height);
static const uchar jpeg_default_quality = 75;
static uchar ibuf_quality;
@@ -253,8 +253,8 @@ static boolean handle_app1(j_decompress_ptr cinfo)
static ImBuf *ibJpegImageFromCinfo(struct jpeg_decompress_struct *cinfo,
int flags,
int max_size,
size_t *width_r,
size_t *height_r)
size_t *r_width,
size_t *r_height)
{
JSAMPARRAY row_pointer;
JSAMPLE *buffer = NULL;
@@ -278,11 +278,11 @@ static ImBuf *ibJpegImageFromCinfo(struct jpeg_decompress_struct *cinfo,
cinfo->out_color_space = JCS_CMYK;
}
if (width_r) {
*width_r = cinfo->image_width;
if (r_width) {
*r_width = cinfo->image_width;
}
if (height_r) {
*height_r = cinfo->image_height;
if (r_height) {
*r_height = cinfo->image_height;
}
if (max_size > 0) {
@@ -489,9 +489,9 @@ ImBuf *imb_load_jpeg(const unsigned char *buffer,
struct ImBuf *imb_thumbnail_jpeg(const char *filepath,
const int flags,
const size_t max_thumb_size,
size_t *width_r,
size_t *height_r,
char colorspace[IM_MAX_SPACE])
char colorspace[IM_MAX_SPACE],
size_t *r_width,
size_t *r_height)
{
struct jpeg_decompress_struct _cinfo, *cinfo = &_cinfo;
struct my_error_mgr jerr;
@@ -550,7 +550,7 @@ struct ImBuf *imb_thumbnail_jpeg(const char *filepath,
jpeg_create_decompress(cinfo);
jpeg_stdio_src(cinfo, infile);
ImBuf *ibuf = ibJpegImageFromCinfo(cinfo, flags, max_thumb_size, width_r, height_r);
ImBuf *ibuf = ibJpegImageFromCinfo(cinfo, flags, max_thumb_size, r_width, r_height);
fclose(infile);
return ibuf;

View File

@@ -258,7 +258,7 @@ struct ImBuf *IMB_thumb_load_image(const char *filepath,
if (type->load_filepath_thumbnail) {
ibuf = type->load_filepath_thumbnail(
filepath, flags, max_thumb_size, &width, &height, colorspace);
filepath, flags, max_thumb_size, colorspace, &width, &height);
}
else {
/* Skip images of other types if over 100MB. */