Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 219ef270 authored by Mark Salyzyn's avatar Mark Salyzyn
Browse files

liblog: log_time add explicit to some constructors.

(cherry pick from commit d87d47f7)

Add explicit to constructors, to prevent implicit conversions.

Test: compile
Bug: 37378309
Change-Id: I3f9f8d561e84c492eafa6528db7c238da072dad8
parent 912eb625
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -41,13 +41,12 @@ struct log_time {
  static const uint32_t tv_sec_max = 0xFFFFFFFFUL;
  static const uint32_t tv_nsec_max = 999999999UL;

  log_time(const timespec& T) {
    tv_sec = static_cast<uint32_t>(T.tv_sec);
    tv_nsec = static_cast<uint32_t>(T.tv_nsec);
  log_time(const timespec& T)
      : tv_sec(static_cast<uint32_t>(T.tv_sec)),
        tv_nsec(static_cast<uint32_t>(T.tv_nsec)) {
  }
  log_time(uint32_t sec, uint32_t nsec) {
    tv_sec = sec;
    tv_nsec = nsec;
  explicit log_time(uint32_t sec, uint32_t nsec = 0)
      : tv_sec(sec), tv_nsec(nsec) {
  }
#ifdef _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_LOGGER_H_
#define __struct_log_time_private_defined
@@ -56,14 +55,14 @@ struct log_time {
  log_time() {
  }
#ifdef __linux__
  log_time(clockid_t id) {
  explicit log_time(clockid_t id) {
    timespec T;
    clock_gettime(id, &T);
    tv_sec = static_cast<uint32_t>(T.tv_sec);
    tv_nsec = static_cast<uint32_t>(T.tv_nsec);
  }
#endif
  log_time(const char* T) {
  explicit log_time(const char* T) {
    const uint8_t* c = reinterpret_cast<const uint8_t*>(T);
    tv_sec = c[0] | (static_cast<uint32_t>(c[1]) << 8) |
             (static_cast<uint32_t>(c[2]) << 16) |