Fixing int/size_t warnings
authorjongfoster <jongfoster@users.sourceforge.net>
Fri, 8 Mar 2002 17:46:04 +0000 (17:46 +0000)
committerjongfoster <jongfoster@users.sourceforge.net>
Fri, 8 Mar 2002 17:46:04 +0000 (17:46 +0000)
deanimate.c
deanimate.h
gateway.c
loaders.c

index 5eaccb3..2233dcc 100644 (file)
@@ -1,4 +1,4 @@
-const char deanimate_rcs[] = "$Id: deanimate.c,v 1.5 2001/09/10 10:16:06 oes Exp $";
+const char deanimate_rcs[] = "$Id: deanimate.c,v 1.6 2002/03/07 03:46:17 oes Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/deanimate.c,v $
@@ -37,6 +37,9 @@ const char deanimate_rcs[] = "$Id: deanimate.c,v 1.5 2001/09/10 10:16:06 oes Exp
  *
  * Revisions   :
  *    $Log: deanimate.c,v $
+ *    Revision 1.6  2002/03/07 03:46:17  oes
+ *    Fixed compiler warnings
+ *
  *    Revision 1.5  2001/09/10 10:16:06  oes
  *    Silenced compiler warnings
  *
@@ -100,7 +103,7 @@ void buf_free(struct binbuffer *buf)
  *
  * Description :  Ensure that a given binbuffer can hold a given amount
  *                of bytes, by reallocating its buffer if necessary.
- *                Allocate new mem in chunks of 1000 bytes, so we don't
+ *                Allocate new mem in chunks of 1024 bytes, so we don't
  *                have to realloc() too often.
  *
  * Parameters  :
@@ -117,7 +120,7 @@ int buf_extend(struct binbuffer *buf, size_t length)
 
    if (buf->offset + length > buf->size)
    {
-      buf->size = buf->size + length + 1000 - (buf->size + length) % 1000;
+      buf->size = ((buf->size + length + 1023) & ~1023);
       newbuf = (char *)realloc(buf->buffer, buf->size);
 
       if (newbuf == NULL)
@@ -198,7 +201,7 @@ int buf_copy(struct binbuffer *src, struct binbuffer *dst, size_t length)
  * Returns     :  The byte on success, or 0 on failiure
  *
  *********************************************************************/
-unsigned char buf_getbyte(struct binbuffer *src, int offset)
+unsigned char buf_getbyte(struct binbuffer *src, size_t offset)
 {
    if (src->offset + offset < src->size)
    {
@@ -296,14 +299,14 @@ int gif_extract_image(struct binbuffer *src, struct binbuffer *dst)
     */
    while((c = buf_getbyte(src, 0)))
    {
-      if (buf_copy(src, dst, (size_t) c + 1)) return 1;
+      if (buf_copy(src, dst, 1 + (size_t) c)) return 1;
    }
    if (buf_copy(src, dst, 1)) return 1;
 
    /*
     * Trim and rewind the dst buffer
     */
-   if (NULL == (dst->buffer = (char *)realloc(dst->buffer, (size_t) dst->offset))) return 1;
+   if (NULL == (dst->buffer = (char *)realloc(dst->buffer, dst->offset))) return 1;
    dst->size = dst->offset;
    dst->offset = 0;
 
index 0445ef9..ab24589 100644 (file)
@@ -1,6 +1,6 @@
 #ifndef DEANIMATE_H_INCLUDED
 #define DEANIMATE_H_INCLUDED
-#define DEANIMATE_H_VERSION "$Id: deanimate.h,v 1.4 2001/07/29 18:50:04 jongfoster Exp $"
+#define DEANIMATE_H_VERSION "$Id: deanimate.h,v 1.5 2002/03/07 03:46:17 oes Exp $"
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/deanimate.h,v $
@@ -40,6 +40,9 @@
  *
  * Revisions   :
  *    $Log: deanimate.h,v $
+ *    Revision 1.5  2002/03/07 03:46:17  oes
+ *    Fixed compiler warnings
+ *
  *    Revision 1.4  2001/07/29 18:50:04  jongfoster
  *    Fixing "extern C" block, and renaming #define _DEANIMATE_H
  *
@@ -64,7 +67,7 @@ extern "C" {
 struct binbuffer
 {
    char *buffer; 
-   int offset;   
+   size_t offset;   
    size_t size;    
 };
 
index 2ad02c5..2e4cbe2 100644 (file)
--- a/gateway.c
+++ b/gateway.c
@@ -1,4 +1,4 @@
-const char gateway_rcs[] = "$Id: gateway.c,v 1.9 2001/10/25 03:40:48 david__schmidt Exp $";
+const char gateway_rcs[] = "$Id: gateway.c,v 1.10 2002/03/07 03:50:19 oes Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/gateway.c,v $
@@ -34,6 +34,10 @@ const char gateway_rcs[] = "$Id: gateway.c,v 1.9 2001/10/25 03:40:48 david__schm
  *
  * Revisions   :
  *    $Log: gateway.c,v $
+ *    Revision 1.10  2002/03/07 03:50:19  oes
+ *     - Improved handling of failed DNS lookups
+ *     - Fixed compiler warnings
+ *
  *    Revision 1.9  2001/10/25 03:40:48  david__schmidt
  *    Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
  *    threads to call select() simultaneously.  So, it's time to do a real, live,
@@ -224,7 +228,7 @@ static int socks4_connect(const struct forward_spec * fwd,
    char sbuf[BUFFER_SIZE];
    struct socks_op    *c = (struct socks_op    *)cbuf;
    struct socks_reply *s = (struct socks_reply *)sbuf;
-   int n;
+   size_t n;
    size_t csiz;
    int sfd;
    int err = 0;
@@ -299,14 +303,14 @@ static int socks4_connect(const struct forward_spec * fwd,
       return(-1);
    }
 
-   if ((n = write_socket(sfd, (char *)c, csiz)) != csiz)
+   if (write_socket(sfd, (char *)c, csiz) != csiz)
    {
       log_error(LOG_LEVEL_CONNECT, "SOCKS4 negotiation write failed...");
       close_socket(sfd);
       return(-1);
    }
 
-   if ((n = read_socket(sfd, sbuf, sizeof(sbuf))) != sizeof(*s))
+   if (read_socket(sfd, sbuf, sizeof(sbuf)) != sizeof(*s))
    {
       log_error(LOG_LEVEL_CONNECT, "SOCKS4 negotiation read failed...");
       close_socket(sfd);
index d0fcd56..585ab75 100644 (file)
--- a/loaders.c
+++ b/loaders.c
@@ -1,4 +1,4 @@
-const char loaders_rcs[] = "$Id: loaders.c,v 1.38 2002/03/06 22:54:35 jongfoster Exp $";
+const char loaders_rcs[] = "$Id: loaders.c,v 1.39 2002/03/07 03:46:17 oes Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/loaders.c,v $
@@ -35,6 +35,9 @@ const char loaders_rcs[] = "$Id: loaders.c,v 1.38 2002/03/06 22:54:35 jongfoster
  *
  * Revisions   :
  *    $Log: loaders.c,v $
+ *    Revision 1.39  2002/03/07 03:46:17  oes
+ *    Fixed compiler warnings
+ *
  *    Revision 1.38  2002/03/06 22:54:35  jongfoster
  *    Automated function-comment nitpicking.
  *
@@ -492,7 +495,7 @@ int check_file_changed(const struct file_list * current,
  *********************************************************************/
 jb_err simple_read_line(FILE *fp, char **dest, int *newline)
 {
-   int len = 0;
+   size_t len = 0;
    size_t buflen = BUFFER_SIZE;
    char * buf;
    char * p;