* configure.ac: Added check for sys/utsname.h header.
[cacao.git] / src / native / vm / cldc1.1 / com_sun_cldc_io_ResourceInputStream.cpp
index 2ece32fc4ba96ee68313b3df4e261b3dced6b02a..520a4018f539d5d92d86db132171d74e72f7e3f9 100644 (file)
 
 #include "config.h"
 
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <fcntl.h>
 #include <errno.h>
 #include <zlib.h>
 
-#include "mm/memory.h"
+#include "mm/memory.hpp"
 
 #include "native/jni.hpp"
-#include "native/llni.h"
 #include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 
 #include "threads/mutex.hpp"
 
-#include "vm/jit/builtin.hpp"
+#include "vm/array.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/javaobjects.hpp"
+#include "vm/os.hpp"
 #include "vm/string.hpp"
 #include "vm/types.h"
 #include "vm/vm.hpp" /* REMOVE ME: temporarily */
@@ -193,7 +190,10 @@ JNIEXPORT jobject JNICALL Java_com_sun_cldc_io_ResourceInputStream_open(JNIEnv *
        char *path;
        utf *uname;
        java_handle_t* descriptor;
-       
+
+       // Get current list of classpath entries.
+       SuckClasspath& suckclasspath = VM::get_current()->get_suckclasspath();
+
        /* get the classname as char string (do it here for the warning at
        the end of the function) */
 
@@ -201,10 +201,10 @@ JNIEXPORT jobject JNICALL Java_com_sun_cldc_io_ResourceInputStream_open(JNIEnv *
        filenamelen = utf_bytes(uname) + strlen("0");
        filename = MNEW(char, filenamelen);
        utf_copy(filename, uname);
-       
+
        /* walk through all classpath entries */
 
-       for (List<list_classpath_entry*>::iterator it = list_classpath_entries->begin(); it != list_classpath_entries->end(); it++) {
+       for (SuckClasspath::iterator it = suckclasspath.begin(); it != suckclasspath.end(); it++) {
                list_classpath_entry* lce = *it;
 
 #if defined(ENABLE_ZLIB)
@@ -302,8 +302,9 @@ JNIEXPORT jint JNICALL Java_com_sun_cldc_io_ResourceInputStream_readBytes(JNIEnv
 {
        /* get pointer to the buffer */
        // XXX Not GC safe.
-       void* buf = &(LLNI_array_direct((java_handle_bytearray_t*) byteArray, off));
-       
+       ByteArray ba(byteArray);
+       void* buf = (void*) (((int8_t*) ba.get_raw_data_ptr()) + off);
+
        com_sun_cldchi_jvm_FileDescriptor fd(jobj);
 
        int64_t filep      = fd.get_pointer();