diff --git a/assembler/assembly-parser.cpp b/assembler/assembly-parser.cpp index 623aff38e672ed9bb01566f2a9d677056ca99961..aa8c8be0995597b9ea968daebb0788681b2c255e 100644 --- a/assembler/assembly-parser.cpp +++ b/assembler/assembly-parser.cpp @@ -349,7 +349,7 @@ void Parser::ParseResetFunctionLabelsAndParams() for (const auto &t : context_.function_arguments_lists) { curr_func_ = &(program_.function_table.at(t.first)); - curr_func_->regs_num = curr_func_->value_of_first_param + 1; + curr_func_->regs_num = static_cast(curr_func_->value_of_first_param + 1); for (const auto &v : t.second) { if (!curr_func_->ins.empty() && curr_func_->ins.size() >= v.first && diff --git a/assembler/assembly-parser.h b/assembler/assembly-parser.h index 1e6b0d9dcec648fa7897ac991d0e3e1802d0c52c..725a3906a9329c54ecbe626f46fa10272e8ff320 100644 --- a/assembler/assembly-parser.h +++ b/assembler/assembly-parser.h @@ -112,7 +112,7 @@ private: inline void GetWarning(const std::string &mess = "", Error::ErrorType err = Error::ErrorType::ERR_NONE, int8_t shift = 0, const std::string &add_mess = "") { - war_.emplace_back(mess, line_stric_, err, add_mess, context_.tokens[context_.number - 1].bound_left + shift, + war_.emplace_back(mess, line_stric_, err, add_mess, context_.tokens[context_.number - 1].bound_left + static_cast(shift), context_.tokens[context_.number - 1].bound_right, context_.tokens[context_.number - 1].whole_line, Error::ErrorClass::WARNING); } diff --git a/libpandabase/os/unix/futex/mutex.cpp b/libpandabase/os/unix/futex/mutex.cpp index 444e02e920a26caf7d4d19bb93b2782ea3256815..d3da1d38f2b800cf1001293bb828b79a95ddb5de 100644 --- a/libpandabase/os/unix/futex/mutex.cpp +++ b/libpandabase/os/unix/futex/mutex.cpp @@ -440,8 +440,8 @@ const int64_t NANOSECONDS_PER_SEC = 1000000000; struct timespec ConvertTime(uint64_t ms, uint64_t ns) { struct timespec time = {0, 0}; - time_t seconds = ms / MILLISECONDS_PER_SEC; - time_t nanoseconds = (ms % MILLISECONDS_PER_SEC) * NANOSECONDS_PER_MILLISEC + ns; + auto seconds = static_cast(ms / MILLISECONDS_PER_SEC); + auto nanoseconds = static_cast((ms % MILLISECONDS_PER_SEC) * NANOSECONDS_PER_MILLISEC + ns); time.tv_sec += seconds; time.tv_nsec += nanoseconds; if (time.tv_nsec >= NANOSECONDS_PER_SEC) { diff --git a/libpandabase/os/unix/sighooklib/sighook.cpp b/libpandabase/os/unix/sighooklib/sighook.cpp index 1a5af974958daa3b3d702fbd3efd9d1088e9063f..9cec549f1aa0320acfcccb4d18ae78a3036cb55f 100644 --- a/libpandabase/os/unix/sighooklib/sighook.cpp +++ b/libpandabase/os/unix/sighooklib/sighook.cpp @@ -265,7 +265,7 @@ void SignalHook::Handler(int signo, siginfo_t *siginfo, void *ucontext_raw) } // Call user handler - size_t handler_flags = signal_hooks[signo].user_action_.sa_flags; + auto handler_flags = static_cast(signal_hooks[signo].user_action_.sa_flags); auto *ucontext = static_cast(ucontext_raw); sigset_t mask; sigemptyset(&mask); diff --git a/libpandabase/utils/murmur3_hash.h b/libpandabase/utils/murmur3_hash.h index 25dadd45396b53c3b6374ba5a12e144887d8ab98..91b48efcc1546a38eb1d534a36c3330579401225 100644 --- a/libpandabase/utils/murmur3_hash.h +++ b/libpandabase/utils/murmur3_hash.h @@ -121,7 +121,7 @@ private: // Get ((uint8_t*)tail)[i - 1]: uintptr_t block_pointer = tail + sizeof(uint8_t) * (i - 1); uint8_t block = *reinterpret_cast(block_pointer); - uint32_t temp = static_cast(block << (TAIL_SHIFT * (i - 1U))); + uint32_t temp = static_cast(block) << (TAIL_SHIFT * (i - 1U)); k1 ^= temp; if (i == 1) { k1 = Rotl(k1, TAIL_LAST_SHIFT); @@ -180,7 +180,7 @@ private: uint32_t k1 = 0; for (size_t i = tail_len; i > 0; i--) { uint8_t block = memblock[i - 1U]; - uint32_t temp = static_cast(block << (TAIL_SHIFT * (i - 1U))); + uint32_t temp = static_cast(block) << (TAIL_SHIFT * (i - 1U)); k1 ^= temp; if (i == 1) { k1 = Rotl(k1, TAIL_LAST_SHIFT); diff --git a/libpandabase/utils/utf.cpp b/libpandabase/utils/utf.cpp index 8214beb39bf7aef6200a50315f089cfc1c7b1a19..2f98d4319c263b8453300ced8b889af46fe3de4b 100644 --- a/libpandabase/utils/utf.cpp +++ b/libpandabase/utils/utf.cpp @@ -261,7 +261,7 @@ int CompareMUtf8ToMUtf8(const uint8_t *mutf8_1, const uint8_t *mutf8_2) auto [c1p1, c1p2] = SplitUtf16Pair(c1); auto [c2p1, c2p2] = SplitUtf16Pair(c2); - int result = c1p1 - c2p1; + auto result = static_cast(c1p1 - c2p1); if (result != 0) { return result; } @@ -308,7 +308,7 @@ int CompareUtf8ToUtf8(const uint8_t *utf8_1, size_t utf8_1_length, const uint8_t auto [c1p1, c1p2] = SplitUtf16Pair(c1); auto [c2p1, c2p2] = SplitUtf16Pair(c2); - int result = c1p1 - c2p1; + auto result = static_cast(c1p1 - c2p1); if (result != 0) { return result; } diff --git a/libpandafile/debug_info_extractor.cpp b/libpandafile/debug_info_extractor.cpp index a0aa3b4da503ee4e4dd0ba3ad3fb982ceb037634..74a25390e47a4c6a11b03544a017aced44d80f97 100644 --- a/libpandafile/debug_info_extractor.cpp +++ b/libpandafile/debug_info_extractor.cpp @@ -222,7 +222,7 @@ private: { ASSERT(static_cast(opcode) >= LineNumberProgramItem::OPCODE_BASE); - auto adjust_opcode = static_cast(opcode) - LineNumberProgramItem::OPCODE_BASE; + auto adjust_opcode = static_cast(opcode - LineNumberProgramItem::OPCODE_BASE); auto pc_offset = static_cast(adjust_opcode / LineNumberProgramItem::LINE_RANGE); int32_t line_offset = adjust_opcode % LineNumberProgramItem::LINE_RANGE + LineNumberProgramItem::LINE_BASE; state_.AdvancePc(pc_offset);