Windows: Replace _WIN32 macro with _MSC_VER since the conditionals are really for the MSVC compiler, not for the windows platform in general. Code cleanup.

This commit is contained in:
Elias Naur 2006-07-15 21:01:11 +00:00
parent 050638760e
commit bd474ceaa9
4 changed files with 7 additions and 17 deletions

View file

@ -39,11 +39,6 @@
#include <jni.h>
#include <stdlib.h>
#ifdef _WIN32
#include <wtypes.h>
#endif
#include "common_tools.h"
#include "org_lwjgl_DefaultSysImplementation.h"
@ -81,7 +76,7 @@ static jstring sprintfJavaString(JNIEnv *env, const char *format, va_list ap) {
#define BUFFER_SIZE 4000
char buffer[BUFFER_SIZE];
jstring str;
#ifdef _WIN32
#ifdef _MSC_VER
vsnprintf_s(buffer, BUFFER_SIZE, _TRUNCATE, format, ap);
#else
vsnprintf(buffer, BUFFER_SIZE, format, ap);

View file

@ -57,7 +57,7 @@ typedef enum {false, true} bool;
#endif
#endif
#ifdef _WIN32
#ifdef _MSC_VER
#define inline __inline
#include <Basetsd.h>
#else

View file

@ -88,7 +88,7 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nCreateCursor
colorDIB = CreateDIBSection(GetDC(NULL), (BITMAPINFO*)&(bitmapInfo),
DIB_RGB_COLORS,
(void**)&(ptrCursorImage),
(void*)&(ptrCursorImage),
NULL, 0);
srcPtr = pixels;
dstPtr = ptrCursorImage;

View file

@ -119,7 +119,7 @@ static LRESULT CALLBACK lwjglWindowProc(HWND hWnd,
message_time = GetMessageTime();
handleMessage_method = (*env)->GetStaticMethodID(env, display_class_global, "handleMessage", "(JIJJJ)Z");
if (handleMessage_method != NULL)
if ((*env)->CallStaticBooleanMethod(env, display_class_global, handleMessage_method, (jlong)hWnd, (jint)msg, (jlong)wParam, (jlong)lParam, (jlong)message_time))
if ((*env)->CallStaticBooleanMethod(env, display_class_global, handleMessage_method, (jlong)(intptr_t)hWnd, (jint)msg, (jlong)wParam, (jlong)lParam, (jlong)message_time))
return 0;
}
}
@ -190,7 +190,6 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nCreateWindow(JNIEnv
jfieldID fid_height = (*env)->GetFieldID(env, cls_displayMode, "height", "I");
int width = (*env)->GetIntField(env, mode, fid_width);
int height = (*env)->GetIntField(env, mode, fid_height);
BOOL result;
bool isUndecorated; // Whether we're undecorated or not
static bool oneShotInitialised = false;
if (!oneShotInitialised) {
@ -321,8 +320,6 @@ static HICON createWindowIcon(JNIEnv *env, jint *pixels, jint width, jint height
char *ptrCursorImage;
int x, y;
char *dstPtr;
int pixelCount;
int scanlinePad;
int wordAlignedWidth;
int imageSize;
unsigned char *maskPixels;
@ -332,8 +329,6 @@ static HICON createWindowIcon(JNIEnv *env, jint *pixels, jint width, jint height
int scanlineWidth;
HBITMAP colorDIB;
jsize pixelsLen = width * height;
memset(&bitmapInfo, 0, sizeof(BITMAPINFO));
bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bitmapInfo.bmiHeader.biWidth = width;
@ -343,7 +338,7 @@ static HICON createWindowIcon(JNIEnv *env, jint *pixels, jint width, jint height
bitmapInfo.bmiHeader.biCompression = BI_RGB;
colorDIB = CreateDIBSection(GetDC(NULL), (BITMAPINFO*)&(bitmapInfo),
DIB_RGB_COLORS, (void**)&(ptrCursorImage), NULL, 0);
DIB_RGB_COLORS, (void*)&(ptrCursorImage), NULL, 0);
if (!ptrCursorImage) {
throwException(env, "Could not allocate DIB section.");
}
@ -435,7 +430,7 @@ static HICON createWindowIcon(JNIEnv *env, jint *pixels, jint width, jint height
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetWindowIcon16
(JNIEnv *env, jclass clazz, jobject iconBuffer)
{
int *imgData = (int *)(*env)->GetDirectBufferAddress(env, iconBuffer);
jint *imgData = (jint *)(*env)->GetDirectBufferAddress(env, iconBuffer);
freeSmallIcon();
small_icon = createWindowIcon(env, imgData, 16, 16);
@ -453,7 +448,7 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetWindowIcon16
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetWindowIcon32
(JNIEnv *env, jclass clazz, jobject iconBuffer)
{
int *imgData = (int *)(*env)->GetDirectBufferAddress(env, iconBuffer);
jint *imgData = (jint *)(*env)->GetDirectBufferAddress(env, iconBuffer);
freeLargeIcon();
large_icon = createWindowIcon(env, imgData, 32, 32);