Hi,
As suggested by Mark it is unnecessary to support compilers that does
not support 64 bits integer. So jlong will be considered as a real type
(and not potentially composite). This patch assumes this for now.
Regards,
Guilhem.
ChangeLog:
2006-02-19 Guilhem Lavaux <[EMAIL PROTECTED]>
* native/jni/java-io/java_io_VMFile.c,
native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c,
native/jni/midi-dssi/dssi_data.h,
native/jni/native-lib/cpio.c,
native/jni/native-lib/cpmath.h: Removed cpmath
dependency. Fixed coding style.
? build
? log
Index: native/jni/java-io/java_io_VMFile.c
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/java-io/java_io_VMFile.c,v
retrieving revision 1.10.2.2
diff -u -r1.10.2.2 java_io_VMFile.c
--- native/jni/java-io/java_io_VMFile.c 28 Jan 2006 16:38:25 -0000 1.10.2.2
+++ native/jni/java-io/java_io_VMFile.c 19 Feb 2006 10:45:06 -0000
@@ -44,7 +44,6 @@
#include <jni.h>
#include <jcl.h>
-#include "cpmath.h"
#include "cpio.h"
#include "cpnative.h"
@@ -73,7 +72,7 @@
filename = JCL_jstring_to_cstring (env, name);
if (filename == NULL)
{
- return (0);
+ return 0;
}
result = cpio_openFile (filename, &fd, CPFILE_FLAG_CREATE|CPFILE_FLAG_WRITE,
CPFILE_PERMISSION_NORMAL);
@@ -84,14 +83,14 @@
"java/io/IOException",
cpnative_getErrorString (result));
JCL_free_cstring (env, name, filename);
- return (0);
+ return 0;
}
cpio_closeFile (fd);
JCL_free_cstring (env, name, filename);
- return (1);
+ return 1;
#else /* not WITHOUT_FILESYSTEM */
- return (0);
+ return 0;
#endif /* not WITHOUT_FILESYSTEM */
}
@@ -120,7 +119,7 @@
filename = (*env)->GetStringUTFChars (env, name, 0);
if (filename == NULL)
{
- return (0);
+ return 0;
}
/* The lazy man's way out. We actually do open the file for reading
@@ -128,12 +127,12 @@
result = cpio_openFile (filename, &fd, CPFILE_FLAG_READ, 0);
(*env)->ReleaseStringUTFChars (env, name, filename);
if (result != CPNATIVE_OK)
- return (0);
+ return 0;
cpio_closeFile (fd);
- return (1);
+ return 1;
#else /* not WITHOUT_FILESYSTEM */
- return (0);
+ return 0;
#endif /* not WITHOUT_FILESYSTEM */
}
@@ -162,7 +161,7 @@
filename = (*env)->GetStringUTFChars (env, name, 0);
if (filename == NULL)
{
- return (0);
+ return 0;
}
/* The lazy man's way out. We actually do open the file for writing
@@ -171,13 +170,13 @@
(*env)->ReleaseStringUTFChars (env, name, filename);
if (result != CPNATIVE_OK)
{
- return (0);
+ return 0;
}
cpio_closeFile (fd);
- return (1);
+ return 1;
#else /* not WITHOUT_FILESYSTEM */
- return (0);
+ return 0;
#endif /* not WITHOUT_FILESYSTEM */
}
@@ -205,15 +204,15 @@
filename = (*env)->GetStringUTFChars (env, name, 0);
if (filename == NULL)
{
- return (0);
+ return 0;
}
result = cpio_setFileReadonly (filename);
(*env)->ReleaseStringUTFChars (env, name, filename);
- return ((result == CPNATIVE_OK) ? 1 : 0);
+ return result == CPNATIVE_OK ? 1 : 0;
#else /* not WITHOUT_FILESYSTEM */
- return (0);
+ return 0;
#endif /* not WITHOUT_FILESYSTEM */
}
@@ -241,15 +240,15 @@
filename = (*env)->GetStringUTFChars (env, name, 0);
if (filename == NULL)
{
- return (0);
+ return 0;
}
result = cpio_isFileExists (filename);
(*env)->ReleaseStringUTFChars (env, name, filename);
- return ((result == CPNATIVE_OK) ? 1 : 0);
+ return result == CPNATIVE_OK ? 1 : 0;
#else /* not WITHOUT_FILESYSTEM */
- return (0);
+ return 0;
#endif /* not WITHOUT_FILESYSTEM */
}
@@ -279,15 +278,15 @@
filename = (*env)->GetStringUTFChars (env, name, 0);
if (filename == NULL)
{
- return (0);
+ return 0;
}
result = cpio_checkType (filename, &entryType);
(*env)->ReleaseStringUTFChars (env, name, filename);
- return ((result == CPNATIVE_OK && entryType == CPFILE_FILE) ? 1 : 0);
+ return result == CPNATIVE_OK && entryType == CPFILE_FILE ? 1 : 0;
#else /* not WITHOUT_FILESYSTEM */
- return (0);
+ return 0;
#endif /* not WITHOUT_FILESYSTEM */
}
@@ -316,15 +315,15 @@
filename = (*env)->GetStringUTFChars (env, name, 0);
if (filename == NULL)
{
- return (0);
+ return 0;
}
result = cpio_checkType (filename, &entryType);
(*env)->ReleaseStringUTFChars (env, name, filename);
- return ((result == CPNATIVE_OK && entryType == CPFILE_DIRECTORY) ? 1 : 0);
+ return result == CPNATIVE_OK && entryType == CPFILE_DIRECTORY ? 1 : 0;
#else /* not WITHOUT_FILESYSTEM */
- return (0);
+ return 0;
#endif /* not WITHOUT_FILESYSTEM */
}
@@ -353,26 +352,26 @@
on failure */
filename = (*env)->GetStringUTFChars (env, name, 0);
if (filename == NULL)
- return CP_JLONG0;
+ return 0;
/* open file for reading, get size and close file */
result = cpio_openFile (filename, &tmpfd, CPFILE_FLAG_READ, 0);
if (result != CPNATIVE_OK)
- return CP_JLONG0;
+ return 0;
result = cpio_getFileSize (tmpfd, &length);
if (result != CPNATIVE_OK)
{
cpio_closeFile (tmpfd);
- return CP_JLONG0;
+ return 0;
}
result = cpio_closeFile (tmpfd);
(*env)->ReleaseStringUTFChars (env, name, filename);
- return (result == CPNATIVE_OK) ? length : CP_JLONG0;
+ return result == CPNATIVE_OK ? length : 0;
#else /* not WITHOUT_FILESYSTEM */
- return CP_JLONG0;
+ return 0;
#endif /* not WITHOUT_FILESYSTEM */
}
@@ -401,15 +400,15 @@
filename = (*env)->GetStringUTFChars (env, name, 0);
if (filename == NULL)
{
- return CP_JLONG0;
+ return 0;
}
result = cpio_getModificationTime (filename, &mtime);
(*env)->ReleaseStringUTFChars (env, name, filename);
- return ((result == CPNATIVE_OK) ? mtime : CP_JLONG0);
+ return result == CPNATIVE_OK ? mtime : 0;
#else /* not WITHOUT_FILESYSTEM */
- return (CP_JLONG0);
+ return 0;
#endif /* not WITHOUT_FILESYSTEM */
}
@@ -437,15 +436,15 @@
filename = (*env)->GetStringUTFChars (env, name, 0);
if (filename == NULL)
{
- return (0);
+ return 0;
}
result = cpio_setModificationTime (filename, newtime);
(*env)->ReleaseStringUTFChars (env, name, filename);
- return ((result == CPNATIVE_OK) ? 1 : 0);
+ return result == CPNATIVE_OK ? 1 : 0;
#else /* not WITHOUT_FILESYSTEM */
- return (0);
+ return 0;
#endif /* not WITHOUT_FILESYSTEM */
}
@@ -474,15 +473,15 @@
filename = (*env)->GetStringUTFChars (env, name, 0);
if (filename == NULL)
{
- return (0);
+ return 0;
}
result = cpio_removeFile (filename);
(*env)->ReleaseStringUTFChars (env, name, filename);
- return ((result == CPNATIVE_OK) ? 1 : 0);
+ return result == CPNATIVE_OK ? 1 : 0;
#else /* not WITHOUT_FILESYSTEM */
- return (0);
+ return 0;
#endif /* not WITHOUT_FILESYSTEM */
}
@@ -510,15 +509,15 @@
pathname = (*env)->GetStringUTFChars (env, name, 0);
if (pathname == NULL)
{
- return (0);
+ return 0;
}
result = cpio_mkdir (pathname);
(*env)->ReleaseStringUTFChars (env, name, pathname);
- return ((result == CPNATIVE_OK) ? 1 : 0);
+ return (result == CPNATIVE_OK) ? 1 : 0;
#else /* not WITHOUT_FILESYSTEM */
- return (0);
+ return 0;
#endif /* not WITHOUT_FILESYSTEM */
}
@@ -546,23 +545,23 @@
old_filename = (*env)->GetStringUTFChars (env, t, 0);
if (old_filename == NULL)
{
- return (0);
+ return 0;
}
new_filename = (*env)->GetStringUTFChars (env, d, 0);
if (new_filename == NULL)
{
(*env)->ReleaseStringUTFChars (env, t, old_filename);
- return (0);
+ return 0;
}
result = cpio_rename (old_filename, new_filename);
(*env)->ReleaseStringUTFChars (env, d, new_filename);
(*env)->ReleaseStringUTFChars (env, t, old_filename);
- return ((result == CPNATIVE_OK) ? 1 : 0);
+ return (result == CPNATIVE_OK) ? 1 : 0;
#else /* not WITHOUT_FILESYSTEM */
- return (0);
+ return 0;
#endif /* not WITHOUT_FILESYSTEM */
}
@@ -601,7 +600,7 @@
dirname = (*env)->GetStringUTFChars (env, name, 0);
if (dirname == NULL)
{
- return (0);
+ return 0;
}
/* open directory for reading */
@@ -611,7 +610,7 @@
if (result != CPNATIVE_OK)
{
- return (0);
+ return 0;
}
/* allocate filelist */
@@ -619,7 +618,7 @@
if (filelist == NULL)
{
result = cpio_closeDir (handle);
- return (0);
+ return 0;
}
filelist_count = 0;
max_filelist_count = REALLOC_SIZE;
@@ -646,7 +645,7 @@
}
JCL_free (env, filelist);
result = cpio_closeDir (handle);
- return (0);
+ return 0;
}
filelist = tmp_filelist;
max_filelist_count += REALLOC_SIZE;
@@ -676,7 +675,7 @@
JCL_free (env, filelist[i]);
}
JCL_free (env, filelist);
- return (0);
+ return 0;
}
filearray = (*env)->NewObjectArray (env, filelist_count, str_clazz, 0);
if (filearray == NULL)
@@ -686,7 +685,7 @@
JCL_free (env, filelist[i]);
}
JCL_free (env, filelist);
- return (0);
+ return 0;
}
for (i = 0; i < filelist_count; i++)
{
@@ -701,7 +700,7 @@
JCL_free (env, filelist[i]);
}
JCL_free (env, filelist);
- return (0);
+ return 0;
}
/* save into array */
@@ -718,8 +717,8 @@
}
JCL_free (env, filelist);
- return (filearray);
+ return filearray;
#else /* not WITHOUT_FILESYSTEM */
- return (0);
+ return 0;
#endif /* not WITHOUT_FILESYSTEM */
}
Index: native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c
===================================================================
RCS file:
/cvsroot/classpath/classpath/native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c,v
retrieving revision 1.32.2.1
diff -u -r1.32.2.1 gnu_java_nio_channels_FileChannelImpl.c
--- native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c 28 Jan 2006
11:11:30 -0000 1.32.2.1
+++ native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c 19 Feb 2006
10:45:06 -0000
@@ -46,7 +46,6 @@
#include "cpnative.h"
#include "cpio.h"
-#include "cpmath.h"
#include "gnu_java_nio_channels_FileChannelImpl.h"
@@ -255,7 +254,7 @@
while (result != CPNATIVE_OK);
/* FIXME NYI ??? why only jint and not jlong? */
- return cpmath_jlong_to_jint (bytes_available);
+ return (jint)bytes_available;
}
JNIEXPORT jlong JNICALL
@@ -272,7 +271,7 @@
{
JCL_ThrowException (env, IO_EXCEPTION,
cpnative_getErrorString (result));
- return cpmath_jint_to_jlong(-1);
+ return -1;
}
return file_size;
@@ -297,7 +296,7 @@
{
JCL_ThrowException (env, IO_EXCEPTION,
cpnative_getErrorString (result));
- return cpmath_jint_to_jlong(-1);
+ return -1;
}
return current_offset;
Index: native/jni/midi-dssi/dssi_data.h
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/midi-dssi/dssi_data.h,v
retrieving revision 1.3
diff -u -r1.3 dssi_data.h
--- native/jni/midi-dssi/dssi_data.h 7 Oct 2005 03:21:05 -0000 1.3
+++ native/jni/midi-dssi/dssi_data.h 19 Feb 2006 10:45:06 -0000
@@ -46,8 +46,6 @@
#include <stdio.h>
-#include "target_native.h"
-#include "target_native_misc.h"
#include "../classpath/jcl.h"
/* Specify the size of the circular buffer. It only needs to be big
Index: native/jni/native-lib/cpio.c
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/native-lib/Attic/cpio.c,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 cpio.c
--- native/jni/native-lib/cpio.c 28 Jan 2006 11:11:30 -0000 1.1.2.1
+++ native/jni/native-lib/cpio.c 19 Feb 2006 10:45:06 -0000
@@ -71,7 +71,6 @@
#endif
#include "cpnative.h"
-#include "cpmath.h"
#include "cpio.h"
JNIEXPORT int cpio_openFile (const char *filename, int *fd, int flags, int
permissions)
@@ -280,13 +279,13 @@
if (result != CPNATIVE_OK)
return result;
- if (cpmath_jlong_lt (file_size, new_size))
+ if (file_size < new_size)
{
/* File is too short -- seek to one byte short of where we want,
* then write a byte */
/* move to position n-1 */
- result = cpio_setFilePosition (native_fd, cpmath_jlong_sub_jint
(new_size, 1));
+ result = cpio_setFilePosition (native_fd, new_size-1);
if (result != CPNATIVE_OK)
return result;
@@ -299,14 +298,14 @@
return result;
/* Reposition file pointer to where we started if not beyond new len. */
- if (cpmath_jlong_lt (save_offset, new_size))
+ if (save_offset < new_size)
{
result = cpio_setFilePosition (native_fd, save_offset);
if (result != CPNATIVE_OK)
return result;
}
}
- else if (cpmath_jlong_lt (new_size, file_size))
+ else if (new_size < file_size)
{
/* File is too long - use ftruncate if available */
result = cpio_truncate (native_fd, new_size);
@@ -314,7 +313,7 @@
return result;
/* Reposition file pointer when it now is beyond the end of file. */
- if (cpmath_jlong_lt (new_size, save_offset))
+ if (new_size < save_offset)
{
result = cpio_setFilePosition (native_fd, new_size);
if (result != CPNATIVE_OK)
Index: native/jni/native-lib/cpmath.h
===================================================================
RCS file: native/jni/native-lib/cpmath.h
diff -N native/jni/native-lib/cpmath.h
--- native/jni/native-lib/cpmath.h 28 Jan 2006 15:48:58 -0000 1.1.2.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,50 +0,0 @@
-/* cpmath.h -
- Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-#ifndef _CLASSPATH_MATH_H_INCLUDED
-#define _CLASSPATH_MATH_H_INCLUDED
-
-#include <jni.h>
-
-#define cpmath_jint_to_jlong(i) ((jlong)(i))
-#define cpmath_jlong_to_jint(l) ((jint)(l))
-#define cpmath_jlong_lt(l1, l2) ((l1) < (l2))
-#define cpmath_jlong_sub_jint(l1, i2) ((l1) - (i2))
-
-#define CP_JLONG0 cpmath_jint_to_jlong(0)
-
-#endif