Fixed an assortment of C++ and Haiku build errors.

This commit is contained in:
Pietro Gagliardi 2015-11-17 19:18:55 -05:00
parent 5cfea3c0e0
commit 2a42511c5c
5 changed files with 21 additions and 9 deletions

View File

@ -15,6 +15,8 @@ CFLAGS += \
-Wno-switch \
--std=c99
# TODO consider switching to C++11
# this will hopelessly disbar Haiku for GCC 2
CXXFLAGS += \
-g \
-Wall -Wextra \

View File

@ -1,4 +1,8 @@
// 6 april 2015
#ifdef __cplusplus
extern "C" {
#endif
#include <stdlib.h>
#define uthash_fatal(msg) complain("uthash failed: %s", (msg))
@ -70,3 +74,7 @@ extern void fallbackScale(uiDrawMatrix *, double, double, double, double);
extern void fallbackMultiply(uiDrawMatrix *, uiDrawMatrix *);
extern void fallbackTransformPoint(uiDrawMatrix *, double *, double *);
extern void fallbackTransformSize(uiDrawMatrix *, double *, double *);
#ifdef __cplusplus
}
#endif

View File

@ -16,7 +16,7 @@ CXXFLAGS += \
LDFLAGS += \
-fvisibility=hidden \
-fPIC \
-lbe -lm
-lbe
# flags for warning on undefined symbols
LDFLAGS += \

View File

@ -3,7 +3,7 @@
#include <cstdio>
#include <cstdlib>
#include "uipriv_haiku.hpp"
using namepsace std;
using namespace std;
static set<void *> allocations;
@ -48,23 +48,23 @@ void *uiAlloc(size_t size, const char *type)
return DATA(out);
}
void *uiRealloc(void *p, size_t new, const char *type)
void *uiRealloc(void *p, size_t xnew, const char *type)
{
void *out;
size_t *s;
if (p == NULL)
return uiAlloc(new, type);
return uiAlloc(xnew, type);
p = BASE(p);
out = realloc(p, EXTRA + new);
out = realloc(p, EXTRA + xnew);
if (out == NULL) {
fprintf(stderr, "memory exhausted in uiRealloc()\n");
abort();
}
s = SIZE(out);
if (new <= *s)
memset(((uint8_t *) DATA(out)) + *s, 0, new - *s);
*s = new;
if (xnew <= *s)
memset(((uint8_t *) DATA(out)) + *s, 0, xnew - *s);
*s = xnew;
// TODO check this
allocations.erase(p);
allocations.insert(out);

View File

@ -1,7 +1,9 @@
// 17 november 2015
// TODO versioning macros?
#include <AppKit.h>
#include <InterfaceKit.h>
#include "../ui.h"
//TODO#include "../ui.h"
#include "ui.hpp"
#include "../ui_haiku.hpp"
#include "../common/uipriv.h"