diff options
| author | Roman Kennke <roman@kennke.org> | 2006-01-17 12:29:38 +0000 |
|---|---|---|
| committer | Roman Kennke <roman@kennke.org> | 2006-01-17 12:29:38 +0000 |
| commit | 88368b65b491556d2596cc366fb3890277cb164a (patch) | |
| tree | 05d34a28dff383f312ae83c3982c92aa7f21a8af /native/jni/java-io | |
| parent | 745afe139667f48282bebcac854561f1113beb67 (diff) | |
| download | classpath-88368b65b491556d2596cc366fb3890277cb164a.tar.gz | |
2006-01-17 Roman Kennke <kennke@aicas.com>
* native/jni/classpath/jcl.c: Added missing imports.
(JCL_realloc): Fixed signature to include oldsize. This is needed
for some targets. Make this function use the MEMORY_REALLOC macro
for portability.
* native/jni/classpath/jcl.h
(JCL_realloc): Adjusted signature.
* native/jni/java-io/java_io_VMFile.c:
(Java_java_io_VMFile_create): Use target layer macro for handling
errno, for portability.
(Java_java_io_VMFile_length): Release filename string in error cases
before returning.
(Java_java_io_VMFile_list): Initialize filename variable. Use new
version of JCL_realloc.
* native/jni/java-net/java_net_VMInetAddress.c:
(Java_java_net_VMInetAddress_getHostByName): Use renamed macro
TARGET_NATIVE_NETWORK_GET_HOSTADDRESS_BY_NAME.
* native/jni/java-net/javanet.c:
(_javanet_bind): Make errorstr variable const to avoid compiler
warning.
(_javanet_set_option): Fixed typo.
(_javanet_get_option): Fixed typo.
* native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c:
(Java_gnu_java_nio_channels_FileChannelImpl_open): Made
error_string variable const to avoid compiler warning.
* native/target/generic/target_generic_file.h:
Replaced // comments with /* */ comments to avoid compiler warnings.
Added some spaces to make code better readable.
* native/target/generic/target_generic_memory.h:
Replaced // comments with /* */ comments to avoid compiler warnings.
* native/target/generic/target_generic_misc.c:
Removed unused TARGET_NATIVE_MISC_FORMAT_STRING macro. This caused
compiler warnings due to use of varargs.
* native/target/generic/target_generic_misc.h:
Removed unused TARGET_NATIVE_MISC_FORMAT_STRING macro. This caused
compiler warnings due to use of varargs.
* native/target/generic/target_generic_network.h:
Replaced // comments with /* */ comments to avoid compiler warnings.
(targetGenericNetwork_receive): Fixed signature to use signed chars
for buffer parameter to avoid warning when passing a jbyte to the
function.
Diffstat (limited to 'native/jni/java-io')
| -rw-r--r-- | native/jni/java-io/java_io_VMFile.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/native/jni/java-io/java_io_VMFile.c b/native/jni/java-io/java_io_VMFile.c index b6d839777..4909ae3c1 100644 --- a/native/jni/java-io/java_io_VMFile.c +++ b/native/jni/java-io/java_io_VMFile.c @@ -46,7 +46,7 @@ exception statement from your version. */ #include "target_native.h" #ifndef WITHOUT_FILESYSTEM -#include "target_native_file.h" + #include "target_native_file.h" #endif #include "target_native_math.h" @@ -81,8 +81,7 @@ Java_java_io_VMFile_create (JNIEnv * env, TARGET_NATIVE_FILE_OPEN_CREATE (filename, fd, result); if (result != TARGET_NATIVE_OK) { - /* XXX ??? NYI */ - if (errno != EEXIST) + if (TARGET_NATIVE_LAST_ERROR() != TARGET_NATIVE_ERROR_FILE_EXISTS) JCL_ThrowException (env, "java/io/IOException", TARGET_NATIVE_LAST_ERROR_STRING ()); @@ -364,12 +363,14 @@ Java_java_io_VMFile_length (JNIEnv * env, TARGET_NATIVE_FILE_OPEN_READ (filename, tmpfd, result); if (result != TARGET_NATIVE_OK) { + (*env)->ReleaseStringUTFChars(env, name, filename); return (TARGET_NATIVE_MATH_INT_INT64_CONST_0); } TARGET_NATIVE_FILE_SIZE (tmpfd, length, result); if (result != TARGET_NATIVE_OK) { TARGET_NATIVE_FILE_CLOSE (tmpfd, result); + (*env)->ReleaseStringUTFChars(env, name, filename); return (TARGET_NATIVE_MATH_INT_INT64_CONST_0); } TARGET_NATIVE_FILE_CLOSE (tmpfd, result); @@ -595,7 +596,7 @@ Java_java_io_VMFile_list (JNIEnv * env, jobject obj int result; char **filelist; void *handle; - const char *filename; + char filename[256]; unsigned long int filelist_count, max_filelist_count; char **tmp_filelist; jclass str_clazz; @@ -640,11 +641,13 @@ Java_java_io_VMFile_list (JNIEnv * env, jobject obj /* allocate more memory if necessary */ if (filelist_count >= max_filelist_count) { - tmp_filelist = (char **) JCL_realloc (env, + tmp_filelist = (char **) JCL_realloc (env, filelist, - (max_filelist_count + - REALLOC_SIZE) * - sizeof (char *)); + max_filelist_count + * sizeof (char *), + (max_filelist_count + + REALLOC_SIZE) + * sizeof (char *)); if (tmp_filelist == NULL) { for (i = 0; i < filelist_count; i++) |
