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

Commit 23f1d09b authored by Jaesung Chung's avatar Jaesung Chung
Browse files

logd-unit-tests: make sure use unsigned types when reading le

The get4LE method needs to use unsigned types since the sign char values
can lead to producing wrong values.

Bug: 62599757
Test: passes all test cases of logd-unit-tests.
Change-Id: Ifaf83533d847ea4fbe0cd46a978f4dabbfa7df8d
parent 72ca5035
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -933,9 +933,13 @@ TEST(logd, getEventTag_newentry) {
}

#ifdef __ANDROID__
static inline int32_t get4LE(const char* src) {
static inline uint32_t get4LE(const uint8_t* src) {
  return src[0] | (src[1] << 8) | (src[2] << 16) | (src[3] << 24);
}

static inline uint32_t get4LE(const char* src) {
  return get4LE(reinterpret_cast<const uint8_t*>(src));
}
#endif

void __android_log_btwrite_multiple__helper(int count) {