summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2009-04-27 09:18:17 +0000
committer Aaron Giles <aaron@aarongiles.com>2009-04-27 09:18:17 +0000
commit9eb86548bbb847ca2fc01f04fc3a4caa3568aefe (patch)
tree7bc8d0a67746251f1ec2dc38d52a1e8da5c381be /src/osd
parent5d4816b66528f07a78ce8470413c524cbb57c799 (diff)
Added missing casts and made other tweaks. The entire project
can now be optionally compiled with the C++ compiler (mingw g++ only for the moment; MSVC still has issues).
Diffstat (limited to 'src/osd')
-rw-r--r--src/osd/windows/ledutil.c4
-rw-r--r--src/osd/windows/winalloc.c4
-rw-r--r--src/osd/windows/windows.mak4
-rw-r--r--src/osd/windows/winprefix.h8
4 files changed, 16 insertions, 4 deletions
diff --git a/src/osd/windows/ledutil.c b/src/osd/windows/ledutil.c
index 708231c9a14..9b940f9eec2 100644
--- a/src/osd/windows/ledutil.c
+++ b/src/osd/windows/ledutil.c
@@ -381,11 +381,11 @@ static LRESULT handle_copydata(WPARAM wparam, LPARAM lparam)
return 1;
// allocate memory
- entry = malloc(sizeof(*entry));
+ entry = (id_map_entry *)malloc(sizeof(*entry));
if (entry == NULL)
return 0;
- string = malloc(strlen(data->string) + 1);
+ string = (char *)malloc(strlen(data->string) + 1);
if (string == NULL)
{
free(entry);
diff --git a/src/osd/windows/winalloc.c b/src/osd/windows/winalloc.c
index 6b7357cbd97..e33f339c33e 100644
--- a/src/osd/windows/winalloc.c
+++ b/src/osd/windows/winalloc.c
@@ -155,12 +155,12 @@ void *malloc_file_line(size_t size, const char *file, int line)
rounded_size = ((size + PAGE_SIZE - 1) / PAGE_SIZE) * PAGE_SIZE;
// reserve that much memory, plus two guard pages
- page_base = VirtualAlloc(NULL, rounded_size + 2 * PAGE_SIZE, MEM_RESERVE, PAGE_NOACCESS);
+ page_base = (UINT8 *)VirtualAlloc(NULL, rounded_size + 2 * PAGE_SIZE, MEM_RESERVE, PAGE_NOACCESS);
if (page_base == NULL)
return NULL;
// now allow access to everything but the first and last pages
- page_base = VirtualAlloc(page_base + PAGE_SIZE, rounded_size, MEM_COMMIT, PAGE_READWRITE);
+ page_base = (UINT8 *)VirtualAlloc(page_base + PAGE_SIZE, rounded_size, MEM_COMMIT, PAGE_READWRITE);
if (page_base == NULL)
return NULL;
diff --git a/src/osd/windows/windows.mak b/src/osd/windows/windows.mak
index 35a563d73f3..1a2b58f3126 100644
--- a/src/osd/windows/windows.mak
+++ b/src/osd/windows/windows.mak
@@ -207,6 +207,10 @@ endif
# add the windows libraries
LIBS += -luser32 -lgdi32 -lddraw -ldsound -ldxguid -lwinmm -ladvapi32 -lcomctl32 -lshlwapi
+ifdef CPP_COMPILE
+LIBS += -lsupc++
+endif
+
ifeq ($(DIRECTINPUT),8)
LIBS += -ldinput8
CCOMFLAGS += -DDIRECTINPUT_VERSION=0x0800
diff --git a/src/osd/windows/winprefix.h b/src/osd/windows/winprefix.h
index ef0f3f1e69b..6e5e059ca69 100644
--- a/src/osd/windows/winprefix.h
+++ b/src/osd/windows/winprefix.h
@@ -13,12 +13,20 @@
#include <stdlib.h>
#include <malloc.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
// override malloc/calloc/realloc/free to track file/line
void *malloc_file_line(size_t size, const char *file, int line);
void *calloc_file_line(size_t size, size_t count, const char *FILE, int line);
void *realloc_file_line(void *memory, size_t size, const char *file, int line);
void free_file_line(void *memory, const char *file, int line);
+#ifdef __cplusplus
+};
+#endif
+
#undef malloc
#define malloc(x) malloc_file_line(x, __FILE__, __LINE__)
#undef calloc