A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge master into mc-process
[simgrid.git]
/
src
/
bindings
/
java
/
jmsg_file.c
diff --git
a/src/bindings/java/jmsg_file.c
b/src/bindings/java/jmsg_file.c
index
1d45583
..
1210a74
100644
(file)
--- a/
src/bindings/java/jmsg_file.c
+++ b/
src/bindings/java/jmsg_file.c
@@
-1,17
+1,21
@@
/* Functions related to the java file API. */
/* 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
* 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"
#include "jmsg_file.h"
#include "jxbt_utilities.h"
-void jfile_bind(JNIEnv *env, jobject jfile, msg_file_t stream) {
- (*env)->SetLongField(env, jfile, jfile_field_bind, (jlong) (long) (stream));
+
+void jfile_bind(JNIEnv *env, jobject jfile, msg_file_t fd) {
+ (*env)->SetLongField(env, jfile, jfile_field_bind, (intptr_t)fd);
}
msg_file_t jfile_get_native(JNIEnv *env, jobject jfile) {
}
msg_file_t jfile_get_native(JNIEnv *env, jobject jfile) {
- msg_file_t file = (msg_file_t)(*env)->GetLongField(env, jfile, jfile_field_bind);
+ msg_file_t file =
+ (msg_file_t)(intptr_t)(*env)->GetLongField(env, jfile, jfile_field_bind);
return file;
}
return file;
}
@@
-22,33
+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
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, jobject jmode) {
- 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);
const char *path = (*env)->GetStringUTFChars(env, jpath, 0);
- const char *mode = (*env)->GetStringUTFChars(env, jmode, 0);
msg_file_t file;
msg_file_t file;
- file = MSG_file_open(
storage, path, mode
);
+ file = MSG_file_open(
path, NULL
);
jfile_bind(env, jfile, file);
jfile_bind(env, jfile, file);
- (*env)->ReleaseStringUTFChars(env, jstorage, storage);
(*env)->ReleaseStringUTFChars(env, jpath, path);
(*env)->ReleaseStringUTFChars(env, jpath, path);
- (*env)->ReleaseStringUTFChars(env, jmode, mode);
}
JNIEXPORT jlong JNICALL
}
JNIEXPORT jlong JNICALL
-Java_org_simgrid_msg_File_read(JNIEnv *env, jobject jfile, jlong jsize
, jlong jnmemb
) {
+Java_org_simgrid_msg_File_read(JNIEnv *env, jobject jfile, jlong jsize) {
msg_file_t file = jfile_get_native(env, jfile);
msg_file_t file = jfile_get_native(env, jfile);
- size_t n;
- n = MSG_file_read(NULL,(size_t)jsize, (size_t)jnmemb, file);
- return (jlong)n;
+ return (jlong)MSG_file_read(file, (sg_size_t)jsize);
}
JNIEXPORT jlong JNICALL
}
JNIEXPORT jlong JNICALL
-Java_org_simgrid_msg_File_write(JNIEnv *env, jobject jfile, jlong jsize
, jlong jnmemb
) {
+Java_org_simgrid_msg_File_write(JNIEnv *env, jobject jfile, jlong jsize) {
msg_file_t file = jfile_get_native(env, jfile);
msg_file_t file = jfile_get_native(env, jfile);
- size_t n;
- n = MSG_file_write(NULL, (size_t)jsize, (size_t)jnmemb, 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) {
}
JNIEXPORT void JNICALL
Java_org_simgrid_msg_File_close(JNIEnv *env, jobject jfile) {