diff options
| author | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-08-14 23:12:35 +0000 |
|---|---|---|
| committer | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-08-14 23:12:35 +0000 |
| commit | ffde862e033a0825e1e9972a89c0f1f80b261a8e (patch) | |
| tree | 97037d2c09c8384d80531f67ec36a01205df6bdb /libjava/classpath/native/jni/java-net | |
| parent | b415ff10527e977c3758234fd930e2c027bfa17d (diff) | |
| download | ppe42-gcc-ffde862e033a0825e1e9972a89c0f1f80b261a8e.tar.gz ppe42-gcc-ffde862e033a0825e1e9972a89c0f1f80b261a8e.zip | |
2006-08-14 Mark Wielaard <mark@klomp.org>
Imported GNU Classpath 0.92
* HACKING: Add more importing hints. Update automake version
requirement.
* configure.ac (gconf-peer): New enable AC argument.
Add --disable-gconf-peer and --enable-default-preferences-peer
to classpath configure when gconf is disabled.
* scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and
gnu/java/awt/dnd/peer/gtk to bc. Classify
gnu/java/security/Configuration.java as generated source file.
* gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java,
gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java,
gnu/java/lang/management/VMClassLoadingMXBeanImpl.java,
gnu/java/lang/management/VMRuntimeMXBeanImpl.java,
gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java,
gnu/java/lang/management/VMThreadMXBeanImpl.java,
gnu/java/lang/management/VMMemoryMXBeanImpl.java,
gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub
classes.
* java/lang/management/VMManagementFactory.java: Likewise.
* java/net/VMURLConnection.java: Likewise.
* gnu/java/nio/VMChannel.java: Likewise.
* java/lang/Thread.java (getState): Add stub implementation.
* java/lang/Class.java (isEnum): Likewise.
* java/lang/Class.h (isEnum): Likewise.
* gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed.
* javax/naming/spi/NamingManager.java: New override for StackWalker
functionality.
* configure, sources.am, Makefile.in, gcj/Makefile.in,
include/Makefile.in, testsuite/Makefile.in: Regenerated.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116139 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/native/jni/java-net')
4 files changed, 134 insertions, 36 deletions
diff --git a/libjava/classpath/native/jni/java-net/Makefile.am b/libjava/classpath/native/jni/java-net/Makefile.am index e48173a169d..26bb64f73bf 100644 --- a/libjava/classpath/native/jni/java-net/Makefile.am +++ b/libjava/classpath/native/jni/java-net/Makefile.am @@ -12,11 +12,12 @@ libjavanet_la_SOURCES = javanet.c \ javanet.h \ java_net_VMInetAddress.c \ java_net_VMNetworkInterface.c \ + java_net_VMURLConnection.c \ gnu_java_net_VMPlainDatagramSocketImpl.c \ gnu_java_net_VMPlainSocketImpl.c \ $(local_sources) -libjavanet_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo +libjavanet_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo $(LIBMAGIC) AM_LDFLAGS = @CLASSPATH_MODULE@ AM_CPPFLAGS = @CLASSPATH_INCLUDES@ diff --git a/libjava/classpath/native/jni/java-net/Makefile.in b/libjava/classpath/native/jni/java-net/Makefile.in index cc47eb3fb73..4e19911a29f 100644 --- a/libjava/classpath/native/jni/java-net/Makefile.in +++ b/libjava/classpath/native/jni/java-net/Makefile.in @@ -61,10 +61,13 @@ am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(nativeexeclibdir)" nativeexeclibLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(nativeexeclib_LTLIBRARIES) +am__DEPENDENCIES_1 = libjavanet_la_DEPENDENCIES = \ - $(top_builddir)/native/jni/classpath/jcl.lo + $(top_builddir)/native/jni/classpath/jcl.lo \ + $(am__DEPENDENCIES_1) am__libjavanet_la_SOURCES_DIST = javanet.c javanet.h \ java_net_VMInetAddress.c java_net_VMNetworkInterface.c \ + java_net_VMURLConnection.c \ gnu_java_net_VMPlainDatagramSocketImpl.c \ gnu_java_net_VMPlainSocketImpl.c \ gnu_java_net_local_LocalSocketImpl.c local.c local.h @@ -72,7 +75,7 @@ am__libjavanet_la_SOURCES_DIST = javanet.c javanet.h \ @ENABLE_LOCAL_SOCKETS_TRUE@am__objects_1 = gnu_java_net_local_LocalSocketImpl.lo \ @ENABLE_LOCAL_SOCKETS_TRUE@ local.lo am_libjavanet_la_OBJECTS = javanet.lo java_net_VMInetAddress.lo \ - java_net_VMNetworkInterface.lo \ + java_net_VMNetworkInterface.lo java_net_VMURLConnection.lo \ gnu_java_net_VMPlainDatagramSocketImpl.lo \ gnu_java_net_VMPlainSocketImpl.lo $(am__objects_1) libjavanet_la_OBJECTS = $(am_libjavanet_la_OBJECTS) @@ -122,6 +125,8 @@ CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@ CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@ CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@ +CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@ +CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@ CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@ CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@ CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@ @@ -142,6 +147,7 @@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DATE = @DATE@ +DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ @@ -172,6 +178,10 @@ FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@ FREETYPE2_LIBS = @FREETYPE2_LIBS@ GCJ = @GCJ@ GCJX = @GCJX@ +GCONF_CFLAGS = @GCONF_CFLAGS@ +GCONF_LIBS = @GCONF_LIBS@ +GDK_CFLAGS = @GDK_CFLAGS@ +GDK_LIBS = @GDK_LIBS@ GJDOC = @GJDOC@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ @@ -222,6 +232,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@ PANGOFT2_LIBS = @PANGOFT2_LIBS@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PATH_TO_ESCHER = @PATH_TO_ESCHER@ PATH_TO_GLIBJ_ZIP = @PATH_TO_GLIBJ_ZIP@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ @@ -242,6 +253,8 @@ USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@ USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@ USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@ USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@ +USE_ESCHER_FALSE = @USE_ESCHER_FALSE@ +USE_ESCHER_TRUE = @USE_ESCHER_TRUE@ USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@ USE_PREBUILT_GLIBJ_ZIP_TRUE = @USE_PREBUILT_GLIBJ_ZIP_TRUE@ VERSION = @VERSION@ @@ -316,11 +329,12 @@ libjavanet_la_SOURCES = javanet.c \ javanet.h \ java_net_VMInetAddress.c \ java_net_VMNetworkInterface.c \ + java_net_VMURLConnection.c \ gnu_java_net_VMPlainDatagramSocketImpl.c \ gnu_java_net_VMPlainSocketImpl.c \ $(local_sources) -libjavanet_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo +libjavanet_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo $(LIBMAGIC) AM_LDFLAGS = @CLASSPATH_MODULE@ AM_CPPFLAGS = @CLASSPATH_INCLUDES@ AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@ @@ -398,6 +412,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnu_java_net_local_LocalSocketImpl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/java_net_VMInetAddress.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/java_net_VMNetworkInterface.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/java_net_VMURLConnection.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/javanet.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/local.Plo@am__quote@ diff --git a/libjava/classpath/native/jni/java-net/gnu_java_net_local_LocalSocketImpl.c b/libjava/classpath/native/jni/java-net/gnu_java_net_local_LocalSocketImpl.c index 3b29001a748..35fb6bcdcc7 100644 --- a/libjava/classpath/native/jni/java-net/gnu_java_net_local_LocalSocketImpl.c +++ b/libjava/classpath/native/jni/java-net/gnu_java_net_local_LocalSocketImpl.c @@ -200,22 +200,15 @@ Java_gnu_java_net_local_LocalSocketImpl_accept (JNIEnv *env, jobject this, jobje jint -Java_gnu_java_net_local_LocalSocketImpl_available (JNIEnv *env, jobject this) +Java_gnu_java_net_local_LocalSocketImpl_available +(JNIEnv *env, jobject this __attribute__((unused)), jint fd) { #ifdef ENABLE_LOCAL_SOCKETS - jfieldID socket_fd; - jclass clazz; jint avail; TRACE("begin"); - clazz = (*env)->GetObjectClass (env, this); - socket_fd = (*env)->GetFieldID (env, clazz, "socket_fd", "I"); - if (!socket_fd) - { - return 0; - } - avail = (jint) local_available ((int) (*env)->GetIntField (env, this, socket_fd)); + avail = (jint) local_available (fd); if (avail < 0) { _throw (env, "java/io/IOException", local_error ()); @@ -227,6 +220,7 @@ Java_gnu_java_net_local_LocalSocketImpl_available (JNIEnv *env, jobject this) return avail; #else (void) this; + (void) fd; _throw (env, "java/lang/Error", "support for local sockets not available"); return -1; #endif /* ENABLE_LOCAL_SOCKETS */ @@ -452,14 +446,13 @@ Java_gnu_java_net_local_LocalSocketImpl_localConnect (JNIEnv *env, jobject this, jint -Java_gnu_java_net_local_LocalSocketImpl_read (JNIEnv *env, jobject this, jbyteArray buf, jint off, jint len) +Java_gnu_java_net_local_LocalSocketImpl_read +(JNIEnv *env, jobject this __attribute__((unused)), jint fd, jbyteArray buf, + jint off, jint len) { #ifdef ENABLE_LOCAL_SOCKETS - jfieldID socket_fd; - jclass clazz; jbyte *buffer; jint count; - int fd; TRACE("begin"); @@ -468,13 +461,6 @@ Java_gnu_java_net_local_LocalSocketImpl_read (JNIEnv *env, jobject this, jbyteAr _throw (env, "java/lang/ArrayIndexOutOfBoundsException", ""); } - clazz = (*env)->GetObjectClass (env, this); - socket_fd = (*env)->GetFieldID (env, clazz, "socket_fd", "I"); - if (!socket_fd) - { - return 0; - } - fd = (int) (*env)->GetIntField (env, this, socket_fd); buffer = (*env)->GetByteArrayElements (env, buf, NULL); count = (jint) local_read (fd, (void *) (buffer + off), (int) len); if (count < 0) @@ -488,6 +474,7 @@ Java_gnu_java_net_local_LocalSocketImpl_read (JNIEnv *env, jobject this, jbyteAr return count; #else (void) this; + (void) fd; (void) buf; (void) off; (void) len; @@ -498,13 +485,12 @@ Java_gnu_java_net_local_LocalSocketImpl_read (JNIEnv *env, jobject this, jbyteAr void -Java_gnu_java_net_local_LocalSocketImpl_write (JNIEnv *env, jobject this, jbyteArray buf, jint off, jint len) +Java_gnu_java_net_local_LocalSocketImpl_write +(JNIEnv *env, jobject this __attribute__((unused)), jint fd, jbyteArray buf, + jint off, jint len) { #ifdef ENABLE_LOCAL_SOCKETS - jfieldID socket_fd; - jclass clazz; jbyte *buffer; - int fd; TRACE("begin"); @@ -513,13 +499,6 @@ Java_gnu_java_net_local_LocalSocketImpl_write (JNIEnv *env, jobject this, jbyteA _throw (env, "java/lang/ArrayIndexOutOfBoundsException", ""); } - clazz = (*env)->GetObjectClass (env, this); - socket_fd = (*env)->GetFieldID (env, clazz, "socket_fd", "I"); - if (!socket_fd) - { - return; - } - fd = (int) (*env)->GetIntField (env, this, socket_fd); buffer = (*env)->GetByteArrayElements (env, buf, NULL); if (local_write (fd, (void *) (buffer + off), (int) len) < 0) { @@ -530,6 +509,7 @@ Java_gnu_java_net_local_LocalSocketImpl_write (JNIEnv *env, jobject this, jbyteA TRACE("end"); #else (void) this; + (void) fd; (void) buf; (void) off; (void) len; diff --git a/libjava/classpath/native/jni/java-net/java_net_VMURLConnection.c b/libjava/classpath/native/jni/java-net/java_net_VMURLConnection.c new file mode 100644 index 00000000000..52fae0ccb20 --- /dev/null +++ b/libjava/classpath/native/jni/java-net/java_net_VMURLConnection.c @@ -0,0 +1,102 @@ +/* VMURLConnection.c - native bits for URLConnection + Copyright (C) 2006 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. */ + +#include <config.h> + +#include <java_net_VMURLConnection.h> + +#ifdef HAVE_MAGIC_H + +#include <magic.h> + +static magic_t cookie; + +#endif /* HAVE_MAGIC_H */ + +void +Java_java_net_VMURLConnection_init (JNIEnv *env __attribute__ ((__unused__)), + jclass klass __attribute__ ((__unused__))) +{ +#ifdef HAVE_MAGIC_H + cookie = magic_open (MAGIC_MIME); + if (cookie == (magic_t) NULL) + return; + if (magic_load (cookie, NULL) == -1) + { + magic_close (cookie); + cookie = (magic_t) NULL; + } +#endif /* HAVE_MAGIC_H */ +} + +#ifdef HAVE_MAGIC_H +jstring +Java_java_net_VMURLConnection_guessContentTypeFromBuffer (JNIEnv *env, + jclass klass + __attribute__ ((__unused__)), + jbyteArray bytes, + jint valid) +{ + jbyte *elements; + const char *result; + + if (cookie == (magic_t) NULL) + return NULL; + + elements = (*env)->GetByteArrayElements (env, bytes, NULL); + result = magic_buffer (cookie, elements, valid); + + /* The mode we use doesn't matter, since we don't change the array. */ + (*env)->ReleaseByteArrayElements (env, bytes, elements, JNI_ABORT); + + if (result == NULL) + return NULL; + return (*env)->NewStringUTF (env, result); +#else +jstring +Java_java_net_VMURLConnection_guessContentTypeFromBuffer (JNIEnv *env + __attribute__ ((__unused__)), + jclass klass + __attribute__ ((__unused__)), + jbyteArray bytes + __attribute__ ((__unused__)), + jint valid + __attribute__ ((__unused__))) +{ + return NULL; +#endif /* HAVE_MAGIC_H */ +} |

