Add casts to avoid build warnings with gcc-4.7
Example:
keystore.cpp:1339:35: error: narrowing conversion of 'CommandCodes[0]'
from 'command_code_t {aka unsigned char}' to 'int8_t {aka signed char}'
Change-Id: I8cd239880821724050d1716b78851807e0246ef2
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
diff --git a/keystore/keystore.cpp b/keystore/keystore.cpp
index ef4c7d4..ea58ad6 100644
--- a/keystore/keystore.cpp
+++ b/keystore/keystore.cpp
@@ -1331,7 +1331,7 @@
static struct action {
ResponseCode (*run)(KeyStore* keyStore, int sock, uid_t uid, Value* param1, Value* param2,
Value* param3);
- int8_t code;
+ uint8_t code;
State state;
uint32_t perm;
int lengths[MAX_PARAM];
@@ -1364,11 +1364,11 @@
uid_t euid;
uint32_t perms;
} users[] = {
- {AID_SYSTEM, ~0, ~0},
- {AID_VPN, AID_SYSTEM, P_GET | P_SIGN | P_VERIFY },
- {AID_WIFI, AID_SYSTEM, P_GET | P_SIGN | P_VERIFY },
- {AID_ROOT, AID_SYSTEM, P_GET},
- {~0, ~0, P_TEST | P_GET | P_INSERT | P_DELETE | P_EXIST | P_SAW |
+ {AID_SYSTEM, (uid_t)(~0), (uint32_t)(~0)},
+ {AID_VPN, AID_SYSTEM, P_GET | P_SIGN | P_VERIFY },
+ {AID_WIFI, AID_SYSTEM, P_GET | P_SIGN | P_VERIFY },
+ {AID_ROOT, AID_SYSTEM, P_GET},
+ {(uid_t)(~0), (uid_t)(~0), P_TEST | P_GET | P_INSERT | P_DELETE | P_EXIST | P_SAW |
P_SIGN | P_VERIFY},
};
diff --git a/keystore/keystore_client.cpp b/keystore/keystore_client.cpp
index db9eb68..a3a51ec 100644
--- a/keystore/keystore_client.cpp
+++ b/keystore/keystore_client.cpp
@@ -47,7 +47,7 @@
return SYSTEM_ERROR;
}
- uint8_t bytes[2] = { argLen >> 8, argLen };
+ uint8_t bytes[2] = { (uint8_t)(argLen >> 8), (uint8_t)argLen };
if (TEMP_FAILURE_RETRY(send(sock, bytes, 2, MSG_NOSIGNAL)) != 2
|| TEMP_FAILURE_RETRY(send(sock, arg, argLen, MSG_NOSIGNAL))
!= static_cast<ssize_t>(argLen)) {