Merge pull request #706 from mayeut/issue135
[openjpeg.git] / tests / unit / testempty2.c
index e342e01503cdc63d9b40d85b3fb396e14cfb63cd..6b395480d3c96730e94c70b8c548b2501c2d84c0 100644 (file)
@@ -58,15 +58,15 @@ int main(int argc, char *argv[])
   const char * v = opj_version();
 
   const OPJ_COLOR_SPACE color_space = OPJ_CLRSPC_GRAY;
-  int numcomps = 1;
-  int i;
-  int image_width = 256;
-  int image_height = 256;
+  unsigned int numcomps = 1;
+  unsigned int i;
+  unsigned int image_width = 256;
+  unsigned int image_height = 256;
 
   opj_cparameters_t parameters;
 
-  int subsampling_dx = parameters.subsampling_dx;
-  int subsampling_dy = parameters.subsampling_dy;
+  unsigned int subsampling_dx;
+  unsigned int subsampling_dy;
   const char outputfile[] = "testempty2.j2k";
 
   opj_image_cmptparm_t cmptparm;
@@ -80,6 +80,8 @@ int main(int argc, char *argv[])
   opj_set_default_encoder_parameters(&parameters);
   parameters.cod_format = J2K_CFMT;
   puts(v);
+  subsampling_dx = (unsigned int)parameters.subsampling_dx;
+  subsampling_dy = (unsigned int)parameters.subsampling_dy;
   cmptparm.prec = 8;
   cmptparm.bpp = 8;
   cmptparm.sgnd = 0;
@@ -94,7 +96,7 @@ int main(int argc, char *argv[])
 
   for (i = 0; i < image_width * image_height; i++)
     {
-    int compno;
+    unsigned int compno;
     for(compno = 0; compno < numcomps; compno++)
       {
       image->comps[compno].data[i] = 0;
@@ -113,20 +115,20 @@ int main(int argc, char *argv[])
 
   opj_setup_encoder(l_codec, &parameters, image);
 
-  l_stream = opj_stream_create_default_file_stream_v3(parameters.outfile,OPJ_FALSE);
+  l_stream = opj_stream_create_default_file_stream(parameters.outfile,OPJ_FALSE);
   if( !l_stream )
     {
     fprintf( stderr, "Something went wrong during creation of stream\n" );
     opj_destroy_codec(l_codec);
     opj_image_destroy(image);
-    opj_stream_destroy_v3(l_stream);
+    opj_stream_destroy(l_stream);
     return 1;
     }
   assert(l_stream);
   bSuccess = opj_start_compress(l_codec,image,l_stream);
   if( !bSuccess )
     {
-    opj_stream_destroy_v3(l_stream);
+    opj_stream_destroy(l_stream);
     opj_destroy_codec(l_codec);
     opj_image_destroy(image);
     return 0;
@@ -138,7 +140,7 @@ int main(int argc, char *argv[])
   bSuccess = opj_end_compress(l_codec, l_stream);
   assert( bSuccess );
 
-  opj_stream_destroy_v3(l_stream);
+  opj_stream_destroy(l_stream);
 
   opj_destroy_codec(l_codec);
   opj_image_destroy(image);
@@ -157,7 +159,7 @@ int main(int argc, char *argv[])
   bSuccess = opj_setup_decoder(d_codec, &dparameters);
   assert( bSuccess );
 
-  l_stream = opj_stream_create_default_file_stream_v3(outputfile,1);
+  l_stream = opj_stream_create_default_file_stream(outputfile,1);
   assert( l_stream );
 
   bSuccess = opj_read_header(l_stream, d_codec, &image);
@@ -169,7 +171,7 @@ int main(int argc, char *argv[])
   bSuccess = opj_end_decompress(l_codec, l_stream);
   assert( bSuccess );
 
-  opj_stream_destroy_v3(l_stream);
+  opj_stream_destroy(l_stream);
 
   opj_destroy_codec(d_codec);