From 8b4928d280881b175c7e752d9f29f4d04330fd8b Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Mon, 16 Aug 2004 21:55:31 +0000 Subject: [PATCH] *** empty log message *** --- include/libtorrent/peer_id.hpp | 6 ++++-- src/identify_client.cpp | 2 ++ src/sha1.cpp | 15 +++++++++++---- src/stat.cpp | 4 ++++ src/storage.cpp | 1 + 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/include/libtorrent/peer_id.hpp b/include/libtorrent/peer_id.hpp index d4ae6aa07..792120478 100755 --- a/include/libtorrent/peer_id.hpp +++ b/include/libtorrent/peer_id.hpp @@ -124,13 +124,15 @@ namespace libtorrent inline std::istream& operator>>(std::istream& is, big_number& peer) { + using namespace std; + for (big_number::iterator i = peer.begin(); i != peer.end(); ++i) { char c[2]; is >> c[0] >> c[1]; - *i = ((std::isdigit(c[0])?c[0]-'0':c[0]-'a'+10) << 4) - + (std::isdigit(c[1])?c[1]-'0':c[1]-'a'+10); + *i = ((isdigit(c[0])?c[0]-'0':c[0]-'a'+10) << 4) + + (isdigit(c[1])?c[1]-'0':c[1]-'a'+10); } return is; } diff --git a/src/identify_client.cpp b/src/identify_client.cpp index 745d133f9..eb5658d88 100755 --- a/src/identify_client.cpp +++ b/src/identify_client.cpp @@ -50,6 +50,8 @@ namespace std { using ::isprint; using ::isdigit; + using ::toupper; + using ::isalnum; } #endif diff --git a/src/sha1.cpp b/src/sha1.cpp index 869d31510..2309eb06e 100755 --- a/src/sha1.cpp +++ b/src/sha1.cpp @@ -19,6 +19,10 @@ changelog at the end of the file. #include +#if defined _MSC_VER && _MSC_VER < 1300 +#define for if (false) {} else for +#endif + struct SHA1_CTX { boost::uint32_t state[5]; @@ -74,12 +78,13 @@ namespace template void SHA1Transform(boost::uint32_t state[5], boost::uint8_t const buffer[64]) { + using namespace std; boost::uint32_t a, b, c, d, e; CHAR64LONG16* block; boost::uint8_t workspace[64]; block = (CHAR64LONG16*)workspace; - std::memcpy(block, buffer, 64); + memcpy(block, buffer, 64); // Copy context->state[] to working vars a = state[0]; @@ -120,7 +125,8 @@ namespace 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] , context->state[0], context->state[1] , context->state[2], context->state[3] @@ -130,6 +136,7 @@ namespace template void internal_update(SHA1_CTX* context, boost::uint8_t const* data, boost::uint32_t len) { + using namespace std; boost::uint32_t i, j; // JHB #ifdef VERBOSE @@ -140,7 +147,7 @@ namespace context->count[1] += (len >> 29); if ((j + len) > 63) { - std::memcpy(&context->buffer[j], data, (i = 64-j)); + memcpy(&context->buffer[j], data, (i = 64-j)); SHA1Transform(context->state, context->buffer); for ( ; i + 63 < len; i += 64) { @@ -152,7 +159,7 @@ namespace { i = 0; } - std::memcpy(&context->buffer[j], &data[i], len - i); + memcpy(&context->buffer[j], &data[i], len - i); #ifdef VERBOSE SHAPrintContext(context, "after "); #endif diff --git a/src/stat.cpp b/src/stat.cpp index 83f9de655..55417e206 100755 --- a/src/stat.cpp +++ b/src/stat.cpp @@ -41,6 +41,10 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/invariant_check.hpp" #include +#if defined _MSC_VER && _MSC_VER <= 1200 +#define for if (false) {} else for +#endif + using namespace libtorrent; void libtorrent::stat::second_tick() diff --git a/src/storage.cpp b/src/storage.cpp index 724f883a6..989e26958 100755 --- a/src/storage.cpp +++ b/src/storage.cpp @@ -66,6 +66,7 @@ POSSIBILITY OF SUCH DAMAGE. namespace std { using ::srand; + using ::rename; } #endif