diff options
| author | Mickael Savinaud <savmickael@users.noreply.github.com> | 2013-02-17 10:34:31 +0000 |
|---|---|---|
| committer | Mickael Savinaud <savmickael@users.noreply.github.com> | 2013-02-17 10:34:31 +0000 |
| commit | af58e8e8f9d08c1e276a9ba070eb4d44a6ca4950 (patch) | |
| tree | 1e3e627b331e62a1ec4d28e1bd2bd0d422096769 /src/bin/jp2/opj_dump.c | |
| parent | 4bf4a7668eaeaa4b02051afe06b8ec3e0d805de3 (diff) | |
[trunk] move to the new API for function opj_stream_create_default_file_stream. Use now opj_stream_create_default_file_stream_v3 (WIP)
Diffstat (limited to 'src/bin/jp2/opj_dump.c')
| -rw-r--r-- | src/bin/jp2/opj_dump.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/bin/jp2/opj_dump.c b/src/bin/jp2/opj_dump.c index 0fb5d117..23913899 100644 --- a/src/bin/jp2/opj_dump.c +++ b/src/bin/jp2/opj_dump.c @@ -401,7 +401,7 @@ static void info_callback(const char *msg, void *client_data) { /* -------------------------------------------------------------------------- */ int main(int argc, char *argv[]) { - FILE *fsrc = NULL, *fout = NULL; + FILE *fout = NULL; opj_dparameters_t parameters; /* Decompression parameters */ opj_image_t* image = NULL; /* Image structure */ @@ -486,16 +486,10 @@ int main(int argc, char *argv[]) /* Read the input file and put it in memory */ /* ---------------------------------------- */ - fsrc = fopen(parameters.infile, "rb"); - if (!fsrc) { - fprintf(stderr, "ERROR -> failed to open %s for reading\n", parameters.infile); - return EXIT_FAILURE; - } - l_stream = opj_stream_create_default_file_stream(fsrc,1); + l_stream = opj_stream_create_default_file_stream_v3(parameters.infile,1); if (!l_stream){ - fclose(fsrc); - fprintf(stderr, "ERROR -> failed to create the stream from the file\n"); + fprintf(stderr, "ERROR -> failed to create the stream from the file %s\n",parameters.infile); return EXIT_FAILURE; } @@ -536,7 +530,6 @@ int main(int argc, char *argv[]) if ( !opj_setup_decoder(l_codec, ¶meters) ){ fprintf(stderr, "ERROR -> opj_dump: failed to setup the decoder\n"); opj_stream_destroy_v3(l_stream); - fclose(fsrc); opj_destroy_codec(l_codec); fclose(fout); return EXIT_FAILURE; @@ -546,7 +539,6 @@ int main(int argc, char *argv[]) if(! opj_read_header(l_stream, l_codec, &image)){ fprintf(stderr, "ERROR -> opj_dump: failed to read the header\n"); opj_stream_destroy_v3(l_stream); - fclose(fsrc); opj_destroy_codec(l_codec); opj_image_destroy(image); fclose(fout); @@ -561,7 +553,6 @@ int main(int argc, char *argv[]) /* close the byte stream */ opj_stream_destroy_v3(l_stream); - fclose(fsrc); /* free remaining structures */ if (l_codec) { |
