Fix some warnings.

This commit is contained in:
levlam 2020-11-20 03:11:27 +03:00
parent 34cf869c02
commit 57de0c4967
2 changed files with 6 additions and 2 deletions

View File

@ -653,6 +653,8 @@ void AesCtrState::encrypt(Slice from, MutableSlice to) {
#if OPENSSL_VERSION_NUMBER >= 0x10100000L #if OPENSSL_VERSION_NUMBER >= 0x10100000L
ctx_->evp_.encrypt(from.ubegin(), to.ubegin(), narrow_cast<int>(from.size())); ctx_->evp_.encrypt(from.ubegin(), to.ubegin(), narrow_cast<int>(from.size()));
#else #else
auto from_ptr = from.ubegin();
auto to_ptr = to.ubegin();
for (size_t i = 0; i < from.size(); i++) { for (size_t i = 0; i < from.size(); i++) {
if (ctx_->current_pos_ == 0) { if (ctx_->current_pos_ == 0) {
AES_encrypt(ctx_->counter_, ctx_->encrypted_counter_, &ctx_->aes_key_); AES_encrypt(ctx_->counter_, ctx_->encrypted_counter_, &ctx_->aes_key_);
@ -662,7 +664,7 @@ void AesCtrState::encrypt(Slice from, MutableSlice to) {
} }
} }
} }
to[i] = from[i] ^ ctx_->encrypted_counter_[ctx_->current_pos_]; to_ptr[i] = static_cast<uint8>(from_ptr[i] ^ ctx_->encrypted_counter_[ctx_->current_pos_]);
ctx_->current_pos_ = (ctx_->current_pos_ + 1) & 15; ctx_->current_pos_ = (ctx_->current_pos_ + 1) & 15;
} }
#endif #endif

View File

@ -91,6 +91,8 @@ int Clocks::tz_offset() {
return offset; return offset;
} }
static int init_tz_offset = Clocks::tz_offset(); namespace detail {
int init_tz_offset_private = Clocks::tz_offset();
} // namespace detail
} // namespace td } // namespace td