diff options
| author | Francois-Olivier Devaux <fodevaux@users.noreply.github.com> | 2007-02-13 09:00:37 +0000 |
|---|---|---|
| committer | Francois-Olivier Devaux <fodevaux@users.noreply.github.com> | 2007-02-13 09:00:37 +0000 |
| commit | d084ff59f2da8bfa430d113105df1037fb1c605f (patch) | |
| tree | b0e44cacb2613bde311780296d510da4e4357b66 /codec | |
| parent | dcc6f679bc82055dca47654c562af27701b5da7c (diff) | |
David Fries suggestions. In image_to_j2k and j2k_to_image, strncpy() functions: instead of specifying the path size macro, let the compiler read the length out of the array entry.
Diffstat (limited to 'codec')
| -rw-r--r-- | codec/image_to_j2k.c | 8 | ||||
| -rw-r--r-- | codec/j2k_to_image.c | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/codec/image_to_j2k.c b/codec/image_to_j2k.c index 98745ee6..a41f077a 100644 --- a/codec/image_to_j2k.c +++ b/codec/image_to_j2k.c @@ -332,7 +332,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters) infile); return 1; } - strncpy(parameters->infile, infile, OPJ_PATH_LEN); + strncpy(parameters->infile, infile, sizeof(parameters->infile)-1); } break; @@ -350,7 +350,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters) fprintf(stderr, "Unknown output format image %s [only *.j2k, *.jp2]!! \n", outfile); return 1; } - strncpy(parameters->outfile, outfile, OPJ_PATH_LEN); + strncpy(parameters->outfile, outfile, sizeof(parameters->outfile)-1); } break; @@ -498,7 +498,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters) case 'x': /* creation of index file */ { char *index = optarg; - strncpy(parameters->index, index, OPJ_PATH_LEN); + strncpy(parameters->index, index, sizeof(parameters->index)-1); parameters->index_on = 1; } break; @@ -668,7 +668,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters) /* we need to enable indexing */ if (!parameters->index_on) { - strncpy(parameters->index, JPWL_PRIVATEINDEX_NAME, OPJ_PATH_LEN); + strncpy(parameters->index, JPWL_PRIVATEINDEX_NAME, sizeof(parameters->index)-1); parameters->index_on = 1; } diff --git a/codec/j2k_to_image.c b/codec/j2k_to_image.c index 7a75b8d1..7d8eefd0 100644 --- a/codec/j2k_to_image.c +++ b/codec/j2k_to_image.c @@ -153,7 +153,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters) infile); return 1; } - strncpy(parameters->infile, infile, OPJ_PATH_LEN); + strncpy(parameters->infile, infile, sizeof(parameters->infile)-1); } break; @@ -172,7 +172,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters) fprintf(stderr, "Unknown output format image %s [only *.pnm, *.pgm, *.ppm, *.pgx or *.bmp]!! \n", outfile); return 1; } - strncpy(parameters->outfile, outfile, OPJ_PATH_LEN); + strncpy(parameters->outfile, outfile, sizeof(parameters->outfile)-1); } break; |
