X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e75eb9cf239c06058afeba5e57096534a3990013..10a65e631bec1d5290a4c9753b6c8b0b4ae5fcca:/src/bindings/java/jmsg_file.c diff --git a/src/bindings/java/jmsg_file.c b/src/bindings/java/jmsg_file.c index ec40195a28..1210a74c3a 100644 --- a/src/bindings/java/jmsg_file.c +++ b/src/bindings/java/jmsg_file.c @@ -1,9 +1,11 @@ /* Functions related to the java file API. */ -/* Copyright (c) 2012. The SimGrid Team. + +/* Copyright (c) 2012-2014. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it - * under the terms of the license (GNU LGPL) which comes with this package. */ + * under the terms of the license (GNU LGPL) which comes with this package. */ + #include "jmsg_file.h" #include "jxbt_utilities.h" @@ -24,31 +26,25 @@ Java_org_simgrid_msg_File_nativeInit(JNIEnv *env, jclass cls) { xbt_assert((jfile_field_bind != NULL), "Can't find \"bind\" field in File class."); } JNIEXPORT void JNICALL -Java_org_simgrid_msg_File_open(JNIEnv *env, jobject jfile, jobject jstorage, jobject jpath) { - const char *storage = (*env)->GetStringUTFChars(env, jstorage, 0); +Java_org_simgrid_msg_File_open(JNIEnv *env, jobject jfile, jobject jpath) { const char *path = (*env)->GetStringUTFChars(env, jpath, 0); msg_file_t file; - file = MSG_file_open(storage, path, NULL); + file = MSG_file_open(path, NULL); jfile_bind(env, jfile, file); - (*env)->ReleaseStringUTFChars(env, jstorage, storage); (*env)->ReleaseStringUTFChars(env, jpath, path); } JNIEXPORT jlong JNICALL Java_org_simgrid_msg_File_read(JNIEnv *env, jobject jfile, jlong jsize) { msg_file_t file = jfile_get_native(env, jfile); - size_t n; - n = MSG_file_read((size_t)jsize, file); - return (jlong)n; + return (jlong)MSG_file_read(file, (sg_size_t)jsize); } JNIEXPORT jlong JNICALL Java_org_simgrid_msg_File_write(JNIEnv *env, jobject jfile, jlong jsize) { msg_file_t file = jfile_get_native(env, jfile); - size_t n; - n = MSG_file_write((size_t)jsize, file); - return (jlong)n; + return (jlong)MSG_file_write(file, (sg_size_t)jsize); } JNIEXPORT void JNICALL Java_org_simgrid_msg_File_close(JNIEnv *env, jobject jfile) {