Commit 3e2d3b7a authored by Donald Haase's avatar Donald Haase
Browse files

Resolve incompatibilities with modern KOS to get the library to build

parent b6371546
......@@ -21,7 +21,7 @@ OBJS += core/XML.o core/music_object.o core/sprite_object.o core/makesplitpath.o
OBJS += core/allocator.o core/hashmap.o core/font_object.o core/soundeffect_object.o core/zipfile_object.o core/xml_object.o
OBJS += core/vmufile_object.o
KOS_CFLAGS += -g -Os
KOS_CFLAGS += -g -Os -std=c++11 -D_GNU_SOURCE -Dstricmp=strcasecmp
include $(KOS_BASE)/addons/Makefile.prefab
......
This diff is collapsed.
......@@ -47,7 +47,7 @@ Object g_TimerHandlerFunc;
Object g_TimerThisObj;
ExecState* g_TimerExec = NULL;
static void timer_handler(irq_t source, irq_context_t *context)
static void timer_handler(irq_t source, irq_context_t *context, void*)
{
if (!g_TimerExec)
return;
......@@ -88,7 +88,7 @@ Value SystemFunctionImp::call(ExecState *exec, Object &thisObj, const List &args
g_TimerHandlerFunc = args[1].toObject(exec);
timer_prime(TMU2, cycles_per_second, true);
irq_set_handler(EXC_TMU2_TUNI2, timer_handler);
irq_set_handler(EXC_TMU2_TUNI2, timer_handler,NULL);
timer_start(TMU2);
break;
}
......
......@@ -44,7 +44,7 @@ VMUFileInstanceImp::VMUFileInstanceImp(ObjectImp* proto) : ObjectImp(proto)
VMUFileInstanceImp::~VMUFileInstanceImp()
{
if (pkg.data)
free(pkg.data);
free((void*)pkg.data);
}
/*
......@@ -116,10 +116,9 @@ void VMUFileInstanceImp::putValueProperty(ExecState *exec, int token, const Valu
{
const char* data = value.toString(exec).cstring().c_str();
if (pkg.data)
free(pkg.data);
pkg.data = (uint8*) malloc(strlen(data)+1);
free((void*)pkg.data);
pkg.data = (uint8*) calloc(strlen(data)+1, sizeof(uint8));
strcpy((char*)pkg.data, data);
pkg.data[strlen(data)] = 0;
break;
}
}
......@@ -225,11 +224,10 @@ Value VMUFileProtoFuncImp::call(ExecState* exec, Object& thisObj, const List &ar
return Boolean(false);
}
if (f->pkg.data)
free(f->pkg.data);
free((void*)f->pkg.data);
initVMUPkg(&f->pkg);
f->pkg.data = (uint8*) malloc(tempPkg.data_len+1);
memcpy(f->pkg.data, tempPkg.data, tempPkg.data_len);
f->pkg.data[tempPkg.data_len] = 0;
f->pkg.data = (uint8*) calloc(tempPkg.data_len+1, sizeof(uint8));
memcpy((void*)f->pkg.data, tempPkg.data, tempPkg.data_len);
strcpy(f->pkg.desc_short, tempPkg.desc_short);
strcpy(f->pkg.desc_long, tempPkg.desc_long);
strcpy(f->pkg.app_id, tempPkg.app_id);
......
......@@ -50,8 +50,9 @@
#include <math.h>
#include <string.h>
#include <strings.h>
#include <stdio.h>
#include <stdlib.h>
#include <cstdlib>
//#include <locale.h>
//#include <ctype.h>
......
......@@ -169,6 +169,9 @@
* the result overflows to +-Infinity or underflows to 0.
*/
#include <cstdlib>
#include <string.h>
//SCHERZO #include <config.h>
#ifdef WORDS_BIGENDIAN
#define IEEE_MC68k
......@@ -195,9 +198,6 @@ typedef unsigned Long ULong;
#define Bug(x) {fprintf(stderr, "%s\n", x); exit(1);}
#endif
#include "stdlib.h"
#include "string.h"
#ifdef USE_LOCALE
#include "locale.h"
#endif
......
......@@ -45,6 +45,9 @@
#include "operations.h"
#include "ustring.h"
#include <cstdlib>
#include <string.h>
using namespace KJS;
#define KJS_BREAKPOINT \
......
......@@ -115,7 +115,7 @@ CString &CString::operator=(const CString &str)
return *this;
}
bool KJS::operator==(const KJS::CString& c1, const KJS::CString& c2)
bool operator==(const KJS::CString& c1, const KJS::CString& c2)
{
int len = c1.size();
return len == c2.size() && (len == 0 || memcmp(c1.c_str(), c2.c_str(), len) == 0);
......@@ -897,7 +897,7 @@ void UString::release()
rep->deref();
}
bool KJS::operator==(const UString& s1, const UString& s2)
bool operator==(const UString& s1, const UString& s2)
{
if (s1.rep->len != s2.rep->len)
return false;
......@@ -906,7 +906,7 @@ bool KJS::operator==(const UString& s1, const UString& s2)
s1.rep->len * sizeof(UChar)) == 0);
}
bool KJS::operator==(const UString& s1, const char *s2)
bool operator==(const UString& s1, const char *s2)
{
if (s2 == 0) {
return s1.isEmpty();
......@@ -924,7 +924,7 @@ bool KJS::operator==(const UString& s1, const char *s2)
return u == uend && *s2 == 0;
}
bool KJS::operator<(const UString& s1, const UString& s2)
bool operator<(const UString& s1, const UString& s2)
{
const int l1 = s1.size();
const int l2 = s2.size();
......@@ -943,7 +943,7 @@ bool KJS::operator<(const UString& s1, const UString& s2)
return (l1 < l2);
}
int KJS::compare(const UString& s1, const UString& s2)
int compare(const UString& s1, const UString& s2)
{
const int l1 = s1.size();
const int l2 = s2.size();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment