*** empty log message ***

This commit is contained in:
Arvid Norberg 2004-08-16 21:55:31 +00:00
parent bb25ef1cb6
commit 8b4928d280
5 changed files with 22 additions and 6 deletions

View File

@ -124,13 +124,15 @@ namespace libtorrent
inline std::istream& operator>>(std::istream& is, big_number& peer) inline std::istream& operator>>(std::istream& is, big_number& peer)
{ {
using namespace std;
for (big_number::iterator i = peer.begin(); for (big_number::iterator i = peer.begin();
i != peer.end(); ++i) i != peer.end(); ++i)
{ {
char c[2]; char c[2];
is >> c[0] >> c[1]; is >> c[0] >> c[1];
*i = ((std::isdigit(c[0])?c[0]-'0':c[0]-'a'+10) << 4) *i = ((isdigit(c[0])?c[0]-'0':c[0]-'a'+10) << 4)
+ (std::isdigit(c[1])?c[1]-'0':c[1]-'a'+10); + (isdigit(c[1])?c[1]-'0':c[1]-'a'+10);
} }
return is; return is;
} }

View File

@ -50,6 +50,8 @@ namespace std
{ {
using ::isprint; using ::isprint;
using ::isdigit; using ::isdigit;
using ::toupper;
using ::isalnum;
} }
#endif #endif

View File

@ -19,6 +19,10 @@ changelog at the end of the file.
#include <boost/cstdint.hpp> #include <boost/cstdint.hpp>
#if defined _MSC_VER && _MSC_VER < 1300
#define for if (false) {} else for
#endif
struct SHA1_CTX struct SHA1_CTX
{ {
boost::uint32_t state[5]; boost::uint32_t state[5];
@ -74,12 +78,13 @@ namespace
template <class BlkFun> template <class BlkFun>
void SHA1Transform(boost::uint32_t state[5], boost::uint8_t const buffer[64]) void SHA1Transform(boost::uint32_t state[5], boost::uint8_t const buffer[64])
{ {
using namespace std;
boost::uint32_t a, b, c, d, e; boost::uint32_t a, b, c, d, e;
CHAR64LONG16* block; CHAR64LONG16* block;
boost::uint8_t workspace[64]; boost::uint8_t workspace[64];
block = (CHAR64LONG16*)workspace; block = (CHAR64LONG16*)workspace;
std::memcpy(block, buffer, 64); memcpy(block, buffer, 64);
// Copy context->state[] to working vars // Copy context->state[] to working vars
a = state[0]; a = state[0];
@ -120,7 +125,8 @@ namespace
void SHAPrintContext(SHA1_CTX *context, char *msg) void SHAPrintContext(SHA1_CTX *context, char *msg)
{ {
std::printf("%s (%d,%d) %x %x %x %x %x\n" using namespace std;
printf("%s (%d,%d) %x %x %x %x %x\n"
, msg, context->count[0], context->count[1] , msg, context->count[0], context->count[1]
, context->state[0], context->state[1] , context->state[0], context->state[1]
, context->state[2], context->state[3] , context->state[2], context->state[3]
@ -130,6 +136,7 @@ namespace
template <class BlkFun> template <class BlkFun>
void internal_update(SHA1_CTX* context, boost::uint8_t const* data, boost::uint32_t len) void internal_update(SHA1_CTX* context, boost::uint8_t const* data, boost::uint32_t len)
{ {
using namespace std;
boost::uint32_t i, j; // JHB boost::uint32_t i, j; // JHB
#ifdef VERBOSE #ifdef VERBOSE
@ -140,7 +147,7 @@ namespace
context->count[1] += (len >> 29); context->count[1] += (len >> 29);
if ((j + len) > 63) if ((j + len) > 63)
{ {
std::memcpy(&context->buffer[j], data, (i = 64-j)); memcpy(&context->buffer[j], data, (i = 64-j));
SHA1Transform<BlkFun>(context->state, context->buffer); SHA1Transform<BlkFun>(context->state, context->buffer);
for ( ; i + 63 < len; i += 64) for ( ; i + 63 < len; i += 64)
{ {
@ -152,7 +159,7 @@ namespace
{ {
i = 0; i = 0;
} }
std::memcpy(&context->buffer[j], &data[i], len - i); memcpy(&context->buffer[j], &data[i], len - i);
#ifdef VERBOSE #ifdef VERBOSE
SHAPrintContext(context, "after "); SHAPrintContext(context, "after ");
#endif #endif

View File

@ -41,6 +41,10 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/invariant_check.hpp" #include "libtorrent/invariant_check.hpp"
#include <algorithm> #include <algorithm>
#if defined _MSC_VER && _MSC_VER <= 1200
#define for if (false) {} else for
#endif
using namespace libtorrent; using namespace libtorrent;
void libtorrent::stat::second_tick() void libtorrent::stat::second_tick()

View File

@ -66,6 +66,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace std namespace std
{ {
using ::srand; using ::srand;
using ::rename;
} }
#endif #endif