Fix build with clang in C++11 mode
Now that we're in C++11 mode by default, clang complains about switch statements with case values not matching the type -- since some binder_driver_return_protocol values are > 0x7fffffff, we need to make the switch statements operate on uint32_t rather than int32_t. BUG: 18466763 Change-Id: Iedbfd5c7a3d3d9f087d2eab4ff21343ad7a2a448 Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
This commit is contained in:
parent
45aa022710
commit
74debb0b8f
@ -147,9 +147,9 @@ static const void* printReturnCommand(TextOutput& out, const void* _cmd)
|
|||||||
{
|
{
|
||||||
static const size_t N = sizeof(kReturnStrings)/sizeof(kReturnStrings[0]);
|
static const size_t N = sizeof(kReturnStrings)/sizeof(kReturnStrings[0]);
|
||||||
const int32_t* cmd = (const int32_t*)_cmd;
|
const int32_t* cmd = (const int32_t*)_cmd;
|
||||||
int32_t code = *cmd++;
|
uint32_t code = (uint32_t)*cmd++;
|
||||||
size_t cmdIndex = code & 0xff;
|
size_t cmdIndex = code & 0xff;
|
||||||
if (code == (int32_t) BR_ERROR) {
|
if (code == BR_ERROR) {
|
||||||
out << "BR_ERROR: " << (void*)(long)(*cmd++) << endl;
|
out << "BR_ERROR: " << (void*)(long)(*cmd++) << endl;
|
||||||
return cmd;
|
return cmd;
|
||||||
} else if (cmdIndex >= N) {
|
} else if (cmdIndex >= N) {
|
||||||
@ -208,7 +208,7 @@ static const void* printCommand(TextOutput& out, const void* _cmd)
|
|||||||
{
|
{
|
||||||
static const size_t N = sizeof(kCommandStrings)/sizeof(kCommandStrings[0]);
|
static const size_t N = sizeof(kCommandStrings)/sizeof(kCommandStrings[0]);
|
||||||
const int32_t* cmd = (const int32_t*)_cmd;
|
const int32_t* cmd = (const int32_t*)_cmd;
|
||||||
int32_t code = *cmd++;
|
uint32_t code = (uint32_t)*cmd++;
|
||||||
size_t cmdIndex = code & 0xff;
|
size_t cmdIndex = code & 0xff;
|
||||||
|
|
||||||
if (cmdIndex >= N) {
|
if (cmdIndex >= N) {
|
||||||
@ -697,7 +697,7 @@ status_t IPCThreadState::sendReply(const Parcel& reply, uint32_t flags)
|
|||||||
|
|
||||||
status_t IPCThreadState::waitForResponse(Parcel *reply, status_t *acquireResult)
|
status_t IPCThreadState::waitForResponse(Parcel *reply, status_t *acquireResult)
|
||||||
{
|
{
|
||||||
int32_t cmd;
|
uint32_t cmd;
|
||||||
int32_t err;
|
int32_t err;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
@ -706,7 +706,7 @@ status_t IPCThreadState::waitForResponse(Parcel *reply, status_t *acquireResult)
|
|||||||
if (err < NO_ERROR) break;
|
if (err < NO_ERROR) break;
|
||||||
if (mIn.dataAvail() == 0) continue;
|
if (mIn.dataAvail() == 0) continue;
|
||||||
|
|
||||||
cmd = mIn.readInt32();
|
cmd = (uint32_t)mIn.readInt32();
|
||||||
|
|
||||||
IF_LOG_COMMANDS() {
|
IF_LOG_COMMANDS() {
|
||||||
alog << "Processing waitForResponse Command: "
|
alog << "Processing waitForResponse Command: "
|
||||||
@ -936,7 +936,7 @@ status_t IPCThreadState::executeCommand(int32_t cmd)
|
|||||||
RefBase::weakref_type* refs;
|
RefBase::weakref_type* refs;
|
||||||
status_t result = NO_ERROR;
|
status_t result = NO_ERROR;
|
||||||
|
|
||||||
switch (cmd) {
|
switch ((uint32_t)cmd) {
|
||||||
case BR_ERROR:
|
case BR_ERROR:
|
||||||
result = mIn.readInt32();
|
result = mIn.readInt32();
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user