mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-06 21:58:57 -04:00
Removed some std::ostringstream.
To be continued. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5107 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
d52904e7c6
commit
b2ea453804
8 changed files with 82 additions and 169 deletions
|
@ -24,8 +24,8 @@
|
|||
*/
|
||||
|
||||
#include "pqi/pqi.h"
|
||||
#include "util/rsstring.h"
|
||||
#include "services/p3service.h"
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
/*****
|
||||
|
@ -226,29 +226,27 @@ RsRawItem *p3Service::send()
|
|||
|
||||
std::string generateRandomServiceId()
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << std::hex;
|
||||
std::string out;
|
||||
|
||||
/********************************** 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;
|
||||
rs_sprintf_append(out, "%08x", 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;
|
||||
rs_sprintf_append(out, "%04x", rint);
|
||||
}
|
||||
#endif
|
||||
/********************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
||||
return out.str();
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue