From 15ee25b923180850794e71cc44c9859e65eea8a2 Mon Sep 17 00:00:00 2001 From: Andrew John Hughes Date: Sun, 27 Nov 2005 21:00:34 +0000 Subject: 2005-11-27 Andrew John Hughes * Merge of HEAD --> generics from the release of Classpath 0.19 to 2005/11/27. --- native/jni/gtk-peer/Makefile.am | 4 +- .../gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c | 23 +- .../gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c | 29 +- .../gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c | 57 ++-- .../gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c | 1 + .../gnu_java_awt_peer_gtk_GdkPixbufDecoder.c | 3 + .../gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c | 1 + .../gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c | 6 +- .../gnu_java_awt_peer_gtk_GtkComponentPeer.c | 35 +- .../gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c | 1 + .../gtk-peer/gnu_java_awt_peer_gtk_GtkSelection.c | 6 + .../gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c | 2 + .../gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c | 2 +- native/jni/java-io/Makefile.am | 4 +- native/jni/java-io/java_io_VMFile.c | 2 - native/jni/java-io/javaio.c | 363 --------------------- native/jni/java-io/javaio.h | 58 ---- native/jni/java-lang/java_lang_VMDouble.c | 5 + .../gnu_java_nio_charset_iconv_IconvDecoder.c | 2 +- native/jni/java-nio/java_nio.c | 2 - native/jni/midi-alsa/.cvsignore | 2 + native/jni/midi-dssi/.cvsignore | 2 + native/jni/midi-dssi/Makefile.am | 3 +- native/jni/qt-peer/qtmenupeer.cpp | 1 + native/jni/xmlj/xmlj_util.h | 6 +- 25 files changed, 147 insertions(+), 473 deletions(-) delete mode 100644 native/jni/java-io/javaio.c delete mode 100644 native/jni/java-io/javaio.h (limited to 'native') diff --git a/native/jni/gtk-peer/Makefile.am b/native/jni/gtk-peer/Makefile.am index bb947424c..46ea172f3 100644 --- a/native/jni/gtk-peer/Makefile.am +++ b/native/jni/gtk-peer/Makefile.am @@ -55,11 +55,11 @@ libgtkpeer_la_LIBADD = $(top_builddir)/native/jni/classpath/native_state.lo \ $(top_builddir)/native/jni/classpath/jcl.lo AM_LDFLAGS = @CLASSPATH_MODULE@ @GTK_LIBS@ @CAIRO_LIBS@ @PANGOFT2_LIBS@ \ - @FREETYPE2_LIBS@ @X_PRE_LIBS@ @X_LIBS@ @X_EXTRA_LIBS@ -lX11 -lXtst + @X_PRE_LIBS@ @X_LIBS@ @X_EXTRA_LIBS@ -lX11 -lXtst AM_CPPFLAGS = @CLASSPATH_INCLUDES@ # Just the WARNING_CFLAGS. We cannot use the strict flags since the gtk # headers contain broken prototypes (by design, see gtkitemfactory.h). AM_CFLAGS = @WARNING_CFLAGS@ @ERROR_CFLAGS@ \ - @GTK_CFLAGS@ @CAIRO_CFLAGS@ @PANGOFT2_CFLAGS@ @FREETYPE2_CFLAGS@ \ + @GTK_CFLAGS@ @CAIRO_CFLAGS@ @PANGOFT2_CFLAGS@ \ @X_CFLAGS@ diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c index ce65a1994..30f2d5e24 100644 --- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c +++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c @@ -65,6 +65,9 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_initStaticState glyphVector_class = (*env)->FindClass (env, "gnu/java/awt/peer/gtk/GdkGlyphVector"); + glyphVector_class = (*env)->NewGlobalRef + (env, glyphVector_class); + glyphVector_ctor = (*env)->GetMethodID (env, glyphVector_class, "", "([D[ILjava/awt/Font;Ljava/awt/font/FontRenderContext;)V"); @@ -288,6 +291,10 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_getTextMetrics const char *cstr = NULL; jdouble *native_metrics = NULL; PangoRectangle log; + PangoRectangle log2; + int line_count = 0; + int i = 0; + int width = 0; gdk_threads_enter(); @@ -296,9 +303,17 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_getTextMetrics cstr = (*env)->GetStringUTFChars (env, str, NULL); g_assert(cstr != NULL); - + pango_layout_set_text (pfont->layout, cstr, -1); pango_layout_get_extents (pfont->layout, NULL, &log); + + line_count = pango_layout_get_line_count (pfont->layout); + for (i = 0; i < line_count; i++) + { + pango_layout_line_get_extents (pango_layout_get_line (pfont->layout, i), + NULL, &log2); + width += log2.width; + } (*env)->ReleaseStringUTFChars (env, str, cstr); pango_layout_set_text (pfont->layout, "", -1); @@ -312,12 +327,12 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_getTextMetrics native_metrics[TEXT_METRICS_Y_BEARING] = PANGO_PIXELS( ((double)log.y) ); - native_metrics[TEXT_METRICS_WIDTH] - = PANGO_PIXELS( ((double)log.width) ); - native_metrics[TEXT_METRICS_HEIGHT] = PANGO_PIXELS( ((double)log.height) ); + native_metrics[TEXT_METRICS_WIDTH] + = PANGO_PIXELS( ((double)width) ); + native_metrics[TEXT_METRICS_X_ADVANCE] = PANGO_PIXELS( ((double) (log.x + log.width)) ); diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c index 4aca1cf57..244c27e6b 100644 --- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c +++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c @@ -291,6 +291,11 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_drawString struct peerfont *pfont = NULL; struct graphics *g = NULL; const char *cstr = NULL; + const char *sTmp = NULL; + char *tmp = NULL; + char *p = NULL; + int count = 0; + int charSize = 0; int baseline_y = 0; PangoLayoutIter *iter = NULL; @@ -303,9 +308,29 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_drawString g_assert (pfont != NULL); cstr = (*env)->GetStringUTFChars (env, str, NULL); + g_assert (cstr != NULL); + + charSize = sizeof(char); + p = malloc((strlen(cstr) + 1) * charSize); + g_assert (p != NULL); + + tmp = p; + sTmp = cstr; + for (; *sTmp != '\0'; sTmp++) + if (((unsigned char) *sTmp) >= ' ') + { + *p = *sTmp; + count++; + p++; + } + *p = '\0'; + + p = realloc(tmp, (count + 1) * charSize); + g_assert (p != NULL); + pango_layout_set_text (pfont->layout, p, -1); + free(p); pango_layout_set_font_description (pfont->layout, pfont->desc); - pango_layout_set_text (pfont->layout, cstr, -1); iter = pango_layout_get_iter (pfont->layout); baseline_y = pango_layout_iter_get_baseline (iter); @@ -317,7 +342,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_drawString pango_layout_iter_free (iter); pango_layout_set_text (pfont->layout, "", -1); - + gdk_flush (); (*env)->ReleaseStringUTFChars (env, str, cstr); diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c index 17effd88f..092e997a3 100644 --- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c +++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c @@ -565,6 +565,13 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_gdkDrawDrawable /* gdk_flush(); */ + if (!GDK_IS_DRAWABLE (src->drawable) || + !GDK_IS_DRAWABLE (dst->drawable)) + { + gdk_threads_leave (); + return; + } + gdk_drawable_get_size (src->drawable, &s_width, &s_height); gdk_drawable_get_size (dst->drawable, &d_width, &d_height); width = min (s_width, d_width); @@ -780,12 +787,13 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setGradientUnlocked if (peer_is_disposed(env, obj)) return; - if (gr->debug) printf ("setGradient (%f,%f) -> (%f,%f); (%d,%d,%d,%d) -> (%d,%d,%d,%d)\n", - x1, y1, - x2, y2, - r1, g1, b1, a1, - r2, g2, b2, a2); - + if (gr->debug) + printf ("setGradientUnlocked (%f,%f) -> (%f,%f); (%d,%d,%d,%d) -> (%d,%d,%d,%d)\n", + x1, y1, + x2, y2, + r1, g1, b1, a1, + r2, g2, b2, a2); + if (cyclic) surf = cairo_surface_create_similar (gr->surface, CAIRO_FORMAT_ARGB32, 3, 2); else @@ -906,8 +914,9 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setTexturePixelsUnlocked gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj); g_assert (gr != NULL); - if (gr->debug) printf ("setTexturePixels (%d pixels, %dx%d, stride: %d)\n", - (*env)->GetArrayLength (env, jarr), w, h, stride); + if (gr->debug) + printf ("setTexturePixelsUnlocked (%d pixels, %dx%d, stride: %d)\n", + (*env)->GetArrayLength (env, jarr), w, h, stride); if (gr->pattern) cairo_pattern_destroy (gr->pattern); @@ -960,8 +969,9 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_drawPixels gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj); g_assert (gr != NULL); - if (gr->debug) printf ("drawPixels (%d pixels, %dx%d, stride: %d)\n", - (*env)->GetArrayLength (env, java_pixels), w, h, stride); + if (gr->debug) + printf ("drawPixels (%d pixels, %dx%d, stride: %d)\n", + (*env)->GetArrayLength (env, java_pixels), w, h, stride); native_pixels = (*env)->GetIntArrayElements (env, java_pixels, NULL); native_matrix = (*env)->GetDoubleArrayElements (env, java_matrix, NULL); @@ -1081,10 +1091,11 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMatrixUnlocked g_assert (native_matrix != NULL); g_assert ((*env)->GetArrayLength (env, java_matrix) == 6); - if (gr->debug) printf ("cairo_set_matrix [ %f, %f, %f, %f, %f, %f ]\n", - native_matrix[0], native_matrix[1], - native_matrix[2], native_matrix[3], - native_matrix[4], native_matrix[5]); + if (gr->debug) + printf ("cairo_matrix_init [ %f, %f, %f, %f, %f, %f ]\n", + native_matrix[0], native_matrix[1], + native_matrix[2], native_matrix[3], + native_matrix[4], native_matrix[5]); { cairo_matrix_t mat; @@ -1272,7 +1283,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawGlyphVector (*env)->ReleaseFloatArrayElements (env, java_positions, native_positions, 0); (*env)->ReleaseIntArrayElements (env, java_codes, native_codes, 0); - begin_drawing_operation (env, gr); + begin_drawing_operation (env, gr); cairo_show_glyphs (gr->cr, glyphs, n); end_drawing_operation (env, gr); @@ -1440,7 +1451,8 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetRGBAColorUnlocked draw to a PixBuf, you must exchange the R and B components of your color. */ - if (gr->debug) printf ("cairo_set_source_rgb (%f, %f, %f)\n", r, g, b); + if (gr->debug) + printf ("cairo_set_source_rgba (%f, %f, %f, %f)\n", r, g, b, a); if (gr->drawbuf) cairo_set_source_rgba (gr->cr, b, g, r, a); @@ -1731,7 +1743,9 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoCurveTo gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj); g_assert (gr != NULL); - if (gr->debug) printf ("cairo_curve_to (%f, %f), (%f, %f), (%f, %f)\n", x1, y1, x2, y2, x3, y3); + if (gr->debug) + printf ("cairo_curve_to (%f, %f), (%f, %f), (%f, %f)\n", + x1, y1, x2, y2, x3, y3); cairo_curve_to (gr->cr, x1, y1, x2, y2, x3, y3); gdk_threads_leave(); @@ -1797,7 +1811,9 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRelCurveTo gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj); g_assert (gr != NULL); - if (gr->debug) printf ("cairo_rel_curve_to (%f, %f), (%f, %f), (%f, %f)\n", dx1, dy1, dx2, dy2, dx3, dy3); + if (gr->debug) + printf ("cairo_rel_curve_to (%f, %f), (%f, %f), (%f, %f)\n", + dx1, dy1, dx2, dy2, dx3, dy3); cairo_rel_curve_to (gr->cr, dx1, dy1, dx2, dy2, dx3, dy3); gdk_threads_leave(); @@ -1825,7 +1841,8 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRectangle return; } - if (gr->debug) printf ("cairo_rectangle (%f, %f) (%f, %f)\n", x, y, width, height); + if (gr->debug) + printf ("cairo_rectangle (%f, %f) (%f, %f)\n", x, y, width, height); cairo_rectangle (gr->cr, x, y, width, height); gdk_threads_leave(); @@ -1955,7 +1972,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSurfaceSetFilterUnlocked gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj); g_assert (gr != NULL); - if (gr->debug) printf ("cairo_surface_set_filter %d\n", filter); + if (gr->debug) printf ("cairo_pattern_set_filter %d\n", filter); switch ((enum java_awt_rendering_hints_filter) filter) { case java_awt_rendering_hints_VALUE_INTERPOLATION_NEAREST_NEIGHBOR: diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c index 0467c3c7a..7662800f0 100644 --- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c +++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c @@ -71,6 +71,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphicsEnvironment_nativeGetFontFamilies const char *name_tmp = pango_font_family_get_name (families[idx]); jstring name = (*env)->NewStringUTF (env, name_tmp); (*env)->SetObjectArrayElement (env, family_name, idx, name); + (*env)->DeleteLocalRef(env, name); } g_free (families); diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c index 74103b5da..4d6169b85 100644 --- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c +++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c @@ -270,6 +270,8 @@ query_formats (JNIEnv *env, jclass clazz) (*env)->DeleteLocalRef(env, string); ++ch; } + + (*env)->DeleteLocalRef(env, jformat); } g_slist_free(formats); @@ -376,6 +378,7 @@ save_to_stream(const gchar *buf, (*(ssr->env))->ReleaseByteArrayElements ((ssr->env), jbuf, cbuf, 0); (*(ssr->env))->CallVoidMethod ((ssr->env), *(ssr->stream), dataOutputWriteID, jbuf); + (*(ssr->env))->DeleteLocalRef((ssr->env), jbuf); gdk_threads_enter (); diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c index c5bf5a353..e9a0f693e 100644 --- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c +++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c @@ -121,6 +121,7 @@ Java_gnu_java_awt_peer_gtk_GtkChoicePeer_append gtk_combo_box_append_text (GTK_COMBO_BOX (ptr), label); (*env)->ReleaseStringUTFChars (env, item, label); + (*env)->DeleteLocalRef(env, item); } gdk_threads_leave (); diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c index f10a80d58..3b62dc335 100644 --- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c +++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c @@ -53,7 +53,7 @@ jstring cp_gtk_imageTarget; jstring cp_gtk_filesTarget; /* Simple id to keep track of the selection we are currently managing. */ -static int current_selection = 0; +static gint current_selection = 0; /* Whether we "own" the clipboard. And may clear it. */ static int owner = 0; @@ -261,7 +261,7 @@ static void clipboard_clear_func (GtkClipboard *clipboard __attribute__((unused)), gpointer user_data) { - if (owner && (int) user_data == current_selection) + if (owner && GPOINTER_TO_INT(user_data) == current_selection) { JNIEnv *env = cp_gtk_gdk_env(); owner = 0; @@ -351,7 +351,7 @@ Java_gnu_java_awt_peer_gtk_GtkClipboard_advertiseContent if (gtk_clipboard_set_with_data (cp_gtk_clipboard, targets, n, clipboard_get_func, clipboard_clear_func, - (gpointer) current_selection)) + GINT_TO_POINTER(current_selection))) { owner = 1; if (gtk_clipboard_instance == NULL) diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c index 85ce2ae65..6de7b61b8 100644 --- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c +++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c @@ -454,7 +454,7 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetDispatchKeyEvent * Find the origin of a widget's window. */ JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetLocationOnScreen +Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWindowGetLocationOnScreen (JNIEnv * env, jobject obj, jintArray jpoint) { void *ptr; @@ -467,11 +467,34 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetLocationOnScreen gdk_window_get_root_origin (GTK_WIDGET (ptr)->window, point, point+1); - if (!GTK_IS_CONTAINER (ptr)) - { - *point += GTK_WIDGET(ptr)->allocation.x; - *(point+1) += GTK_WIDGET(ptr)->allocation.y; - } + (*env)->ReleaseIntArrayElements(env, jpoint, point, 0); + + gdk_threads_leave (); +} + +/* + * Find the origin of a widget + */ +JNIEXPORT void JNICALL +Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetLocationOnScreen + (JNIEnv * env, jobject obj, jintArray jpoint) +{ + void *ptr; + jint *point; + GtkWidget *widget; + + gdk_threads_enter (); + + ptr = NSA_GET_PTR (env, obj); + point = (*env)->GetIntArrayElements (env, jpoint, 0); + + widget = GTK_WIDGET(ptr); + while(gtk_widget_get_parent(widget) != NULL) + widget = gtk_widget_get_parent(widget); + gdk_window_get_position (GTK_WIDGET(widget)->window, point, point+1); + + *point += GTK_WIDGET(ptr)->allocation.x; + *(point+1) += GTK_WIDGET(ptr)->allocation.y; (*env)->ReleaseIntArrayElements(env, jpoint, point, 0); diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c index fc89ab71c..6da42cec6 100644 --- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c +++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c @@ -239,6 +239,7 @@ Java_gnu_java_awt_peer_gtk_GtkListPeer_append COLUMN_STRING, text, -1); (*env)->ReleaseStringUTFChars (env, item, text); + (*env)->DeleteLocalRef(env, item); } gdk_threads_leave (); diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkSelection.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkSelection.c index f744e90ad..3244d2364 100644 --- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkSelection.c +++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkSelection.c @@ -130,6 +130,7 @@ clipboard_targets_received (GtkClipboard *clipboard break; (*env)->SetObjectArrayElement (env, strings, i++, string); + (*env)->DeleteLocalRef (env, string); } } } @@ -201,6 +202,10 @@ clipboard_text_received (GtkClipboard *clipboard textAvailableID, string); (*env)->DeleteGlobalRef (env, selection_obj); + + if (string != NULL) + (*env)->DeleteLocalRef (env, string); + } JNIEXPORT void JNICALL @@ -324,6 +329,7 @@ clipboard_uris_received (GtkClipboard *clipboard if (string == NULL) break; (*env)->SetObjectArrayElement (env, strings, i, string); + (*env)->DeleteLocalRef (env, string); } } g_strfreev (uris); diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c index 59b56cf35..b14330e5f 100644 --- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c +++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c @@ -135,6 +135,8 @@ Java_gnu_java_awt_peer_gtk_GtkToolkit_gtkInit (JNIEnv *env, gtkgenericpeer = (*env)->FindClass(env, "gnu/java/awt/peer/gtk/GtkGenericPeer"); + gtkgenericpeer = (*env)->NewGlobalRef(env, gtkgenericpeer); + printCurrentThreadID = (*env)->GetStaticMethodID (env, gtkgenericpeer, "printCurrentThread", "()V"); diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c index d79bbecba..ac8f6a8ff 100644 --- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c +++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c @@ -1204,8 +1204,8 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_gtkWindowSetResizable gdk_threads_enter (); ptr = NSA_GET_PTR (env, obj); - gtk_window_set_resizable (GTK_WINDOW (ptr), resizable); + g_object_set (G_OBJECT (ptr), "allow-shrink", resizable, NULL); gdk_threads_leave (); } diff --git a/native/jni/java-io/Makefile.am b/native/jni/java-io/Makefile.am index efa7d5688..35afaae50 100644 --- a/native/jni/java-io/Makefile.am +++ b/native/jni/java-io/Makefile.am @@ -1,8 +1,6 @@ nativelib_LTLIBRARIES = libjavaio.la -libjavaio_la_SOURCES = javaio.h \ - javaio.c \ - java_io_VMFile.c \ +libjavaio_la_SOURCES = java_io_VMFile.c \ java_io_VMObjectInputStream.c \ java_io_VMObjectStreamClass.c diff --git a/native/jni/java-io/java_io_VMFile.c b/native/jni/java-io/java_io_VMFile.c index b32c29477..354df04ed 100644 --- a/native/jni/java-io/java_io_VMFile.c +++ b/native/jni/java-io/java_io_VMFile.c @@ -50,8 +50,6 @@ exception statement from your version. */ #endif #include "target_native_math_int.h" -#include "javaio.h" - #include "java_io_VMFile.h" /*************************************************************************/ diff --git a/native/jni/java-io/javaio.c b/native/jni/java-io/javaio.c deleted file mode 100644 index 6dc3de8f0..000000000 --- a/native/jni/java-io/javaio.c +++ /dev/null @@ -1,363 +0,0 @@ -/* javaio.c - Common java.io native functions - Copyright (C) 1998, 2002, 2004 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. */ - -/* do not move; needed here because of some macro definitions */ -#include - -#include -#include - -#include -#include - -#include "target_native.h" -#ifndef WITHOUT_FILESYSTEM -#include "target_native_file.h" -#endif -#include "target_native_math_int.h" - -#include "javaio.h" - -/* - * Function to open a file - */ - -jint -_javaio_open_read (JNIEnv * env, jstring name) -{ -#ifndef WITHOUT_FILESYSTEM - const char *filename; - int fd; - int result; - - filename = JCL_jstring_to_cstring (env, name); - if (filename == NULL) - return (-1); - - TARGET_NATIVE_FILE_OPEN_READ (filename, fd, result); - (*env)->ReleaseStringUTFChars (env, name, filename); - if (result != TARGET_NATIVE_OK) - { - if (TARGET_NATIVE_LAST_ERROR () == TARGET_NATIVE_ERROR_NO_SUCH_FILE) - JCL_ThrowException (env, - "java/io/FileNotFoundException", - TARGET_NATIVE_LAST_ERROR_STRING ()); - else - JCL_ThrowException (env, - "java/io/IOException", - TARGET_NATIVE_LAST_ERROR_STRING ()); - } - - JCL_free_cstring (env, name, filename); - return (fd); -#else /* not WITHOUT_FILESYSTEM */ - return (-1); -#endif /* not WITHOUT_FILESYSTEM */ -} - -/* - * Function to open a file for reading/writing - */ - -jint -_javaio_open_readwrite (JNIEnv * env, jstring name) -{ -#ifndef WITHOUT_FILESYSTEM - const char *filename; - int fd; - int result; - - filename = JCL_jstring_to_cstring (env, name); - if (filename == NULL) - return (-1); - - TARGET_NATIVE_FILE_OPEN_READWRITE (filename, fd, result); - (*env)->ReleaseStringUTFChars (env, name, filename); - if (result != TARGET_NATIVE_OK) - { - if (TARGET_NATIVE_LAST_ERROR () == TARGET_NATIVE_ERROR_NO_SUCH_FILE) - JCL_ThrowException (env, - "java/io/FileNotFoundException", - TARGET_NATIVE_LAST_ERROR_STRING ()); - else - JCL_ThrowException (env, - "java/io/IOException", - TARGET_NATIVE_LAST_ERROR_STRING ()); - } - - JCL_free_cstring (env, name, filename); - return (fd); -#else /* not WITHOUT_FILESYSTEM */ - return (-1); -#endif /* not WITHOUT_FILESYSTEM */ -} - -/*************************************************************************/ - -/* - * Function to close a file - */ - -void -_javaio_close (JNIEnv * env, jint fd) -{ -#ifndef WITHOUT_FILESYSTEM - int result; - - if (fd != -1) - { - TARGET_NATIVE_FILE_CLOSE (fd, result); - if (result != TARGET_NATIVE_OK) - JCL_ThrowException (env, - "java/io/IOException", - TARGET_NATIVE_LAST_ERROR_STRING ()); - } -#else /* not WITHOUT_FILESYSTEM */ -#endif /* not WITHOUT_FILESYSTEM */ -} - -/*************************************************************************/ - -/* - * Skips bytes in a file - */ - -jlong -_javaio_skip_bytes (JNIEnv * env, jint fd, jlong num_bytes) -{ -#ifndef WITHOUT_FILESYSTEM - jlong current_offset, new_offset; - int result; - - TARGET_NATIVE_FILE_SEEK_CURRENT (fd, TARGET_NATIVE_MATH_INT_INT64_CONST_0, - current_offset, result); - if (result != TARGET_NATIVE_OK) - JCL_ThrowException (env, - "java/io/IOException", - TARGET_NATIVE_LAST_ERROR_STRING ()); - - TARGET_NATIVE_FILE_SEEK_CURRENT (fd, num_bytes, new_offset, result); - if (result != TARGET_NATIVE_OK) - JCL_ThrowException (env, - "java/io/IOException", - TARGET_NATIVE_LAST_ERROR_STRING ()); - - return (TARGET_NATIVE_MATH_INT_INT64_SUB (new_offset, current_offset)); -#else /* not WITHOUT_FILESYSTEM */ - return (TARGET_NATIVE_MATH_INT_INT64_CONST_0); -#endif /* not WITHOUT_FILESYSTEM */ -} - -/*************************************************************************/ - -/* - * Gets the size of the file - */ - -jlong -_javaio_get_file_length (JNIEnv * env, jint fd) -{ -#ifndef WITHOUT_FILESYSTEM - jlong length; - int result; - - TARGET_NATIVE_FILE_SIZE (fd, length, result); - if (result != TARGET_NATIVE_OK) - { - JCL_ThrowException (env, - "java/io/IOException", - TARGET_NATIVE_LAST_ERROR_STRING ()); - return (TARGET_NATIVE_MATH_INT_INT64_CONST_MINUS_1); - } - - return (length); -#else /* not WITHOUT_FILESYSTEM */ - return (TARGET_NATIVE_MATH_INT_INT64_CONST_0); -#endif /* not WITHOUT_FILESYSTEM */ -} - -/*************************************************************************/ - -/* - * Reads data from a file - */ - -jint -_javaio_read (JNIEnv * env, jint fd, jarray buf, jint offset, jint len) -{ -#ifndef WITHOUT_FILESYSTEM - jbyte *bufptr; - int bytesRead; - int result; - - assert (offset >= 0); - assert (len >= 0); - - if (len == 0) - return 0; /* Nothing todo, and GetByteArrayElements() seems undefined. */ - - bufptr = (*env)->GetByteArrayElements (env, buf, JNI_FALSE); - if (bufptr == NULL) - { - JCL_ThrowException (env, "java/io/IOException", - "Internal Error: get byte array fail"); - return (-1); - } - - TARGET_NATIVE_FILE_READ (fd, (bufptr + offset), len, bytesRead, result); - (*env)->ReleaseByteArrayElements (env, buf, bufptr, 0); - if (result != TARGET_NATIVE_OK) - JCL_ThrowException (env, - "java/io/IOException", - TARGET_NATIVE_LAST_ERROR_STRING ()); - - if (bytesRead == 0) - return (-1); - - return (bytesRead); -#else /* not WITHOUT_FILESYSTEM */ - jbyte *bufptr; - int bytesRead; - - assert (offset >= 0); - assert (len >= 0); - - if ((fd == 0) || (fd == 1) || (fd == 2)) - { - if (len == 0) - return 0; /* Nothing todo, and GetByteArrayElements() seems undefined. */ - - bufptr = (*env)->GetByteArrayElements (env, buf, JNI_FALSE); - if (bufptr == NULL) - { - JCL_ThrowException (env, "java/io/IOException", - "Internal Error: get byte array"); - return (-1); - } - - TARGET_NATIVE_FILE_READ (fd, (bufptr + offset), len, bytesRead, result); - (*env)->ReleaseByteArrayElements (env, buf, bufptr, 0); - if (result != TARGET_NATIVE_OK) - JCL_ThrowException (env, - "java/io/IOException", - TARGET_NATIVE_LAST_ERROR_STRING ()); - - if (bytesRead == 0) - return (-1); - - return (bytesRead); - } - else - { - return (-1); - } -#endif /* not WITHOUT_FILESYSTEM */ -} - -/*************************************************************************/ - -/* - * Writes data to a file - */ - -jint -_javaio_write (JNIEnv * env, jint fd, jarray buf, jint offset, jint len) -{ -#ifndef WITHOUT_FILESYSTEM - jbyte *bufptr; - int bytes_written; - int result; - - if (len == 0) - return 0; /* Nothing todo, and GetByteArrayElements() seems undefined. */ - - bufptr = (*env)->GetByteArrayElements (env, buf, 0); - if (bufptr == NULL) - { - JCL_ThrowException (env, "java/io/IOException", - "Internal Error: get byte array"); - return (-1); - } - - TARGET_NATIVE_FILE_WRITE (fd, (bufptr + offset), len, bytes_written, - result); - (*env)->ReleaseByteArrayElements (env, buf, bufptr, 0); - if (result != TARGET_NATIVE_OK) - JCL_ThrowException (env, - "java/io/IOException", - TARGET_NATIVE_LAST_ERROR_STRING ()); - - if (bytes_written == 0) - return (-1); - - return (bytes_written); -#else /* not WITHOUT_FILESYSTEM */ - jbyte *bufptr; - int bytesWritten; - - if ((fd == 0) || (fd == 1) || (fd == 2)) - { - if (len == 0) - return 0; /* Nothing todo, and GetByteArrayElements() seems undefined. */ - - bufptr = (*env)->GetByteArrayElements (env, buf, 0); - if (bufptr == NULL) - { - JCL_ThrowException (env, "java/io/IOException", "Internal Error"); - return (-1); - } - - TARGET_NATIVE_FILE_WRITE (fd, (bufptr + offset), len, bytes_written, - result); - (*env)->ReleaseByteArrayElements (env, buf, bufptr, 0); - - if (bytes_written == -1) - JCL_ThrowException (env, - "java/io/IOException", - TARGET_NATIVE_LAST_ERROR_STRING ()); - - if (bytes_written == 0) - return (-1); - - return (bytes_written); - } - else - { - return (-1); - } -#endif /* not WITHOUT_FILESYSTEM */ -} diff --git a/native/jni/java-io/javaio.h b/native/jni/java-io/javaio.h deleted file mode 100644 index 2e4a8d103..000000000 --- a/native/jni/java-io/javaio.h +++ /dev/null @@ -1,58 +0,0 @@ -/* javaio.h - Declaration for common java.io native functions - Copyright (C) 1998, 2004 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 JAVAIO_H_INCLUDED -#define JAVAIO_H_INCLUDED - -#include - -/* - * Function Prototypes - */ - -extern jlong _javaio_get_file_length(JNIEnv *, jint); -extern jlong _javaio_skip_bytes(JNIEnv *, jint, jlong); -extern jint _javaio_open(JNIEnv *, jstring, int); -extern jint _javaio_open_read(JNIEnv *, jstring); -extern jint _javaio_open_readwrite(JNIEnv *, jstring); -extern void _javaio_close(JNIEnv *, jint fd); -extern jint _javaio_read(JNIEnv *, jint, jarray, jint, jint); -extern jint _javaio_write(JNIEnv *, jint, jarray, jint, jint); - -#endif /* JAVAIO_H_INCLUDED */ - diff --git a/native/jni/java-lang/java_lang_VMDouble.c b/native/jni/java-lang/java_lang_VMDouble.c index 846df2e6a..076f42b86 100644 --- a/native/jni/java-lang/java_lang_VMDouble.c +++ b/native/jni/java-lang/java_lang_VMDouble.c @@ -71,6 +71,11 @@ Java_java_lang_VMDouble_initIDs (JNIEnv * env, jclass cls __attribute__ ((__unus { DBG ("unable to get class java.lang.Double\n") return; } + clsDouble = (*env)->NewGlobalRef(env, clsDouble); + if (clsDouble == NULL) + { + DBG ("unable to register class java.lang.Double as global ref\n") return; + } isNaNID = (*env)->GetStaticMethodID (env, clsDouble, "isNaN", "(D)Z"); if (isNaNID == NULL) { diff --git a/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c b/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c index 2541e81ea..b82cd2d90 100644 --- a/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c +++ b/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c @@ -140,7 +140,7 @@ Java_gnu_java_nio_charset_iconv_IconvDecoder_decode (JNIEnv * env, if (retval == (size_t) (-1)) { - if (errno == EILSEQ || errno == EINVAL) + if (errno == EILSEQ) retval = 1; else retval = 0; diff --git a/native/jni/java-nio/java_nio.c b/native/jni/java-nio/java_nio.c index a25f38a6d..bd6f97d3e 100644 --- a/native/jni/java-nio/java_nio.c +++ b/native/jni/java-nio/java_nio.c @@ -52,8 +52,6 @@ exception statement from your version. */ #include "java_nio_channels_FileChannelImpl.h" -#include "javaio.h" - #define NIO_DEBUG(X) /* no debug */ //#define NIO_DEBUG(X) X diff --git a/native/jni/midi-alsa/.cvsignore b/native/jni/midi-alsa/.cvsignore index a71781585..483b27744 100644 --- a/native/jni/midi-alsa/.cvsignore +++ b/native/jni/midi-alsa/.cvsignore @@ -5,3 +5,5 @@ .libs .depsMakefile Makefile.in +Makefile +.deps diff --git a/native/jni/midi-dssi/.cvsignore b/native/jni/midi-dssi/.cvsignore index a71781585..ac18ca272 100644 --- a/native/jni/midi-dssi/.cvsignore +++ b/native/jni/midi-dssi/.cvsignore @@ -5,3 +5,5 @@ .libs .depsMakefile Makefile.in +.deps +Makefile diff --git a/native/jni/midi-dssi/Makefile.am b/native/jni/midi-dssi/Makefile.am index 58ee5c925..6b1ef0407 100644 --- a/native/jni/midi-dssi/Makefile.am +++ b/native/jni/midi-dssi/Makefile.am @@ -1,7 +1,8 @@ nativelib_LTLIBRARIES = libgjsmdssi.la libgjsmdssi_la_SOURCES = gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c \ -gnu_javax_sound_midi_dssi_DSSISynthesizer.c + gnu_javax_sound_midi_dssi_DSSISynthesizer.c \ + dssi_data.h libgjsmdssi_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo -ljack diff --git a/native/jni/qt-peer/qtmenupeer.cpp b/native/jni/qt-peer/qtmenupeer.cpp index bf081e984..1ac17145c 100644 --- a/native/jni/qt-peer/qtmenupeer.cpp +++ b/native/jni/qt-peer/qtmenupeer.cpp @@ -125,6 +125,7 @@ public: jclass menuCls = env->GetObjectClass( menuPeer ); jmethodID mid = env->GetMethodID(menuCls, "add", "(J)V"); + env->DeleteLocalRef(menuCls); env->CallVoidMethod( menuPeer, mid, (jlong)newAction ); env->DeleteGlobalRef( menuPeer ); diff --git a/native/jni/xmlj/xmlj_util.h b/native/jni/xmlj/xmlj_util.h index 7bbe78b8e..72601ae9f 100644 --- a/native/jni/xmlj/xmlj_util.h +++ b/native/jni/xmlj/xmlj_util.h @@ -1,5 +1,5 @@ /* xmlj_util.h - - Copyright (C) 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -38,10 +38,6 @@ exception statement from your version. */ #ifndef XMLJ_UTIL_H #define XMLJ_UTIL_H -#if defined __64BIT__ || defined __LP64 || defined _LP64 || defined __LP64__ || defined _ADDR64 -# define XMLJ_64BIT_POINTER 1 -#endif - #include #include -- cgit v1.2.1