Skip to content

Commit add146f

Browse files
committed
2 parents 1a16989 + 41ba40c commit add146f

17 files changed

+224
-105
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ add_subdirectory(Lib)
5353

5454
set(RAKNET_COMMON_LIBS RakNetLibStatic)
5555

56-
if( RAKNET_GENERATE_SAMPLES )
56+
if( RAKNET_ENABLE_SAMPLES )
5757
add_subdirectory(Samples)
5858
endif()

DependentExtensions/Autopatcher/ApplyPatch.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,10 @@ int TestPatchInMemory(int argc,char *argv[])
297297
fclose(newFile);
298298
fclose(oldFile);
299299

300+
delete[] patch;
301+
delete[] old;
302+
delete[] _new;
303+
300304
return res;
301305
}
302306

Lib/DLL/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ IF(WIN32 AND NOT UNIX)
1313
SET( CMAKE_CXX_FLAGS "/D WIN32 /D _RAKNET_DLL /D _CRT_NONSTDC_NO_DEPRECATE /D _CRT_SECURE_NO_DEPRECATE /GS- /GR- ")
1414
ENDIF(WIN32 AND NOT UNIX)
1515

16-
IF(WIN32 AND NOT UNIX)
17-
target_link_libraries (RakNetDLL ${RAKNET_LIBRARY_LIBS})
18-
ELSE(WIN32 AND NOT UNIX)
19-
target_link_libraries (RakNetDLL ${RAKNET_LIBRARY_LIBS})
20-
INSTALL(TARGETS RakNetDLL DESTINATION ${RakNet_SOURCE_DIR}/Lib/DLL)
21-
ENDIF(WIN32 AND NOT UNIX)
16+
target_link_libraries (RakNetDLL ${RAKNET_LIBRARY_LIBS})
17+
18+
# install lib and header files to CMAKE_INSTALL_PREFIX
19+
install(TARGETS RakNetDLL DESTINATION "lib")
20+
install(FILES ${ALL_HEADER_SRCS} DESTINATION "include/RakNet")
21+

Lib/LibStatic/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ IF(WIN32 AND NOT UNIX)
2727

2828
ELSE(WIN32 AND NOT UNIX)
2929
target_link_libraries (RakNetLibStatic ${RAKNET_LIBRARY_LIBS})
30-
INSTALL(TARGETS RakNetLibStatic DESTINATION ${RakNet_SOURCE_DIR}/Lib/RakNetLibStatic)
31-
INSTALL(FILES ${ALL_HEADER_SRCS} DESTINATION ${RakNet_SOURCE_DIR}/include/raknet)
3230
ENDIF(WIN32 AND NOT UNIX)
3331

32+
INSTALL(TARGETS RakNetLibStatic DESTINATION "lib")
33+
INSTALL(FILES ${ALL_HEADER_SRCS} DESTINATION "include/RakNet")
34+
35+
3436

Samples/CrossConnectionTest/CrossConnectionTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ int main()
9999
{
100100
printf("Test failed, ID_NEW_INCOMING_CONNECTION is true for both instances\n");
101101
}
102-
else if (gotConnectionRequestAccepted[0]==0 && gotConnectionRequestAccepted[1]==0)
102+
else if (gotNewIncomingConnection[0]==0 && gotNewIncomingConnection[1]==0)
103103
{
104104
printf("Test failed, ID_NEW_INCOMING_CONNECTION is false for both instances\n");
105105
}

Source/BitStream.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2022,7 +2022,7 @@ namespace RakNet
20222022
}
20232023

20242024
template <class templateType>
2025-
BitStream& operator<<(BitStream& out, templateType& c)
2025+
BitStream& operator<<(BitStream& out, const templateType& c)
20262026
{
20272027
out.Write(c);
20282028
return out;

Source/DS_WeightedGraph.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ namespace DataStructures
280280
if (row==0)
281281
{
282282
path.Insert(startNode, _FILE_AND_LINE_);
283-
for (col=0; outputQueue.Size(); col++)
283+
while (!outputQueue.Empty())
284284
path.Insert(outputQueue.Pop(), _FILE_AND_LINE_);
285285
return true;
286286
}
@@ -296,7 +296,7 @@ namespace DataStructures
296296
}
297297

298298
path.Insert(startNode, _FILE_AND_LINE_);
299-
for (col=0; outputQueue.Size(); col++)
299+
while (!outputQueue.Empty())
300300
path.Insert(outputQueue.Pop(), _FILE_AND_LINE_);
301301
return true;
302302
}

Source/NatPunchthroughClient.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ void NatPunchthroughClient::SendTTL(const SystemAddress &sa)
792792
rakPeerInterface->SendTTL(ipAddressString,sa.GetPort(), 2);
793793
}
794794

795-
char *TestModeToString(NatPunchthroughClient::SendPing::TestMode tm)
795+
const char *TestModeToString(NatPunchthroughClient::SendPing::TestMode tm)
796796
{
797797
switch (tm)
798798
{
@@ -855,9 +855,17 @@ void NatPunchthroughClient::SendOutOfBand(SystemAddress sa, MessageID oobId)
855855
RakNet::Time serverTime = RakNet::GetTime() + clockDifferential;
856856

857857
if (oobId==ID_NAT_ESTABLISH_UNIDIRECTIONAL)
858+
#if defined(_WIN32)
858859
natPunchthroughDebugInterface->OnClientMessage(RakNet::RakString("%I64d: %s: OOB ID_NAT_ESTABLISH_UNIDIRECTIONAL to guid %s, system address %s.\n", serverTime, TestModeToString(sp.testMode), guidString, ipAddressString));
860+
#else
861+
natPunchthroughDebugInterface->OnClientMessage(RakNet::RakString("%lld: %s: OOB ID_NAT_ESTABLISH_UNIDIRECTIONAL to guid %s, system address %s.\n", serverTime, TestModeToString(sp.testMode), guidString, ipAddressString));
862+
#endif
859863
else
864+
#if defined(_WIN32)
860865
natPunchthroughDebugInterface->OnClientMessage(RakNet::RakString("%I64d: %s: OOB ID_NAT_ESTABLISH_BIDIRECTIONAL to guid %s, system address %s.\n", serverTime, TestModeToString(sp.testMode), guidString, ipAddressString));
866+
#else
867+
natPunchthroughDebugInterface->OnClientMessage(RakNet::RakString("%lld: %s: OOB ID_NAT_ESTABLISH_BIDIRECTIONAL to guid %s, system address %s.\n", serverTime, TestModeToString(sp.testMode), guidString, ipAddressString));
868+
#endif
861869
}
862870
}
863871
void NatPunchthroughClient::OnNewConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)

Source/PacketizedTCP.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ bool PacketizedTCP::SendList( const char **data, const unsigned int *lengths, co
8787
#endif
8888

8989

90-
unsigned int lengthsArray[512];
91-
const char *dataArray[512];
90+
unsigned int lengthsArray[513];
91+
const char *dataArray[513];
9292
dataArray[0]=(char*) &dataLength;
9393
lengthsArray[0]=sizeof(dataLength);
9494
for (int i=0; i < 512 && i < numParameters; i++)

Source/RakNetSocket2_Berkley_NativeClient.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void DomainNameToIP_Berkley_IPV4And6( const char *domainName, char ip[65] )
3333
hints.ai_socktype = SOCK_DGRAM;
3434

3535
if ((status = getaddrinfo(domainName, NULL, &hints, &res)) != 0) {
36-
memset(ip, 0, sizeof(ip));
36+
memset(ip, 0, 65); // sizeof(ip) returns pointer size, not array size
3737
return;
3838
}
3939

0 commit comments

Comments
 (0)