]> Creatis software - gdcm.git/commitdiff
COMP: Tons of warnings fix...cannot believe how poorly written this was
authormalaterre <malaterre>
Tue, 7 Jun 2005 21:03:24 +0000 (21:03 +0000)
committermalaterre <malaterre>
Tue, 7 Jun 2005 21:03:24 +0000 (21:03 +0000)
src/gdcmjpegls/Decoder/bitio.c
src/gdcmjpegls/Decoder/decoder.c
src/gdcmjpegls/Decoder/global.c
src/gdcmjpegls/Decoder/global.h
src/gdcmjpegls/Decoder/initialize.c
src/gdcmjpegls/Decoder/jpegmark.c
src/gdcmjpegls/Decoder/jpegmark.h
src/gdcmjpegls/Decoder/lossless_d.c
src/gdcmjpegls/Decoder/lossy_d.c
src/gdcmjpegls/Decoder/melcode.c

index 8353b108b671fccb6323baff5bb1c99ea181d6e5..13d9f4596167ae360c8bb002ff884caf9846a7cd 100644 (file)
@@ -88,6 +88,7 @@ int bits;  /* number of bits free in bit buffer (on output) */
 
 void bufiinit(FILE *fil) {
     /* argument is ignored */
+    (void)fil;
     fp = BUFSIZE;
     truebufsize = 0;
     foundeof = 0;
@@ -141,7 +142,8 @@ void bitiflush()  {
     int filled,
   discard, 
   dbytes,
-  i, k, treg;
+  i, k;
+  unsigned int treg;
     byte *bp;
 
     filled = 24 - bits;    /* how many bits at the MS part of reg 
@@ -179,16 +181,16 @@ void bitiflush()  {
     }
     /* check consistency */
     if ( filled-k > 7 ) {
-  fprintf(stderr,"bitiflush: inconsistent bits=%d filled=%d k=%d\n",bits,filled,k);
-  exit(10);
+      fprintf(stderr,"bitiflush: inconsistent bits=%d filled=%d k=%d\n",bits,filled,k);
+      exit(10);
     }
     discard = filled-k;
     if ( treg != (reg<<discard) ) {
-  fprintf(stderr,"bitiflush: inconsistent bits=%d discard=%d reg=%08x treg=%08x\n",bits, discard, reg, treg);
-  exit(10);
+      fprintf(stderr,"bitiflush: inconsistent bits=%d discard=%d reg=%08x treg=%08x\n",bits, discard, reg, treg);
+      exit(10);
     }
     if ( reg & (((1<<discard)-1)<<(BITBUFSIZE-discard)) )
-  fprintf(stderr,"bitiflush: Warning: discarding nonzero bits; reg=%08x bits=%d discard=%d\n",reg,bits,discard);
+      fprintf(stderr,"bitiflush: Warning: discarding nonzero bits; reg=%08x bits=%d discard=%d\n",reg,bits,discard);
 
     fp -= dbytes;  /* do the unget */
     if ( buff[fp-1]==0xff && buff[fp]==0 ) fp++;
index 99745ff8ec86890991aa04944087d98b35e1c098..0343c0899e135239214917f34775026945651cb9 100644 (file)
@@ -118,6 +118,7 @@ int     alpha,     /* alphabet size */
 int     highmask;
 #endif
 
+void usage();
 
 
 
@@ -261,7 +262,7 @@ void initbuffers(int multi, int comp) {
 
 }
 
-swaplines()
+void swaplines()
 {
   pixel *temp;
   temp = pscanl0;
@@ -271,7 +272,7 @@ swaplines()
   cscanline = cscanl0 + components*(LEFTMARGIN-1);
 }
 
-c_swaplines(int i)
+void c_swaplines(int i)
 {
   pixel *temp;
   temp = c_pscanl0[i];
@@ -300,8 +301,7 @@ void closebuffers(int multi) {
 
 
 int initialize(int argc, char *argv[]) {
-  char line[256],tmp_char[1],   
-    *infilename = NULL,
+  char *infilename = NULL,
     *outfilename = OUTFILE ".out",
     *c_outfilename[MAX_COMPONENTS],
     *color_mode_string;
@@ -554,9 +554,11 @@ int initialize(int argc, char *argv[]) {
   }
 
   if ((!multi) && (color_mode==PLANE_INT))
+    {
     if (components>1) {
       fprintf(stderr,"\nERROR: Cannot use -P (PPM output) with plane intereleaved mode\n");
       exit(10);
+      }
     }
   else multi=1;
 
@@ -570,7 +572,7 @@ int initialize(int argc, char *argv[]) {
   }
 
   if ((multi) && (out_files) && (out_files!=components)) {
-    fprintf(stderr,"ERROR: Number of files, %d%, for output must be equal to number of image components, %d\n",out_files,components);
+    fprintf(stderr,"ERROR: Number of files, %d, for output must be equal to number of image components, %d\n",out_files,components);
     exit(10);
   }
 
@@ -613,6 +615,8 @@ int initialize(int argc, char *argv[]) {
   }
 
 
+  /* msgfile seems to start being used here, let's initialize it here */
+  if ( !msgfile ) msgfile = stdout;
   /* Open out file */
   if ( outfilename == NULL ) {
     usage();
@@ -865,7 +869,7 @@ int initialize(int argc, char *argv[]) {
 int main (int argc, char *argv[]) {
   int n,n_c,n_r,my_i,n_s,mk,seek_return;
   int found_EOF = 0;
-  double t0, t1, get_utime();
+  double t0, t1; /*, get_utime();*/
   long pos0, pos1,    
     tot_in = 0,
     tot_out = 0;
@@ -875,7 +879,7 @@ int main (int argc, char *argv[]) {
   
   /* Parse the parameters, initialize */
   /* Not yet fully implemented */
-  bufiinit();
+  bufiinit(NULL);
   pos0 = initialize(argc, argv); 
 
 
@@ -1474,7 +1478,7 @@ int main (int argc, char *argv[]) {
 
 
 
-usage()
+void usage()
 {
   fprintf(stderr,"Usage: %s [flags] [infile] [outfile1 [outfile2, ...]]\n\
 DEFAULTS:\n\
@@ -1500,7 +1504,7 @@ outfile2, ... : Multiple output specification for plane or line int. mode.\n\
 }
 
 
-bad_flag(char *s)
+void bad_flag(char *s)
 {
     fprintf(stderr,"Bad flag %s\n",s);
     usage();
index 62922b4fb062516dfee600232420bbd58f295599..55d1ddc7e9034ea865940fe29768bcbfe289c1e7 100644 (file)
@@ -51,6 +51,7 @@
  */
 
 #include <time.h>
+#include <unistd.h>
 #include "global.h"
 
 
@@ -69,7 +70,7 @@ without the written permission of the copyright holder.\n\
 FILE *in, *out;
 FILE *c_in[MAX_COMPONENTS];
 FILE *c_out[MAX_COMPONENTS];
-FILE *msgfile = stdout;
+FILE *msgfile = NULL; // = stdout;
 
 /* Context quantization thresholds  - initially unset */
 int     T3 = -1,
@@ -141,13 +142,14 @@ void *safecalloc(size_t numels, size_t size) {
 double get_utime()
 {
   clock_t c;
+  (void)c;
 
   return (double)clock()/CLOCKS_PER_SEC;
 }
 
 
 /* Set thresholds to default unless specified by header: */
-set_thresholds(int alfa, int NEAR, int *T1p, int *T2p, int *T3p)
+int set_thresholds(int alfa, int NEAR, int *T1p, int *T2p, int *T3p)
 {
   int lambda,
       ilambda = 256/alfa,
@@ -155,6 +157,8 @@ set_thresholds(int alfa, int NEAR, int *T1p, int *T2p, int *T3p)
       T1 = *T1p, 
       T2 = *T2p, 
       T3 = *T3p;
+  /* Unused */
+  (void)quant;
   
   if (alfa<4096)
      lambda = (alfa+127)/256;
@@ -220,7 +224,7 @@ set_thresholds(int alfa, int NEAR, int *T1p, int *T2p, int *T3p)
 
 /* We first check compatibility with JPEG-LS, then with this implementation */
 
-void check_compatibility(jpeg_ls_header *head_frame, jpeg_ls_header *head_scan, int n_s) 
+void check_compatibility(jpeg_ls_header *head_frame, jpeg_ls_header *head_scan, int n_s)
 {
 
     int  number_of_scans,i;  
@@ -322,7 +326,7 @@ char *ttyfilename = "CON";
 
 #define PAUSE  20
 
-fprint_disclaimer(FILE *fp, int nopause)
+void fprint_disclaimer(FILE *fp, int nopause)
 {
     char *p0, *p1;
     FILE *ttyf;
index 8f80731f7da4c2abf3bcfbd207b49ae811903bc5..9277ea5469c08947aa42bfee2625116f755c0ebd 100644 (file)
@@ -95,7 +95,9 @@ extern char  *plane_int_string,
       *pixel_int_string;
 
 
+#ifndef BIG_ENDIAN
 #define BIG_ENDIAN  1
+#endif
 
 typedef struct  jpeg_ls {
 
@@ -334,6 +336,9 @@ extern int  N[TOT_CONTEXTS],
 void error(char *msg);
 void *safealloc(size_t size);
 void *safecalloc(size_t numels, size_t size);
+double get_utime();
+int set_thresholds(int alfa, int NEAR, int *T1p, int *T2p, int *T3p);
+void check_compatibility(jpeg_ls_header *head_frame, jpeg_ls_header *head_scan, int n_s);
 
 /* scanline.c */
 void prepareLUTs();
@@ -348,6 +353,8 @@ void bitiinit();
 void bitflush();
 void createzeroLUT();
 void buffinit(FILE *);
+void bufiinit(FILE *fil);
+void bitiflush();
 
 /*  melcode.c */
 void init_process_run(int);
@@ -359,6 +366,15 @@ void prepareLUTs();
 void prepare_qtables(int, int);
 void init_stats(int);
 
+/* lossless_d.c */
+int lossless_undoscanline(  pixel *psl, pixel *sl, int no, int color);
+int lossless_undoscanline_pixel(pixel *psl, pixel *sl, int no);
+
+/* lossy_d.c */
+int lossy_undoscanline(  pixel *psl, pixel *sl, int no, int color);
+int lossy_undoscanline_pixel(  pixel *psl, pixel *sl, int no);
+
+
 #ifdef BIG_ENDIAN
 #    define ENDIAN8(x)   (x)
 #    define ENDIAN16(x)   (x)
index 6fe30cceedf10ea586dfd10dae3c97a01be18d36..ad887540bc4706271b572e6cb6bf787c02041257 100644 (file)
@@ -77,7 +77,6 @@ int N[TOT_CONTEXTS],
 void prepareLUTs()
 {
   int i, j, idx, lmax;
-  byte k;
 
   lmax = min(alpha,lutmax);
   
index 64dcc88b756e1c3152e807e375907fa73f716908..c6c092bc7a2a8917ba44ceb7c7563ea9688f21d9 100644 (file)
@@ -211,7 +211,7 @@ write_jpegls_scan(FILE *out, jpeg_ls_header *jp)
 int
 write_jpegls_extmarker(FILE *out, jpeg_ls_header *jp)
 {
-    int marker_len, ct=0;
+    int ct=0;
      
     ct += write_marker(out, LSE);   /* write JPEG-LS extended marker id */
 
@@ -270,7 +270,7 @@ int
 read_marker(FILE *in, int *mkp)
 /* reads a marker from the next two bytes in the input stream */
 {
-  unsigned int m, ct=0;
+  unsigned int m;
 
   m = read_n_bytes(in, 2);
   if ( feof(in) ) return EOF;
@@ -434,7 +434,6 @@ int read_jpegls_extmarker(FILE *in, jpeg_ls_header *jp)
 {
     int marker_len,    /* marker length */
     maxval,      /* max value */
-    T1, T2, T3,    /* thresholds */
     ct = 0;      
   int IDtype;      /* LSE type */
   int TID;      /* table ID */
index 2b1a02bee7111dba9497019ca6298aae8378a83a..fe48d2f17bf222cf8497d52312a3ce72a827fa9e 100644 (file)
@@ -94,3 +94,5 @@ int seek_marker(FILE *in, int *mkp);
 int read_jpegls_frame(FILE *in, jpeg_ls_header *jp);
 int read_jpegls_scan(FILE *in, jpeg_ls_header *jp);
 int read_jpegls_extmarker(FILE *in, jpeg_ls_header *jp);
+
+int read_jpegls_restartmarker(FILE *in, jpeg_ls_header *jp);
index a99a73e9a5d846182b7976c76fc8c4989ea000ca..3887127b054fc08c8ebc7efc631ef2ffaaed6103 100644 (file)
@@ -73,7 +73,7 @@ inline int lossless_regular_mode_d(int Q, int SIGN, int Px)
   At = A[Q];
   {
     /* Estimate k */
-      register nst = Nt;
+      register int nst = Nt;
       for(k=0; nst < At; nst *=2, k++);
   }
 
@@ -542,7 +542,7 @@ int lossless_undoscanline_pixel(pixel *psl,    /* previous scanline */
 /*** watch it! actual pixels in the scan line are numbered 1 to no .
      pixels with indices < 1 or > no are dummy "border" pixels  */
 {
-  int i, psfix, n_c, color, enter_run=0, break_run, was_in_run = 0,
+  int i, psfix, n_c, color, enter_run=0, was_in_run = 0,
       test_run;
   pixel Ra, Rb, Rc, Rd;
   pixel c_aa[MAX_COMPONENTS],
index 7046e3ee7479795ad98d3e69305ceed98bad677e..113080141b38f6dc39c7fe379d53bcaf8a9c14ee 100644 (file)
@@ -72,7 +72,7 @@ inline int lossy_regular_mode_d(int Q, int SIGN, int Px)
   At = A[Q];
   /* Estimate k */
   {
-      register nst = Nt;
+      register int nst = Nt;
       for(k=0; nst < At; nst *=2, k++);
   }
   
@@ -195,8 +195,7 @@ inline int lossy_regular_mode_d(int Q, int SIGN, int Px)
 /* Do end of run DECODING for LOSSY images */
 inline pixel lossy_end_of_run_d(pixel Ra, pixel Rb, int RItype)
 {
-  int xpr,
-    Ix,
+  int Ix,
     Errval,
     absErrval,
     MErrval,
@@ -518,7 +517,7 @@ int lossy_undoscanline_pixel(  pixel *psl,    /* previous scanline */
 /*** watch it! actual pixels in the scan line are numbered 1 to no .
      pixels with indices < 1 or > no are dummy "border" pixels  */
 {
-  int i, psfix, n_c, color, enter_run=0, break_run, was_in_run = 0,
+  int i, psfix, n_c, color, enter_run=0, was_in_run = 0,
       test_run;
   pixel Ra, Rb, Rc, Rd;
   pixel c_aa[MAX_COMPONENTS],
index 82e5cbc045374e2a605193016a228c73b7adb5ea..0c70528bf19585464e388db86f52ea57446b6eae 100644 (file)
@@ -57,7 +57,7 @@
 
 #define MELCSTATES  32  /* number of melcode states */
 
-static J[MELCSTATES] = {
+static int J[MELCSTATES] = {
   0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,5,5,6,6,7,
   7,8,9,10,11,12,13,14,15 
 };
@@ -78,6 +78,7 @@ void init_process_run(int maxrun)    /* maxrun is ignoreed when using MELCODE,
           kept here for function compatibility */            
 {
   int  n_c;
+  (void)maxrun;
 
   for (n_c=0;n_c<components;n_c++)
   {
@@ -97,7 +98,7 @@ int process_run_dec(int lineleft, int color)
   int runlen = 0;
     
   do {
-    register temp, hits;
+    register int temp, hits;
     temp = zeroLUT[(byte)(~(reg >> 24))];   /* number of leading ones in the
                  input stream, up to 8 */
     for ( hits = 1; hits<=temp; hits++ ) 
@@ -131,7 +132,7 @@ int process_run_dec(int lineleft, int color)
   /* read the length of the remainder */
   if ( melclen[color] ) 
   {
-    register temp;
+    register int temp;
     GETBITS(temp, melclen[color]);  /*** GETBITS is a macro, not a function */
     runlen += temp;
   }