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 ...@@ -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/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 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 include $(KOS_BASE)/addons/Makefile.prefab
......
This diff is collapsed.
...@@ -47,7 +47,7 @@ Object g_TimerHandlerFunc; ...@@ -47,7 +47,7 @@ Object g_TimerHandlerFunc;
Object g_TimerThisObj; Object g_TimerThisObj;
ExecState* g_TimerExec = NULL; 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) if (!g_TimerExec)
return; return;
...@@ -88,7 +88,7 @@ Value SystemFunctionImp::call(ExecState *exec, Object &thisObj, const List &args ...@@ -88,7 +88,7 @@ Value SystemFunctionImp::call(ExecState *exec, Object &thisObj, const List &args
g_TimerHandlerFunc = args[1].toObject(exec); g_TimerHandlerFunc = args[1].toObject(exec);
timer_prime(TMU2, cycles_per_second, true); 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); timer_start(TMU2);
break; break;
} }
......
...@@ -44,7 +44,7 @@ VMUFileInstanceImp::VMUFileInstanceImp(ObjectImp* proto) : ObjectImp(proto) ...@@ -44,7 +44,7 @@ VMUFileInstanceImp::VMUFileInstanceImp(ObjectImp* proto) : ObjectImp(proto)
VMUFileInstanceImp::~VMUFileInstanceImp() VMUFileInstanceImp::~VMUFileInstanceImp()
{ {
if (pkg.data) if (pkg.data)
free(pkg.data); free((void*)pkg.data);
} }
/* /*
...@@ -116,10 +116,9 @@ void VMUFileInstanceImp::putValueProperty(ExecState *exec, int token, const Valu ...@@ -116,10 +116,9 @@ void VMUFileInstanceImp::putValueProperty(ExecState *exec, int token, const Valu
{ {
const char* data = value.toString(exec).cstring().c_str(); const char* data = value.toString(exec).cstring().c_str();
if (pkg.data) if (pkg.data)
free(pkg.data); free((void*)pkg.data);
pkg.data = (uint8*) malloc(strlen(data)+1); pkg.data = (uint8*) calloc(strlen(data)+1, sizeof(uint8));
strcpy((char*)pkg.data, data); strcpy((char*)pkg.data, data);
pkg.data[strlen(data)] = 0;
break; break;
} }
} }
...@@ -225,11 +224,10 @@ Value VMUFileProtoFuncImp::call(ExecState* exec, Object& thisObj, const List &ar ...@@ -225,11 +224,10 @@ Value VMUFileProtoFuncImp::call(ExecState* exec, Object& thisObj, const List &ar
return Boolean(false); return Boolean(false);
} }
if (f->pkg.data) if (f->pkg.data)
free(f->pkg.data); free((void*)f->pkg.data);
initVMUPkg(&f->pkg); initVMUPkg(&f->pkg);
f->pkg.data = (uint8*) malloc(tempPkg.data_len+1); f->pkg.data = (uint8*) calloc(tempPkg.data_len+1, sizeof(uint8));
memcpy(f->pkg.data, tempPkg.data, tempPkg.data_len); memcpy((void*)f->pkg.data, tempPkg.data, tempPkg.data_len);
f->pkg.data[tempPkg.data_len] = 0;
strcpy(f->pkg.desc_short, tempPkg.desc_short); strcpy(f->pkg.desc_short, tempPkg.desc_short);
strcpy(f->pkg.desc_long, tempPkg.desc_long); strcpy(f->pkg.desc_long, tempPkg.desc_long);
strcpy(f->pkg.app_id, tempPkg.app_id); strcpy(f->pkg.app_id, tempPkg.app_id);
......
...@@ -50,8 +50,9 @@ ...@@ -50,8 +50,9 @@
#include <math.h> #include <math.h>
#include <string.h> #include <string.h>
#include <strings.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <cstdlib>
//#include <locale.h> //#include <locale.h>
//#include <ctype.h> //#include <ctype.h>
......
...@@ -169,6 +169,9 @@ ...@@ -169,6 +169,9 @@
* the result overflows to +-Infinity or underflows to 0. * the result overflows to +-Infinity or underflows to 0.
*/ */
#include <cstdlib>
#include <string.h>
//SCHERZO #include <config.h> //SCHERZO #include <config.h>
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
#define IEEE_MC68k #define IEEE_MC68k
...@@ -195,9 +198,6 @@ typedef unsigned Long ULong; ...@@ -195,9 +198,6 @@ typedef unsigned Long ULong;
#define Bug(x) {fprintf(stderr, "%s\n", x); exit(1);} #define Bug(x) {fprintf(stderr, "%s\n", x); exit(1);}
#endif #endif
#include "stdlib.h"
#include "string.h"
#ifdef USE_LOCALE #ifdef USE_LOCALE
#include "locale.h" #include "locale.h"
#endif #endif
......
...@@ -45,6 +45,9 @@ ...@@ -45,6 +45,9 @@
#include "operations.h" #include "operations.h"
#include "ustring.h" #include "ustring.h"
#include <cstdlib>
#include <string.h>
using namespace KJS; using namespace KJS;
#define KJS_BREAKPOINT \ #define KJS_BREAKPOINT \
......
...@@ -115,7 +115,7 @@ CString &CString::operator=(const CString &str) ...@@ -115,7 +115,7 @@ CString &CString::operator=(const CString &str)
return *this; 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(); int len = c1.size();
return len == c2.size() && (len == 0 || memcmp(c1.c_str(), c2.c_str(), len) == 0); return len == c2.size() && (len == 0 || memcmp(c1.c_str(), c2.c_str(), len) == 0);
...@@ -897,7 +897,7 @@ void UString::release() ...@@ -897,7 +897,7 @@ void UString::release()
rep->deref(); 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) if (s1.rep->len != s2.rep->len)
return false; return false;
...@@ -906,7 +906,7 @@ bool KJS::operator==(const UString& s1, const UString& s2) ...@@ -906,7 +906,7 @@ bool KJS::operator==(const UString& s1, const UString& s2)
s1.rep->len * sizeof(UChar)) == 0); 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) { if (s2 == 0) {
return s1.isEmpty(); return s1.isEmpty();
...@@ -924,7 +924,7 @@ bool KJS::operator==(const UString& s1, const char *s2) ...@@ -924,7 +924,7 @@ bool KJS::operator==(const UString& s1, const char *s2)
return u == uend && *s2 == 0; 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 l1 = s1.size();
const int l2 = s2.size(); const int l2 = s2.size();
...@@ -943,7 +943,7 @@ bool KJS::operator<(const UString& s1, const UString& s2) ...@@ -943,7 +943,7 @@ bool KJS::operator<(const UString& s1, const UString& s2)
return (l1 < l2); 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 l1 = s1.size();
const int l2 = s2.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