Skip to content
This repository has been archived by the owner on Jun 23, 2019. It is now read-only.

Commit

Permalink
Fix compilation warnings on MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
cgutman committed Mar 11, 2016
1 parent eda70f4 commit 62a51b8
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions jni/jnienet/jnienet.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

#include <jni.h>

#ifdef _WIN32
#pragma comment(lib, "ws2_32.lib")
#pragma comment(lib, "winmm.lib")
#endif

#define CLIENT_TO_LONG(x) ((intptr_t)(x))
#define LONG_TO_CLIENT(x) ((ENetHost*)(intptr_t)(x))

Expand Down Expand Up @@ -45,7 +50,7 @@ Java_com_limelight_nvstream_enet_EnetConnection_connectToPeer(JNIEnv *env, jobje
// Initialize the ENet address
addrStr = (*env)->GetStringUTFChars(env, address, 0);
err = enet_address_set_host(&enetAddress, addrStr);
enet_address_set_port(&enetAddress, port);
enet_address_set_port(&enetAddress, (enet_uint16) port);
(*env)->ReleaseStringUTFChars(env, address, addrStr);
if (err < 0) {
return PEER_TO_LONG(NULL);
Expand Down Expand Up @@ -88,15 +93,15 @@ Java_com_limelight_nvstream_enet_EnetConnection_readPacket(JNIEnv *env, jobject
}

// Check that the packet isn't too large
if (event.packet->dataLength > length) {
if (event.packet->dataLength > (size_t) length) {
enet_packet_destroy(event.packet);
return event.packet->dataLength;
return (jint) event.packet->dataLength;
}

// Copy the packet data into the caller's buffer
dataPtr = (*env)->GetByteArrayElements(env, data, 0);
memcpy(dataPtr, event.packet->data, event.packet->dataLength);
err = event.packet->dataLength;
err = (jint) event.packet->dataLength;
(*env)->ReleaseByteArrayElements(env, data, dataPtr, 0);

// Free the packet
Expand Down

0 comments on commit 62a51b8

Please sign in to comment.