提交 f5d58309 编写于 作者: A art

6989721: awt native code compiler warnings

Reviewed-by: yan, uta
上级 c4c88263
......@@ -29,9 +29,11 @@ import java.awt.Event;
import java.awt.Component;
import java.awt.GraphicsEnvironment;
import java.awt.Toolkit;
import sun.util.logging.PlatformLogger;
import java.util.Arrays;
import sun.awt.AWTAccessor;
import sun.util.logging.PlatformLogger;
/**
* The root event class for all component-level input events.
*
......@@ -54,6 +56,7 @@ import java.util.Arrays;
* @since 1.1
*/
public abstract class InputEvent extends ComponentEvent {
private static final PlatformLogger logger = PlatformLogger.getLogger("java.awt.event.InputEvent");
/**
......@@ -288,6 +291,12 @@ public abstract class InputEvent extends ComponentEvent {
if (!GraphicsEnvironment.isHeadless()) {
initIDs();
}
AWTAccessor.setInputEventAccessor(
new AWTAccessor.InputEventAccessor() {
public int[] getButtonDownMasks() {
return getButtonDownMasks();
}
});
}
/**
......
......@@ -26,6 +26,7 @@
package sun.awt;
import java.awt.*;
import java.awt.event.InputEvent;
import java.awt.geom.Point2D;
import java.awt.image.BufferedImage;
......@@ -303,6 +304,13 @@ public final class AWTAccessor {
void setPosted(AWTEvent ev);
}
public interface InputEventAccessor {
/*
* Accessor for InputEvent.getButtonDownMasks()
*/
int[] getButtonDownMasks();
}
/*
* An accessor for the java.awt.Frame class.
*/
......@@ -435,6 +443,11 @@ public final class AWTAccessor {
*/
private static AWTEventAccessor awtEventAccessor;
/*
* The java.awt.event.InputEvent class accessor object.
*/
private static InputEventAccessor inputEventAccessor;
/*
* The java.awt.Frame class accessor object.
*/
......@@ -517,6 +530,23 @@ public final class AWTAccessor {
return awtEventAccessor;
}
/*
* Set an accessor object for the java.awt.event.InputEvent class.
*/
public static void setInputEventAccessor(InputEventAccessor iea) {
inputEventAccessor = iea;
}
/*
* Retrieve the accessor object for the java.awt.event.InputEvent class.
*/
public static InputEventAccessor getInputEventAccessor() {
if (inputEventAccessor == null) {
unsafe.ensureClassInitialized(InputEvent.class);
}
return inputEventAccessor;
}
/*
* Set an accessor object for the java.awt.Frame class.
*/
......
......@@ -3993,7 +3993,7 @@ png_do_dither(png_row_infop row_info, png_bytep row,
#ifdef PNG_FLOATING_POINT_SUPPORTED
#if defined(PNG_READ_GAMMA_SUPPORTED)
const static int png_gamma_shift[] =
static PNG_CONST int png_gamma_shift[] =
{0x10, 0x21, 0x42, 0x84, 0x110, 0x248, 0x550, 0xff0, 0x00};
/* We build the 8- or 16-bit gamma tables here. Note that for 16-bit
......
......@@ -209,7 +209,7 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
png_charp chunkdata, png_size_t chunklength,
png_size_t prefix_size, png_size_t *newlength)
{
const static char msg[] = "Error decoding compressed text";
static PNG_CONST char msg[] = "Error decoding compressed text";
png_charp text;
png_size_t text_size;
......
......@@ -51,7 +51,7 @@ static const char szNetscape20ext[11] = "NETSCAPE2.0";
#define NSEXT_LOOP 0x01 // Loop Count field code
// convert libungif samples to our ones
#define MAKE_QUAD_GIF(c,a) MAKE_QUAD((c).Red, (c).Green, (c).Blue, (a))
#define MAKE_QUAD_GIF(c,a) MAKE_QUAD((c).Red, (c).Green, (c).Blue, (unsigned)(a))
/* stdio FILE* and memory input functions for libungif */
int
......@@ -165,7 +165,7 @@ SplashDecodeGif(Splash * splash, GifFileType * gif)
{
int flag = pExtension[0];
frameDelay = (pExtension[2] << 8) | pExtension[1];
frameDelay = (((int)pExtension[2]) << 8) | pExtension[1];
if (frameDelay < 10)
frameDelay = 10;
if (flag & GIF_TRANSPARENT) {
......@@ -191,7 +191,7 @@ SplashDecodeGif(Splash * splash, GifFileType * gif)
iSubCode = pExtension[0] & 0x07;
if (iSubCode == NSEXT_LOOP) {
splash->loopCount =
(pExtension[1] | (pExtension[2] << 8)) - 1;
(pExtension[1] | (((int)pExtension[2]) << 8)) - 1;
}
}
break;
......
......@@ -25,11 +25,15 @@
package sun.awt.X11;
import java.awt.*;
import java.awt.event.InputEvent;
import java.awt.peer.*;
import sun.awt.X11GraphicsConfig;
import sun.awt.AWTAccessor;
import sun.awt.SunToolkit;
import sun.awt.X11GraphicsConfig;
class XRobotPeer implements RobotPeer {
private X11GraphicsConfig xgc = null;
/*
* native implementation uses some static shared data (pipes, processes)
......@@ -40,7 +44,7 @@ class XRobotPeer implements RobotPeer {
XRobotPeer(GraphicsConfiguration gc) {
this.xgc = (X11GraphicsConfig)gc;
SunToolkit tk = (SunToolkit)Toolkit.getDefaultToolkit();
setup(tk.getNumberOfButtons());
setup(tk.getNumberOfButtons(), AWTAccessor.getInputEventAccessor().getButtonDownMasks());
}
public void dispose() {
......@@ -83,7 +87,7 @@ class XRobotPeer implements RobotPeer {
return pixelArray;
}
private static native synchronized void setup(int numberOfButtons);
private static native synchronized void setup(int numberOfButtons, int[] buttonDownMasks);
private static native synchronized void mouseMoveImpl(X11GraphicsConfig xgc, int x, int y);
private static native synchronized void mousePressImpl(int buttons);
......
......@@ -159,20 +159,8 @@ extern int lastL;
#endif /* DEBUG_AWT_LOCK && !XAWT */
#ifndef HEADLESS
extern Display *awt_display; /* awt_GraphicsEnv.c */
extern XtAppContext awt_appContext; /* awt_MToolkit.c */
extern Widget awt_root_shell;
extern Pixel awt_defaultBg;
extern Pixel awt_defaultFg;
extern int awt_multiclick_time; /* awt_MToolkit.c */
extern int awt_multiclick_smudge; /* canvas.c */
extern unsigned int awt_MetaMask; /* awt_MToolkit.c */
extern unsigned int awt_AltMask;
extern unsigned int awt_NumLockMask;
extern unsigned int awt_ModeSwitchMask;
extern Cursor awt_scrollCursor; /* awt_MToolkit.c */
extern Boolean awt_ModLockIsShiftLock;
extern Display *awt_display; /* awt_GraphicsEnv.c */
extern Boolean awt_ModLockIsShiftLock; /* XToolkit.c */
#endif /* !HEADLESS */
#endif /* ! _AWT_ */
......@@ -264,7 +264,7 @@ awt_DrawingSurface_GetDrawingSurfaceInfo(JAWT_DrawingSurface* ds)
#ifndef XAWT
px->drawable = XtWindow(cdata->widget);
#else
px->drawable = JNU_GetLongFieldAsPtr(env, peer, windowID);
px->drawable = (*env)->GetLongField(env, peer, windowID);
#endif
px->display = awt_display;
......
......@@ -46,8 +46,6 @@
#ifdef XAWT
#include <sun_awt_X11_XComponentPeer.h>
#include <sun_awt_X11_XInputMethod.h>
#define XtWindow(w) (w)
#else /* !XAWT */
#include <sun_awt_motif_MComponentPeer.h>
#include <sun_awt_motif_MInputMethod.h>
......@@ -670,7 +668,8 @@ static StatusWindow *createStatusWindow(
int mccr = 0;
char *dsr;
Pixel bg, fg, light, dim;
int x, y, w, h, bw, depth, off_x, off_y, xx, yy;
int x, y, off_x, off_y, xx, yy;
unsigned int w, h, bw, depth;
XGCValues values;
unsigned long valuemask = 0; /*ignore XGCvalue and use defaults*/
int screen = 0;
......@@ -709,7 +708,7 @@ static StatusWindow *createStatusWindow(
light = adata->AwtColorMatch(195, 195, 195, adata);
dim = adata->AwtColorMatch(128, 128, 128, adata);
XGetWindowAttributes(dpy, XtWindow(parent), &xwa);
XGetWindowAttributes(dpy, parent, &xwa);
bw = 2; /*xwa.border_width does not have the correct value*/
/*compare the size difference between parent container
......@@ -717,7 +716,7 @@ static StatusWindow *createStatusWindow(
and title bar height (?)*/
XQueryTree( dpy,
XtWindow(parent),
parent,
&rootWindow,
&containerWindow,
&ignoreWindowPtr,
......@@ -731,7 +730,7 @@ static StatusWindow *createStatusWindow(
XGetWindowAttributes(dpy, rootWindow, &xxwa);
XTranslateCoordinates(dpy,
XtWindow(parent), xwa.root,
parent, xwa.root,
xwa.x, xwa.y,
&x, &y,
&child);
......@@ -833,9 +832,9 @@ static void onoffStatusWindow(X11InputMethodData* pX11IMData,
if (statusWindow->parent != parent){
statusWindow->parent = parent;
}
XGetWindowAttributes(dpy, XtWindow(parent), &xwa);
XGetWindowAttributes(dpy, parent, &xwa);
XTranslateCoordinates(dpy,
XtWindow(parent), xwa.root,
parent, xwa.root,
xwa.x, xwa.y,
&x, &y,
&child);
......@@ -966,9 +965,9 @@ void adjustStatusWindow(Widget shell){
XWindowAttributes xwa;
int x, y;
Window child;
XGetWindowAttributes(dpy, XtWindow(shell), &xwa);
XGetWindowAttributes(dpy, shell, &xwa);
XTranslateCoordinates(dpy,
XtWindow(shell), xwa.root,
shell, xwa.root,
xwa.x, xwa.y,
&x, &y,
&child);
......@@ -1033,7 +1032,7 @@ createXIC(Widget w, X11InputMethodData *pX11IMData,
return False;
}
#ifdef XAWT
if (w == NULL) {
if (!w) {
return False;
}
#else /* !XAWT */
......@@ -1148,8 +1147,8 @@ createXIC(Widget w, X11InputMethodData *pX11IMData,
goto err;
pX11IMData->statusWindow = createStatusWindow(w);
pX11IMData->ic_active = XCreateIC(X11im,
XNClientWindow, XtWindow(w),
XNFocusWindow, XtWindow(w),
XNClientWindow, w,
XNFocusWindow, w,
XNInputStyle, active_styles,
XNPreeditAttributes, preedit,
XNStatusAttributes, status,
......@@ -1166,8 +1165,8 @@ createXIC(Widget w, X11InputMethodData *pX11IMData,
goto err;
pX11IMData->statusWidget = awt_util_getXICStatusAreaWindow(w);
pX11IMData->ic_active = XCreateIC(X11im,
XNClientWindow, XtWindow(pX11IMData->statusWidget),
XNFocusWindow, XtWindow(w),
XNClientWindow, pX11IMData->statusWidget,
XNFocusWindow, w,
XNInputStyle, active_styles,
XNPreeditAttributes, preedit,
XNStatusAttributes, status,
......@@ -1176,8 +1175,8 @@ createXIC(Widget w, X11InputMethodData *pX11IMData,
} else {
#endif /* XAWT */
pX11IMData->ic_active = XCreateIC(X11im,
XNClientWindow, XtWindow(w),
XNFocusWindow, XtWindow(w),
XNClientWindow, w,
XNFocusWindow, w,
XNInputStyle, active_styles,
XNPreeditAttributes, preedit,
NULL);
......@@ -1187,15 +1186,15 @@ createXIC(Widget w, X11InputMethodData *pX11IMData,
XFree((void *)preedit);
#endif /* __linux__ */
pX11IMData->ic_passive = XCreateIC(X11im,
XNClientWindow, XtWindow(w),
XNFocusWindow, XtWindow(w),
XNClientWindow, w,
XNFocusWindow, w,
XNInputStyle, passive_styles,
NULL);
} else {
pX11IMData->ic_active = XCreateIC(X11im,
XNClientWindow, XtWindow(w),
XNFocusWindow, XtWindow(w),
XNClientWindow, w,
XNFocusWindow, w,
XNInputStyle, active_styles,
NULL);
pX11IMData->ic_passive = pX11IMData->ic_active;
......@@ -1213,7 +1212,7 @@ createXIC(Widget w, X11InputMethodData *pX11IMData,
{
XIMCallback cb;
cb.client_data = (XPointer) pX11IMData->x11inputmethod;
cb.callback = CommitStringCallback;
cb.callback = (XIMProc) CommitStringCallback;
XSetICValues (pX11IMData->ic_active, XNCommitStringCallback, &cb, NULL);
if (pX11IMData->ic_active != pX11IMData->ic_passive) {
XSetICValues (pX11IMData->ic_passive, XNCommitStringCallback, &cb, NULL);
......@@ -1506,7 +1505,7 @@ Java_sun_awt_motif_MInputMethod_openXIMNative(JNIEnv *env,
AWT_LOCK();
#ifdef XAWT
dpy = (Display *)display;
dpy = (Display *)jlong_to_ptr(display);
#else
dpy = awt_display;
#endif
......@@ -1516,7 +1515,7 @@ Java_sun_awt_motif_MInputMethod_openXIMNative(JNIEnv *env,
*/
#ifdef __linux__
registered = XRegisterIMInstantiateCallback(dpy, NULL, NULL,
NULL, (XIMProc)OpenXIMCallback, NULL);
NULL, (XIDProc)OpenXIMCallback, NULL);
if (!registered) {
/* directly call openXIM callback */
#endif
......@@ -1551,7 +1550,7 @@ Java_sun_awt_motif_MInputMethod_createXICNative(JNIEnv *env,
AWT_LOCK();
#ifdef XAWT
if (window == NULL) {
if (!window) {
#else /* !XAWT */
if (JNU_IsNull(env, comp)) {
#endif /* XAWT */
......@@ -1660,7 +1659,7 @@ Java_sun_awt_motif_MInputMethod_reconfigureXICNative(JNIEnv *env,
* On Solaris2.6, setXICWindowFocus() has to be invoked
* before setting focus.
*/
setXICWindowFocus(pX11IMData->current_ic, XtWindow(cdata->widget));
setXICWindowFocus(pX11IMData->current_ic, cdata->widget);
setXICFocus(pX11IMData->current_ic, True);
} else {
destroyX11InputMethodData((JNIEnv *) NULL, pX11IMData);
......@@ -1701,7 +1700,7 @@ Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env,
if (req) {
#ifdef XAWT
if (w == NULL) {
if (!w) {
AWT_UNLOCK();
return;
}
......@@ -1734,10 +1733,10 @@ Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env,
#ifndef XAWT
w = cdata->widget;
#endif /* XAWT */
setXICWindowFocus(pX11IMData->current_ic, XtWindow(w));
setXICWindowFocus(pX11IMData->current_ic, w);
setXICFocus(pX11IMData->current_ic, req);
currentX11InputMethodInstance = pX11IMData->x11inputmethod;
currentFocusWindow = XtWindow(w);
currentFocusWindow = w;
#ifdef __linux__
if (active && pX11IMData->statusWindow && pX11IMData->statusWindow->on)
onoffStatusWindow(pX11IMData, w, True);
......
......@@ -165,41 +165,34 @@ static XImage *getWindowImage(Display * display, Window window,
// this should be called from XRobotPeer constructor
JNIEXPORT void JNICALL
Java_sun_awt_X11_XRobotPeer_setup (JNIEnv * env, jclass cls, jint numberOfButtons) {
Java_sun_awt_X11_XRobotPeer_setup (JNIEnv * env, jclass cls, jint numberOfButtons, jintArray buttonDownMasks)
{
int32_t xtestAvailable;
jint *tmp;
int i;
DTRACE_PRINTLN("RobotPeer: setup()");
num_buttons = numberOfButtons;
jclass inputEventClazz = (*env)->FindClass(env, "java/awt/event/InputEvent");
jmethodID getButtonDownMasksID = (*env)->GetStaticMethodID(env, inputEventClazz, "getButtonDownMasks", "()[I");
jintArray obj = (jintArray)(*env)->CallStaticObjectMethod(env, inputEventClazz, getButtonDownMasksID);
jint * tmp = (*env)->GetIntArrayElements(env, obj, JNI_FALSE);
masks = (jint *)malloc(sizeof(jint) * num_buttons);
tmp = (*env)->GetIntArrayElements(env, buttonDownMasks, JNI_FALSE);
masks = (jint *)malloc(sizeof(jint) * num_buttons);
if (masks == (jint *) NULL) {
JNU_ThrowOutOfMemoryError((JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2), NULL);
goto finally;
(*env)->ReleaseIntArrayElements(env, buttonDownMasks, tmp, 0);
return;
}
int i;
for (i = 0; i < num_buttons; i++) {
masks[i] = tmp[i];
}
(*env)->ReleaseIntArrayElements(env, obj, tmp, 0);
(*env)->DeleteLocalRef(env, obj);
(*env)->ReleaseIntArrayElements(env, buttonDownMasks, tmp, 0);
AWT_LOCK();
xtestAvailable = isXTestAvailable();
DTRACE_PRINTLN1("RobotPeer: XTest available = %d", xtestAvailable);
if (!xtestAvailable) {
JNU_ThrowByName(env, "java/awt/AWTException", "java.awt.Robot requires your X server support the XTEST extension version 2.2");
AWT_UNLOCK();
return;
}
finally:
AWT_UNLOCK();
}
......
......@@ -112,7 +112,7 @@ jboolean _icon_upcall(JNIEnv *env, jobject this, GdkPixbuf *pixbuf)
/* Copy the data array into a Java structure so we can pass it back. */
jbyteArray data = (*env)->NewByteArray(env, (row_stride * height));
(*env)->SetByteArrayRegion(env, data, 0, (row_stride * height),
pixbuf_data);
(jbyte *)pixbuf_data);
/* Release the pixbuf. */
(*fp_g_object_unref)(pixbuf);
......
......@@ -484,8 +484,8 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XkbLibraryVersion
(JNIEnv *env, jclass clazz, jlong lib_major_in_out, jlong lib_minor_in_out)
{
AWT_CHECK_HAVE_LOCK();
*((int *)lib_major_in_out) = XkbMajorVersion;
*((int *)lib_minor_in_out) = XkbMinorVersion;
*((int *)jlong_to_ptr(lib_major_in_out)) = XkbMajorVersion;
*((int *)jlong_to_ptr(lib_minor_in_out)) = XkbMinorVersion;
return XkbLibraryVersion((int *)jlong_to_ptr(lib_major_in_out), (int *)jlong_to_ptr(lib_minor_in_out));
}
......@@ -1229,7 +1229,6 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_IsKanaKeyboard
(JNIEnv *env, jclass clazz, jlong display)
{
int xx;
AWT_CHECK_HAVE_LOCK();
static jboolean result = JNI_FALSE;
int32_t minKeyCode, maxKeyCode, keySymsPerKeyCode;
......@@ -1237,6 +1236,8 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_IsKanaKeyboard
int32_t i;
int32_t kanaCount = 0;
AWT_CHECK_HAVE_LOCK();
// There's no direct way to determine whether the keyboard has
// a kana lock key. From available keyboard mapping tables, it looks
// like only keyboards with the kana lock key can produce keysyms
......@@ -1337,12 +1338,14 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_PrintXErrorEvent
JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XInternAtoms
(JNIEnv *env, jclass clazz, jlong display, jobjectArray names_arr, jboolean only_if_exists, jlong atoms)
{
int length = (*env)->GetArrayLength(env, names_arr);
char ** names = (char**)malloc(length*sizeof(char*));
jboolean copy;
int index, name_index = 0;
int status;
AWT_CHECK_HAVE_LOCK();
for (index = 0; index < length; index++) {
jstring str = (*env)->GetObjectArrayElement(env, names_arr, index);
if (!JNU_IsNull(env, str)) {
......@@ -1352,7 +1355,6 @@ JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XInternAtoms
(*env)->DeleteLocalRef(env, str);
}
}
AWT_CHECK_HAVE_LOCK();
status = XInternAtoms((Display*)jlong_to_ptr(display), names, name_index, only_if_exists, (Atom*) jlong_to_ptr(atoms));
for (index = 0; index < length; index++) {
free(names[index]);
......@@ -2186,12 +2188,12 @@ JNIEXPORT void JNICALL
Java_sun_awt_X11_XlibWrapper_SetZOrder
(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong above)
{
AWT_CHECK_HAVE_LOCK();
unsigned int value_mask = CWStackMode;
XWindowChanges wc;
wc.sibling = (Window)jlong_to_ptr(above);
unsigned int value_mask = CWStackMode;
AWT_CHECK_HAVE_LOCK();
if (above == 0) {
wc.stack_mode = Above;
......@@ -2219,6 +2221,7 @@ Java_sun_awt_X11_XlibWrapper_SetBitmapShape
jboolean isCopy = JNI_FALSE;
size_t worstBufferSize = (size_t)((width / 2 + 1) * height);
RECT_T * pRect;
int numrects;
AWT_CHECK_HAVE_LOCK();
......@@ -2237,7 +2240,7 @@ Java_sun_awt_X11_XlibWrapper_SetBitmapShape
/* Note: the values[0] and values[1] are supposed to contain the width
* and height (see XIconInfo.getIntData() for details). So, we do +2.
*/
int numrects = BitmapToYXBandedRectangles(32, (int)width, (int)height,
numrects = BitmapToYXBandedRectangles(32, (int)width, (int)height,
(unsigned char *)(values + 2), pRect);
XShapeCombineRectangles((Display *)jlong_to_ptr(display), (Window)jlong_to_ptr(window),
......
......@@ -28,12 +28,15 @@
typedef int gboolean;
gboolean (*gnome_url_show) (const char *url, void **error);
typedef gboolean (GNOME_URL_SHOW_TYPE)(const char *, void **);
typedef gboolean (GNOME_VFS_INIT_TYPE)(void);
GNOME_URL_SHOW_TYPE *gnome_url_show;
GNOME_VFS_INIT_TYPE *gnome_vfs_init;
int init(){
void *vfs_handle;
void *gnome_handle;
gboolean (*gnome_vfs_init) (void);
const char *errmsg;
vfs_handle = dlopen("libgnomevfs-2.so.0", RTLD_LAZY);
......@@ -44,7 +47,7 @@ int init(){
return 0;
}
dlerror(); /* Clear errors */
gnome_vfs_init = dlsym(vfs_handle, "gnome_vfs_init");
gnome_vfs_init = (GNOME_VFS_INIT_TYPE*)dlsym(vfs_handle, "gnome_vfs_init");
if ((errmsg = dlerror()) != NULL) {
#ifdef INTERNAL_BUILD
fprintf(stderr, "can not find symble gnome_vfs_init\n");
......@@ -62,7 +65,7 @@ int init(){
return 0;
}
dlerror(); /* Clear errors */
gnome_url_show = dlsym(gnome_handle, "gnome_url_show");
gnome_url_show = (GNOME_URL_SHOW_TYPE*)dlsym(gnome_handle, "gnome_url_show");
if ((errmsg = dlerror()) != NULL) {
#ifdef INTERNAL_BUILD
fprintf(stderr, "can not find symble gnome_url_show\n");
......@@ -94,14 +97,15 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XDesktopPeer_gnome_1url_1show
(JNIEnv *env, jobject obj, jbyteArray url_j)
{
gboolean success;
const char* url_c;
const char* url_c = (*env)->GetByteArrayElements(env, url_j, NULL);
if (gnome_url_show == NULL) return JNI_FALSE;
if (gnome_url_show == NULL) {
return JNI_FALSE;
}
url_c = (char*)(*env)->GetByteArrayElements(env, url_j, NULL);
// call gnome_url_show(const char* , GError**)
success = (*gnome_url_show)(url_c, NULL);
(*env)->ReleaseByteArrayElements(env, url_j, (signed char*)url_c, 0);
return success ? JNI_TRUE : JNI_FALSE;
......
......@@ -639,7 +639,7 @@ static BOOL IsDCPostscript( HDC hDC )
if( ::ExtEscape( hDC, GETTECHNOLOGY, 0, NULL, MAX_PATH,
(LPSTR)szTechnology ) <= 0 )
return FALSE;
strupr( szTechnology );
_strupr_s(szTechnology, MAX_PATH);
if(!strstr( szTechnology, "POSTSCRIPT" ) == NULL )
return TRUE;
......
......@@ -246,7 +246,7 @@ HRGN BitmapUtil::BitmapToRgn(HBITMAP hBitmap)
UINT height = abs(bi.bmiHeader.biHeight);
BYTE * buf = (BYTE*)safe_Malloc(bi.bmiHeader.biSizeImage);
bi.bmiHeader.biHeight = -height;
bi.bmiHeader.biHeight = -(INT)height;
::GetDIBits(hdc, hBitmap, 0, height, buf,
reinterpret_cast<BITMAPINFO*>(&bi), DIB_RGB_COLORS);
......@@ -305,7 +305,7 @@ HBITMAP BitmapUtil::BlendCopy(HBITMAP hSrcBitmap, COLORREF blendColor,
UINT height = abs(bi.bmiHeader.biHeight);
BYTE * buf = (BYTE*)safe_Malloc(bi.bmiHeader.biSizeImage);
bi.bmiHeader.biHeight = -height;
bi.bmiHeader.biHeight = -(INT)height;
::GetDIBits(hdc, hSrcBitmap, 0, height, buf,
reinterpret_cast<BITMAPINFO*>(&bi), DIB_RGB_COLORS);
......
......@@ -238,7 +238,7 @@ void AwtDesktopProperties::GetNonClientParameters() {
// when running on XP. However this can't be referenced at compile time
// with the older SDK, so there use 'lfMessageFont' plus its size.
if (!IS_WINVISTA) {
#if defined(_MSC_VER) && (_MSC_VER >= 1600) {
#if defined(_MSC_VER) && (_MSC_VER >= 1600)
ncmetrics.cbSize = offsetof(NONCLIENTMETRICS, iPaddedBorderWidth);
#else
ncmetrics.cbSize = offsetof(NONCLIENTMETRICS,lfMessageFont) + sizeof(LOGFONT);
......
......@@ -159,7 +159,8 @@ extern "C" {
void JNICALL DSUnlockAWT(JNIEnv* env);
_JNI_IMPORT_OR_EXPORT_
jobject JNICALL DSGetComponent(JNIEnv* env, void* platformInfo);
jobject JNICALL DSGetComponent(
JNIEnv* env, void* platformInfo);
#ifdef __cplusplus
} /* extern "C" */
......
......@@ -1189,7 +1189,7 @@ LONG AwtFontCache::DecRefCount(Item* item){
AwtFontCache::Item::Item(const WCHAR* s, HFONT f, AwtFontCache::Item* n )
{
name = wcsdup(s);
name = _wcsdup(s);
font = f;
next = n;
refCount = 1;
......@@ -1237,7 +1237,7 @@ void CSegTableComponent::Create(LPCWSTR name)
free(m_lpszFontName);
m_lpszFontName = NULL;
}
m_lpszFontName = wcsdup(name);
m_lpszFontName = _wcsdup(name);
DASSERT(m_lpszFontName);
}
......
......@@ -1050,7 +1050,7 @@ static LPTSTR GetPrinterPort(JNIEnv *env, LPTSTR printer) {
return NULL;
}
LPTSTR port = wcsdup(info2->pPortName);
LPTSTR port = _wcsdup(info2->pPortName);
::GlobalFree(info2);
return port;
}
......
......@@ -23,16 +23,12 @@
* questions.
*/
#define _JNI_IMPLEMENTATION_
#include "awt.h"
#include <signal.h>
#include <windowsx.h>
//#if defined(_DEBUG) && defined(_MSC_VER) && _MSC_VER >= 1000
//#include <crtdbg.h>
//#endif
#define _JNI_IMPLEMENTATION_
#include "awt_DrawingSurface.h"
#include "awt_AWTEvent.h"
#include "awt_Component.h"
......@@ -2224,21 +2220,21 @@ Java_sun_awt_windows_WToolkit_getWindowsVersion(JNIEnv *env, jclass cls)
WCHAR szVer[128];
DWORD version = ::GetVersion();
swprintf(szVer, L"0x%x = %ld", version, version);
swprintf(szVer, 128, L"0x%x = %ld", version, version);
int l = lstrlen(szVer);
if (IS_WIN2000) {
if (IS_WINXP) {
if (IS_WINVISTA) {
swprintf(szVer + l, L" (Windows Vista)");
swprintf(szVer + l, 128, L" (Windows Vista)");
} else {
swprintf(szVer + l, L" (Windows XP)");
swprintf(szVer + l, 128, L" (Windows XP)");
}
} else {
swprintf(szVer + l, L" (Windows 2000)");
swprintf(szVer + l, 128, L" (Windows 2000)");
}
} else {
swprintf(szVer + l, L" (Unknown)");
swprintf(szVer + l, 128, L" (Unknown)");
}
return JNU_NewStringPlatform(env, szVer);
......
......@@ -269,7 +269,7 @@ Java_sun_awt_Win32FontManager_getEUDCFontFile(JNIEnv *env, jclass cl) {
//if the fontPath includes %SystemRoot%
LPWSTR systemRoot = _wgetenv(L"SystemRoot");
if (systemRoot != NULL
&& swprintf(tmpPath, L"%s%s", systemRoot, fontPath + 12) != -1) {
&& swprintf(tmpPath, MAX_PATH, L"%s%s", systemRoot, fontPath + 12) != -1) {
fontPath = tmpPath;
}
else {
......@@ -279,7 +279,7 @@ Java_sun_awt_Win32FontManager_getEUDCFontFile(JNIEnv *env, jclass cl) {
//else to see if it only inludes "EUDC.TTE"
WCHAR systemRoot[MAX_PATH + 1];
if (GetWindowsDirectory(systemRoot, MAX_PATH + 1) != 0) {
swprintf(tmpPath, L"%s\\FONTS\\EUDC.TTE", systemRoot);
swprintf(tmpPath, MAX_PATH, L"%s\\FONTS\\EUDC.TTE", systemRoot);
fontPath = tmpPath;
}
else {
......
......@@ -219,7 +219,7 @@ AwtWindow::AwtWindow() {
::InitializeCriticalSection(&contentBitmapCS);
m_windowType = Type::NORMAL;
m_windowType = NORMAL;
m_alwaysOnTop = false;
}
......@@ -1016,9 +1016,9 @@ void AwtWindow::InitType(JNIEnv *env, jobject peer)
}
if (strcmp(valueNative, "UTILITY") == 0) {
m_windowType = Type::UTILITY;
m_windowType = UTILITY;
} else if (strcmp(valueNative, "POPUP") == 0) {
m_windowType = Type::POPUP;
m_windowType = POPUP;
}
env->ReleaseStringUTFChars(value, valueNative);
......@@ -1029,10 +1029,10 @@ void AwtWindow::InitType(JNIEnv *env, jobject peer)
void AwtWindow::TweakStyle(DWORD & style, DWORD & exStyle)
{
switch (GetType()) {
case Type::UTILITY:
case UTILITY:
exStyle |= WS_EX_TOOLWINDOW;
break;
case Type::POPUP:
case POPUP:
style &= ~WS_OVERLAPPED;
style |= WS_POPUP;
break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册