Types: make SilcUInt32 an unsigned int in most cases.
[silc.git] / lib / silcutil / silctypes.h
index 7500b1fb22d71a403d09f99267f47ed58d3bfe2e..d7f979766577c666ee2e5f6726ab4f2727bb28a4 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 2002 - 2006 Pekka Riikonen
+  Copyright (C) 2002 - 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
 #ifndef SILCTYPES_H
 #define SILCTYPES_H
 
+/****d* silcutil/SILCTypes/SilcBool
+ *
+ * NAME
+ *
+ *    typedef unigned char SilcBool;
+ *
+ * DESCRIPTION
+ *
+ *    Boolean value, and is always 8-bits.  Represents value 0 or 1.
+ *
+ ***/
+typedef unsigned char SilcBool;
+
+/* The bool macro is deprecated.  Use SilcBool instead. */
+#ifdef SILC_MACOSX
+#define bool _Bool
+#endif
+#ifndef __cplusplus
+#ifndef bool
+#define bool unsigned char
+#endif
+#endif
+
 /****d* silcutil/SILCTypes/TRUE
  *
  * NAME
 #endif
 /***/
 
-/****d* silcutil/SILCTypes/SilcBool
- *
- * NAME
- *
- *    typedef unigned char SilcBool;
- *
- * DESCRIPTION
- *
- *    Boolean value, and is always 8-bits.  Represents value 0 or 1.
- *
- ***/
-typedef unsigned char SilcBool;
-
-/****d* silcutil/SILCTypes/bool
- *
- * NAME
- *
- *    #define SilcBool ...
- *
- * DESCRIPTION
- *
- *    Boolean value, and is 8-bits.  Represents value 0 or 1.  In
- *    C++ code this type is defined by the C++, and this definition is
- *    not used.
- *
- * NOTES
- *
- *    This macro is deprecated.  Use SilcBool instead.
- *
- * SOURCE
- */
-#ifdef SILC_MACOSX
-#define bool _Bool
-#endif
-
-#ifndef __cplusplus
-#ifndef bool
-#define bool unsigned char
-#endif
-#endif
-/***/
-
 /* Our offsetof macro */
 #define silc_offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
 
@@ -196,14 +177,14 @@ typedef signed short SilcInt16;
  *
  * SOURCE
  */
-#if SILC_SIZEOF_LONG == 4
-typedef unsigned long SilcUInt32;
-typedef signed long SilcInt32;
-#else
 #if SILC_SIZEOF_INT == 4
 typedef unsigned int SilcUInt32;
 typedef signed int SilcInt32;
 #else
+#if SILC_SIZEOF_LONG == 4
+typedef unsigned long SilcUInt32;
+typedef signed long SilcInt32;
+#else
 #if SILC_SIZEOF_LONG_LONG >= 4
 #ifndef WIN32
 typedef unsigned long long SilcUInt32;
@@ -290,8 +271,10 @@ typedef SilcUInt32 * void *;
  *
  * SOURCE
  */
-#if defined(SILC_UNIX) || defined(SILC_WIN32)
+#if defined(SILC_UNIX)
 typedef int SilcSocket;
+#elif defined(SILC_WIN32)
+typedef SOCKET SilcSocket;
 #elif defined(SILC_SYMBIAN)
 typedef void * SilcSocket;
 #endif
@@ -651,4 +634,11 @@ do {                                               \
 #endif
 /***/
 
+typedef char __check_size1[sizeof(SilcInt8)   ==       1 ? 1 : -1];
+typedef char __check_size2[sizeof(SilcUInt8)  ==       1 ? 1 : -1];
+typedef char __check_size3[sizeof(SilcInt16)  ==       2 ? 1 : -1];
+typedef char __check_size4[sizeof(SilcUInt16) ==       2 ? 1 : -1];
+typedef char __check_size5[sizeof(SilcInt32)  ==       4 ? 1 : -1];
+typedef char __check_size6[sizeof(SilcUInt32) ==       4 ? 1 : -1];
+
 #endif /* SILCTYPES_H */