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
This commit is contained in:
parent
72ca50359e
commit
23f1d09b74
1 changed files with 6 additions and 2 deletions
|
|
@ -933,8 +933,12 @@ TEST(logd, getEventTag_newentry) {
|
|||
}
|
||||
|
||||
#ifdef __ANDROID__
|
||||
static inline int32_t get4LE(const char* src) {
|
||||
return src[0] | (src[1] << 8) | (src[2] << 16) | (src[3] << 24);
|
||||
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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue