#include "vm/types.h"
-#include "mm/memory.h"
+#include "mm/memory.hpp"
-#include "native/jni.h"
-#include "native/llni.h"
-#include "native/native.h"
+#include "native/jni.hpp"
+#include "native/native.hpp"
#if defined(ENABLE_JNI_HEADERS)
# include "native/include/com_sun_cldc_io_j2me_socket_Protocol.h"
// The hostname byte-array is a NULL terminated C-string.
// XXX Not GC safe.
- char* name = (char*) &(LLNI_array_data((java_handle_bytearray_t*) hostname));
+ ByteArray ba(hostname);
+ char* name = (char*) ba.get_raw_data_ptr();
/* get the host */
{
// Get pointer to the buffer.
// XXX Not GC safe.
- void* buf = &(LLNI_array_direct((java_handle_bytearray_t*) b, off));
+ ByteArray ba(b);
+ void* buf = (void*) (((int8_t*) ba.get_raw_data_ptr()) + off);
// Receive from the socket.
ssize_t result = recv(handle, buf, len, 0);
{
// Get pointer to the buffer.
// XXX Not GC safe.
- void* buf = &(LLNI_array_direct((java_handle_bytearray_t*) b, off));
+ ByteArray ba(b);
+ void* buf = (void*) (((int8_t*) ba.get_raw_data_ptr()) + off);
// Send the given byte to the socket.
ssize_t result = send(handle, buf, len, 0);
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_com_sun_cldc_io_j2me_socket_Protocol_init(void)
{
- utf *u;
-
- u = utf_new_char("com/sun/cldc/io/j2me/socket/Protocol");
+ utf* u = utf_new_char("com/sun/cldc/io/j2me/socket/Protocol");
- native_method_register(u, methods, NATIVE_METHODS_COUNT);
-}
+ NativeMethods& nm = VM::get_current()->get_nativemethods();
+ nm.register_methods(u, methods, NATIVE_METHODS_COUNT);
}