ICC compiler warning fixes.
authorPekka Riikonen <priikone@silcnet.org>
Sat, 1 Sep 2007 09:37:45 +0000 (09:37 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Sat, 1 Sep 2007 09:37:45 +0000 (09:37 +0000)
lib/silcutil/silcbuffmt.c
lib/silcutil/silcfileutil.c
lib/silcutil/silcstack_i.h
lib/silcutil/silctime.c
lib/silcutil/silctime.h
lib/silcutil/silcutil.c

index ff69ac6eab5acdfb8485a94eef1b7ea8c1672d16..36d9b4817bae692966f26b8d3b815b2d69da7348 100644 (file)
@@ -108,11 +108,11 @@ int silc_buffer_sformat_vp(SilcStack stack, SilcBuffer dst, va_list ap)
     case SILC_PARAM_UI16_STRING_ALLOC:
     case SILC_PARAM_UI32_STRING_ALLOC:
       {
-       unsigned char *x = va_arg(ap, unsigned char *);
+       char *x = va_arg(ap, char *);
        SilcUInt32 tmp_len = x ? strlen(x) : 0;
        if (x && tmp_len) {
          FORMAT_HAS_SPACE(stack, dst, tmp_len);
-         silc_buffer_put(dst, x, tmp_len);
+         silc_buffer_put(dst, (unsigned char *)x, tmp_len);
          silc_buffer_pull(dst, tmp_len);
        }
        break;
@@ -179,7 +179,7 @@ int silc_buffer_sformat_vp(SilcStack stack, SilcBuffer dst, va_list ap)
       {
        char x = (char)va_arg(ap, int);
        FORMAT_HAS_SPACE(stack, dst, 1);
-       silc_buffer_put(dst, &x, 1);
+       silc_buffer_put(dst, (unsigned char *)&x, 1);
        silc_buffer_pull(dst, 1);
        break;
       }
index 5404183a6c67a406dcf4f21ee80871420d8c86b2..c28ba38ffcbf41b9faed74c2a3b327da3b7b393f 100644 (file)
@@ -128,7 +128,7 @@ char *silc_file_readfile(const char *filename, SilcUInt32 *return_len,
                         SilcStack stack)
 {
   int fd;
-  char *buffer;
+  unsigned char *buffer;
   int filelen;
 
   fd = silc_file_open(filename, O_RDONLY);
@@ -155,7 +155,7 @@ char *silc_file_readfile(const char *filename, SilcUInt32 *return_len,
     return NULL;
   }
 
-  buffer = silc_calloc(filelen + 1, sizeof(char));
+  buffer = silc_calloc(filelen + 1, sizeof(*buffer));
 
   if ((silc_file_read(fd, buffer, filelen)) == -1) {
     memset(buffer, 0, sizeof(buffer));
@@ -171,7 +171,7 @@ char *silc_file_readfile(const char *filename, SilcUInt32 *return_len,
   if (return_len)
     *return_len = filelen;
 
-  return buffer;
+  return (char *)buffer;
 }
 
 /* Returns the size of `filename'. Returns 0 on error. */
index 712800502762421b50927e2c5ca8fde2ab6e6b90..badc5ff7d5012e514af955cf6801ee39ff127906 100644 (file)
@@ -32,7 +32,7 @@
 #define SILC_STACK_DEFAULT_NUM 32
 
 /* Default alignment */
-#define SILC_STACK_DEFAULT_ALIGN sizeof(unsigned long)
+#define SILC_STACK_DEFAULT_ALIGN SILC_ALIGNMENT
 
 /* Maximum allocation that can be made with SilcStack. */
 #define SILC_STACK_BLOCK_NUM 21
index 639724c4f9d503cfcd8e4b5d2a482aaa21523029..5a91717213dbdee352a43b501105e5dac90e9c1c 100644 (file)
@@ -224,9 +224,9 @@ SilcBool silc_time_universal(const char *universal_time, SilcTime ret_time)
       return FALSE;
     }
 
-    if (hour < 0 || hour > 23)
+    if (hour > 23)
       return FALSE;
-    if (minute < 0 || minute > 60)
+    if (minute > 60)
       return FALSE;
 
     ret_time->utc_hour   = hour;
@@ -342,9 +342,9 @@ SilcBool silc_time_generalized(const char *generalized_time, SilcTime ret_time)
       return FALSE;
     }
 
-    if (hour < 0 || hour > 23)
+    if (hour > 23)
       return FALSE;
-    if (minute < 0 || minute > 60)
+    if (minute > 60)
       return FALSE;
 
     ret_time->utc_hour   = hour;
index 6c22d90ae1a3c7079888dd9e9b84428c973fd691..e01e1ae701f92660debb212b10dae7a6195f7b86 100644 (file)
@@ -276,7 +276,7 @@ int silc_gettimeofday(struct timeval *p);
  *
  * SYNOPSIS
  *
- *    void silc_usleep(long microseconds);
+ *    void silc_usleep(unsigned long microseconds);
  *
  * DESCRIPTION
  *
@@ -290,7 +290,7 @@ int silc_gettimeofday(struct timeval *p);
  *
  ***/
 static inline
-void silc_usleep(long microseconds)
+void silc_usleep(unsigned long microseconds)
 {
 #ifdef SILC_UNIX
 #ifdef HAVE_NANOSLEEP
index 0333e6302e2cb9fe545d4bad226490d1edc997de..a191f46b0a24e7444577b914daa306791822d64d 100644 (file)
@@ -165,7 +165,7 @@ void silc_parse_command_line(unsigned char *buffer,
 {
   int i, len = 0;
   int argc = 0;
-  const char *cp = buffer;
+  const char *cp = (const char *)buffer;
   char *tmp;
 
   *parsed = silc_calloc(1, sizeof(**parsed));