Fix unsigned vs OPJ_INT32 mismatches (#1398)

This commit is contained in:
Eric Harvey 2022-01-16 12:54:00 -05:00 committed by GitHub
parent 6e4588f379
commit a1eec9c49e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 14 deletions

View File

@ -553,7 +553,8 @@ 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],
@ -561,7 +562,7 @@ static char get_next_file(int imageno, dircnt_t *dirptr, img_fol_t *img_fol,
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;
@ -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;
}
@ -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);

View File

@ -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);
@ -475,7 +475,7 @@ 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],
@ -483,7 +483,7 @@ char get_next_file(int imageno, dircnt_t *dirptr, img_fol_t *img_fol,
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;
@ -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;
@ -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");

View File

@ -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);
@ -220,7 +221,8 @@ 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],
@ -228,7 +230,7 @@ static char get_next_file(int imageno, dircnt_t *dirptr, img_fol_t *img_fol,
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;
@ -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;
@ -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");