[g2clib] Fix compiler warnings

This commit is contained in:
Roland Winklmeier
2016-01-11 17:34:09 +01:00
parent f290f09d4e
commit f4f5999595
15 changed files with 28 additions and 27 deletions

View File

@@ -67,7 +67,7 @@ void compack(g2float *fld,g2int ndpts,g2int idrsnum,g2int *idrstmpl,
static g2int zero=0; static g2int zero=0;
g2int *ifld,*gref,*glen,*gwidth; g2int *ifld,*gref,*glen,*gwidth;
g2int *jmin, *jmax, *lbit; g2int *jmin, *jmax, *lbit;
g2int i,j,n,nbits,imin,imax,left; g2int i,j,n,imin,imax,left;
g2int isd,itemp,ilmax,ngwidthref=0,nbitsgwidth=0; g2int isd,itemp,ilmax,ngwidthref=0,nbitsgwidth=0;
g2int nglenref=0,nglenlast=0,iofst,ival1,ival2; g2int nglenref=0,nglenlast=0,iofst,ival1,ival2;
g2int minsd,nbitsd=0,maxorig,nbitorig,ngroups; g2int minsd,nbitsd=0,maxorig,nbitorig,ngroups;
@@ -385,7 +385,6 @@ void compack(g2float *fld,g2int ndpts,g2int idrsnum,g2int *idrstmpl,
if ( glen!=0 ) free(glen); if ( glen!=0 ) free(glen);
} }
else { // Constant field ( max = min ) else { // Constant field ( max = min )
nbits=0;
*lcpack=0; *lcpack=0;
nbitsgref=0; nbitsgref=0;
ngroups=0; ngroups=0;

View File

@@ -50,7 +50,6 @@
*$$$*/ *$$$*/
{ {
int ier;
g2int i,j,k; g2int i,j,k;
jas_image_t *image=0; jas_image_t *image=0;
jas_stream_t *jpcstream; jas_stream_t *jpcstream;
@@ -60,7 +59,6 @@
// jas_init(); // jas_init();
ier=0;
// //
// Create jas_stream_t containing input JPEG200 codestream in memory. // Create jas_stream_t containing input JPEG200 codestream in memory.
// //
@@ -133,7 +131,7 @@
// Clean up JasPer work structures. // Clean up JasPer work structures.
// //
jas_matrix_destroy(data); jas_matrix_destroy(data);
ier=jas_stream_close(jpcstream); jas_stream_close(jpcstream);
jas_image_destroy(image); jas_image_destroy(image);
return 0; return 0;

View File

@@ -167,8 +167,8 @@ int enc_jpeg2000(unsigned char *cin,g2int width,g2int height,g2int nbits,
// Clean up JasPer work structures. // Clean up JasPer work structures.
// //
rwcnt=jpcstream->rwcnt_; rwcnt=jpcstream->rwcnt_;
ier=jas_stream_close(istream); jas_stream_close(istream);
ier=jas_stream_close(jpcstream); jas_stream_close(jpcstream);
// //
// Return size of jpeg2000 code stream // Return size of jpeg2000 code stream
// //

View File

@@ -43,8 +43,6 @@ void user_flush_data(png_structp png_ptr)
Dummy Custom flush function Dummy Custom flush function
*/ */
{ {
int *do_nothing;
do_nothing=NULL;
} }

View File

@@ -131,11 +131,17 @@ g2int g2_addfield(unsigned char *cgrib,g2int ipdsnum,g2int *ipdstmpl,
g2int lensec4,lensec5,lensec6,lensec7; g2int lensec4,lensec5,lensec6,lensec7;
g2int issec3,isprevbmap,lpos3=0,JJ,KK,MM; g2int issec3,isprevbmap,lpos3=0,JJ,KK,MM;
g2int *coordieee; g2int *coordieee;
g2int width,height,iscan,itemp; g2int width=0,height=0,iscan=0,itemp=0;
g2float *pfld; g2float *pfld;
gtemplate *mappds,*mapdrs; gtemplate *mappds,*mapdrs;
unsigned int allones=4294967295u; unsigned int allones=4294967295u;
(void) width;
(void) height;
(void) iscan;
(void) itemp;
(void) allones;
ierr=0; ierr=0;
// //
// Check to see if beginning of GRIB message exists // Check to see if beginning of GRIB message exists

View File

@@ -340,7 +340,6 @@ g2int g2_getfld(unsigned char *cgrib,g2int ifldnum,g2int unpack,g2int expand,
break; break;
} }
// Get length of Section and Section number // Get length of Section and Section number
iofst=(ipos-1)*8;
iofst=ipos*8; iofst=ipos*8;
gbit(cgrib,&lensec,iofst,32); // Get Length of Section gbit(cgrib,&lensec,iofst,32); // Get Length of Section
iofst=iofst+32; iofst=iofst+32;

View File

@@ -119,7 +119,6 @@ g2int g2_unpack3(unsigned char *cgrib,g2int *iofst,g2int **igds,g2int **igdstmpl
// corresponding entries in array mapgrid. // corresponding entries in array mapgrid.
// //
if (*mapgridlen > 0) { if (*mapgridlen > 0) {
ligdstmpl=0;
ligdstmpl=(g2int *)calloc(*mapgridlen,sizeof(g2int)); ligdstmpl=(g2int *)calloc(*mapgridlen,sizeof(g2int));
if (ligdstmpl == 0) { if (ligdstmpl == 0) {
ierr=6; ierr=6;

View File

@@ -40,7 +40,7 @@ g2int jpcunpack(unsigned char *cpack,g2int len,g2int *idrstmpl,g2int ndpts,
{ {
g2int *ifld; g2int *ifld;
g2int j,nbits,iret; g2int j,nbits;
g2float ref,bscale,dscale; g2float ref,bscale,dscale;
rdieee(idrstmpl+0,&ref,1); rdieee(idrstmpl+0,&ref,1);
@@ -58,7 +58,7 @@ g2int jpcunpack(unsigned char *cpack,g2int len,g2int *idrstmpl,g2int ndpts,
fprintf(stderr,"Could not allocate space in jpcunpack.\n Data field NOT upacked.\n"); fprintf(stderr,"Could not allocate space in jpcunpack.\n Data field NOT upacked.\n");
return(1); return(1);
} }
iret=(g2int)dec_jpeg2000(cpack,len,ifld); dec_jpeg2000(cpack,len,ifld);
for (j=0;j<ndpts;j++) { for (j=0;j<ndpts;j++) {
fld[j]=(((g2float)ifld[j]*bscale)+ref)*dscale; fld[j]=(((g2float)ifld[j]*bscale)+ref)*dscale;
} }

View File

@@ -81,6 +81,8 @@ void misspack(g2float *fld,g2int ndpts,g2int idrsnum,g2int *idrstmpl,
static g2float alog2=0.69314718; // ln(2.0) static g2float alog2=0.69314718; // ln(2.0)
static g2int one=1; static g2int one=1;
(void) ij;
bscale=int_power(2.0,-idrstmpl[1]); bscale=int_power(2.0,-idrstmpl[1]);
dscale=int_power(10.0,idrstmpl[2]); dscale=int_power(10.0,idrstmpl[2]);
missopt=idrstmpl[6]; missopt=idrstmpl[6];

View File

@@ -36,7 +36,8 @@ void mkieee(g2float *a,g2int *rieee,g2int num)
{ {
g2int j,n,ieee,iexp,imant; g2int j,n,ieee,iexp,imant;
double alog2,atemp; //double alog2,atemp;
double atemp;
static double two23,two126; static double two23,two126;
static g2int test=0; static g2int test=0;
@@ -50,7 +51,7 @@ void mkieee(g2float *a,g2int *rieee,g2int num)
test=1; test=1;
} }
alog2=0.69314718; // ln(2.0) //alog2=0.69314718; // ln(2.0)
for (j=0;j<num;j++) { for (j=0;j<num;j++) {

View File

@@ -40,7 +40,7 @@ g2int pngunpack(unsigned char *cpack,g2int len,g2int *idrstmpl,g2int ndpts,
{ {
g2int *ifld; g2int *ifld;
g2int j,nbits,iret,width,height; g2int j,nbits,width,height;
g2float ref,bscale,dscale; g2float ref,bscale,dscale;
unsigned char *ctemp; unsigned char *ctemp;
@@ -60,7 +60,7 @@ g2int pngunpack(unsigned char *cpack,g2int len,g2int *idrstmpl,g2int ndpts,
fprintf(stderr,"Could not allocate space in jpcunpack.\n Data field NOT upacked.\n"); fprintf(stderr,"Could not allocate space in jpcunpack.\n Data field NOT upacked.\n");
return(1); return(1);
} }
iret=(g2int)dec_png(cpack,&width,&height,ctemp); dec_png(cpack,&width,&height,ctemp);
gbits(ctemp,ifld,0,nbits,0,ndpts); gbits(ctemp,ifld,0,nbits,0,ndpts);
for (j=0;j<ndpts;j++) { for (j=0;j<ndpts;j++) {
fld[j]=(((g2float)ifld[j]*bscale)+ref)*dscale; fld[j]=(((g2float)ifld[j]*bscale)+ref)*dscale;

View File

@@ -37,6 +37,8 @@ typedef g2float real;
ntotbt[31], ntotpr, newboxt; ntotbt[31], ntotpr, newboxt;
integer *newbox, *newboxp; integer *newbox, *newboxp;
(void) kfildo;
(void) nboxj;
/* NOVEMBER 2001 GLAHN TDL GRIB2 */ /* NOVEMBER 2001 GLAHN TDL GRIB2 */
/* MARCH 2002 GLAHN COMMENT IER = 715 */ /* MARCH 2002 GLAHN COMMENT IER = 715 */

View File

@@ -35,7 +35,6 @@ void seekgb(FILE *lugb,g2int iseek,g2int mseek,g2int *lskip,g2int *lgrib)
// //
//$$$ //$$$
{ {
g2int ret;
g2int k,k4,ipos,nread,lim,start,vers,lengrib; g2int k,k4,ipos,nread,lim,start,vers,lengrib;
int end; int end;
unsigned char *cbuf; unsigned char *cbuf;
@@ -53,7 +52,7 @@ void seekgb(FILE *lugb,g2int iseek,g2int mseek,g2int *lskip,g2int *lgrib)
// READ PARTIAL SECTION // READ PARTIAL SECTION
ret=fseek(lugb,ipos,SEEK_SET); fseek(lugb,ipos,SEEK_SET);
nread=fread(cbuf,sizeof(unsigned char),mseek,lugb); nread=fread(cbuf,sizeof(unsigned char),mseek,lugb);
lim=nread-8; lim=nread-8;
@@ -66,7 +65,7 @@ void seekgb(FILE *lugb,g2int iseek,g2int mseek,g2int *lskip,g2int *lgrib)
// LOOK FOR '7777' AT END OF GRIB MESSAGE // LOOK FOR '7777' AT END OF GRIB MESSAGE
if (vers == 1) gbit(cbuf,&lengrib,(k+4)*8,3*8); if (vers == 1) gbit(cbuf,&lengrib,(k+4)*8,3*8);
if (vers == 2) gbit(cbuf,&lengrib,(k+12)*8,4*8); if (vers == 2) gbit(cbuf,&lengrib,(k+12)*8,4*8);
ret=fseek(lugb,ipos+k+lengrib-4,SEEK_SET); fseek(lugb,ipos+k+lengrib-4,SEEK_SET);
// Hard code to 4 instead of sizeof(g2int) // Hard code to 4 instead of sizeof(g2int)
k4=fread(&end,4,1,lugb); k4=fread(&end,4,1,lugb);
if (k4 == 1 && end == 926365495) { //GRIB message found if (k4 == 1 && end == 926365495) { //GRIB message found

View File

@@ -39,15 +39,13 @@ g2int simunpack(unsigned char *cpack,g2int *idrstmpl,g2int ndpts,g2float *fld)
{ {
g2int *ifld; g2int *ifld;
g2int j,nbits,itype; g2int j,nbits;
g2float ref,bscale,dscale; g2float ref,bscale,dscale;
rdieee(idrstmpl+0,&ref,1); rdieee(idrstmpl+0,&ref,1);
bscale = int_power(2.0,idrstmpl[1]); bscale = int_power(2.0,idrstmpl[1]);
dscale = int_power(10.0,-idrstmpl[2]); dscale = int_power(10.0,-idrstmpl[2]);
nbits = idrstmpl[3]; nbits = idrstmpl[3];
itype = idrstmpl[4];
ifld=(g2int *)calloc((ndpts ? ndpts : 1),sizeof(g2int)); ifld=(g2int *)calloc((ndpts ? ndpts : 1),sizeof(g2int));
if ( ifld == 0 ) { if ( ifld == 0 ) {

View File

@@ -43,12 +43,12 @@ void specpack(g2float *fld,g2int ndpts,g2int JJ,g2int KK,g2int MM,
{ {
g2int *ifld,tmplsim[5]; g2int *ifld,tmplsim[5];
g2float bscale,dscale,*unpk,*tfld; g2float *unpk,*tfld;
g2float *pscale,tscale; g2float *pscale,tscale;
g2int Js,Ks,Ms,Ts,Ns,inc,incu,incp,n,Nm,m,ipos; g2int Js,Ks,Ms,Ts,Ns,inc,incu,incp,n,Nm,m,ipos;
bscale = int_power(2.0,-idrstmpl[1]); int_power(2.0,-idrstmpl[1]);
dscale = int_power(10.0,idrstmpl[2]); int_power(10.0,idrstmpl[2]);
Js=idrstmpl[5]; Js=idrstmpl[5];
Ks=idrstmpl[6]; Ks=idrstmpl[6];
Ms=idrstmpl[7]; Ms=idrstmpl[7];