diff --git a/libics_binary.c b/libics_binary.c index 7f43d29..3bde35b 100644 --- a/libics_binary.c +++ b/libics_binary.c @@ -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; @@ -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; } @@ -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"); diff --git a/libics_compress.c b/libics_compress.c index d16ba4c..9e184ee 100644 --- a/libics_compress.c +++ b/libics_compress.c @@ -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; diff --git a/libics_gzip.c b/libics_gzip.c index 79d218f..3590935 100644 --- a/libics_gzip.c +++ b/libics_gzip.c @@ -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; @@ -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; @@ -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; diff --git a/libics_history.c b/libics_history.c index 3173e06..c59d87c 100644 --- a/libics_history.c +++ b/libics_history.c @@ -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; diff --git a/libics_top.c b/libics_top.c index 1c5f34b..14557ec 100644 --- a/libics_top.c +++ b/libics_top.c @@ -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 */ @@ -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]; @@ -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; iiDim[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++) {