Cope with platforms whose vsnprintf violates both POSIX and C99 - part 1
[platform/upstream/dbus.git] / dbus / dbus-internals.h
index 01f6247..dcef7d7 100644 (file)
@@ -27,8 +27,6 @@
 #ifndef DBUS_INTERNALS_H
 #define DBUS_INTERNALS_H
 
-#include <config.h>
-
 #include <dbus/dbus-memory.h>
 #include <dbus/dbus-types.h>
 #include <dbus/dbus-errors.h>
@@ -37,7 +35,9 @@
 
 DBUS_BEGIN_DECLS
 
+#ifndef DBUS_SESSION_BUS_DEFAULT_ADDRESS
 #define DBUS_SESSION_BUS_DEFAULT_ADDRESS       "autolaunch:"
+#endif
 
 void _dbus_warn               (const char *format,
                                ...) _DBUS_GNUC_PRINTF (1, 2);
@@ -55,21 +55,6 @@ void _dbus_warn_check_failed  (const char *format,
 #endif
 
 /*
- * This is necessary to access global variables outside the DLL with MSVC,
- * just exporting them in the .def file still leads to linker errors
- * note: dbus_1_EXPORTS is set automatically by CMake when the DLL is built
- */
-#if defined(_MSC_VER)
-#  if defined(dbus_1_EXPORTS)
-#  define DBUS_EXTERN __declspec(dllexport)
-#  else
-#  define DBUS_EXTERN __declspec(dllimport)
-#  endif
-#else
-#define DBUS_EXTERN extern
-#endif
-
-/*
  * (code from GLib)
  * 
  * The _DBUS_LIKELY and _DBUS_UNLIKELY macros let the programmer give hints to 
@@ -162,7 +147,7 @@ void _dbus_real_assert_not_reached (const char *explanation,
 #define _dbus_return_val_if_fail(condition, val)
 #else
 
-DBUS_EXTERN const char *_dbus_return_if_fail_warning_format;
+extern const char *_dbus_return_if_fail_warning_format;
 
 #define _dbus_return_if_fail(condition) do {                                       \
    _dbus_assert ((*(const char*)_DBUS_FUNCTION_NAME) != '_');                      \
@@ -184,13 +169,13 @@ DBUS_EXTERN const char *_dbus_return_if_fail_warning_format;
 
 #define _DBUS_N_ELEMENTS(array) ((int) (sizeof ((array)) / sizeof ((array)[0])))
 
-#define _DBUS_POINTER_TO_INT(pointer) ((long)(pointer))
-#define _DBUS_INT_TO_POINTER(integer) ((void*)((long)(integer)))
+#define _DBUS_POINTER_TO_INT(pointer) ((intptr_t)(pointer))
+#define _DBUS_INT_TO_POINTER(integer) ((void*)((intptr_t)(integer)))
 
 #define _DBUS_ZERO(object) (memset (&(object), '\0', sizeof ((object))))
 
 #define _DBUS_STRUCT_OFFSET(struct_type, member)       \
-    ((long) ((unsigned char*) &((struct_type*) 0)->member))
+    ((intptr_t) ((unsigned char*) &((struct_type*) 0)->member))
 
 #ifdef DBUS_DISABLE_CHECKS
 /* this is an assert and not an error, but in the typical --disable-checks case (you're trying
@@ -218,7 +203,7 @@ DBUS_EXTERN const char *_dbus_return_if_fail_warning_format;
  */
 
 #define _DBUS_ALIGN_VALUE(this, boundary) \
-  (( ((unsigned long)(this)) + (((unsigned long)(boundary)) -1)) & (~(((unsigned long)(boundary))-1)))
+  (( ((uintptr_t)(this)) + (((uintptr_t)(boundary)) -1)) & (~(((uintptr_t)(boundary))-1)))
 
 #define _DBUS_ALIGN_ADDRESS(this, boundary) \
   ((void*)_DBUS_ALIGN_VALUE(this, boundary))
@@ -276,7 +261,7 @@ void _dbus_verbose_bytes_of_string (const DBusString    *str,
 
 const char* _dbus_header_field_to_string (int header_field);
 
-DBUS_EXTERN const char *_dbus_no_memory_message;
+extern const char *_dbus_no_memory_message;
 #define _DBUS_SET_OOM(error) dbus_set_error_const ((error), DBUS_ERROR_NO_MEMORY, _dbus_no_memory_message)
 
 #ifdef DBUS_BUILD_TESTS