Skip to content

Commit 007fcf9

Browse files
committed
update
1 parent f3d32f1 commit 007fcf9

File tree

13 files changed

+43
-43
lines changed

13 files changed

+43
-43
lines changed

include/veriblock/pop/blockchain/blockchain_util.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ bool recoverEndorsements(ProtectedBlockTree& ed_,
6868
}
6969

7070
auto* endorsed = ed_.getBlockIndex(e.endorsedHash);
71-
if (!endorsed) {
71+
if (endorsed == nullptr) {
7272
return state.Invalid(
7373
"no-endorsed",
7474
format("Can not find endorsed block in {}", e.toPrettyString()));
@@ -89,7 +89,7 @@ bool recoverEndorsements(ProtectedBlockTree& ed_,
8989
}
9090

9191
auto* blockOfProof = as_mut(ing).getBlockIndex(e.blockOfProof);
92-
if (!blockOfProof) {
92+
if (blockOfProof == nullptr) {
9393
return state.Invalid(
9494
"bad-blockofproof",
9595
format("Block Of Proof {} does not exist in SP chain",
@@ -107,8 +107,8 @@ bool recoverEndorsements(ProtectedBlockTree& ed_,
107107
"same endorsement is added to endorsedBy second time");
108108
bool isDirty = endorsed->isDirty();
109109
endorsed->insertEndorsedBy(endorsement);
110-
// keep dirty flag since recoverEndorsements is used when loading blocks from storage
111-
// and should not affect dirtyness of the blocks
110+
// keep dirty flag since recoverEndorsements is used when loading blocks
111+
// from storage and should not affect dirtyness of the blocks
112112
if (!isDirty) {
113113
endorsed->unsetDirty();
114114
}

include/veriblock/pop/blockchain/chain.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ typename C::index_t* findFork(const C& chain,
151151
if (pindex->getHeight() > lastHeight) {
152152
pindex = pindex->getAncestor(lastHeight);
153153
}
154-
while (pindex && !chain.contains(pindex)) {
154+
while (pindex != nullptr && !chain.contains(pindex)) {
155155
pindex = pindex->getPrev();
156156
}
157157
return const_cast<typename C::index_t*>(pindex);
@@ -164,7 +164,7 @@ const index_t* findBlockContainingEndorsement(
164164
const index_t* workBlock,
165165
const typename index_t::endorsement_t::id_t& id,
166166
const uint32_t& window) {
167-
for (uint32_t count = 0; count < window && workBlock &&
167+
for (uint32_t count = 0; count < window && workBlock != nullptr &&
168168
workBlock->getHeight() >= chain.getStartHeight();
169169
count++) {
170170
if (workBlock->getContainingEndorsements().count(id)) {

include/veriblock/pop/blockchain/commands/addendorsement.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ struct AddEndorsement : public Command {
3636

3737
bool Execute(ValidationState& state) noexcept override {
3838
auto* containing = ed_->getBlockIndex(e_->containingHash);
39-
if (!containing) {
39+
if (containing == nullptr) {
4040
return state.Invalid(
4141
protected_block_t::name() + "-no-containing",
4242
format("Can not find containing block in endorsement={}",
4343
e_->toPrettyString()));
4444
}
4545

4646
auto* endorsed = ed_->getBlockIndex(e_->endorsedHash);
47-
if (!endorsed) {
47+
if (endorsed == nullptr) {
4848
return state.Invalid(protected_block_t::name() + "-no-endorsed-block",
4949
format("Endorsed block={} not found in the tree",
5050
HexStr(e_->endorsedHash)));
@@ -67,7 +67,7 @@ struct AddEndorsement : public Command {
6767
}
6868

6969
auto* blockOfProof = ing_->getBlockIndex(e_->blockOfProof);
70-
if (!blockOfProof) {
70+
if (blockOfProof == nullptr) {
7171
return state.Invalid(
7272
protected_block_t::name() + "-block-of-proof-not-found",
7373
format("Can not find block of proof in SP Chain ({})",

include/veriblock/pop/third_party/fmt/core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,7 @@ template <typename Context> struct arg_mapper {
12031203
// a pointer cast it to "void *" or "const void *". In particular, this
12041204
// forbids formatting of "[const] volatile char *" which is printed as bool
12051205
// by iostreams.
1206-
static_assert(!sizeof(T), "formatting of non-void pointers is disallowed");
1206+
static_assert(sizeof(T) != 0, "formatting of non-void pointers is disallowed");
12071207
return 0;
12081208
}
12091209

include/veriblock/pop/third_party/fmt/format-inl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2362,7 +2362,7 @@ void fallback_format(Double d, int num_digits, bool binary32, buffer<char>& buf,
23622362
// Invariant: value == (numerator / denominator) * pow(10, exp10).
23632363
if (num_digits < 0) {
23642364
// Generate the shortest representation.
2365-
if (!upper) upper = &lower;
2365+
if (upper == nullptr) upper = &lower;
23662366
bool even = (value.f & 1) == 0;
23672367
num_digits = 0;
23682368
char* data = buf.data();

include/veriblock/pop/third_party/fmt/format.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ FMT_CONSTEXPR bool is_supported_floating_point(T) {
808808
// represent all values of an integral type T.
809809
template <typename T>
810810
using uint32_or_64_or_128_t =
811-
conditional_t<num_bits<T>() <= 32 && !FMT_REDUCE_INT_INSTANTIATIONS,
811+
conditional_t<num_bits<T>() <= 32 && FMT_REDUCE_INT_INSTANTIATIONS == 0,
812812
uint32_t,
813813
conditional_t<num_bits<T>() <= 64, uint64_t, uint128_t>>;
814814

@@ -1411,8 +1411,8 @@ FMT_CONSTEXPR float_specs parse_float_type_spec(
14111411
template <typename Char, typename Handler>
14121412
FMT_CONSTEXPR void handle_char_specs(const basic_format_specs<Char>* specs,
14131413
Handler&& handler) {
1414-
if (!specs) return handler.on_char();
1415-
if (specs->type && specs->type != 'c') return handler.on_int();
1414+
if (specs == nullptr) return handler.on_char();
1415+
if (specs->type != 0 && specs->type != 'c') return handler.on_int();
14161416
if (specs->align == align::numeric || specs->sign != sign::none || specs->alt)
14171417
handler.on_error("invalid format specifier for char");
14181418
handler.on_char();
@@ -1665,7 +1665,7 @@ template <typename OutputIt, typename Char, typename UInt> struct int_writer {
16651665
std::string groups = grouping<Char>(locale);
16661666
if (groups.empty()) return on_dec();
16671667
auto sep = thousands_sep<Char>(locale);
1668-
if (!sep) return on_dec();
1668+
if (sep == 0) return on_dec();
16691669
int num_digits = count_digits(abs_value);
16701670
int size = num_digits, n = num_digits;
16711671
std::string::const_iterator group = groups.cbegin();
@@ -1762,7 +1762,7 @@ template <typename Char, typename UInt,
17621762
inline Char* write_significand(Char* out, UInt significand,
17631763
int significand_size, int integral_size,
17641764
Char decimal_point) {
1765-
if (!decimal_point)
1765+
if (decimal_point == 0)
17661766
return format_decimal(out, significand, significand_size).end;
17671767
auto end = format_decimal(out + 1, significand, significand_size).end;
17681768
if (integral_size == 1)
@@ -1790,7 +1790,7 @@ inline OutputIt write_significand(OutputIt out, const char* significand,
17901790
int significand_size, int integral_size,
17911791
Char decimal_point) {
17921792
out = detail::copy_str<Char>(significand, significand + integral_size, out);
1793-
if (!decimal_point) return out;
1793+
if (decimal_point == 0) return out;
17941794
*out++ = decimal_point;
17951795
return detail::copy_str<Char>(significand + integral_size,
17961796
significand + significand_size, out);
@@ -1910,7 +1910,7 @@ OutputIt write(OutputIt out, T value, basic_format_specs<Char> specs,
19101910
if (!std::isfinite(value))
19111911
return write_nonfinite(out, std::isinf(value), specs, fspecs);
19121912

1913-
if (specs.align == align::numeric && fspecs.sign) {
1913+
if (specs.align == align::numeric && fspecs.sign != 0) {
19141914
auto it = reserve(out, 1);
19151915
*it++ = static_cast<Char>(data::signs[fspecs.sign]);
19161916
out = base_iterator(out, it);
@@ -1924,7 +1924,7 @@ OutputIt write(OutputIt out, T value, basic_format_specs<Char> specs,
19241924
snprintf_float(promote_float(value), specs.precision, fspecs, buffer);
19251925
return write_bytes(out, {buffer.data(), buffer.size()}, specs);
19261926
}
1927-
int precision = specs.precision >= 0 || !specs.type ? specs.precision : 6;
1927+
int precision = specs.precision >= 0 || specs.type == 0 ? specs.precision : 6;
19281928
if (fspecs.format == float_format::exp) {
19291929
if (precision == max_value<int>())
19301930
FMT_THROW(format_error("number is too big"));
@@ -2066,7 +2066,7 @@ OutputIt write(OutputIt out, Char value) {
20662066

20672067
template <typename Char, typename OutputIt>
20682068
OutputIt write(OutputIt out, const Char* value) {
2069-
if (!value) {
2069+
if (value == nullptr) {
20702070
FMT_THROW(format_error("string pointer is null"));
20712071
} else {
20722072
auto length = std::char_traits<Char>::length(value);
@@ -2225,7 +2225,7 @@ class arg_formatter_base {
22252225
}
22262226

22272227
void write(const Char* value) {
2228-
if (!value) {
2228+
if (value == nullptr) {
22292229
FMT_THROW(format_error("string pointer is null"));
22302230
} else {
22312231
auto length = std::char_traits<char_type>::length(value);
@@ -2259,7 +2259,7 @@ class arg_formatter_base {
22592259
}
22602260

22612261
iterator operator()(bool value) {
2262-
if (specs_ && specs_->type) return (*this)(value ? 1 : 0);
2262+
if (specs_ != nullptr && specs_->type != 0) return (*this)(value ? 1 : 0);
22632263
write(value != 0);
22642264
return out_;
22652265
}
@@ -2275,7 +2275,7 @@ class arg_formatter_base {
22752275
}
22762276

22772277
iterator operator()(const Char* value) {
2278-
if (!specs_) return write(value), out_;
2278+
if (specs_ == nullptr) return write(value), out_;
22792279
handle_cstring_type_spec(specs_->type, cstring_spec_handler(*this, value));
22802280
return out_;
22812281
}
@@ -2773,7 +2773,7 @@ FMT_CONSTEXPR int code_point_length(const Char* begin) {
27732773
// Compute the pointer to the next character early so that the next
27742774
// iteration can start working on the next character. Neither Clang
27752775
// nor GCC figure out this reordering on their own.
2776-
return len + !len;
2776+
return len + (int)(len == 0);
27772777
}
27782778

27792779
template <typename Char> constexpr bool is_ascii_letter(Char c) {

include/veriblock/pop/third_party/fmt/printf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ class printf_arg_formatter : public detail::arg_formatter_base<OutputIt, Char> {
251251
this->write(value != 0);
252252
} else if (std::is_same<T, char_type>::value) {
253253
format_specs& fmt_specs = *this->specs();
254-
if (fmt_specs.type && fmt_specs.type != 'c')
254+
if (fmt_specs.type != 0 && fmt_specs.type != 'c')
255255
return (*this)(static_cast<int>(value));
256256
fmt_specs.sign = sign::none;
257257
fmt_specs.alt = false;

include/veriblock/pop/third_party/thread_pool/fixed_function.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class FixedFunction<R(ARGS...), STORAGE_SIZE>
109109
*/
110110
R operator()(ARGS... args)
111111
{
112-
if(!m_method_ptr) throw std::runtime_error("call of empty functor");
112+
if(m_method_ptr == nullptr) throw std::runtime_error("call of empty functor");
113113
return m_method_ptr(&m_storage, m_function_ptr, args...);
114114
}
115115

src/pop/third_party/secp256k1/ecdsa_impl.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ static int secp256k1_der_parse_integer(secp256k1_scalar *r, const unsigned char
141141
if (rlen > 32) {
142142
overflow = 1;
143143
}
144-
if (!overflow) {
144+
if (overflow == 0) {
145145
memcpy(ra + 32 - rlen, *sig, rlen);
146146
secp256k1_scalar_set_b32(r, ra, &overflow);
147147
}
@@ -167,10 +167,10 @@ static int secp256k1_ecdsa_sig_parse(secp256k1_scalar *rr, secp256k1_scalar *rs,
167167
return 0;
168168
}
169169

170-
if (!secp256k1_der_parse_integer(rr, &sig, sigend)) {
170+
if (secp256k1_der_parse_integer(rr, &sig, sigend) == 0) {
171171
return 0;
172172
}
173-
if (!secp256k1_der_parse_integer(rs, &sig, sigend)) {
173+
if (secp256k1_der_parse_integer(rs, &sig, sigend) == 0) {
174174
return 0;
175175
}
176176

@@ -215,7 +215,7 @@ static int secp256k1_ecdsa_sig_verify(const secp256k1_ecmult_context *ctx, const
215215
secp256k1_gej pubkeyj;
216216
secp256k1_gej pr;
217217

218-
if (secp256k1_scalar_is_zero(sigr) || secp256k1_scalar_is_zero(sigs)) {
218+
if (secp256k1_scalar_is_zero(sigr) != 0 || secp256k1_scalar_is_zero(sigs) != 0) {
219219
return 0;
220220
}
221221

src/pop/third_party/secp256k1/eckey_impl.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ namespace altintegration {
1919
static int secp256k1_eckey_pubkey_parse(secp256k1_ge *elem, const unsigned char *pub, size_t size) {
2020
if (size == 33 && (pub[0] == SECP256K1_TAG_PUBKEY_EVEN || pub[0] == SECP256K1_TAG_PUBKEY_ODD)) {
2121
secp256k1_fe x;
22-
return secp256k1_fe_set_b32(&x, pub+1) && secp256k1_ge_set_xo_var(elem, &x, pub[0] == SECP256K1_TAG_PUBKEY_ODD);
22+
return secp256k1_fe_set_b32(&x, pub+1) != 0 && secp256k1_ge_set_xo_var(elem, &x, pub[0] == SECP256K1_TAG_PUBKEY_ODD);
2323
} else if (size == 65 && (pub[0] == SECP256K1_TAG_PUBKEY_UNCOMPRESSED || pub[0] == SECP256K1_TAG_PUBKEY_HYBRID_EVEN || pub[0] == SECP256K1_TAG_PUBKEY_HYBRID_ODD)) {
2424
secp256k1_fe x, y;
25-
if (!secp256k1_fe_set_b32(&x, pub+1) || !secp256k1_fe_set_b32(&y, pub+33)) {
25+
if (secp256k1_fe_set_b32(&x, pub+1) == 0 || secp256k1_fe_set_b32(&y, pub+33) == 0) {
2626
return 0;
2727
}
2828
secp256k1_ge_set_xy(elem, &x, &y);

0 commit comments

Comments
 (0)