Fixed implicit conversion warning: __LINE__ is a long (#4397)

This commit is contained in:
Cœur 2022-12-19 00:23:44 +08:00 committed by GitHub
parent e694c3e3a0
commit 4ff59b715d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 10 additions and 10 deletions

View File

@ -314,7 +314,7 @@ static void printMessage(
std::string_view name,
std::string_view message,
std::string_view filename,
int line)
long line)
{
auto const out = std::empty(name) ? fmt::format(FMT_STRING("{:s} ({:s}:{:d})"), message, filename, line) :
fmt::format(FMT_STRING("{:s} {:s} ({:s}:{:d})"), name, message, filename, line);

View File

@ -63,7 +63,7 @@ char const* ccrypto_error_to_str(CCCryptorStatus error_code)
return "Unknown error";
}
void log_ccrypto_error(CCCryptorStatus error_code, char const* file, int line)
void log_ccrypto_error(CCCryptorStatus error_code, char const* file, long line)
{
if (tr_logLevelIsActive(TR_LOG_ERROR))
{
@ -79,7 +79,7 @@ void log_ccrypto_error(CCCryptorStatus error_code, char const* file, int line)
}
}
bool check_ccrypto_result(CCCryptorStatus result, char const* file, int line)
bool check_ccrypto_result(CCCryptorStatus result, char const* file, long line)
{
bool const ret = result == kCCSuccess;

View File

@ -87,7 +87,7 @@ tr_sys_file_t tr_logGetFile()
void logAddImpl(
[[maybe_unused]] char const* file,
[[maybe_unused]] int line,
[[maybe_unused]] long line,
[[maybe_unused]] tr_log_level level,
std::string_view msg,
[[maybe_unused]] std::string_view name)
@ -243,7 +243,7 @@ char* tr_logGetTimeStr(char* buf, size_t buflen)
return buf;
}
void tr_logAddMessage(char const* file, int line, tr_log_level level, std::string_view msg, std::string_view name)
void tr_logAddMessage(char const* file, long line, tr_log_level level, std::string_view msg, std::string_view name)
{
TR_ASSERT(!std::empty(msg));

View File

@ -52,7 +52,7 @@ struct tr_log_message
// location in the source code
std::string_view file;
size_t line;
long line;
// when the message was generated
time_t when;
@ -91,7 +91,7 @@ void tr_logSetLevel(tr_log_level);
void tr_logAddMessage(
char const* source_file,
int source_line,
long source_line,
tr_log_level level,
std::string_view msg,
std::string_view module_name = {});

View File

@ -12,7 +12,7 @@
#if !defined(NDEBUG) || defined(TR_FORCE_ASSERTIONS)
[[noreturn]] bool tr_assert_report(std::string_view file, int line, std::string_view message)
[[noreturn]] bool tr_assert_report(std::string_view file, long line, std::string_view message)
{
std::cerr << "assertion failed: " << message << " (" << file << ':' << line << ')' << std::endl;
abort();

View File

@ -11,7 +11,7 @@
#include "tr-macros.h"
[[noreturn]] bool tr_assert_report(std::string_view file, int line, std::string_view message);
[[noreturn]] bool tr_assert_report(std::string_view file, long line, std::string_view message);
#define TR_ASSERT(x) ((void)(TR_LIKELY(x) || tr_assert_report(__FILE__, __LINE__, #x)))
#define TR_ASSERT_MSG(x, message) ((void)(TR_LIKELY(x) || tr_assert_report(__FILE__, __LINE__, message)))

View File

@ -16,7 +16,7 @@
// macOS implementation of tr_assert_report() that provides the message in the crash report
// This replaces the generic implementation of the function in tr-assert.cc
[[noreturn]] bool tr_assert_report(std::string_view file, int line, std::string_view message)
[[noreturn]] bool tr_assert_report(std::string_view file, long line, std::string_view message)
{
auto const full_text = fmt::format(FMT_STRING("assertion failed: {:s} ({:s}:{:d})"), message, file, line);
[NSException raise:NSInternalInconsistencyException format:@"%s", full_text.c_str()];