X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2Fplat%2FGCJ.cc;h=3050a2b617e8f2e668207a3f872bd79a7f256f70;hb=38786988d12f2c48a314ee37c326965ff0bcadb6;hp=b35c94ff442110c435c650f7d7cf94dac5116436;hpb=4f7f0b92b26b48cd88f534c5ca29b5bce98929b2;p=org.ibex.core.git diff --git a/src/org/xwt/plat/GCJ.cc b/src/org/xwt/plat/GCJ.cc index b35c94f..3050a2b 100644 --- a/src/org/xwt/plat/GCJ.cc +++ b/src/org/xwt/plat/GCJ.cc @@ -1,15 +1,43 @@ -#include -#include +// Copyright 2002 Adam Megacz, see the COPYING file for licensing [LGPL] + +// Inclusions ///////////////////////////////////////////////////////// + #include #include -#include "jpeglib.h" -#include +extern "C" { -#include +// hack for broken Solaris headers +#define _WCHAR_T + +#include +#include +#include +#include "jpeglib.h" +} +#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 { @@ -97,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); }