return error code upon errors

This commit is contained in:
Mathieu Malaterre 2010-06-29 19:08:45 +00:00
parent 84f77a71e5
commit 8bb5a19905
1 changed files with 4 additions and 4 deletions

View File

@ -189,7 +189,7 @@ int load_images(dircnt_t *dirptr, char *imgdirpath){
int get_file_format(char *filename) { int get_file_format(char *filename) {
unsigned int i; unsigned int i;
static const char *extension[] = {"pgx", "pnm", "pgm", "ppm", "bmp","tif", "raw", "tga", "png", "j2k", "jp2", "jpt", "j2c", "jpc" }; static const char *extension[] = {"pgx", "pnm", "pgm", "ppm", "bmp","tif", "raw", "tga", "png", "j2k", "jp2", "jpt", "j2c", "jpc" };
static const int format[] = { PGX_DFMT, PXM_DFMT, PXM_DFMT, PXM_DFMT, BMP_DFMT, TIF_DFMT, RAW_DFMT, TGA_DFMT, PNG_DFMT, J2K_CFMT, JP2_CFMT, JPT_CFMT, J2K_CFMT, J2K_CFMT }; static const int format[] = { PGX_DFMT, PXM_DFMT, PXM_DFMT, PXM_DFMT, BMP_DFMT, TIF_DFMT, RAW_DFMT, TGA_DFMT, PNG_DFMT, J2K_CFMT, JP2_CFMT, JPT_CFMT, J2K_CFMT, J2K_CFMT };
char * ext = strrchr(filename, '.'); char * ext = strrchr(filename, '.');
if (ext == NULL) if (ext == NULL)
@ -553,18 +553,18 @@ int main(int argc, char **argv) {
dirptr->filename = (char**) malloc(num_images*sizeof(char*)); dirptr->filename = (char**) malloc(num_images*sizeof(char*));
if(!dirptr->filename_buf){ if(!dirptr->filename_buf){
return 0; return 1;
} }
for(i=0;i<num_images;i++){ for(i=0;i<num_images;i++){
dirptr->filename[i] = dirptr->filename_buf + i*OPJ_PATH_LEN; dirptr->filename[i] = dirptr->filename_buf + i*OPJ_PATH_LEN;
} }
} }
if(load_images(dirptr,img_fol.imgdirpath)==1){ if(load_images(dirptr,img_fol.imgdirpath)==1){
return 0; return 1;
} }
if (num_images==0){ if (num_images==0){
fprintf(stdout,"Folder is empty\n"); fprintf(stdout,"Folder is empty\n");
return 0; return 1;
} }
}else{ }else{
num_images=1; num_images=1;