Symbian compilation fixes.
authorPekka Riikonen <priikone@silcnet.org>
Sun, 31 Dec 2006 15:33:57 +0000 (15:33 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Sun, 31 Dec 2006 15:33:57 +0000 (15:33 +0000)
lib/silcutil/silcbuffer.h
lib/silcutil/silcconfig.c
lib/silcutil/silcschedule.c
lib/silcutil/silcschedule.h
lib/silcutil/silcstack.c
lib/silcutil/silcstream.c
lib/silcutil/silcstringprep.c

index 90bc3be574611fa2896ca3d2ac751455d57c6d01..673c4a7ff0608da0bd421c4f42be134060c5c313 100644 (file)
@@ -1051,7 +1051,7 @@ SilcBuffer silc_buffer_srealloc(SilcStack stack,
   if (!h) {
     /* Do slow and stack wasting realloc.  The old sb->head is lost and
        is freed eventually. */
-    h = silc_smalloc_ua(stack, newsize);
+    h = (unsigned char *)silc_smalloc_ua(stack, newsize);
     if (silc_unlikely(!h))
       return NULL;
     memcpy(h, sb->head, silc_buffer_truelen(sb));
index b0c4f8163d67d3fe7436fc85d4800020e2078029..97760b3f88ee0cf47154cc891d0c96b06d52cee6 100644 (file)
@@ -98,6 +98,7 @@ static void my_trim_spaces(SilcConfigFile *file)
     if (*r++ == '\n') file->line++;
   file->p = r;
 }
+
 /* Skips the current line until newline (lf or cr) */
 static void my_skip_line(SilcConfigFile *file)
 {
@@ -106,6 +107,7 @@ static void my_skip_line(SilcConfigFile *file)
   file->p = ((*r != '\0' && *r != EOF) ? r + 1 : r);
   file->line++;
 }
+
 /* Obtains a text token from the current position until first separator.
  * a separator is any non alphanumeric character nor "_" or "-" */
 static char *my_next_token(SilcConfigFile *file, char *to)
@@ -119,6 +121,7 @@ static char *my_next_token(SilcConfigFile *file, char *to)
   file->p = o;
   return to;
 }
+
 /* Obtains a string from the current position. The only difference from
  * next_token() is that quoted-strings are also accepted */
 static char *my_get_string(SilcConfigFile *file, char *to)
@@ -146,7 +149,8 @@ static char *my_get_string(SilcConfigFile *file, char *to)
   /* we don't need quote parsing, fall-back to token extractor */
   my_next_token(file, to);
   return to;
-};
+}
+
 /* Skips all comment lines and spaces lines until first useful character */
 static void my_skip_comments(SilcConfigFile *file)
 {
@@ -171,6 +175,7 @@ static SilcConfigOption *silc_config_find_option(SilcConfigEntity ent,
   }
   return NULL;
 }
+
 /* Converts a string in the type specified. returns a dynamically
  * allocated pointer. */
 static void *silc_config_marshall(SilcConfigType type, const char *val)
@@ -295,7 +300,7 @@ SilcConfigEntity silc_config_init(SilcConfigFile *file)
   ret = silc_calloc(1, sizeof(*ret));
   ret->file = file;
   return ret;
-};
+}
 
 /* Returns the original filename of the object file */
 
index 2e546ee8576a6ee919bf97e9902268c3431a14d9..c0ee5dea72e3c9d6e080ca4df0e38b175a95c17e 100644 (file)
@@ -595,6 +595,8 @@ SilcTask silc_schedule_task_add(SilcSchedule schedule, SilcUInt32 fd,
     task = (SilcTask)ttask;
 
   } else if (silc_likely(type == SILC_TASK_FD)) {
+    SilcTaskFd ftask;
+
     /* Check if fd is already added */
     if (silc_unlikely(silc_hash_table_find(schedule->fd_queue,
                                           SILC_32_TO_PTR(fd),
@@ -609,7 +611,7 @@ SilcTask silc_schedule_task_add(SilcSchedule schedule, SilcUInt32 fd,
       goto out;
     }
 
-    SilcTaskFd ftask = silc_calloc(1, sizeof(*ftask));
+    ftask = silc_calloc(1, sizeof(*ftask));
     if (silc_unlikely(!ftask))
       goto out;
 
index 44060fdca04ea11c72d4fd469c8b13621e1e58b3..4dc15c50c928335fd84aec73e45c103e9031baac 100644 (file)
@@ -293,6 +293,14 @@ void silc_schedule_stop(SilcSchedule schedule);
  *    When this returns the program is to be ended. Before this function can
  *    be called, one must call silc_schedule_init function.
  *
+ * NOTES
+ *
+ *    On Windows this will block the program, but will continue dispatching
+ *    window messages, and thus can be used as the main loop of the program.
+ *
+ *    On Symbian this will return immediately.  On Symbian calling
+ *    silc_schedule is same as calling silc_schedule_one.
+ *
  ***/
 void silc_schedule(SilcSchedule schedule);
 
@@ -311,6 +319,10 @@ void silc_schedule(SilcSchedule schedule);
  *    scheduler.  The function will not return in this timeout unless
  *    some other event occurs.
  *
+ *    Typically this would be called from a timeout or idle task
+ *    periodically (typically from 5-50 ms) to schedule SILC tasks.  In
+ *    this case the `timeout_usecs' is usually 0.
+ *
  ***/
 SilcBool silc_schedule_one(SilcSchedule schedule, int timeout_usecs);
 
index 9432b22d25c10c69693345f6072156fd1b8066f8..fabef8ec7dbddc953b8ba2ff45cec6f7f4aafeca 100644 (file)
@@ -267,7 +267,8 @@ void *silc_stack_realloc(SilcStack stack, SilcUInt32 old_size,
   /* Check that `ptr' is last allocation */
   sptr = (unsigned char *)stack->stack[si] +
     SILC_STACK_ALIGN(sizeof(**stack->stack), SILC_STACK_DEFAULT_ALIGN);
-  if (stack->stack[si]->bytes_left + old_size + (ptr - sptr) != bsize) {
+  if (stack->stack[si]->bytes_left + old_size +
+      ((unsigned char *)ptr - (unsigned char *)sptr) != bsize) {
     SILC_LOG_DEBUG(("Cannot reallocate"));
     SILC_STACK_STAT(stack, num_errors, 1);
     return NULL;
index 730ce55cb0ab742f75c819f20cd9dac0fc07f972..7b8b08af36bc39ed014b98c59a952a2711261d77 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 2005 Pekka Riikonen
+  Copyright (C) 2005 - 2006 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
@@ -46,14 +46,14 @@ SilcBool silc_stream_close(SilcStream stream)
 void silc_stream_destroy(SilcStream stream)
 {
   SilcStreamHeader h = stream;
-  return h->ops->destroy(stream);
+  h->ops->destroy(stream);
 }
 
 void silc_stream_set_notifier(SilcStream stream, SilcSchedule schedule,
                              SilcStreamNotifier notifier, void *context)
 {
   SilcStreamHeader h = stream;
-  return h->ops->notifier(stream, schedule, notifier, context);
+  h->ops->notifier(stream, schedule, notifier, context);
 }
 
 SilcSchedule silc_stream_get_schedule(SilcStream stream)
index 5674eaf3009226abb2fff24ebb87b6b4a0ae7197..18ec3e94c889a648886ebaa47d394c1de904ddd1 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "silc.h"
 #include "silcstringprep.h"
-#include <stringprep.h>
+#include "stringprep.h"
 
 /* We use GNU Libidn which has stringprep to do the magic.  Only bad thing
    is that its interface is idiotic.  We have our own API here in case