SYNERGY-956 - Resolve code scanning issues (#7006)
* SYNERGY-956 - Resolve code scanning issues * SYNERGY-956 - Update changelog * SYNERGY-956 - Platform based localtime * SYNERGY-956 - Fix argument order Co-authored-by: SerhiiGadzhilov <71632867+SerhiiGadzhilov@users.noreply.github.com>
This commit is contained in:
parent
ab346d4832
commit
c7fd0a8e4d
4 changed files with 11 additions and 6 deletions
|
|
@ -2,6 +2,7 @@ v1.14.1-snapshot
|
|||
===========
|
||||
Bug fixes:
|
||||
- #7016 Fix script that generates version number
|
||||
- #7006 Resolve code scanning issues
|
||||
|
||||
Enhancements:
|
||||
|
||||
|
|
|
|||
|
|
@ -177,13 +177,17 @@ Log::print(const char* file, int line, const char* fmt, ...)
|
|||
// do not prefix time and file for kPRINT (CLOG_PRINT)
|
||||
if (priority != kPRINT) {
|
||||
|
||||
struct tm *tm;
|
||||
struct tm tm;
|
||||
static const int timestamp_size = 50;
|
||||
char timestamp[timestamp_size];
|
||||
time_t t;
|
||||
time(&t);
|
||||
tm = localtime(&t);
|
||||
snprintf(timestamp, timestamp_size, "%04i-%02i-%02iT%02i:%02i:%02i", tm->tm_year + 1900, tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
|
||||
#if WINAPI_MSWINDOWS
|
||||
localtime_s(&tm, &t);
|
||||
#else
|
||||
localtime_r(&t, &tm);
|
||||
#endif
|
||||
snprintf(timestamp, timestamp_size, "%04i-%02i-%02iT%02i:%02i:%02i", tm.tm_year + 1900, tm.tm_mon+1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
|
||||
|
||||
// square brackets, spaces, comma and null terminator take about 10
|
||||
int size = 10;
|
||||
|
|
|
|||
|
|
@ -497,7 +497,7 @@ InputFilter::KeyboardBroadcastAction::format() const
|
|||
}
|
||||
else {
|
||||
return synergy::string::sprintf("%s(%s,%.*s)", s_name, s_mode[m_mode],
|
||||
m_screens.size() - 2,
|
||||
static_cast<int>(m_screens.size() >= 2 ? m_screens.size() - 2 : 0),
|
||||
m_screens.c_str() + 1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ MATCHER_P(EqVoidPointeeInt32, expected, "")
|
|||
MATCHER_P(EqVoidVectorInt1byte, expected, "")
|
||||
{
|
||||
bool Result = true;
|
||||
const UInt8* Actual = (static_cast<const UInt8*>(arg)) + sizeof (UInt32);
|
||||
const UInt8* Actual = (static_cast<const UInt8*>(arg)) + 4;
|
||||
const size_t Size = *(Actual - 1);
|
||||
|
||||
if (Size == expected.size()){
|
||||
|
|
@ -77,7 +77,7 @@ MATCHER_P(EqVoidVectorInt1byte, expected, "")
|
|||
MATCHER_P(EqVoidVectorInt2bytes, expected, "")
|
||||
{
|
||||
bool Result = true;
|
||||
const UInt16* Actual = (static_cast<const UInt16*>(arg)) + sizeof (UInt16);
|
||||
const UInt16* Actual = (static_cast<const UInt16*>(arg)) + 2;
|
||||
const size_t Size = *(Actual - 1) >> 8;
|
||||
|
||||
if (Size == expected.size()){
|
||||
|
|
|
|||
Loading…
Reference in a new issue