mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 08:00:38 +03:00
Merge pull request #7 from mikhail4021/master
compilation errors solved
This commit is contained in:
commit
6bbf34a21c
14
Identity.cpp
14
Identity.cpp
@ -52,9 +52,17 @@ namespace data
|
|||||||
memcpy (buf, (const uint8_t *)ident, 32);
|
memcpy (buf, (const uint8_t *)ident, 32);
|
||||||
time_t t = time (nullptr);
|
time_t t = time (nullptr);
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
gmtime_r (&t, &tm);
|
// WARNING!!! check if it is correct
|
||||||
sprintf ((char *)(buf + 32),"%4i%2i%2i", tm.tm_year, tm.tm_mon, tm.tm_mday);
|
#ifdef _WIN32
|
||||||
|
gmtime_s(&tm, &t);
|
||||||
|
// тут возвращается какое-то значение sprintf'ом. может стоит его проверять?
|
||||||
|
// http://msdn.microsoft.com/en-us/library/ce3zzk1k.aspx
|
||||||
|
sprintf_s((char *)(buf + 32), 9, "%4i%2i%2i", tm.tm_year, tm.tm_mon, tm.tm_mday);
|
||||||
|
#else
|
||||||
|
gmtime_r(&t, &tm);
|
||||||
|
// тут возвращается какое-то значение sprintf'ом. может стоит его проверять?
|
||||||
|
sprintf((char *)(buf + 32), "%4i%2i%2i", tm.tm_year, tm.tm_mon, tm.tm_mday);
|
||||||
|
#endif
|
||||||
RoutingKey key;
|
RoutingKey key;
|
||||||
CryptoPP::SHA256().CalculateDigest(key.hash, buf, 40);
|
CryptoPP::SHA256().CalculateDigest(key.hash, buf, 40);
|
||||||
return key;
|
return key;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include "CryptoConst.h"
|
#include "CryptoConst.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "LeaseSet.h"
|
#include "LeaseSet.h"
|
||||||
|
#include "I2PEndian.h"
|
||||||
|
|
||||||
namespace i2p
|
namespace i2p
|
||||||
{
|
{
|
||||||
|
@ -169,7 +169,7 @@ namespace data
|
|||||||
{
|
{
|
||||||
for (boost::filesystem::directory_iterator it1 (it->path ()); it1 != end; ++it1)
|
for (boost::filesystem::directory_iterator it1 (it->path ()); it1 != end; ++it1)
|
||||||
{
|
{
|
||||||
RouterInfo * r = new RouterInfo (it1->path ().c_str ()); // FIXME!!! path::value_type != char in boost 1_55 on Windows. How to solve?
|
RouterInfo * r = new RouterInfo (it1->path().string().c_str ());
|
||||||
m_RouterInfos[r->GetIdentHash ()] = r;
|
m_RouterInfos[r->GetIdentHash ()] = r;
|
||||||
numRouters++;
|
numRouters++;
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ namespace tunnel
|
|||||||
CryptoPP::SHA256().CalculateDigest (hash, payload, size+16);
|
CryptoPP::SHA256().CalculateDigest (hash, payload, size+16);
|
||||||
memcpy (buf+20, hash, 4); // checksum
|
memcpy (buf+20, hash, 4); // checksum
|
||||||
payload[-1] = 0; // zero
|
payload[-1] = 0; // zero
|
||||||
ssize_t paddingSize = payload - buf - 25; // 25 = 24 + 1
|
ptrdiff_t paddingSize = payload - buf - 25; // 25 = 24 + 1
|
||||||
if (paddingSize > 0)
|
if (paddingSize > 0)
|
||||||
memset (buf + 24, 1, paddingSize); // padding TODO: fill with random data
|
memset (buf + 24, 1, paddingSize); // padding TODO: fill with random data
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user