Skip to content

Commit bf62cd5

Browse files
committed
fix: signed and init field warnings
Signed-off-by: Frederic Pillon <[email protected]>
1 parent baa1370 commit bf62cd5

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

src/utility/HCI.cpp

+9-5
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ void HCIClass::poll(unsigned long timeout)
138138
while (HCITransport.available()) {
139139
byte b = HCITransport.read();
140140

141-
if (_recvIndex >= sizeof(_recvBuffer)) {
141+
if (_recvIndex >= (int)sizeof(_recvBuffer)) {
142142
_recvIndex = 0;
143143
if (_debug) {
144144
_debug->println("_recvBuffer overflow");
@@ -461,6 +461,8 @@ int HCIClass::leConnUpdate(uint16_t handle, uint16_t minInterval, uint16_t maxIn
461461
return sendCommand(OGF_LE_CTL << 10 | OCF_LE_CONN_UPDATE, sizeof(leConnUpdateData), &leConnUpdateData);
462462
}
463463
void HCIClass::saveNewAddress(uint8_t addressType, uint8_t* address, uint8_t* peerIrk, uint8_t* localIrk){
464+
(void)addressType;
465+
(void)localIrk;
464466
if(_storeIRK!=0){
465467
_storeIRK(address, peerIrk);
466468
}
@@ -503,6 +505,7 @@ int HCIClass::leStartResolvingAddresses(){
503505
return HCI.sendCommand(OGF_LE_CTL << 10 | 0x2D, 1,&enable); // Disable address resolution
504506
}
505507
int HCIClass::leReadPeerResolvableAddress(uint8_t peerAddressType, uint8_t* peerIdentityAddress, uint8_t* peerResolvableAddress){
508+
(void)peerResolvableAddress;
506509
struct __attribute__ ((packed)) Request {
507510
uint8_t addressType;
508511
uint8_t identityAddress[6];
@@ -546,7 +549,7 @@ int HCIClass::readStoredLK(uint8_t BD_ADDR[], uint8_t read_all ){
546549
struct __attribute__ ((packed)) Request {
547550
uint8_t BD_ADDR[6];
548551
uint8_t read_a;
549-
} request = {0,0};
552+
} request = {{0},0};
550553
for(int i=0; i<6; i++) request.BD_ADDR[5-i] = BD_ADDR[i];
551554
request.read_a = read_all;
552555
return sendCommand(OGF_HOST_CTL << 10 | 0xD, sizeof(request), &request);
@@ -1268,7 +1271,7 @@ void HCIClass::handleEventPkt(uint8_t /*plen*/, uint8_t pdata[])
12681271
uint8_t U[32];
12691272
uint8_t V[32];
12701273
uint8_t Z;
1271-
} f4Params = {0,0,Z};
1274+
} f4Params = {{0},{0},Z};
12721275
for(int i=0; i<32; i++){
12731276
f4Params.U[31-i] = pairingPublicKey.publicKey[i];
12741277
f4Params.V[31-i] = HCI.remotePublicKeyBuffer[i];
@@ -1288,7 +1291,7 @@ void HCIClass::handleEventPkt(uint8_t /*plen*/, uint8_t pdata[])
12881291
#endif
12891292

12901293
uint8_t cb_temp[sizeof(pairingConfirm.cb)];
1291-
for(int i=0; i<sizeof(pairingConfirm.cb);i++){
1294+
for(unsigned int i=0; i<sizeof(pairingConfirm.cb);i++){
12921295
cb_temp[sizeof(pairingConfirm.cb)-1-i] = pairingConfirm.cb[i];
12931296
}
12941297
/// cb wa back to front.
@@ -1372,11 +1375,12 @@ void HCIClass::handleEventPkt(uint8_t /*plen*/, uint8_t pdata[])
13721375
}
13731376
}
13741377
int HCIClass::leEncrypt(uint8_t* key, uint8_t* plaintext, uint8_t* status, uint8_t* ciphertext){
1378+
(void)status;
13751379
struct __attribute__ ((packed)) LeEncryptCommand
13761380
{
13771381
uint8_t key[16];
13781382
uint8_t plaintext[16];
1379-
} leEncryptCommand = {0,0};
1383+
} leEncryptCommand = {{0},{0}};
13801384
for(int i=0; i<16; i++){
13811385
leEncryptCommand.key[15-i] = key[i];
13821386
leEncryptCommand.plaintext[15-i] = plaintext[i];

src/utility/L2CAPSignaling.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ void L2CAPSignalingClass::handleSecurityData(uint16_t connectionHandle, uint8_t
122122
#ifdef _BLE_TRACE_
123123
Serial.print("dlen: ");
124124
Serial.println(dlen);
125+
#else
126+
(void)dlen;
125127
#endif
126128
uint8_t code = l2capSignalingHdr->code;
127129

@@ -310,8 +312,8 @@ void L2CAPSignalingClass::handleSecurityData(uint16_t connectionHandle, uint8_t
310312
uint8_t x[32];
311313
uint8_t y[32];
312314
} generateDHKeyCommand = {
313-
0x00,
314-
0x00,
315+
{0x00},
316+
{0x00},
315317
};
316318
memcpy(generateDHKeyCommand.x,connectionPairingPublicKey->x,32);
317319
memcpy(generateDHKeyCommand.y,connectionPairingPublicKey->y,32);

src/utility/btct.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ int BluetoothCryptoToolbox::f5(uint8_t DHKey[],uint8_t N_master[], uint8_t N_sla
7171
uint8_t A1[7];
7272
uint8_t A2[7];
7373
uint8_t length[2];
74-
} cmacInput = {0,0,0,0,0,0,0};
74+
} cmacInput = {0,{0},{0},{0},{0},{0},{0}};
7575
cmacInput.counter = 0;
7676
memcpy(cmacInput.keyID, keyID, 4);
7777
memcpy(cmacInput.N1,N_master,16);
@@ -97,7 +97,7 @@ int BluetoothCryptoToolbox::f6(uint8_t W[], uint8_t N1[],uint8_t N2[],uint8_t R[
9797
uint8_t IOCap[3];
9898
uint8_t A1[7];
9999
uint8_t A2[7];
100-
} f6Input = {0,0,0,0,0,0};
100+
} f6Input = {{0},{0},{0},{0},{0},{0}};
101101

102102
memcpy(f6Input.N1, N1, 16);
103103
memcpy(f6Input.N2, N2, 16);
@@ -145,7 +145,7 @@ int BluetoothCryptoToolbox::g2(uint8_t U[], uint8_t V[], uint8_t X[], uint8_t Y[
145145
uint8_t U[32];
146146
uint8_t V[32];
147147
uint8_t Y[16];
148-
} cmacInput= {0,0,0};
148+
} cmacInput= {{0},{0},{0}};
149149
memcpy(cmacInput.U,U,32);
150150
memcpy(cmacInput.V,V,32);
151151
memcpy(cmacInput.Y,Y,16);

0 commit comments

Comments
 (0)