Changes required to get Retroshare V0.4 working under windows.

Most of these changes relate to:
 (1) rand() is different 
 (2) sleep() don't exist on Windows.
 (3) networking headers are different - these need to be cleaned up in general.
 (4) disabled tests that won't compile on Windows.

Will probably have to rollback some of these changes for Unix later.





git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@372 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2008-03-03 14:41:15 +00:00
parent 9e954e9c0f
commit 9bdd44d0f5
29 changed files with 218 additions and 86 deletions

View file

@ -27,6 +27,7 @@
#include "services/p3gameservice.h"
#include "pqi/pqidebug.h"
#include <sstream>
#include <iomanip>
/* global variable for GUI */
RsGameLauncher *rsGameLauncher = NULL;
@ -131,13 +132,27 @@ std::string generateRandomGameId()
{
std::ostringstream out;
out << std::hex;
/********************************** WINDOWS/UNIX SPECIFIC PART ******************/
#ifndef WINDOWS_SYS
/* 4 bytes per random number: 4 x 4 = 16 bytes */
for(int i = 0; i < 4; i++)
{
out << std::setw(8) << std::setfill('0');
uint32_t rint = random();
out << rint;
}
#else
srand(time(NULL));
/* 2 bytes per random number: 8 x 2 = 16 bytes */
for(int i = 0; i < 8; i++)
{
out << std::setw(4) << std::setfill('0');
uint16_t rint = rand(); /* only gives 16 bits */
out << rint;
}
#endif
/********************************** WINDOWS/UNIX SPECIFIC PART ******************/
return out.str();
}

View file

@ -25,6 +25,7 @@
#include "serialiser/rsrankitems.h"
#include "services/p3ranking.h"
#include <iomanip>
#include "pqi/pqibin.h"
#include "pqi/p3authmgr.h"
@ -823,13 +824,26 @@ std::string generateRandomLinkId()
{
std::ostringstream out;
out << std::hex;
/********************************** WINDOWS/UNIX SPECIFIC PART ******************/
#ifndef WINDOWS_SYS
/* 4 bytes per random number: 4 x 4 = 16 bytes */
for(int i = 0; i < 4; i++)
{
out << std::setw(8) << std::setfill('0');
uint32_t rint = random();
out << rint;
}
#else
srand(time(NULL));
/* 2 bytes per random number: 8 x 2 = 16 bytes */
for(int i = 0; i < 8; i++)
{
out << std::setw(4) << std::setfill('0');
uint16_t rint = rand(); /* only gives 16 bits */
out << rint;
}
#endif
/********************************** WINDOWS/UNIX SPECIFIC PART ******************/
return out.str();
}