]> granicus.if.org Git - openjpeg/commitdiff
[trunk] Fix some C90 issues.
authorMathieu Malaterre <mathieu.malaterre@gmail.com>
Mon, 10 Sep 2012 09:42:29 +0000 (09:42 +0000)
committerMathieu Malaterre <mathieu.malaterre@gmail.com>
Mon, 10 Sep 2012 09:42:29 +0000 (09:42 +0000)
applications/mj2/extract_j2k_from_mj2.c
applications/mj2/mj2.c
applications/mj2/mj2_convert.c
libopenjpeg/jpwl/jpwl.c
libopenjpeg/jpwl/jpwl_lib.c

index 9242c4e7049237816e89e65562f78951927a728e..f694d53150197cb743943990ff196dd2d78832c8 100644 (file)
@@ -109,10 +109,10 @@ int main(int argc, char *argv[]) {
        movie = (opj_mj2_t*) dinfo->mj2_handle;
        mj2_setup_decoder(movie, &parameters);
 
-  if (mj2_read_struct(file, movie)) // Creating the movie structure
+  if (mj2_read_struct(file, movie)) /* Creating the movie structure*/
     return 1;
 
-  // Decode first video track 
+  /* Decode first video track */
   tnum = 0;
   while (movie->tk[tnum].track_type != 0)
     tnum ++;
@@ -124,9 +124,9 @@ int main(int argc, char *argv[]) {
   for (snum=0; snum < track->num_samples; snum++)
   {
     sample = &track->sample[snum];
-    frame_codestream = (unsigned char*) malloc (sample->sample_size-8); // Skipping JP2C marker
+    frame_codestream = (unsigned char*) malloc (sample->sample_size-8); /* Skipping JP2C marker*/
     fseek(file,sample->offset+8,SEEK_SET);
-    fread(frame_codestream,sample->sample_size-8,1, file);  // Assuming that jp and ftyp markers size do
+    fread(frame_codestream,sample->sample_size-8,1, file);  /* Assuming that jp and ftyp markers size do*/
 
     sprintf(outfilename,"%s_%05d.j2k",argv[2],snum);
     outfile = fopen(outfilename, "wb");
index a8b3e37fc496343a58269364c043c628b8bf2eae..f5ab5f3f4e04216f045f2a5c93d8dc80c54378c8 100644 (file)
@@ -1236,10 +1236,10 @@ void mj2_write_stsd(mj2_tk_t * tk, opj_cio_t *cio)
   if (tk->track_type == 0) {
     mj2_write_smj2(tk, cio);
   } else if (tk->track_type == 1) {
-    // Not implemented
+    /* Not implemented*/
   }
   if (tk->track_type == 2) {
-    // Not implemented
+    /* Not implemented*/
   }
        
        
@@ -1287,10 +1287,10 @@ int mj2_read_stsd(mj2_tk_t * tk, opj_image_t * img, opj_cio_t *cio)
                                return 1;
     }
   } else if (tk->track_type == 1) {
-    len_2skip = cio_read(cio, 4);      // Not implemented -> skipping box
+    len_2skip = cio_read(cio, 4);      /* Not implemented -> skipping box*/
     cio_skip(cio,len_2skip - 4);
   } else if (tk->track_type == 2) {
-    len_2skip = cio_read(cio, 4);      // Not implemented -> skipping box
+    len_2skip = cio_read(cio, 4);      /* Not implemented -> skipping box*/
     cio_skip(cio,len_2skip - 4);
   }
        
@@ -2111,7 +2111,7 @@ int mj2_read_mdhd(mj2_tk_t * tk, opj_cio_t *cio)
   mj2_box_t box;
        
   mj2_read_boxhdr(&box, cio);
-  if (!(MJ2_MHDR == box.type || MJ2_MDHD == box.type)) {       // Kakadu writes MHDR instead of MDHD
+  if (!(MJ2_MHDR == box.type || MJ2_MDHD == box.type)) {       /* Kakadu writes MHDR instead of MDHD*/
     opj_event_msg(cio->cinfo, EVT_ERROR, "Error: Expected MDHD Marker\n");
     return 1;
   }
@@ -2765,7 +2765,7 @@ void mj2_destroy_decompress(opj_mj2_t *movie) {
                        tk = &movie->tk[i];
                        if (tk->name_size != 0)
                                opj_free(tk->name);
-                       if (tk->track_type == 0)  {// Video track
+                       if (tk->track_type == 0)  {/* Video track*/
                                if (tk->jp2_struct.comps != NULL)
                                        opj_free(tk->jp2_struct.comps);
                                if (tk->jp2_struct.cl != NULL)
@@ -2821,20 +2821,20 @@ void mj2_setup_encoder(opj_mj2_t *movie, mj2_cparameters_t *parameters) {
        if(movie && parameters) {
                opj_jp2_t *jp2_struct;
                        
-               movie->num_htk = 0;       // No hint tracks
-               movie->num_stk = 0;       // No sound tracks
-               movie->num_vtk = 1;       // One video track  
+               movie->num_htk = 0;       /* No hint tracks*/
+               movie->num_stk = 0;       /* No sound tracks*/
+               movie->num_vtk = 1;       /* One video track*/
 
-               movie->brand = MJ2_MJ2;  // One brand: MJ2
-               movie->num_cl = 2;        // Two compatible brands: MJ2 and MJ2S
+               movie->brand = MJ2_MJ2;  /* One brand: MJ2*/
+               movie->num_cl = 2;        /* Two compatible brands: MJ2 and MJ2S*/
                movie->cl = (unsigned int*) opj_malloc(movie->num_cl * sizeof(unsigned int));
                movie->cl[0] = MJ2_MJ2;
                movie->cl[1] = MJ2_MJ2S;
-               movie->minversion = 0;    // Minimum version: 0         
+               movie->minversion = 0;    /* Minimum version: 0 */
 
-               movie->tk = (mj2_tk_t*) opj_malloc(sizeof(mj2_tk_t)); //Memory allocation for the video track
-               movie->tk[0].track_ID = 1;        // Track ID = 1 
-               movie->tk[0].track_type = 0;      // Video track
+               movie->tk = (mj2_tk_t*) opj_malloc(sizeof(mj2_tk_t)); /*Memory allocation for the video track*/
+               movie->tk[0].track_ID = 1;        /* Track ID = 1 */
+               movie->tk[0].track_type = 0;      /* Video track */
                movie->tk[0].Dim[0] = parameters->Dim[0];
                movie->tk[0].Dim[1] = parameters->Dim[1];
                movie->tk[0].w = parameters->w;
@@ -2848,7 +2848,7 @@ void mj2_setup_encoder(opj_mj2_t *movie, mj2_cparameters_t *parameters) {
                movie->tk[0].depth = parameters->prec;
 
                jp2_struct = &movie->tk[0].jp2_struct;
-               jp2_struct->numcomps = parameters->numcomps;    // NC           
+               jp2_struct->numcomps = parameters->numcomps;    /* NC */
                jp2_struct->comps = (opj_jp2_comps_t*) opj_malloc(jp2_struct->numcomps * sizeof(opj_jp2_comps_t));
                jp2_struct->precedence = 0;   /* PRECEDENCE*/
                jp2_struct->approx = 0;   /* APPROX*/           
@@ -2884,7 +2884,7 @@ void mj2_destroy_compress(opj_mj2_t *movie) {
                        tk = &movie->tk[i];
                        if (tk->name_size != 0)
                                opj_free(tk->name);
-                       if (tk->track_type == 0)  {// Video track
+                       if (tk->track_type == 0)  {/* Video track*/
                                if (tk->jp2_struct.comps != NULL)
                                        opj_free(tk->jp2_struct.comps);
                                if (tk->jp2_struct.cl != NULL)
index 3d842883fc3f6729092ec97cd3a975f7c11b501f..ed823f8be45a9c49f312554db74b267a8c5cdfa4 100644 (file)
@@ -67,12 +67,12 @@ unsigned int yuv_num_frames(mj2_tk_t * tk, char *infile)
   return (unsigned int)(end_of_f / frame_size);
 }
 
-//  -----------------------
-//
-//
-//  YUV to IMAGE
-//
-//  -----------------------
+/*  ----------------------- */
+/* */
+/* */
+/*  YUV to IMAGE */
+/* */
+/*  ----------------------- */
 
 opj_image_t *mj2_image_create(mj2_tk_t * tk, opj_cparameters_t *parameters)
 {
@@ -169,12 +169,12 @@ char yuvtoimage(mj2_tk_t * tk, opj_image_t * img, int frame_num, opj_cparameters
 
 
 
-//  -----------------------
-//
-//
-//  IMAGE to YUV
-//
-//  -----------------------
+/*  ----------------------- */
+/* */
+/* */
+/*  IMAGE to YUV */
+/* */
+/*  ----------------------- */
 
 
 opj_bool imagetoyuv(opj_image_t * img, char *outfile)
@@ -263,12 +263,12 @@ opj_bool imagetoyuv(opj_image_t * img, char *outfile)
   return OPJ_TRUE;
 }
 
-//  -----------------------
-//
-//
-//  IMAGE to BMP
-//
-//  -----------------------
+/*  ----------------------- */
+/* */
+/* */
+/*  IMAGE to BMP */
+/* */
+/*  ----------------------- */
 
 int imagetobmp(opj_image_t * img, char *outfile) {
   int w,wr,h,hr,i,pad;
@@ -353,11 +353,11 @@ int imagetobmp(opj_image_t * img, char *outfile) {
     for (i = 0; i < wr * hr; i++) {
       unsigned char R, G, B;
       /* a modifier */
-      // R = img->comps[0].data[w * h - ((i) / (w) + 1) * w + (i) % (w)];
+      /* R = img->comps[0].data[w * h - ((i) / (w) + 1) * w + (i) % (w)];*/
       R = img->comps[0].data[w * hr - ((i) / (wr) + 1) * w + (i) % (wr)];
-      // G = img->comps[1].data[w * h - ((i) / (w) + 1) * w + (i) % (w)];
+      /* G = img->comps[1].data[w * h - ((i) / (w) + 1) * w + (i) % (w)];*/
       G = img->comps[1].data[w * hr - ((i) / (wr) + 1) * w + (i) % (wr)];
-      // B = img->comps[2].data[w * h - ((i) / (w) + 1) * w + (i) % (w)];
+      /* B = img->comps[2].data[w * h - ((i) / (w) + 1) * w + (i) % (w)];*/
       B = img->comps[2].data[w * hr - ((i) / (wr) + 1) * w + (i) % (wr)];
       fprintf(f, "%c%c%c", B, G, R);
       
index a7e124c1ad8cc29e322de71a99f65e3c93fab6d8..ba8cac5aeccff67085fcbc9749825c4488a05963 100644 (file)
@@ -179,7 +179,7 @@ opj_bool j2k_add_marker(opj_codestream_info_t *cstr_info, unsigned short int typ
                         cstr_info->marknum = 0;
                         cstr_info->maxmarknum = 0;
                         /* opj_event_msg_v2(p_manager, EVT_ERROR, "Not enough memory to add a marker\n"); */
-                        // TODO_test_add_marker_result;
+                        /* TODO_test_add_marker_result;*/
                         return OPJ_FALSE;
                 }
                 cstr_info->marker = new_marker;
index ee01aa058b3842d7b2c21624b4df3c73c36c087e..b75cfdb1f15237c08088ed9691a44f831bd5ce84 100644 (file)
@@ -327,7 +327,7 @@ void jpwl_epb_write(opj_j2k_t *j2k, jpwl_epb_ms_t *epb, unsigned char *buf) {
        /* update markers struct */
        j2k_add_marker(j2k->cstr_info, J2K_MS_EPB, -1, epb->Lepb + 2);
 
-};
+}
 
 
 jpwl_epc_ms_t *jpwl_epc_create(opj_j2k_t *j2k, opj_bool esd_on, opj_bool red_on, opj_bool epb_on, opj_bool info_on) {
@@ -1190,7 +1190,7 @@ void jpwl_epc_write(opj_j2k_t *j2k, jpwl_epc_ms_t *epc, unsigned char *buf) {
        /* update markers struct */
        j2k_add_marker(j2k->cstr_info, J2K_MS_EPC, -1, epc->Lepc + 2);
 
-};
+}
 
 int jpwl_esds_add(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int *jwmarker_num,
                                  int comps, unsigned char addrm, unsigned char ad_size,