win32 compatibility

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1095 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2009-03-23 14:45:51 +00:00
parent 4ef56e1b79
commit ef54d9d176
2 changed files with 10 additions and 5 deletions

View File

@ -196,7 +196,7 @@ bool ftController::moveFile(const std::string& source,const std::string& dest)
static const int BUFF_SIZE = 10485760 ; // 10 MB buffer to speed things up. static const int BUFF_SIZE = 10485760 ; // 10 MB buffer to speed things up.
void *buffer = malloc(BUFF_SIZE) ; void *buffer = malloc(BUFF_SIZE) ;
FILE *in = fopen(source.c_str(),"r") ; FILE *in = fopen(source.c_str(),"rb") ;
if(in == NULL) if(in == NULL)
{ {
@ -204,7 +204,7 @@ bool ftController::moveFile(const std::string& source,const std::string& dest)
return false ; return false ;
} }
FILE *out = fopen(dest.c_str(),"w") ; FILE *out = fopen(dest.c_str(),"wb") ;
if(out == NULL) if(out == NULL)
{ {

View File

@ -24,6 +24,7 @@
*/ */
#include <stdexcept> #include <stdexcept>
#include <stdlib.h>
#include "rsiface/rsiface.h" #include "rsiface/rsiface.h"
#include "rsiface/rspeers.h" #include "rsiface/rspeers.h"
@ -55,7 +56,7 @@ p3turtle::p3turtle(p3ConnectMgr *cm) :p3Service(RS_SERVICE_TYPE_TURTLE), mConnMg
{ {
RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/ RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/
srand48(time(NULL)) ; srand(time(NULL)) ;
addSerialType(new RsTurtleSerialiser()); addSerialType(new RsTurtleSerialiser());
} }
@ -87,7 +88,7 @@ uint32_t p3turtle::generateRandomRequestId()
{ {
RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/ RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/
return lrand48() ; return rand() ;
} }
TurtleRequestId p3turtle::turtleSearch(const std::string& string_to_match) TurtleRequestId p3turtle::turtleSearch(const std::string& string_to_match)
@ -106,7 +107,11 @@ TurtleRequestId p3turtle::turtleSearch(const std::string& string_to_match)
while(mConnMgr->getOwnId() == "") while(mConnMgr->getOwnId() == "")
{ {
std::cerr << "... waitting for connect manager to form own id." << std::endl ; std::cerr << "... waitting for connect manager to form own id." << std::endl ;
#ifdef WIN32
Sleep(1000) ;
#else
sleep(1) ; sleep(1) ;
#endif
} }
item->PeerId(mConnMgr->getOwnId()) ; item->PeerId(mConnMgr->getOwnId()) ;
@ -549,7 +554,7 @@ RsTurtleSearchResultItem::RsTurtleSearchResultItem(void *data,uint32_t pktsize)
result.clear() ; result.clear() ;
for(uint i=0;i<s;++i) for(int i=0;i<(int)s;++i)
{ {
TurtleFileInfo f ; TurtleFileInfo f ;