Skip to content

Commit

Permalink
Merge pull request #7 from mikhail4021/master
Browse files Browse the repository at this point in the history
compilation errors solved
  • Loading branch information
orignal committed Jan 9, 2014
2 parents fd84226 + a34e0cd commit 6bbf34a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
14 changes: 11 additions & 3 deletions Identity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,17 @@ namespace data
memcpy (buf, (const uint8_t *)ident, 32);
time_t t = time (nullptr);
struct tm tm;
gmtime_r (&t, &tm);
sprintf ((char *)(buf + 32),"%4i%2i%2i", tm.tm_year, tm.tm_mon, tm.tm_mday);

// WARNING!!! check if it is correct
#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;
CryptoPP::SHA256().CalculateDigest(key.hash, buf, 40);
return key;
Expand Down
1 change: 1 addition & 0 deletions LeaseSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "CryptoConst.h"
#include "Log.h"
#include "LeaseSet.h"
#include "I2PEndian.h"

namespace i2p
{
Expand Down
2 changes: 1 addition & 1 deletion NetDb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ namespace data
{
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;
numRouters++;
}
Expand Down
2 changes: 1 addition & 1 deletion TunnelGateway.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ namespace tunnel
CryptoPP::SHA256().CalculateDigest (hash, payload, size+16);
memcpy (buf+20, hash, 4); // checksum
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)
memset (buf + 24, 1, paddingSize); // padding TODO: fill with random data

Expand Down

0 comments on commit 6bbf34a

Please sign in to comment.