Skip to content

Commit

Permalink
Fix unsigned vs OPJ_INT32 mismatches (#1398)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eharve14 authored Jan 16, 2022
1 parent 6e4588f commit a1eec9c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
9 changes: 5 additions & 4 deletions src/bin/jp2/opj_compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,15 +553,16 @@ static char * get_file_name(char *name)
return fname;
}

static char get_next_file(int imageno, dircnt_t *dirptr, img_fol_t *img_fol,
static char get_next_file(unsigned int imageno, dircnt_t *dirptr,
img_fol_t *img_fol,
opj_cparameters_t *parameters)
{
char image_filename[OPJ_PATH_LEN], infilename[OPJ_PATH_LEN],
outfilename[OPJ_PATH_LEN], temp_ofname[OPJ_PATH_LEN];
char *temp_p, temp1[OPJ_PATH_LEN] = "";

strcpy(image_filename, dirptr->filename[imageno]);
fprintf(stderr, "File Number %d \"%s\"\n", imageno, image_filename);
fprintf(stderr, "File Number %u \"%s\"\n", imageno, image_filename);
parameters->decod_format = get_file_format(image_filename);
if (parameters->decod_format == -1) {
return 1;
Expand Down Expand Up @@ -1995,7 +1996,7 @@ int main(int argc, char **argv)
fprintf(stderr, "\n");

if (img_fol.set_imgdir == 1) {
if (get_next_file((int)imageno, dirptr, &img_fol, &parameters)) {
if (get_next_file(imageno, dirptr, &img_fol, &parameters)) {
fprintf(stderr, "skipping file...\n");
continue;
}
Expand Down Expand Up @@ -2250,7 +2251,7 @@ int main(int argc, char **argv)
}
for (i = 0; i < l_nb_tiles; ++i) {
if (! opj_write_tile(l_codec, i, l_data, l_data_size, l_stream)) {
fprintf(stderr, "ERROR -> test_tile_encoder: failed to write the tile %d!\n",
fprintf(stderr, "ERROR -> test_tile_encoder: failed to write the tile %u!\n",
i);
opj_stream_destroy(l_stream);
opj_destroy_codec(l_codec);
Expand Down
10 changes: 5 additions & 5 deletions src/bin/jp2/opj_decompress.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ typedef struct opj_decompress_params {
unsigned int get_num_images(char *imgdirpath);
int load_images(dircnt_t *dirptr, char *imgdirpath);
int get_file_format(const char *filename);
char get_next_file(int imageno, dircnt_t *dirptr, img_fol_t *img_fol,
char get_next_file(unsigned int imageno, dircnt_t *dirptr, img_fol_t *img_fol,
opj_decompress_parameters *parameters);
static int infile_format(const char *fname);

Expand Down Expand Up @@ -475,15 +475,15 @@ const char* path_separator = "/";
#endif

/* -------------------------------------------------------------------------- */
char get_next_file(int imageno, dircnt_t *dirptr, img_fol_t *img_fol,
char get_next_file(unsigned int imageno, dircnt_t *dirptr, img_fol_t *img_fol,
opj_decompress_parameters *parameters)
{
char image_filename[OPJ_PATH_LEN], infilename[OPJ_PATH_LEN],
outfilename[OPJ_PATH_LEN], temp_ofname[OPJ_PATH_LEN];
char *temp_p, temp1[OPJ_PATH_LEN] = "";

strcpy(image_filename, dirptr->filename[imageno]);
fprintf(stderr, "File Number %d \"%s\"\n", imageno, image_filename);
fprintf(stderr, "File Number %u \"%s\"\n", imageno, image_filename);
if (strlen(img_fol->imgdirpath) + strlen(path_separator) + strlen(
image_filename) + 1 > sizeof(infilename)) {
return 1;
Expand Down Expand Up @@ -1341,7 +1341,7 @@ int main(int argc, char **argv)
{
opj_decompress_parameters parameters; /* decompression parameters */

OPJ_INT32 num_images, imageno;
unsigned int num_images, imageno;
img_fol_t img_fol;
dircnt_t *dirptr = NULL;
int failed = 0;
Expand Down Expand Up @@ -1372,7 +1372,7 @@ int main(int argc, char **argv)

/* Initialize reading of directory */
if (img_fol.set_imgdir == 1) {
int it_image;
unsigned int it_image;
num_images = get_num_images(img_fol.imgdirpath);
if (num_images == 0) {
fprintf(stderr, "Folder is empty\n");
Expand Down
12 changes: 7 additions & 5 deletions src/bin/jp2/opj_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ typedef struct img_folder {
static unsigned int get_num_images(char *imgdirpath);
static int load_images(dircnt_t *dirptr, char *imgdirpath);
static int get_file_format(const char *filename);
static char get_next_file(int imageno, dircnt_t *dirptr, img_fol_t *img_fol,
static char get_next_file(unsigned int imageno, dircnt_t *dirptr,
img_fol_t *img_fol,
opj_dparameters_t *parameters);
static int infile_format(const char *fname);

Expand Down Expand Up @@ -220,15 +221,16 @@ static int get_file_format(const char *filename)
}

/* -------------------------------------------------------------------------- */
static char get_next_file(int imageno, dircnt_t *dirptr, img_fol_t *img_fol,
static char get_next_file(unsigned int imageno, dircnt_t *dirptr,
img_fol_t *img_fol,
opj_dparameters_t *parameters)
{
char image_filename[OPJ_PATH_LEN], infilename[OPJ_PATH_LEN],
outfilename[OPJ_PATH_LEN], temp_ofname[OPJ_PATH_LEN];
char *temp_p, temp1[OPJ_PATH_LEN] = "";

strcpy(image_filename, dirptr->filename[imageno]);
fprintf(stderr, "File Number %d \"%s\"\n", imageno, image_filename);
fprintf(stderr, "File Number %u \"%s\"\n", imageno, image_filename);
parameters->decod_format = get_file_format(image_filename);
if (parameters->decod_format == -1) {
return 1;
Expand Down Expand Up @@ -492,7 +494,7 @@ int main(int argc, char *argv[])
opj_codestream_info_v2_t* cstr_info = NULL;
opj_codestream_index_t* cstr_index = NULL;

OPJ_INT32 num_images, imageno;
unsigned int num_images, imageno;
img_fol_t img_fol;
dircnt_t *dirptr = NULL;

Expand All @@ -514,7 +516,7 @@ int main(int argc, char *argv[])

/* Initialize reading of directory */
if (img_fol.set_imgdir == 1) {
int it_image;
unsigned int it_image;
num_images = get_num_images(img_fol.imgdirpath);
if (num_images == 0) {
fprintf(stdout, "Folder is empty\n");
Expand Down

0 comments on commit a1eec9c

Please sign in to comment.