Skip to content

Commit 26923f4

Browse files
committed
Fix errors that will surface due to header reordering in the next commit
1 parent d7b4e73 commit 26923f4

File tree

5 files changed

+21
-19
lines changed

5 files changed

+21
-19
lines changed

crypto/block/block-binlog.h

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@
1717
Copyright 2017-2020 Telegram Systems LLP
1818
*/
1919
#pragma once
20-
#include "td/utils/int_types.h"
21-
#include "ton/ton-types.h"
2220

2321
#include <ctime>
2422

23+
#include "td/utils/as.h"
24+
#include "ton/ton-types.h"
25+
2526
namespace block {
2627

2728
namespace log {
@@ -35,9 +36,9 @@ struct Start {
3536
unsigned type_field;
3637
unsigned created_at;
3738
unsigned char zerostate_root_hash[32];
38-
Start(const RootHash& hash, unsigned _now = 0)
39+
Start(const ton::RootHash& hash, unsigned _now = 0)
3940
: tag_field(tag), type_field(log_type), created_at(_now ? _now : (unsigned)std::time(nullptr)) {
40-
td::as<RootHash>(zerostate_root_hash) = hash;
41+
td::as<ton::RootHash>(zerostate_root_hash) = hash;
4142
}
4243
};
4344

@@ -48,10 +49,10 @@ struct SetZeroState {
4849
long long file_size;
4950
unsigned char file_hash[32];
5051
unsigned char root_hash[32];
51-
SetZeroState(const RootHash& rhash, const FileHash& fhash, unsigned long long _fsize, unsigned _flags = 0)
52+
SetZeroState(const ton::RootHash& rhash, const ton::FileHash& fhash, unsigned long long _fsize, unsigned _flags = 0)
5253
: tag_field(tag), flags(_flags), file_size(_fsize) {
53-
td::as<FileHash>(file_hash) = fhash;
54-
td::as<RootHash>(root_hash) = rhash;
54+
td::as<ton::FileHash>(file_hash) = fhash;
55+
td::as<ton::RootHash>(root_hash) = rhash;
5556
}
5657
};
5758

@@ -66,16 +67,16 @@ struct NewBlock {
6667
unsigned char file_hash[32];
6768
unsigned char root_hash[32];
6869
unsigned char last_bytes[8];
69-
NewBlock(const ton::BlockId& block, const RootHash& rhash, const FileHash& fhash, unsigned long long _fsize,
70+
NewBlock(const ton::BlockId& block, const ton::RootHash& rhash, const ton::FileHash& fhash, unsigned long long _fsize,
7071
unsigned _flags)
7172
: tag_field(tag)
7273
, flags(_flags)
7374
, workchain(block.workchain)
7475
, seqno(block.seqno)
7576
, shard(block.shard)
7677
, file_size(_fsize) {
77-
td::as<FileHash>(file_hash) = fhash;
78-
td::as<RootHash>(root_hash) = rhash;
78+
td::as<ton::FileHash>(file_hash) = fhash;
79+
td::as<ton::RootHash>(root_hash) = rhash;
7980
td::as<unsigned long long>(last_bytes) = 0;
8081
}
8182
};
@@ -91,16 +92,16 @@ struct NewState {
9192
unsigned char file_hash[32];
9293
unsigned char root_hash[32];
9394
unsigned char last_bytes[8];
94-
NewState(const ton::BlockId& state, const RootHash& rhash, const FileHash& fhash, unsigned long long _fsize,
95+
NewState(const ton::BlockId& state, const ton::RootHash& rhash, const ton::FileHash& fhash, unsigned long long _fsize,
9596
unsigned _flags)
9697
: tag_field(tag)
9798
, flags(_flags)
9899
, workchain(state.workchain)
99100
, seqno(state.seqno)
100101
, shard(state.shard)
101102
, file_size(_fsize) {
102-
td::as<FileHash>(file_hash) = fhash;
103-
td::as<RootHash>(root_hash) = rhash;
103+
td::as<ton::FileHash>(file_hash) = fhash;
104+
td::as<ton::RootHash>(root_hash) = rhash;
104105
td::as<unsigned long long>(last_bytes) = 0;
105106
}
106107
};

crypto/common/AtomicRef.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@
1818
*/
1919
#pragma once
2020

21-
#include "td/utils/SpinLock.h"
22-
#include "common/refcnt.hpp"
23-
21+
#include <limits>
2422
#include <type_traits>
2523

24+
#include "common/refcnt.hpp"
25+
#include "td/utils/SpinLock.h"
26+
2627
namespace td {
2728
template <class T>
2829
class AtomicRefSpinlock {

crypto/common/util.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ std::size_t buff_base64_decode(td::MutableSlice buffer, td::Slice encoded, bool
163163
return wptr - (unsigned char *)buffer.data();
164164
}
165165

166-
td::BufferSlice base64_decode(td::Slice encoded, bool allow_base64_url) {
166+
td::BufferSlice base64_decode_to_buffer_slice(td::Slice encoded, bool allow_base64_url) {
167167
auto s = decoded_base64_size(encoded, allow_base64_url);
168168
if (s <= 0) {
169169
return td::BufferSlice{};

crypto/common/util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ bool is_valid_base64(td::Slice encoded, bool allow_base64_url = true);
3434
td::int32 decoded_base64_size(td::Slice encoded, bool allow_base64_url = true);
3535

3636
std::size_t buff_base64_decode(td::MutableSlice buffer, td::Slice data, bool allow_base64_url = true);
37-
td::BufferSlice base64_decode(td::Slice encoded, bool allow_base64_url = true);
37+
td::BufferSlice base64_decode_to_buffer_slice(td::Slice encoded, bool allow_base64_url = true);
3838
std::string str_base64_decode(td::Slice encoded, bool allow_base64_url = true);
3939

4040
//TODO: move it somewhere else

dht/utils/dht-resolve.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class Resolver : public td::actor::Actor {
149149
};
150150

151151
td::Result<td::Bits256> parse_bits256(td::Slice s) {
152-
td::BufferSlice str = td::base64_decode(s, true);
152+
td::BufferSlice str = td::base64_decode_to_buffer_slice(s, true);
153153
if (str.size() != 32) {
154154
return td::Status::Error("Invalid bits256");
155155
}

0 commit comments

Comments
 (0)