Skip to content

Commit

Permalink
fixed some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter J. Verveer committed Oct 20, 2016
1 parent 12246af commit cbd0c26
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
6 changes: 4 additions & 2 deletions libics_binary.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Ics_Error IcsWritePlainWithStrides (void const* src, size_t const* dim,
size_t curpos[ICS_MAXDIM];
char const* data;
int ii;
size_t jj;

for (ii = 0; ii < ndims; ii++) {
curpos[ii] = 0;
Expand All @@ -84,7 +85,7 @@ Ics_Error IcsWritePlainWithStrides (void const* src, size_t const* dim,
}
}
else {
for (ii = 0; ii < dim[0]; ii++) {
for (jj = 0; jj < dim[0]; jj++) {
if (fwrite (data, nbytes, 1, file) != 1) {
return IcsErr_FWriteIds;
}
Expand Down Expand Up @@ -195,7 +196,8 @@ Ics_Error IcsCopyIds (char const* infilename, size_t inoffset, char const* outfi
FILE* in = 0;
FILE* out = 0;
char* buffer = 0;
int done = 0, n;
int done = 0;
size_t n;

/* Open files */
in = IcsFOpen (infilename, "rb");
Expand Down
4 changes: 2 additions & 2 deletions libics_compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ Ics_Error IcsReadCompress (Ics_Header* IcsStruct, void* outbuf, size_t len)
size_t rsize;
int block_mode;
int maxbits;
int ii;
int offset;
size_t ii;
size_t offset;
unsigned char *inbuf = NULL;
unsigned char *htab = NULL;
unsigned short *codetab = NULL;
Expand Down
5 changes: 3 additions & 2 deletions libics_gzip.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Ics_Error IcsWriteZip (void const* inbuf, size_t len, FILE* file, int level)
{
#ifdef ICS_ZLIB
z_stream stream;
Byte* outbuf; /* output buffer */ int err, done, flush;
Byte* outbuf; /* output buffer */ int err, flush;
size_t total_count;
unsigned int have;
uLong crc;
Expand Down Expand Up @@ -208,6 +208,7 @@ Ics_Error IcsWriteZipWithStrides (void const* src, size_t const* dim,
size_t curpos[ICS_MAXDIM];
char const* data;
int ii, err, done;
size_t jj;
size_t count, total_count = 0;
uLong crc;
int const contiguous_line = stride[0]==1;
Expand Down Expand Up @@ -262,7 +263,7 @@ Ics_Error IcsWriteZipWithStrides (void const* src, size_t const* dim,
}
else {
inbuf_ptr = inbuf;
for (ii = 0; ii < dim[0]; ii++) {
for (jj = 0; jj < dim[0]; jj++) {
memcpy (inbuf_ptr, data, nbytes);
data += stride[0]*nbytes;
inbuf_ptr += nbytes;
Expand Down
2 changes: 1 addition & 1 deletion libics_history.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Ics_Error IcsInternAddHistory (Ics_Header* ics, char const* key, char const* val
hist = (Ics_History*)ics->History;
}
/* Reallocate if array is not large enough */
if (hist->NStr >= hist->Length) {
if ((size_t)hist->NStr >= hist->Length) {
char** tmp = (char**)realloc (hist->Strings, (hist->Length+ICS_HISTARRAY_INCREMENT)*sizeof (char*));
ICSTR( tmp == NULL, IcsErr_Alloc );
hist->Strings = tmp;
Expand Down
11 changes: 7 additions & 4 deletions libics_top.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ char const* ICSKEY_LABEL[] = {"x-position", "y-position", "z-position",
Ics_Error IcsOpen (ICS* *ics, char const* filename, char const* mode)
{
ICSINIT;
int ii, version = 0, forcename = 0, forcelocale = 1, reading = 0, writing = 0;
int version = 0, forcename = 0, forcelocale = 1, reading = 0, writing = 0;
size_t ii;

/* the mode string is one of: "r", "w", "rw", with "f" and/or "l" appended for
reading and "1" or "2" appended for writing */
Expand Down Expand Up @@ -359,6 +360,7 @@ Ics_Error IcsGetROIData (ICS* ics, size_t const* p_offset, size_t const* p_size,
{
ICSDECL;
int ii, sizeconflict = 0, p;
size_t jj;
size_t imelsize, roisize, cur_loc, new_loc, bufsize;
size_t curpos[ICS_MAXDIM];
size_t stride[ICS_MAXDIM];
Expand Down Expand Up @@ -443,7 +445,7 @@ Ics_Error IcsGetROIData (ICS* ics, size_t const* p_offset, size_t const* p_size,
break; /* stop reading on error */
}
cur_loc += bufsize;
for (ii=0; ii<size[0]; ii+=sampling[0]) {
for (jj=0; jj<size[0]; jj+=sampling[0]) {
memcpy (dest, buf+ii*imelsize, imelsize);
dest += imelsize;
}
Expand Down Expand Up @@ -509,6 +511,7 @@ Ics_Error IcsGetDataWithStrides (ICS* ics, void* p_dest, size_t n, size_t const*
{
ICSDECL;
int ii, p;
size_t jj;
size_t imelsize, lastpixel, bufsize;
size_t curpos[ICS_MAXDIM];
size_t b_stride[ICS_MAXDIM];
Expand Down Expand Up @@ -556,8 +559,8 @@ Ics_Error IcsGetDataWithStrides (ICS* ics, void* p_dest, size_t n, size_t const*
if (error != IcsErr_Ok) {
break; /* stop reading on error */
}
for (ii = 0; ii < ics->Dim[0].Size; ii++) {
memcpy (out, buf+ii*imelsize, imelsize);
for (jj = 0; jj < ics->Dim[0].Size; jj++) {
memcpy (out, buf+jj*imelsize, imelsize);
out += stride[0]*imelsize;
}
for (ii = 1; ii < p; ii++) {
Expand Down

0 comments on commit cbd0c26

Please sign in to comment.