Skip to content

Commit 212bf3a

Browse files
authored
Various fixes (#52)
* fix initialization * fix clang-UBSAN error
1 parent 6e42dc9 commit 212bf3a

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/sub-linux.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ static time_t clock_millisec ()
8282
clock_gettime(CLOCK_REALTIME, &current);
8383
#endif
8484

85-
return (int)current.tv_sec * 1000 + (int)(current.tv_nsec / 1000000);
85+
long long current_time = static_cast<long long>(current.tv_sec) * 1000L +
86+
static_cast<long long>(current.tv_nsec / 1000000L);
87+
return static_cast<time_t>(current_time);
8688
}
8789

8890

src/subprocess.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ size_t consume_utf8 (const char * _input, size_t _length)
5959
{
6060
wchar_t wc;
6161
size_t used, consumed = 0;
62-
mbstate_t mb_st { 0 };
62+
mbstate_t mb_st = { };
6363

6464
if (!mbsinit(&mb_st)) memset(&mb_st,0,sizeof(mb_st));
6565

0 commit comments

Comments
 (0)