GCC 4.1 compiler warning fixes.
authorPekka Riikonen <priikone@silcnet.org>
Wed, 14 Feb 2007 17:39:21 +0000 (17:39 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Wed, 14 Feb 2007 17:39:21 +0000 (17:39 +0000)
lib/silcapputil/silcidcache.c
lib/silcclient/client_ftp.c
lib/silcclient/command_reply.c
lib/silcutil/silcmime.c
lib/silcutil/silcschedule.c
lib/silcutil/silctime.c

index 1c23b290236100a20581bf3617f57aeaa652bd26..bc18e1ab5b971822a6eeaaa27e965c56ad66d2db 100644 (file)
@@ -205,7 +205,7 @@ SilcBool silc_idcache_del_by_id(SilcIDCache cache, void *id,
   if (!cache)
     return FALSE;
 
-  if (!silc_hash_table_find(cache->id_table, id, NULL, (void **)&c))
+  if (!silc_hash_table_find(cache->id_table, id, NULL, (void *)&c))
     return FALSE;
 
   return silc_idcache_del(cache, c, app_context);
@@ -221,7 +221,7 @@ SilcBool silc_idcache_del_by_context(SilcIDCache cache, void *context,
   if (!cache)
     return FALSE;
 
-  if (!silc_hash_table_find(cache->context_table, context, NULL, (void **)&c))
+  if (!silc_hash_table_find(cache->context_table, context, NULL, (void *)&c))
     return FALSE;
 
   return silc_idcache_del(cache, c, app_context);
@@ -279,7 +279,7 @@ SilcBool silc_idcache_update_by_context(SilcIDCache cache, void *context,
   if (!cache)
     return FALSE;
 
-  if (!silc_hash_table_find(cache->context_table, context, NULL, (void **)&c))
+  if (!silc_hash_table_find(cache->context_table, context, NULL, (void *)&c))
     return FALSE;
 
   return silc_idcache_update(cache, c, new_id, new_name, free_old_name);
index 5143c92177f445565283e28b5c0a7b8f6eb1d41a..a057a6d25cc973746965306ba09225b5c790424b 100644 (file)
@@ -939,6 +939,8 @@ SilcClientFileError silc_client_file_close(SilcClient client,
     session->monitor = NULL;
   }
 
+  silc_schedule_task_del_by_context(client->schedule, session);
+
   session->closed = TRUE;
 
   /* Destroy via timeout */
index 73e45893ef9f4011f0eb460b2b0b74453ba9c2f0..8317c61717481920e8c03e7c857dcddf1f45812d 100644 (file)
@@ -1252,8 +1252,8 @@ SILC_FSM_STATE(silc_client_command_reply_join)
   }
 
   /* Get channel mode */
-  tmp = silc_argument_get_arg_type(args, 5, NULL);
-  if (tmp)
+  tmp = silc_argument_get_arg_type(args, 5, &len);
+  if (tmp && len == 4)
     SILC_GET32_MSB(mode, tmp);
   channel->mode = mode;
 
@@ -1440,6 +1440,11 @@ SILC_FSM_STATE(silc_client_command_reply_cmode)
     goto out;
   }
 
+  /* Get founder public key */
+  tmp = silc_argument_get_arg_type(args, 4, &len);
+  if (tmp)
+    silc_public_key_payload_decode(tmp, len, &public_key);
+
   /* Get channel mode */
   tmp = silc_argument_get_arg_type(args, 3, &len);
   if (!tmp || len != 4) {
@@ -1447,11 +1452,6 @@ SILC_FSM_STATE(silc_client_command_reply_cmode)
     goto out;
   }
 
-  /* Get founder public key */
-  tmp = silc_argument_get_arg_type(args, 4, &len);
-  if (tmp)
-    silc_public_key_payload_decode(tmp, len, &public_key);
-
   silc_rwlock_wrlock(channel->internal.lock);
 
   /* Save the mode */
index e424d5d3839840021f52ee6b85b4d941e4b6194f..d4407dfe4ed1a210b95afdfb6051ee1da5e510b1 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 2005 - 2006 Pekka Riikonen
+  Copyright (C) 2005 - 2007 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -322,7 +322,7 @@ unsigned char *silc_mime_encode(SilcMime mime, SilcUInt32 *encoded_len)
   /* Encode the headers. Order doesn't matter */
   i = 0;
   silc_hash_table_list(mime->fields, &htl);
-  while (silc_hash_table_get(&htl, (void **)&field, (void **)&value)) {
+  while (silc_hash_table_get(&htl, (void *)&field, (void *)&value)) {
     memset(tmp, 0, sizeof(tmp));
     SILC_LOG_DEBUG(("Header %s: %s", field, value));
     silc_snprintf(tmp, sizeof(tmp) - 1, "%s: %s\r\n", field, value);
@@ -461,7 +461,7 @@ SilcMime silc_mime_assemble(SilcMimeAssembler assembler, SilcMime partial)
 
   /* Find fragments with this ID. */
   if (!silc_hash_table_find(assembler->fragments, (void *)id,
-                           NULL, (void **)&f)) {
+                           NULL, (void *)&f)) {
     /* This is new fragment to new message.  Add to hash table and return. */
     f = silc_hash_table_alloc(0, silc_hash_uint, NULL, NULL, NULL,
                              silc_mime_assemble_dest, NULL, TRUE);
@@ -506,7 +506,7 @@ SilcMime silc_mime_assemble(SilcMimeAssembler assembler, SilcMime partial)
   /* Assemble the complete MIME message now. We get them in order from
      the hash table. */
   for (i = 1; i <= total; i++) {
-    if (!silc_hash_table_find(f, SILC_32_TO_PTR(i), NULL, (void **)&p))
+    if (!silc_hash_table_find(f, SILC_32_TO_PTR(i), NULL, (void *)&p))
       goto err;
 
     /* The fragment is in the data portion of the partial message */
@@ -698,7 +698,7 @@ const char *silc_mime_get_field(SilcMime mime, const char *field)
     return NULL;
 
   if (!silc_hash_table_find(mime->fields, (void *)field,
-                           NULL, (void **)&value))
+                           NULL, (void *)&value))
     return NULL;
 
   return (const char *)value;
index 790b242ff5633a337ae4cdcfa6b803f73c7eb9d4..adfacd55ea9eb04ca171ee0e001c151a3ad60124 100644 (file)
@@ -205,7 +205,7 @@ static void silc_schedule_task_remove(SilcSchedule schedule, SilcTask task)
 
     /* Delete from fd queue */
     silc_hash_table_list(schedule->fd_queue, &htl);
-    while (silc_hash_table_get(&htl, (void **)&fd, (void **)&task))
+    while (silc_hash_table_get(&htl, (void *)&fd, (void *)&task))
       silc_hash_table_del(schedule->fd_queue, SILC_32_TO_PTR(fd));
     silc_hash_table_list_reset(&htl);
 
@@ -600,7 +600,7 @@ SilcTask silc_schedule_task_add(SilcSchedule schedule, SilcUInt32 fd,
     /* Check if fd is already added */
     if (silc_unlikely(silc_hash_table_find(schedule->fd_queue,
                                           SILC_32_TO_PTR(fd),
-                                          NULL, (void **)&task))) {
+                                          NULL, (void *)&task))) {
       if (task->valid)
         goto out;
 
@@ -672,7 +672,7 @@ SilcBool silc_schedule_task_del(SilcSchedule schedule, SilcTask task)
 
     /* Delete from fd queue */
     silc_hash_table_list(schedule->fd_queue, &htl);
-    while (silc_hash_table_get(&htl, NULL, (void **)&task))
+    while (silc_hash_table_get(&htl, NULL, (void *)&task))
       task->valid = FALSE;
     silc_hash_table_list_reset(&htl);
 
@@ -708,7 +708,7 @@ SilcBool silc_schedule_task_del_by_fd(SilcSchedule schedule, SilcUInt32 fd)
   /* fd is unique, so there is only one task with this fd in the table */
   if (silc_likely(silc_hash_table_find(schedule->fd_queue,
                                       SILC_32_TO_PTR(fd), NULL,
-                                      (void **)&task))) {
+                                      (void *)&task))) {
     SILC_LOG_DEBUG(("Deleting task %p", task));
     task->valid = FALSE;
     ret = TRUE;
@@ -741,7 +741,7 @@ SilcBool silc_schedule_task_del_by_callback(SilcSchedule schedule,
 
   /* Delete from fd queue */
   silc_hash_table_list(schedule->fd_queue, &htl);
-  while (silc_hash_table_get(&htl, NULL, (void **)&task)) {
+  while (silc_hash_table_get(&htl, NULL, (void *)&task)) {
     if (task->callback == callback) {
       task->valid = FALSE;
       ret = TRUE;
@@ -780,7 +780,7 @@ SilcBool silc_schedule_task_del_by_context(SilcSchedule schedule,
 
   /* Delete from fd queue */
   silc_hash_table_list(schedule->fd_queue, &htl);
-  while (silc_hash_table_get(&htl, NULL, (void **)&task)) {
+  while (silc_hash_table_get(&htl, NULL, (void *)&task)) {
     if (task->context == context) {
       task->valid = FALSE;
       ret = TRUE;
@@ -851,7 +851,7 @@ SilcBool silc_schedule_set_listen_fd(SilcSchedule schedule, SilcUInt32 fd,
   SILC_SCHEDULE_LOCK(schedule);
 
   if (silc_hash_table_find(schedule->fd_queue, SILC_32_TO_PTR(fd),
-                          NULL, (void **)&task)) {
+                          NULL, (void *)&task)) {
     if (!schedule_ops.schedule_fd(schedule, schedule->internal, task, mask)) {
       SILC_SCHEDULE_UNLOCK(schedule);
       return FALSE;
@@ -881,7 +881,7 @@ SilcTaskEvent silc_schedule_get_fd_events(SilcSchedule schedule,
 
   SILC_SCHEDULE_LOCK(schedule);
   if (silc_hash_table_find(schedule->fd_queue, SILC_32_TO_PTR(fd),
-                          NULL, (void **)&task))
+                          NULL, (void *)&task))
     event = task->events;
   SILC_SCHEDULE_UNLOCK(schedule);
 
index 52c356fd8e656efaa11a22bfdab88d612b43d8bf..7619f99e63ed3042006e0a3177a6cf33c47e2c58 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 2003 - 2006 Pekka Riikonen
+  Copyright (C) 2003 - 2007 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -106,6 +106,7 @@ SilcBool silc_time_value(SilcInt64 time_val, SilcTime ret_time)
 {
   struct tm *time;
   unsigned int msec = 0;
+  time_t timeval;
 
   if (!ret_time)
     return TRUE;
@@ -116,9 +117,10 @@ SilcBool silc_time_value(SilcInt64 time_val, SilcTime ret_time)
   msec = time_val % 1000;
   time_val /= 1000;
 
-  time = localtime((time_t *)&time_val);
+  time = localtime(&timeval);
   if (!time)
     return FALSE;
+  time_val = timeval;
 
   memset(ret_time, 0, sizeof(*ret_time));
   if (!silc_time_fill(ret_time, time->tm_year + 1900, time->tm_mon + 1,