]> Creatis software - gdcm.git/blobdiff - src/gdcmjasper/src/libjasper/jpc/jpc_enc.c
COMP: VS6 was not happy to cast an int into ushort
[gdcm.git] / src / gdcmjasper / src / libjasper / jpc / jpc_enc.c
index 839c56454c5cebf586adeb510c1107238cfed596..ec13ad23b274fdf7ff75ed5efd51e3aaac2f83dc 100644 (file)
@@ -62,7 +62,7 @@
  */
 
 /*
- * $Id: jpc_enc.c,v 1.3 2005/06/08 17:39:37 malaterre Exp $
+ * $Id: jpc_enc.c,v 1.5 2005/06/11 02:05:20 malaterre Exp $
  */
 
 /******************************************************************************\
@@ -768,6 +768,7 @@ error:
   if (cp) {
     jpc_enc_cp_destroy(cp);
   }
+  (void)ret; /* ret' is assigned a value that is never used in function cp_create */
   return 0;
 }
 
@@ -797,9 +798,10 @@ int ratestrtosize(char *s, uint_fast32_t rawsize, uint_fast32_t *size)
     } else if (f > 1.0) {
       *size = rawsize + 1;
     } else {
-      *size = f * rawsize;
+      *size = (uint_fast32_t)(f * rawsize);
     }
   }
+  (void)cp; /* 'cp' is assigned a value that is never used in function ratestrtosize */
   return 0;
 }
 
@@ -1035,8 +1037,8 @@ startoff = jas_stream_getrwcount(enc->out);
   cod->mctrans = (cp->tcp.mctid != JPC_MCT_NONE);
   if (tccp->csty & JPC_COX_PRT) {
     for (rlvlno = 0; rlvlno < tccp->maxrlvls; ++rlvlno) {
-      cod->compparms.rlvls[rlvlno].parwidthval = tccp->prcwidthexpns[rlvlno];
-      cod->compparms.rlvls[rlvlno].parheightval = tccp->prcheightexpns[rlvlno];
+      cod->compparms.rlvls[rlvlno].parwidthval = (uint_fast8_t)tccp->prcwidthexpns[rlvlno];
+      cod->compparms.rlvls[rlvlno].parheightval = (uint_fast8_t)tccp->prcheightexpns[rlvlno];
     }
   }
   if (jpc_putms(enc->out, enc->cstate, enc->mrk)) {
@@ -1096,14 +1098,13 @@ startoff = jas_stream_getrwcount(enc->out);
     enc->mainbodysize = UINT_FAST32_MAX;
   }
 
+  (void)mctsynweight; /* 'mctsynweight' is assigned a value that is never used in function jpc_enc_encodemainhdr */
   return 0;
 }
 
 static int jpc_enc_encodemainbody(jpc_enc_t *enc)
 {
   int tileno;
-  int tilex;
-  int tiley;
   int i;
   jpc_sot_t *sot;
   jpc_enc_tcmpt_t *comp;
@@ -1117,7 +1118,6 @@ static int jpc_enc_encodemainbody(jpc_enc_t *enc)
   int adjust;
   int j;
   int absbandno;
-  long numbytes;
   long tilehdrlen;
   long tilelen;
   jpc_enc_tile_t *tile;
@@ -1139,12 +1139,7 @@ int numgbits;
 
   cp = enc->cp;
 
-  /* Avoid compile warnings. */
-  numbytes = 0;
-
   for (tileno = 0; tileno < JAS_CAST(int, cp->numtiles); ++tileno) {
-    tilex = tileno % cp->numhtiles;
-    tiley = tileno / cp->numhtiles;
 
     if (!(enc->curtile = jpc_enc_tile_create(enc->cp, enc->image, tileno))) {
       abort();
@@ -1394,14 +1389,14 @@ if (jpc_enc_enccblks(enc)) {
     rho = (double) (tile->brx - tile->tlx) * (tile->bry - tile->tly) /
       ((cp->refgrdwidth - cp->imgareatlx) * (cp->refgrdheight -
       cp->imgareatly));
-    tile->rawsize = cp->rawsize * rho;
+    tile->rawsize = (uint_fast32_t)(cp->rawsize * rho);
 
     for (lyrno = 0; lyrno < tile->numlyrs - 1; ++lyrno) {
-      tile->lyrsizes[lyrno] = tile->rawsize * jpc_fixtodbl(
-        cp->tcp.ilyrrates[lyrno]);
+      tile->lyrsizes[lyrno] = (uint_fast32_t)(tile->rawsize * jpc_fixtodbl(
+        cp->tcp.ilyrrates[lyrno]));
     }
-    tile->lyrsizes[tile->numlyrs - 1] = (cp->totalsize != UINT_FAST32_MAX) ?
-      (rho * enc->mainbodysize) : UINT_FAST32_MAX;
+    tile->lyrsizes[tile->numlyrs - 1] = (uint_fast32_t)((cp->totalsize != UINT_FAST32_MAX) ?
+      (rho * enc->mainbodysize) : UINT_FAST32_MAX);
     for (lyrno = 0; lyrno < tile->numlyrs; ++lyrno) {
       if (tile->lyrsizes[lyrno] != UINT_FAST32_MAX) {
         if (tilehdrlen <= JAS_CAST(long, tile->lyrsizes[lyrno])) {