提交 0ce605c9 编写于 作者: J jchen

8025294: [parfait] JNI-related warnings from b107 for jdk.src.solaris.native.sun.java2d.x11

Reviewed-by: prr, jgodinez
上级 6a31b16a
...@@ -465,9 +465,7 @@ JNIEXPORT void JNICALL Java_sun_java2d_x11_X11Renderer_XDrawPoly ...@@ -465,9 +465,7 @@ JNIEXPORT void JNICALL Java_sun_java2d_x11_X11Renderer_XDrawPoly
points = transformPoints(env, xcoordsArray, ycoordsArray, transx, transy, points = transformPoints(env, xcoordsArray, ycoordsArray, transx, transy,
pTmp, (int *)&npoints, isclosed); pTmp, (int *)&npoints, isclosed);
if (points == 0) { if (points != 0) {
JNU_ThrowOutOfMemoryError(env, "translated coordinate array");
} else {
if (npoints == 2) { if (npoints == 2) {
/* /*
* Some X11 implementations fail to draw anything for * Some X11 implementations fail to draw anything for
...@@ -588,6 +586,7 @@ Java_sun_java2d_x11_X11Renderer_XDoPath ...@@ -588,6 +586,7 @@ Java_sun_java2d_x11_X11Renderer_XDoPath
NULL NULL
}; };
PHStroke stroke; PHStroke stroke;
jboolean ok = JNI_TRUE;
if (xsdo == NULL) { if (xsdo == NULL) {
return; return;
...@@ -625,8 +624,6 @@ Java_sun_java2d_x11_X11Renderer_XDoPath ...@@ -625,8 +624,6 @@ Java_sun_java2d_x11_X11Renderer_XDoPath
types = (jbyte*) types = (jbyte*)
(*env)->GetPrimitiveArrayCritical(env, typesArray, NULL); (*env)->GetPrimitiveArrayCritical(env, typesArray, NULL);
if (types != NULL) { if (types != NULL) {
jboolean ok;
if (isFill) { if (isFill) {
drawHandler.pDrawScanline = &drawScanline; drawHandler.pDrawScanline = &drawScanline;
ok = doFillPath(&drawHandler, ok = doFillPath(&drawHandler,
...@@ -643,14 +640,14 @@ Java_sun_java2d_x11_X11Renderer_XDoPath ...@@ -643,14 +640,14 @@ Java_sun_java2d_x11_X11Renderer_XDoPath
types, numTypes, types, numTypes,
stroke); stroke);
} }
if (!ok) {
JNU_ThrowArrayIndexOutOfBoundsException(env, "coords array");
}
(*env)->ReleasePrimitiveArrayCritical(env, typesArray, types, (*env)->ReleasePrimitiveArrayCritical(env, typesArray, types,
JNI_ABORT); JNI_ABORT);
} }
(*env)->ReleasePrimitiveArrayCritical(env, coordsArray, coords, (*env)->ReleasePrimitiveArrayCritical(env, coordsArray, coords,
JNI_ABORT); JNI_ABORT);
if (!ok) {
JNU_ThrowArrayIndexOutOfBoundsException(env, "coords array");
}
} }
XDHD_FREE_POINTS(&dHData); XDHD_FREE_POINTS(&dHData);
...@@ -893,9 +890,7 @@ JNIEXPORT void JNICALL Java_sun_java2d_x11_X11Renderer_XFillPoly ...@@ -893,9 +890,7 @@ JNIEXPORT void JNICALL Java_sun_java2d_x11_X11Renderer_XFillPoly
points = transformPoints(env, xcoordsArray, ycoordsArray, transx, transy, points = transformPoints(env, xcoordsArray, ycoordsArray, transx, transy,
pTmp, (int *)&npoints, JNI_FALSE); pTmp, (int *)&npoints, JNI_FALSE);
if (points == 0) { if (points != 0) {
JNU_ThrowOutOfMemoryError(env, "translated coordinate array");
} else {
if (npoints > 2) { if (npoints > 2) {
XFillPolygon(awt_display, xsdo->drawable, (GC) xgc, XFillPolygon(awt_display, xsdo->drawable, (GC) xgc,
points, npoints, Complex, CoordModeOrigin); points, npoints, Complex, CoordModeOrigin);
......
...@@ -227,7 +227,7 @@ Java_sun_java2d_x11_X11SurfaceData_isShmPMAvailable(JNIEnv *env, jobject this) ...@@ -227,7 +227,7 @@ Java_sun_java2d_x11_X11SurfaceData_isShmPMAvailable(JNIEnv *env, jobject this)
#if defined(HEADLESS) || !defined(MITSHM) #if defined(HEADLESS) || !defined(MITSHM)
return JNI_FALSE; return JNI_FALSE;
#else #else
return useMitShmPixmaps; return (jboolean)useMitShmPixmaps;
#endif /* HEADLESS, MITSHM */ #endif /* HEADLESS, MITSHM */
} }
...@@ -258,6 +258,7 @@ Java_sun_java2d_x11_XSurfaceData_initOps(JNIEnv *env, jobject xsd, ...@@ -258,6 +258,7 @@ Java_sun_java2d_x11_XSurfaceData_initOps(JNIEnv *env, jobject xsd,
{ {
#ifndef HEADLESS #ifndef HEADLESS
X11SDOps *xsdo = (X11SDOps*)SurfaceData_InitOps(env, xsd, sizeof(X11SDOps)); X11SDOps *xsdo = (X11SDOps*)SurfaceData_InitOps(env, xsd, sizeof(X11SDOps));
jboolean hasException;
if (xsdo == NULL) { if (xsdo == NULL) {
JNU_ThrowOutOfMemoryError(env, "Initialization of SurfaceData failed."); JNU_ThrowOutOfMemoryError(env, "Initialization of SurfaceData failed.");
return; return;
...@@ -270,7 +271,10 @@ Java_sun_java2d_x11_XSurfaceData_initOps(JNIEnv *env, jobject xsd, ...@@ -270,7 +271,10 @@ Java_sun_java2d_x11_XSurfaceData_initOps(JNIEnv *env, jobject xsd,
xsdo->ReleasePixmapWithBg = X11SD_ReleasePixmapWithBg; xsdo->ReleasePixmapWithBg = X11SD_ReleasePixmapWithBg;
xsdo->widget = NULL; xsdo->widget = NULL;
if (peer != NULL) { if (peer != NULL) {
xsdo->drawable = JNU_CallMethodByName(env, NULL, peer, "getWindow", "()J").j; xsdo->drawable = JNU_CallMethodByName(env, &hasException, peer, "getWindow", "()J").j;
if (hasException) {
return;
}
} else { } else {
xsdo->drawable = 0; xsdo->drawable = 0;
} }
......
...@@ -326,7 +326,13 @@ Java_sun_java2d_xr_XRBackendNative_initIDs(JNIEnv *env, jclass cls) { ...@@ -326,7 +326,13 @@ Java_sun_java2d_xr_XRBackendNative_initIDs(JNIEnv *env, jclass cls) {
jlong fmt32; jlong fmt32;
jfieldID a8ID = (*env)->GetStaticFieldID(env, cls, "FMTPTR_A8", "J"); jfieldID a8ID = (*env)->GetStaticFieldID(env, cls, "FMTPTR_A8", "J");
if (a8ID == NULL) {
return;
}
jfieldID argb32ID = (*env)->GetStaticFieldID(env, cls, "FMTPTR_ARGB32", "J"); jfieldID argb32ID = (*env)->GetStaticFieldID(env, cls, "FMTPTR_ARGB32", "J");
if (argb32ID == NULL) {
return;
}
if (awt_display == (Display *)NULL) { if (awt_display == (Display *)NULL) {
return; return;
...@@ -346,6 +352,10 @@ Java_sun_java2d_xr_XRBackendNative_initIDs(JNIEnv *env, jclass cls) { ...@@ -346,6 +352,10 @@ Java_sun_java2d_xr_XRBackendNative_initIDs(JNIEnv *env, jclass cls) {
defaultImg = XCreateImage(awt_display, NULL, 8, ZPixmap, 0, maskData, 32, 32, 8, 0); defaultImg = XCreateImage(awt_display, NULL, 8, ZPixmap, 0, maskData, 32, 32, 8, 0);
defaultImg->data = maskData; //required? defaultImg->data = maskData; //required?
maskImgID = (*env)->GetStaticFieldID(env, cls, "MASK_XIMG", "J"); maskImgID = (*env)->GetStaticFieldID(env, cls, "MASK_XIMG", "J");
if (maskImgID == NULL) {
return;
}
(*env)->SetStaticLongField(env, cls, maskImgID, ptr_to_jlong(defaultImg)); (*env)->SetStaticLongField(env, cls, maskImgID, ptr_to_jlong(defaultImg));
} }
......
...@@ -88,7 +88,13 @@ Java_sun_java2d_xr_XRSurfaceData_initIDs(JNIEnv *env, jclass xsd) ...@@ -88,7 +88,13 @@ Java_sun_java2d_xr_XRSurfaceData_initIDs(JNIEnv *env, jclass xsd)
J2dTraceLn(J2D_TRACE_INFO, "in XRSurfaceData_initIDs"); J2dTraceLn(J2D_TRACE_INFO, "in XRSurfaceData_initIDs");
pictID = (*env)->GetFieldID(env, xsd, "picture", "I"); pictID = (*env)->GetFieldID(env, xsd, "picture", "I");
if (pictID == NULL) {
return;
}
xidID = (*env)->GetFieldID(env, xsd, "xid", "I"); xidID = (*env)->GetFieldID(env, xsd, "xid", "I");
if (xidID == NULL) {
return;
}
XShared_initIDs(env, JNI_FALSE); XShared_initIDs(env, JNI_FALSE);
#endif /* !HEADLESS */ #endif /* !HEADLESS */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册