[AD] LOCK_*() macros - fixes for C++

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Hi,

These changes were discussed on allegro.cc a while ago, and Bob proposed a patch. I don't know what happened in between, but when I went to look at my CVS version of Allegro, I found the relevant modifications in there. Here's a patch. Basically it adds (void *) casts to the lock macros, on DJGPP and Mac where they don't expand to nothing.

Let me know if the patch is usable or if I did something wrong when creating it - and please apply it this time!

Ben

---
Index: aldjgpp.h
===================================================================
RCS file: /cvsroot/alleg/allegro/include/allegro/platform/aldjgpp.h,v
retrieving revision 1.5
diff -u -r1.5 aldjgpp.h
--- aldjgpp.h	9 Jul 2002 11:37:47 -0000	1.5
+++ aldjgpp.h	19 Jul 2002 16:15:54 -0000
@@ -42,11 +42,11 @@

#define END_OF_FUNCTION(x)          void x##_end(void) { }
#define END_OF_STATIC_FUNCTION(x)   static void x##_end(void) { }
-#define LOCK_DATA(d, s)             _go32_dpmi_lock_data(d, s)
-#define LOCK_CODE(c, s)             _go32_dpmi_lock_code(c, s)
-#define UNLOCK_DATA(d,s)            _unlock_dpmi_data(d, s)
+#define LOCK_DATA(d, s)             _go32_dpmi_lock_data((void*)(d), s)
+#define LOCK_CODE(c, s)             _go32_dpmi_lock_code((void*)(c), s)
+#define UNLOCK_DATA(d,s)            _unlock_dpmi_data((void*)(d), s)
#define LOCK_VARIABLE(x)            LOCK_DATA((void *)&x, sizeof(x))
-#define LOCK_FUNCTION(x)            LOCK_CODE(x, (long)x##_end - (long)x)
+#define LOCK_FUNCTION(x) LOCK_CODE((void*)x, (long)x##_end - (long)x)


/* long filename status */
Index: almaccfg.h
===================================================================
RCS file: /cvsroot/alleg/allegro/include/allegro/platform/almaccfg.h,v
retrieving revision 1.3
diff -u -r1.3 almaccfg.h
--- almaccfg.h	12 Apr 2002 13:45:32 -0000	1.3
+++ almaccfg.h	19 Jul 2002 16:16:02 -0000
@@ -46,11 +46,11 @@

#define END_OF_FUNCTION(x)			void x##_end(void) { }
#define END_OF_STATIC_FUNCTION(x)	static void x##_end(void) { }
-#define LOCK_DATA(d, s)				_mac_lock(d, s)
-#define LOCK_CODE(c, s)				_mac_lock(c, s)
-#define UNLOCK_DATA(d,s)			_mac_unlock(d, s)
+#define LOCK_DATA(d, s)				_mac_lock((void*)(d), s)
+#define LOCK_CODE(c, s)				_mac_lock((void*)(c), s)
+#define UNLOCK_DATA(d,s)			_mac_unlock((void*)(d), s)
#define LOCK_VARIABLE(x)			LOCK_DATA((void *)&x, sizeof(x))
-#define LOCK_FUNCTION(x)			LOCK_CODE(x, (long)x##_end - (long)x)
+#define LOCK_FUNCTION(x)			LOCK_CODE((void*)x, (long)x##_end - (long)x)

/* long filename status */
#define ALLEGRO_LFN  0

_________________________________________________________________
Join the world?s largest e-mail service with MSN Hotmail. http://www.hotmail.com

Attachment: lock.diff.zip
Description: Zip compressed data



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/