A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/Haivision/srt/commit/adba7afcea44db5a87debeb150760021108d9db1 below:

[core] Use ThreadName::BUFSIZE in CreateLogLinePrefix() · Haivision/srt@adba7af · GitHub

File tree Expand file treeCollapse file tree 1 file changed

+8

-4

lines changed

Filter options

Expand file treeCollapse file tree 1 file changed

+8

-4

lines changed Original file line number Diff line number Diff line change

@@ -595,16 +595,20 @@ void LogDispatcher::CreateLogLinePrefix(std::ostringstream& serr)

595 595

{

596 596

using namespace std;

597 597 598 -

char tmp_buf[512];

598 +

SRT_STATIC_ASSERT(ThreadName::BUFSIZE >= sizeof("hh:mm:ss.") * 2, // multiply 2 for some margin

599 +

"ThreadName::BUFSIZE is too small to be used for strftime");

600 +

char tmp_buf[ThreadName::BUFSIZE];

599 601

if ( !isset(SRT_LOGF_DISABLE_TIME) )

600 602

{

601 603

// Not necessary if sending through the queue.

602 604

timeval tv;

603 -

gettimeofday(&tv, 0);

605 +

gettimeofday(&tv, NULL);

604 606

struct tm tm = SysLocalTime((time_t) tv.tv_sec);

605 607 606 -

strftime(tmp_buf, 512, "%X.", &tm);

607 -

serr << tmp_buf << setw(6) << setfill('0') << tv.tv_usec;

608 +

if (strftime(tmp_buf, sizeof(tmp_buf), "%X.", &tm))

609 +

{

610 +

serr << tmp_buf << setw(6) << setfill('0') << tv.tv_usec;

611 +

}

608 612

}

609 613 610 614

string out_prefix;

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4