[trunk] move to the new API for function opj_stream_destroy. Use now opj_stream_destr...
authorMickael Savinaud <savmickael@users.noreply.github.com>
Sat, 16 Feb 2013 17:39:23 +0000 (17:39 +0000)
committerMickael Savinaud <savmickael@users.noreply.github.com>
Sat, 16 Feb 2013 17:39:23 +0000 (17:39 +0000)
src/bin/jp2/opj_compress.c
src/bin/jp2/opj_decompress.c
src/bin/jp2/opj_dump.c
tests/j2k_random_tile_access.c
tests/test_tile_decoder.c
tests/test_tile_encoder.c
tests/unit/testempty1.c
tests/unit/testempty2.c

index 9c957502124f22f451917fa6bcc0d1bc1200a043..5101d841d6201efcdf4c1018a1cabfdda9d8ddd3 100644 (file)
@@ -1806,7 +1806,7 @@ int main(int argc, char **argv) {
                        }
                        default:
                                fprintf(stderr, "skipping file..\n");
-                               opj_stream_destroy(l_stream);
+                               opj_stream_destroy_v3(l_stream);
                                continue;
                }
                
@@ -1828,7 +1828,7 @@ int main(int argc, char **argv) {
                fout = fopen(parameters.outfile, "wb");
                if (! fout) {
                        fprintf(stderr, "Not enable to create output file!\n");
-                       opj_stream_destroy(l_stream);
+                       opj_stream_destroy_v3(l_stream);
                        return 1;
                }
 
@@ -1852,7 +1852,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",i);
-          opj_stream_destroy(l_stream);
+          opj_stream_destroy_v3(l_stream);
           fclose(fout);
           opj_destroy_codec(l_codec);
           opj_image_destroy(image);
@@ -1873,7 +1873,7 @@ int main(int argc, char **argv) {
                }
 
                if (!bSuccess)  {
-                       opj_stream_destroy(l_stream);
+                       opj_stream_destroy_v3(l_stream);
                        fclose(fout);
       opj_destroy_codec(l_codec);
       opj_image_destroy(image);
@@ -1883,7 +1883,7 @@ int main(int argc, char **argv) {
 
                fprintf(stderr,"Generated outfile %s\n",parameters.outfile);
                /* close and free the byte stream */
-               opj_stream_destroy(l_stream);
+               opj_stream_destroy_v3(l_stream);
                fclose(fout);
 
                /* free remaining compression structures */
index df2978db74d949f461cab621109d0d29efd885e4..e462fb5e472ccc2af875db93398ecbe6a5b1d8dd 100644 (file)
@@ -783,7 +783,7 @@ int main(int argc, char **argv)
                        }
                        default:
                                fprintf(stderr, "skipping file..\n");
-                               opj_stream_destroy(l_stream);
+                               opj_stream_destroy_v3(l_stream);
                                continue;
                }
 
@@ -795,7 +795,7 @@ int main(int argc, char **argv)
                /* Setup the decoder decoding parameters using user parameters */
                if ( !opj_setup_decoder(l_codec, &parameters) ){
                        fprintf(stderr, "ERROR -> j2k_dump: failed to setup the decoder\n");
-                       opj_stream_destroy(l_stream);
+                       opj_stream_destroy_v3(l_stream);
                        fclose(fsrc);
                        opj_destroy_codec(l_codec);
                        return EXIT_FAILURE;
@@ -805,7 +805,7 @@ int main(int argc, char **argv)
                /* Read the main header of the codestream and if necessary the JP2 boxes*/
                if(! opj_read_header(l_stream, l_codec, &image)){
                        fprintf(stderr, "ERROR -> opj_decompress: failed to read the header\n");
-                       opj_stream_destroy(l_stream);
+                       opj_stream_destroy_v3(l_stream);
                        fclose(fsrc);
                        opj_destroy_codec(l_codec);
                        opj_image_destroy(image);
@@ -817,7 +817,7 @@ int main(int argc, char **argv)
                        if (!opj_set_decode_area(l_codec, image, parameters.DA_x0,
                                        parameters.DA_y0, parameters.DA_x1, parameters.DA_y1)){
                                fprintf(stderr, "ERROR -> opj_decompress: failed to set the decoded area\n");
-                               opj_stream_destroy(l_stream);
+                               opj_stream_destroy_v3(l_stream);
                                opj_destroy_codec(l_codec);
                                opj_image_destroy(image);
                                fclose(fsrc);
@@ -828,7 +828,7 @@ int main(int argc, char **argv)
                        if (!(opj_decode(l_codec, l_stream, image) && opj_end_decompress(l_codec,       l_stream))) {
                                fprintf(stderr,"ERROR -> opj_decompress: failed to decode image!\n");
                                opj_destroy_codec(l_codec);
-                               opj_stream_destroy(l_stream);
+                               opj_stream_destroy_v3(l_stream);
                                opj_image_destroy(image);
                                fclose(fsrc);
                                return EXIT_FAILURE;
@@ -840,7 +840,7 @@ int main(int argc, char **argv)
                        /*if (!opj_set_decoded_resolution_factor(l_codec, 5)) {
                                fprintf(stderr, "ERROR -> opj_decompress: failed to set the resolution factor tile!\n");
                                opj_destroy_codec(l_codec);
-                               opj_stream_destroy(l_stream);
+                               opj_stream_destroy_v3(l_stream);
                                opj_image_destroy(image);
                                fclose(fsrc);
                                return EXIT_FAILURE;
@@ -849,7 +849,7 @@ int main(int argc, char **argv)
                        if (!opj_get_decoded_tile(l_codec, l_stream, image, parameters.tile_index)) {
                                fprintf(stderr, "ERROR -> opj_decompress: failed to decode tile!\n");
                                opj_destroy_codec(l_codec);
-                               opj_stream_destroy(l_stream);
+                               opj_stream_destroy_v3(l_stream);
                                opj_image_destroy(image);
                                fclose(fsrc);
                                return EXIT_FAILURE;
@@ -858,7 +858,7 @@ int main(int argc, char **argv)
                }
 
                /* Close the byte stream */
-               opj_stream_destroy(l_stream);
+               opj_stream_destroy_v3(l_stream);
                fclose(fsrc);
 
                if(image->color_space == OPJ_CLRSPC_SYCC){
index 2bc1893ac50a26d45385862f4acf7fac1f9d2885..0fb5d1175a9880560e4baa25e6c8bb83d18bc55a 100644 (file)
@@ -523,7 +523,7 @@ int main(int argc, char *argv[])
                        }
                        default:
                                fprintf(stderr, "skipping file..\n");
-                               opj_stream_destroy(l_stream);
+                               opj_stream_destroy_v3(l_stream);
                                continue;
                }
 
@@ -535,7 +535,7 @@ int main(int argc, char *argv[])
                /* Setup the decoder decoding parameters using user parameters */
                if ( !opj_setup_decoder(l_codec, &parameters) ){
                        fprintf(stderr, "ERROR -> opj_dump: failed to setup the decoder\n");
-                       opj_stream_destroy(l_stream);
+                       opj_stream_destroy_v3(l_stream);
                        fclose(fsrc);
                        opj_destroy_codec(l_codec);
                        fclose(fout);
@@ -545,7 +545,7 @@ int main(int argc, char *argv[])
                /* Read the main header of the codestream and if necessary the JP2 boxes*/
                if(! opj_read_header(l_stream, l_codec, &image)){
                        fprintf(stderr, "ERROR -> opj_dump: failed to read the header\n");
-                       opj_stream_destroy(l_stream);
+                       opj_stream_destroy_v3(l_stream);
                        fclose(fsrc);
                        opj_destroy_codec(l_codec);
                        opj_image_destroy(image);
@@ -560,7 +560,7 @@ int main(int argc, char *argv[])
                cstr_index = opj_get_cstr_index(l_codec);
 
                /* close the byte stream */
-               opj_stream_destroy(l_stream);
+               opj_stream_destroy_v3(l_stream);
                fclose(fsrc);
 
                /* free remaining structures */
index afe4bd4184678cc2f5bd6b2ee19ca1601f5bf99f..065a955cfacb88ddd5d8a09d2283f473f652fc38 100644 (file)
@@ -228,7 +228,7 @@ int main(int argc, char **argv)
        /* Setup the decoder decoding parameters using user parameters */
        if ( !opj_setup_decoder(l_codec, &parameters) ){
                fprintf(stderr, "ERROR -> j2k_dump: failed to setup the decoder\n");
-               opj_stream_destroy(l_stream);
+               opj_stream_destroy_v3(l_stream);
                fclose(fsrc);
                opj_destroy_codec(l_codec);
                return EXIT_FAILURE;
@@ -237,7 +237,7 @@ int main(int argc, char **argv)
        /* Read the main header of the codestream and if necessary the JP2 boxes*/
        if(! opj_read_header(l_stream, l_codec, &image)){
                fprintf(stderr, "ERROR -> j2k_to_image: failed to read the header\n");
-               opj_stream_destroy(l_stream);
+               opj_stream_destroy_v3(l_stream);
                fclose(fsrc);
                opj_destroy_codec(l_codec);
                opj_image_destroy(image);
@@ -258,7 +258,7 @@ int main(int argc, char **argv)
        fprintf(stdout, "Decoding tile %d ...\n", tile_index); \
        if(!opj_get_decoded_tile(l_codec, l_stream, image, tile_index )){ \
                fprintf(stderr, "ERROR -> j2k_to_image: failed to decode tile %d\n", tile_index); \
-               opj_stream_destroy(l_stream); \
+               opj_stream_destroy_v3(l_stream); \
                opj_destroy_cstr_info(&cstr_info); \
                opj_destroy_codec(l_codec); \
                opj_image_destroy(image); \
@@ -268,7 +268,7 @@ int main(int argc, char **argv)
   for(index = 0; index < image->numcomps; ++index) { \
     if( image->comps[index].data == NULL ){ \
        fprintf(stderr, "ERROR -> j2k_to_image: failed to decode tile %d\n", tile_index); \
-               opj_stream_destroy(l_stream); \
+               opj_stream_destroy_v3(l_stream); \
                opj_destroy_cstr_info(&cstr_info); \
                opj_destroy_codec(l_codec); \
                opj_image_destroy(image); \
@@ -286,7 +286,7 @@ int main(int argc, char **argv)
        TEST_TILE(tile_lr)
 
        /* Close the byte stream */
-       opj_stream_destroy(l_stream);
+       opj_stream_destroy_v3(l_stream);
 
        /* Destroy code stream info */
        opj_destroy_cstr_info(&cstr_info);
index 81f791cb992de1ce7fd6f9c0a7d56e7e8de4ffed..1dd3382ff84b24c911bcb824b5961f12e95a8984 100644 (file)
@@ -270,7 +270,7 @@ int main (int argc, char *argv[])
                                 fprintf(stderr, "ERROR -> Not a valid JPEG2000 file!\n");
                                 fclose(l_file);
                                 free(l_data);
-                                opj_stream_destroy(l_stream);
+                                opj_stream_destroy_v3(l_stream);
                                 return EXIT_FAILURE;
                         }
         }
@@ -286,7 +286,7 @@ int main (int argc, char *argv[])
                 fprintf(stderr, "ERROR -> j2k_dump: failed to setup the decoder\n");
                 fclose(l_file);
                 free(l_data);
-                opj_stream_destroy(l_stream);
+                opj_stream_destroy_v3(l_stream);
                 opj_destroy_codec(l_codec);
                 return EXIT_FAILURE;
         }
@@ -297,7 +297,7 @@ int main (int argc, char *argv[])
                 fprintf(stderr, "ERROR -> j2k_to_image: failed to read the header\n");
                 fclose(l_file);
                 free(l_data);
-                opj_stream_destroy(l_stream);
+                opj_stream_destroy_v3(l_stream);
                 opj_destroy_codec(l_codec);
                 return EXIT_FAILURE;
         }
@@ -306,7 +306,7 @@ int main (int argc, char *argv[])
                 fprintf(stderr,        "ERROR -> j2k_to_image: failed to set the decoded area\n");
                 fclose(l_file);
                 free(l_data);
-                opj_stream_destroy(l_stream);
+                opj_stream_destroy_v3(l_stream);
                 opj_destroy_codec(l_codec);
                 opj_image_destroy(l_image);
                 return EXIT_FAILURE;
@@ -328,7 +328,7 @@ int main (int argc, char *argv[])
                 {
                         fclose(l_file);
                         free(l_data);
-                        opj_stream_destroy(l_stream);
+                        opj_stream_destroy_v3(l_stream);
                         opj_destroy_codec(l_codec);
                         opj_image_destroy(l_image);
                         return EXIT_FAILURE;
@@ -343,7 +343,7 @@ int main (int argc, char *argv[])
                                 {
                                         fclose(l_file);
                                         free(l_new_data);
-                                        opj_stream_destroy(l_stream);
+                                        opj_stream_destroy_v3(l_stream);
                                         opj_destroy_codec(l_codec);
                                         opj_image_destroy(l_image);
                                         return EXIT_FAILURE;
@@ -356,7 +356,7 @@ int main (int argc, char *argv[])
                         {
                                 fclose(l_file);
                                 free(l_data);
-                                opj_stream_destroy(l_stream);
+                                opj_stream_destroy_v3(l_stream);
                                 opj_destroy_codec(l_codec);
                                 opj_image_destroy(l_image);
                                 return EXIT_FAILURE;
@@ -369,7 +369,7 @@ int main (int argc, char *argv[])
         {
                 fclose(l_file);
                 free(l_data);
-                opj_stream_destroy(l_stream);
+                opj_stream_destroy_v3(l_stream);
                 opj_destroy_codec(l_codec);
                 opj_image_destroy(l_image);
                 return EXIT_FAILURE;
@@ -378,7 +378,7 @@ int main (int argc, char *argv[])
         /* Free memory */
         fclose(l_file);
         free(l_data);
-        opj_stream_destroy(l_stream);
+        opj_stream_destroy_v3(l_stream);
         opj_destroy_codec(l_codec);
         opj_image_destroy(l_image);
 
index 22ecb348220bb4709b35bca17bda3b76e36c2107..54710369b00d7ab9a857db373fb8d02876e82a72 100644 (file)
@@ -290,7 +290,7 @@ int main (int argc, char *argv[])
 
        if (! opj_start_compress(l_codec,l_image,l_stream)) {
                fprintf(stderr, "ERROR -> test_tile_encoder: failed to start compress!\n");
-               opj_stream_destroy(l_stream);
+               opj_stream_destroy_v3(l_stream);
                fclose(l_file);
                opj_destroy_codec(l_codec);
                opj_image_destroy(l_image);
@@ -300,7 +300,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",i);
-                       opj_stream_destroy(l_stream);
+                       opj_stream_destroy_v3(l_stream);
                        fclose(l_file);
                        opj_destroy_codec(l_codec);
                        opj_image_destroy(l_image);
@@ -310,14 +310,14 @@ int main (int argc, char *argv[])
 
        if (! opj_end_compress(l_codec,l_stream)) {
                fprintf(stderr, "ERROR -> test_tile_encoder: failed to end compress!\n");
-               opj_stream_destroy(l_stream);
+               opj_stream_destroy_v3(l_stream);
                fclose(l_file);
                opj_destroy_codec(l_codec);
                opj_image_destroy(l_image);
                return 1;
        }
 
-       opj_stream_destroy(l_stream);
+       opj_stream_destroy_v3(l_stream);
        fclose(l_file);
        opj_destroy_codec(l_codec);
        opj_image_destroy(l_image);
index add522a6f3397fa1ee14b1e6028bad326eaf0765..3273648524147a5753f7e9efad90b20dfc898a0e 100644 (file)
@@ -99,9 +99,9 @@ int main(int argc, char *argv[])
       }
     }
 
-               /* catch events using our callbacks and give a local context */         \r
-               opj_set_info_handler(l_codec, info_callback,00);\r
-               opj_set_warning_handler(l_codec, warning_callback,00);\r
+               /* catch events using our callbacks and give a local context */         
+               opj_set_info_handler(l_codec, info_callback,00);
+               opj_set_warning_handler(l_codec, warning_callback,00);
                opj_set_error_handler(l_codec, error_callback,00);
 
   l_codec = opj_create_compress(OPJ_CODEC_J2K);
@@ -125,7 +125,7 @@ int main(int argc, char *argv[])
   bSuccess = opj_end_compress(l_codec, l_stream);
   assert( bSuccess );
 
-  opj_stream_destroy(l_stream);
+  opj_stream_destroy_v3(l_stream);
   fclose(f);
 
   opj_destroy_codec(l_codec);
index 47ef4cc2ac6651c6bfd80a013d38a53c7b85e2b9..3b0952b2eb40104eb1cfc40ac06824c9d81a7b4e 100644 (file)
@@ -101,9 +101,9 @@ int main(int argc, char *argv[])
       }
     }
 
-    /* catch events using our callbacks and give a local context */            \r
-    opj_set_info_handler(l_codec, info_callback,00);\r
-    opj_set_warning_handler(l_codec, warning_callback,00);\r
+    /* catch events using our callbacks and give a local context */            
+    opj_set_info_handler(l_codec, info_callback,00);
+    opj_set_warning_handler(l_codec, warning_callback,00);
     opj_set_error_handler(l_codec, error_callback,00);
 
   l_codec = opj_create_compress(OPJ_CODEC_J2K);
@@ -127,7 +127,7 @@ int main(int argc, char *argv[])
   bSuccess = opj_end_compress(l_codec, l_stream);
   assert( bSuccess );
 
-  opj_stream_destroy(l_stream);
+  opj_stream_destroy_v3(l_stream);
   fclose(f);
 
   opj_destroy_codec(l_codec);
@@ -161,7 +161,7 @@ int main(int argc, char *argv[])
   bSuccess = opj_end_decompress(l_codec,       l_stream);
   assert( bSuccess );
 
-  opj_stream_destroy(l_stream);
+  opj_stream_destroy_v3(l_stream);
   fclose(fsrc);
   opj_destroy_codec(d_codec);