1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00

use std::string for integers because i am tired of fixing formatting strings

This commit is contained in:
Jeff Becker 2019-02-20 07:09:00 -05:00
parent 6435951e86
commit be30516986
No known key found for this signature in database
GPG key ID: F357B3B42F6F9B05

View file

@ -73,18 +73,10 @@ bencode_write_bytestring(llarp_buffer_t* buff, const void* data, size_t sz)
bool
bencode_write_uint64(llarp_buffer_t* buff, uint64_t i)
{
#ifndef __LP64__
if(!buff->writef("i%llu", i))
#else
if(!buff->write("i%lu", i))
#endif
{
return false;
}
static const char letter[1] = {'e'};
assert(std::distance(std::begin(letter), std::end(letter)) == 1);
return buff->write(std::begin(letter), std::end(letter));
std::string str = "i";
str += std::to_string(i);
str += "e";
return buff->write(str.begin(), str.end());
}
bool