mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 07:29:33 -05:00
Removed some std::ostringstream.
To be continued. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5111 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
a9e496f845
commit
4e26884646
@ -33,8 +33,7 @@
|
||||
#include "bitdht/bdstddht.h"
|
||||
#include "util/bdnet.h"
|
||||
#include "util/bdrandom.h"
|
||||
|
||||
#include <sstream>
|
||||
#include "util/bdstring.h"
|
||||
|
||||
/*
|
||||
* #define DEBUG_PROXY_CONNECTION 1
|
||||
@ -3377,11 +3376,7 @@ std::string decodeConnectionErrorType(uint32_t errcode)
|
||||
switch(errtype)
|
||||
{
|
||||
default:
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << "(" << errtype << ")";
|
||||
namedtype += out.str();
|
||||
}
|
||||
bd_sprintf_append(namedtype, "(%lu)", errtype);
|
||||
break;
|
||||
case BITDHT_CONNECT_ERROR_GENERIC:
|
||||
namedtype = "GENERIC";
|
||||
@ -3434,11 +3429,7 @@ std::string decodeConnectionErrorSource(uint32_t errcode)
|
||||
switch(errsrc)
|
||||
{
|
||||
default:
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << "(" << errsrc << ")";
|
||||
namedtype += out.str();
|
||||
}
|
||||
bd_sprintf_append(namedtype, "(%lu)", errsrc);
|
||||
break;
|
||||
case BITDHT_CONNECT_ERROR_SOURCE_START:
|
||||
namedtype = "START";
|
||||
|
@ -46,12 +46,12 @@
|
||||
#include "bitdht/bdfilter.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <string.h>
|
||||
|
||||
#include "util/bdnet.h"
|
||||
#include "util/bdrandom.h"
|
||||
#include "util/bdstring.h"
|
||||
|
||||
/***
|
||||
* #define DEBUG_MGR 1
|
||||
@ -601,10 +601,10 @@ void bdNodeManager::SearchForLocalNet()
|
||||
for(i = 0; (!filterOk) && (i < MAX_FILTER_ATTEMPTS); i++)
|
||||
{
|
||||
bdStdRandomNodeId(&targetNodeId);
|
||||
std::ostringstream tststr;
|
||||
bdStdPrintNodeId(tststr, &targetNodeId);
|
||||
std::string tststr;
|
||||
bdStdPrintNodeId(tststr, &targetNodeId, false);
|
||||
|
||||
if (mBloomFilter.test(tststr.str()))
|
||||
if (mBloomFilter.test(tststr))
|
||||
{
|
||||
filterOk = true;
|
||||
}
|
||||
@ -1220,26 +1220,23 @@ int bdNodeManager::isBitDhtPacket(char *data, int size, struct sockaddr_in &
|
||||
std::cerr << std::endl;
|
||||
{
|
||||
/* print the fucker... only way to catch bad ones */
|
||||
std::ostringstream out;
|
||||
std::string out;
|
||||
for(int i = 0; i < size; i++)
|
||||
{
|
||||
if (isascii(data[i]))
|
||||
{
|
||||
out << data[i];
|
||||
out += data[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
out << "[";
|
||||
out << std::setw(2) << std::setfill('0')
|
||||
<< std::hex << (uint32_t) data[i];
|
||||
out << "]";
|
||||
bd_sprintf_append(out, "[%02lx]", (uint32_t) data[i]);
|
||||
}
|
||||
if ((i % 16 == 0) && (i != 0))
|
||||
{
|
||||
out << std::endl;
|
||||
out += "\n";
|
||||
}
|
||||
}
|
||||
std::cerr << out.str();
|
||||
std::cerr << out;
|
||||
}
|
||||
std::cerr << "bdNodeManager::isBitDhtPacket() *******************************";
|
||||
std::cerr << std::endl;
|
||||
@ -1262,26 +1259,23 @@ int bdNodeManager::isBitDhtPacket(char *data, int size, struct sockaddr_in &
|
||||
std::cerr << std::endl;
|
||||
{
|
||||
/* print the fucker... only way to catch bad ones */
|
||||
std::ostringstream out;
|
||||
std::string out;
|
||||
for(int i = 0; i < size; i++)
|
||||
{
|
||||
if (isascii(data[i]))
|
||||
{
|
||||
out << data[i];
|
||||
out += data[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
out << "[";
|
||||
out << std::setw(2) << std::setfill('0')
|
||||
<< std::hex << (uint32_t) data[i];
|
||||
out << "]";
|
||||
bd_sprintf_append(out, "[%02lx]", (uint32_t) data[i]);
|
||||
}
|
||||
if ((i % 16 == 0) && (i != 0))
|
||||
{
|
||||
out << std::endl;
|
||||
out += "\n";
|
||||
}
|
||||
}
|
||||
std::cerr << out.str();
|
||||
std::cerr << out;
|
||||
}
|
||||
std::cerr << "bdNodeManager::BadPacket ******************************";
|
||||
std::cerr << std::endl;
|
||||
|
@ -33,14 +33,13 @@
|
||||
|
||||
#include "util/bdnet.h"
|
||||
#include "util/bdrandom.h"
|
||||
|
||||
#include "util/bdstring.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
#define BITDHT_QUERY_START_PEERS 10
|
||||
@ -2100,10 +2099,8 @@ void bdNode::genNewToken(bdToken *token)
|
||||
// XXX is this a good way to do it?
|
||||
// Variable length, from 4 chars up to lots... 10?
|
||||
// leave for the moment, but fix.
|
||||
std::ostringstream out;
|
||||
out << std::setw(4) << std::setfill('0') << bdRandom::random_u32();
|
||||
|
||||
std::string num = out.str();
|
||||
std::string num;
|
||||
bd_sprintf(num, "%04lx", bdRandom::random_u32());
|
||||
int len = num.size();
|
||||
if (len > BITDHT_TOKEN_MAX_LEN)
|
||||
len = BITDHT_TOKEN_MAX_LEN;
|
||||
@ -2125,9 +2122,8 @@ void bdNode::genNewTransId(bdToken *token)
|
||||
fprintf(stderr, ")\n");
|
||||
#endif
|
||||
|
||||
std::ostringstream out;
|
||||
out << std::setw(2) << std::setfill('0') << transIdCounter++;
|
||||
std::string num = out.str();
|
||||
std::string num;
|
||||
bd_sprintf(num, "%02lx", transIdCounter++);
|
||||
int len = num.size();
|
||||
if (len > BITDHT_TOKEN_MAX_LEN)
|
||||
len = BITDHT_TOKEN_MAX_LEN;
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "bitdht/bdstddht.h"
|
||||
#include "bitdht/bdpeer.h"
|
||||
#include "util/bdrandom.h"
|
||||
#include "util/bdstring.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
@ -177,41 +178,53 @@ int bdStdLoadNodeId(bdNodeId *id, std::string input)
|
||||
|
||||
std::string bdStdConvertToPrintable(std::string input)
|
||||
{
|
||||
std::ostringstream out;
|
||||
for(uint32_t i = 0; i < input.length(); i++)
|
||||
std::string out;
|
||||
for(uint32_t i = 0; i < input.length(); i++)
|
||||
{
|
||||
/* sensible chars */
|
||||
if ((input[i] > 31) && (input[i] < 127))
|
||||
{
|
||||
/* sensible chars */
|
||||
if ((input[i] > 31) && (input[i] < 127))
|
||||
{
|
||||
out << input[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
out << "[0x" << std::hex << (uint32_t) input[i] << "]";
|
||||
out << std::dec;
|
||||
}
|
||||
out += input[i];
|
||||
}
|
||||
return out.str();
|
||||
else
|
||||
{
|
||||
bd_sprintf_append(out, "[0x%x]", (uint32_t) input[i]);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
void bdStdPrintNodeId(std::ostream &out, const bdNodeId *a)
|
||||
{
|
||||
for(int i = 0; i < BITDHT_KEY_LEN; i++)
|
||||
{
|
||||
out << std::setw(2) << std::setfill('0') << std::hex << (uint32_t) (a->data)[i];
|
||||
}
|
||||
out << std::dec;
|
||||
|
||||
return;
|
||||
std::string s;
|
||||
bdStdPrintNodeId(s, a, true);
|
||||
out << s;
|
||||
}
|
||||
|
||||
void bdStdPrintNodeId(std::string &out, const bdNodeId *a, bool append)
|
||||
{
|
||||
if (!append)
|
||||
{
|
||||
out.clear();
|
||||
}
|
||||
|
||||
for(int i = 0; i < BITDHT_KEY_LEN; i++)
|
||||
{
|
||||
bd_sprintf_append(out, "%02x", (uint32_t) (a->data)[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void bdStdPrintId(std::ostream &out, const bdId *a)
|
||||
{
|
||||
bdStdPrintNodeId(out, &(a->id));
|
||||
out << " ip:" << bdnet_inet_ntoa(a->addr.sin_addr);
|
||||
out << ":" << ntohs(a->addr.sin_port);
|
||||
return;
|
||||
std::string s;
|
||||
bdStdPrintId(s, a, false);
|
||||
out << s;
|
||||
}
|
||||
|
||||
void bdStdPrintId(std::string &out, const bdId *a, bool append)
|
||||
{
|
||||
bdStdPrintNodeId(out, &(a->id), append);
|
||||
bd_sprintf_append(out, " ip:%s:%u", bdnet_inet_ntoa(a->addr.sin_addr).c_str(), ntohs(a->addr.sin_port));
|
||||
}
|
||||
|
||||
/* returns 0-160 depending on bucket */
|
||||
|
@ -55,7 +55,9 @@ void bdStdRandomMidId(const bdNodeId *target, const bdNodeId *other, bdNodeId *m
|
||||
int bdStdLoadNodeId(bdNodeId *id, std::string input);
|
||||
|
||||
void bdStdPrintId(std::ostream &out, const bdId *a);
|
||||
void bdStdPrintId(std::string &out, const bdId *a, bool append);
|
||||
void bdStdPrintNodeId(std::ostream &out, const bdNodeId *a);
|
||||
void bdStdPrintNodeId(std::string &out, const bdNodeId *a, bool append);
|
||||
|
||||
std::string bdStdConvertToPrintable(std::string input);
|
||||
|
||||
|
@ -141,6 +141,7 @@ SOURCES += \
|
||||
util/bdnet.cc \
|
||||
util/bdthreads.cc \
|
||||
util/bdrandom.cc \
|
||||
util/bdstring.cc \
|
||||
udp/udplayer.cc \
|
||||
udp/udpstack.cc \
|
||||
udp/udpbitdht.cc \
|
||||
|
@ -25,9 +25,9 @@
|
||||
|
||||
#include "udp/udplayer.h"
|
||||
#include "util/bdrandom.h"
|
||||
#include "util/bdstring.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@ -113,53 +113,45 @@ bool operator<(const struct sockaddr_in &addr, const struct sockaddr_in &addr2)
|
||||
|
||||
std::string printPkt(void *d, int size)
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << "Packet:" << "**********************";
|
||||
std::string out = "Packet:**********************";
|
||||
for(int i = 0; i < size; i++)
|
||||
{
|
||||
if (i % 16 == 0)
|
||||
out << std::endl;
|
||||
out << std::hex << std::setw(2) << (unsigned int) ((unsigned char *) d)[i] << " ";
|
||||
out += "\n";
|
||||
bd_sprintf_append(out, "%2x ", (unsigned int) ((unsigned char *) d)[i]);
|
||||
}
|
||||
out << std::endl << "**********************";
|
||||
out << std::endl;
|
||||
return out.str();
|
||||
out += "\n**********************\n";
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
std::string printPktOffset(unsigned int offset, void *d, unsigned int size)
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << "Packet:" << "**********************";
|
||||
out << std::endl;
|
||||
out << "Offset: " << std::hex << offset << " -> " << offset + size;
|
||||
out << std::endl;
|
||||
out << "Packet:" << "**********************";
|
||||
std::string out = "Packet:**********************\n";
|
||||
bd_sprintf_append(out, "Offset: %x -> %x\n", offset, offset + size);
|
||||
out += "Packet:**********************";
|
||||
|
||||
unsigned int j = offset % 16;
|
||||
if (j != 0)
|
||||
{
|
||||
out << std::endl;
|
||||
out << std::hex << std::setw(6) << (unsigned int) offset - j;
|
||||
out << ": ";
|
||||
out += "\n";
|
||||
bd_sprintf_append(out, "%6x: ", (unsigned int) offset - j);
|
||||
for(unsigned int i = 0; i < j; i++)
|
||||
{
|
||||
out << "xx ";
|
||||
out += "xx ";
|
||||
}
|
||||
}
|
||||
for(unsigned int i = offset; i < offset + size; i++)
|
||||
{
|
||||
if (i % 16 == 0)
|
||||
{
|
||||
out << std::endl;
|
||||
out << std::hex << std::setw(6) << (unsigned int) i;
|
||||
out << ": ";
|
||||
out += "\n";
|
||||
bd_sprintf_append(out, "%6x: ", (unsigned int) i);
|
||||
}
|
||||
out << std::hex << std::setw(2) << (unsigned int) ((unsigned char *) d)[i-offset] << " ";
|
||||
bd_sprintf(out, "%2x ", (unsigned int) ((unsigned char *) d)[i-offset]);
|
||||
}
|
||||
out << std::endl << "**********************";
|
||||
out << std::endl;
|
||||
return out.str();
|
||||
out += "\n**********************\n";
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,9 +24,9 @@
|
||||
*/
|
||||
|
||||
#include "util/bdbloom.h"
|
||||
#include "util/bdstring.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(_WIN32) || defined(__MINGW32__)
|
||||
@ -131,7 +131,6 @@ int bloomFilter::setFilterBits(const std::string &hex)
|
||||
std::string bloomFilter::getFilter()
|
||||
{
|
||||
/* extract filter as a hex string */
|
||||
std::string output;
|
||||
int bytes = (mFilterBits / BITS_PER_BYTE);
|
||||
if (mFilterBits % BITS_PER_BYTE)
|
||||
{
|
||||
@ -155,15 +154,15 @@ std::string bloomFilter::getFilter()
|
||||
}
|
||||
}
|
||||
|
||||
std::ostringstream out;
|
||||
std::string out;
|
||||
for(int i = 0; i < bytes; i++)
|
||||
{
|
||||
out << std::setw(2) << std::setfill('0') << std::hex << (uint32_t) (tmparray)[i];
|
||||
bd_sprintf_append(out, "%02lx", (uint32_t) (tmparray)[i]);
|
||||
}
|
||||
|
||||
free(tmparray);
|
||||
|
||||
return out.str();
|
||||
return out;
|
||||
}
|
||||
|
||||
void bloomFilter::setBit(int bit)
|
||||
|
@ -25,9 +25,9 @@
|
||||
*/
|
||||
|
||||
#include "bdnet.h"
|
||||
#include "bdstring.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -361,11 +361,8 @@ void bdsockaddr_clear(struct sockaddr_in *addr)
|
||||
|
||||
std::string bdnet_inet_ntoa(struct in_addr in)
|
||||
{
|
||||
std::ostringstream str;
|
||||
std::string str;
|
||||
uint8_t *bytes = (uint8_t *) &(in.s_addr);
|
||||
str << (int) bytes[0] << ".";
|
||||
str << (int) bytes[1] << ".";
|
||||
str << (int) bytes[2] << ".";
|
||||
str << (int) bytes[3];
|
||||
return str.str();
|
||||
bd_sprintf(str, "%u.%u.%u.%u", (int) bytes[0], (int) bytes[1], (int) bytes[2], (int) bytes[3]);
|
||||
return str;
|
||||
}
|
||||
|
83
libbitdht/src/util/bdstring.cc
Normal file
83
libbitdht/src/util/bdstring.cc
Normal file
@ -0,0 +1,83 @@
|
||||
/****************************************************************
|
||||
* This file is distributed under the following license:
|
||||
*
|
||||
* Copyright (c) 2012, RetroShare Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#include "bdstring.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <stdarg.h>
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
// asprintf() and vasprintf() are missing in Win32
|
||||
static int vasprintf(char **sptr, const char *fmt, va_list argv)
|
||||
{
|
||||
int wanted = __mingw_vsnprintf(*sptr = NULL, 0, fmt, argv);
|
||||
if ((wanted > 0) && ((*sptr = (char*) malloc(wanted + 1)) != NULL)) {
|
||||
return __mingw_vsprintf(*sptr, fmt, argv);
|
||||
}
|
||||
|
||||
return wanted;
|
||||
}
|
||||
|
||||
//int asprintf(char **sptr, const char *fmt, ...)
|
||||
//{
|
||||
// int retval;
|
||||
// va_list argv;
|
||||
// va_start( argv, fmt );
|
||||
// retval = vasprintf(sptr, fmt, argv);
|
||||
// va_end(argv);
|
||||
// return retval;
|
||||
//}
|
||||
#endif
|
||||
|
||||
int bd_sprintf(std::string &str, const char *fmt, ...)
|
||||
{
|
||||
char *buffer;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
int retval = vasprintf(&buffer, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
str = buffer;
|
||||
free(buffer);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
int bd_sprintf_append(std::string &str, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char *ret;
|
||||
|
||||
va_start(ap, fmt);
|
||||
int retval = vasprintf(&ret, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
str.append(ret);
|
||||
free(ret);
|
||||
|
||||
return retval;
|
||||
}
|
@ -22,6 +22,8 @@
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#include <string>
|
||||
|
||||
#ifdef WIN32
|
||||
// for proper handling of %ll
|
||||
#define bd_snprintf __mingw_snprintf
|
||||
@ -31,5 +33,7 @@
|
||||
#define bd_fprintf fprintf
|
||||
#endif
|
||||
|
||||
int bd_sprintf(std::string &str, const char *fmt, ...);
|
||||
int bd_sprintf_append(std::string &str, const char *fmt, ...);
|
||||
|
||||
#endif
|
||||
|
@ -269,10 +269,7 @@ void p3BitDht::getRelayRates(float &read, float &write, float &relay)
|
||||
|
||||
void convertBdPeerToRsDhtPeer(RsDhtPeer &peer, const bdPeer &int_peer)
|
||||
{
|
||||
std::ostringstream out;
|
||||
bdStdPrintNodeId(out, &(int_peer.mPeerId.id));
|
||||
|
||||
peer.mDhtId = out.str();
|
||||
bdStdPrintNodeId(peer.mDhtId, &(int_peer.mPeerId.id), false);
|
||||
|
||||
rs_sprintf(peer.mAddr, "%s:%u", rs_inet_ntoa(int_peer.mPeerId.addr.sin_addr).c_str(), ntohs(int_peer.mPeerId.addr.sin_port));
|
||||
|
||||
@ -287,10 +284,8 @@ void convertBdPeerToRsDhtPeer(RsDhtPeer &peer, const bdPeer &int_peer)
|
||||
|
||||
void convertDhtPeerDetailsToRsDhtNetPeer(RsDhtNetPeer &status, const DhtPeerDetails &details)
|
||||
{
|
||||
std::ostringstream out;
|
||||
bdStdPrintId(out, &(details.mDhtId));
|
||||
bdStdPrintId(status.mDhtId, &(details.mDhtId), false);
|
||||
|
||||
status.mDhtId = out.str();
|
||||
status.mRsId = details.mRsId;
|
||||
|
||||
status.mPeerType = details.mPeerType;
|
||||
@ -320,9 +315,7 @@ void convertDhtPeerDetailsToRsDhtNetPeer(RsDhtNetPeer &status, const DhtPeerDeta
|
||||
}
|
||||
|
||||
//status.mPeerConnectProxyId = details.mPeerConnectProxyId;
|
||||
std::ostringstream out2;
|
||||
bdStdPrintId(out2, &(details.mPeerConnectProxyId));
|
||||
status.mPeerConnectProxyId = out2.str();
|
||||
bdStdPrintId(status.mPeerConnectProxyId, &(details.mPeerConnectProxyId), false);
|
||||
|
||||
status.mCbPeerMsg = details.mPeerCbMsg;
|
||||
|
||||
|
@ -167,9 +167,8 @@ int p3BitDht::NodeCallback(const bdId *id, uint32_t peerflags)
|
||||
|
||||
int p3BitDht::PeerCallback(const bdId *id, uint32_t status)
|
||||
{
|
||||
//std::ostringstream str;
|
||||
//std::string str;
|
||||
//bdStdPrintNodeId(str, &(id->id));
|
||||
//std::string strId = str.str();
|
||||
|
||||
//std::cerr << "p3BitDht::dhtPeerCallback()";
|
||||
//std::cerr << std::endl;
|
||||
@ -628,9 +627,8 @@ int p3BitDht::ConnectCallback(const bdId *srcId, const bdId *proxyId, const bdId
|
||||
/* if we get here, we are an endpoint (peer specified in peerId) */
|
||||
|
||||
/* translate id into string for exclusive mode */
|
||||
std::ostringstream idstr;
|
||||
bdStdPrintNodeId(idstr, &(peerId.id));
|
||||
std::string pid = idstr.str();
|
||||
std::string pid;
|
||||
bdStdPrintNodeId(pid, &(peerId.id), false);
|
||||
|
||||
switch(cbtype)
|
||||
{
|
||||
@ -1173,9 +1171,8 @@ int p3BitDht::doActions()
|
||||
bool grabbedExclusivePort = false;
|
||||
|
||||
/* translate id into string for exclusive mode */
|
||||
std::ostringstream idstr;
|
||||
bdStdPrintNodeId(idstr, &(action.mDestId.id));
|
||||
std::string pid = idstr.str();
|
||||
std::string pid;
|
||||
bdStdPrintNodeId(pid, &(action.mDestId.id), false);
|
||||
|
||||
|
||||
// Parameters that will be used for the Connect Request.
|
||||
@ -2004,13 +2001,11 @@ int p3BitDht::installRelayConnection(const bdId *srcId, const bdId *destId, uint
|
||||
int relayClass = UDP_RELAY_CLASS_GENERAL;
|
||||
|
||||
#ifdef DEBUG_PEERNET
|
||||
std::ostringstream str;
|
||||
bdStdPrintNodeId(str, &(srcId->id));
|
||||
std::string strId1 = str.str();
|
||||
std::string strId1;
|
||||
bdStdPrintNodeId(strId1, &(srcId->id), false);
|
||||
|
||||
str.clear();
|
||||
bdStdPrintNodeId(str, &(destId->id));
|
||||
std::string strId2 = str.str();
|
||||
std::string strId2;
|
||||
bdStdPrintNodeId(strId2, &(destId->id), false);
|
||||
#endif
|
||||
|
||||
/* grab a socket */
|
||||
@ -2334,9 +2329,8 @@ void p3BitDht::ReleaseProxyExclusiveMode_locked(DhtPeerDetails *dpd, bool addrCh
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* translate id into string for exclusive mode */
|
||||
std::ostringstream idstr;
|
||||
bdStdPrintNodeId(idstr, &(dpd->mDhtId.id));
|
||||
std::string pid = idstr.str();
|
||||
std::string pid;
|
||||
bdStdPrintNodeId(pid, &(dpd->mDhtId.id), false);
|
||||
|
||||
|
||||
if (dpd->mExclusiveProxyLock)
|
||||
|
@ -207,7 +207,7 @@ bool ConvertUtf16ToUtf8(const std::wstring& source, std::string& dest)
|
||||
|
||||
#ifdef WINDOWS_SYS
|
||||
// asprintf() and vasprintf() are missing in Win32
|
||||
int vasprintf(char **sptr, const char *fmt, va_list argv)
|
||||
static int vasprintf(char **sptr, const char *fmt, va_list argv)
|
||||
{
|
||||
int wanted = __mingw_vsnprintf(*sptr = NULL, 0, fmt, argv);
|
||||
if ((wanted > 0) && ((*sptr = (char*) malloc(wanted + 1)) != NULL)) {
|
||||
@ -217,7 +217,7 @@ int vasprintf(char **sptr, const char *fmt, va_list argv)
|
||||
return wanted;
|
||||
}
|
||||
|
||||
//int asprintf(char **sptr, const char *fmt, ...)
|
||||
//static int asprintf(char **sptr, const char *fmt, ...)
|
||||
//{
|
||||
// int retval;
|
||||
// va_list argv;
|
||||
|
Loading…
Reference in New Issue
Block a user