X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2Fplat%2FGCJ.cc;h=3050a2b617e8f2e668207a3f872bd79a7f256f70;hb=38786988d12f2c48a314ee37c326965ff0bcadb6;hp=bc8989e9e35102fc7a324a9c044aeaf84f5a4d06;hpb=a45ce685745744f24f23d94132e8042fd88b1736;p=org.ibex.core.git diff --git a/src/org/xwt/plat/GCJ.cc b/src/org/xwt/plat/GCJ.cc index bc8989e..3050a2b 100644 --- a/src/org/xwt/plat/GCJ.cc +++ b/src/org/xwt/plat/GCJ.cc @@ -1,17 +1,43 @@ +// Copyright 2002 Adam Megacz, see the COPYING file for licensing [LGPL] + +// Inclusions ///////////////////////////////////////////////////////// + +#include +#include extern "C" { + +// hack for broken Solaris headers +#define _WCHAR_T + #include #include #include #include "jpeglib.h" } -#include -#include - -#include +#include #include +#include +#include #include #include + + +// builtin.xwar ///////////////////////////////////////////////////////// + +extern unsigned char builtin_bytes[]; +extern int builtin_length; + +java::io::InputStream* org::xwt::plat::GCJ::_getBuiltinInputStream() { + jbyteArray ret = JvNewByteArray(builtin_length); + memcpy(elements(ret), builtin_bytes, builtin_length); + return new java::io::ByteArrayInputStream(ret); +} + + + +// JPEG //////////////////////////////////////////////////////////////// + #define INPUT_BUF_SIZE (1024 * 16) typedef struct { @@ -99,4 +125,8 @@ void org::xwt::plat::GCJ$JPEG::nativeDecompress() { jpeg_destroy_decompress(&cinfo); } - +// C++ new/delete operators (JvMalloc never fails) +void* operator new(size_t size) { return JvMalloc(size); } +void* operator new[](size_t size) { return JvMalloc(size);} +void operator delete(void *p) { JvFree(p); } +void operator delete[](void *p) { JvFree(p); }