Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/bin/jp2/opj_compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,9 +654,13 @@ static int parse_cmdline_encoder(int argc, char **argv,
case 'O': { /* output format */
char outformat[50];
char *of = opj_optarg;
sprintf(outformat, ".%s", of);
img_fol->set_out_format = 1;
parameters->cod_format = get_file_format(outformat);
if (strlen(opj_optarg) < sizeof(outformat)) {
sprintf(outformat, ".%s", of);
img_fol->set_out_format = 1;
parameters->cod_format = get_file_format(outformat);
} else {
parameters->cod_format = -1;
}
switch (parameters->cod_format) {
case J2K_CFMT:
case JP2_CFMT:
Expand Down
10 changes: 7 additions & 3 deletions src/bin/jp2/opj_decompress.c
Original file line number Diff line number Diff line change
Expand Up @@ -662,9 +662,13 @@ int parse_cmdline_decoder(int argc, char **argv,
case 'O': { /* output format */
char outformat[50];
char *of = opj_optarg;
sprintf(outformat, ".%s", of);
img_fol->set_out_format = 1;
parameters->cod_format = get_file_format(outformat);
if (strlen(opj_optarg) < sizeof(outformat)) {
sprintf(outformat, ".%s", of);
img_fol->set_out_format = 1;
parameters->cod_format = get_file_format(outformat);
} else {
parameters->cod_format = -1;
}
switch (parameters->cod_format) {
case PGX_DFMT:
img_fol->out_format = "pgx";
Expand Down
10 changes: 7 additions & 3 deletions src/bin/jpwl/opj_jpwl_compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -768,9 +768,13 @@ static int parse_cmdline_encoder(int argc, char **argv,
case 'O': { /* output format */
char outformat[50];
char *of = opj_optarg;
sprintf(outformat, ".%s", of);
img_fol->set_out_format = 1;
parameters->cod_format = get_file_format(outformat);
if (strlen(opj_optarg) < sizeof(outformat)) {
sprintf(outformat, ".%s", of);
img_fol->set_out_format = 1;
parameters->cod_format = get_file_format(outformat);
} else {
parameters->cod_format = -1;
}
switch (parameters->cod_format) {
case J2K_CFMT:
case JP2_CFMT:
Expand Down
10 changes: 7 additions & 3 deletions src/bin/jpwl/opj_jpwl_decompress.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,13 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,
case 'O': { /* output format */
char outformat[50];
char *of = opj_optarg;
sprintf(outformat, ".%s", of);
img_fol->set_out_format = 1;
parameters->cod_format = get_file_format(outformat);
if (strlen(opj_optarg) < sizeof(outformat)) {
sprintf(outformat, ".%s", of);
img_fol->set_out_format = 1;
parameters->cod_format = get_file_format(outformat);
} else {
parameters->cod_format = -1;
}
switch (parameters->cod_format) {
case PGX_DFMT:
img_fol->out_format = "pgx";
Expand Down