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

pull/320/head
Jeff Becker 6 years ago
parent 6435951e86
commit be30516986
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -73,18 +73,10 @@ bencode_write_bytestring(llarp_buffer_t* buff, const void* data, size_t sz)
bool bool
bencode_write_uint64(llarp_buffer_t* buff, uint64_t i) bencode_write_uint64(llarp_buffer_t* buff, uint64_t i)
{ {
#ifndef __LP64__ std::string str = "i";
if(!buff->writef("i%llu", i)) str += std::to_string(i);
#else str += "e";
if(!buff->write("i%lu", i)) return buff->write(str.begin(), str.end());
#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));
} }
bool bool

Loading…
Cancel
Save