mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-10 15:44:32 +00:00
don't declare variables in case block
This commit is contained in:
parent
6e0f0421a3
commit
ceea31999e
@ -92,6 +92,7 @@ static void continue_remote_names(){
|
||||
static void packet_handler (uint8_t packet_type, uint8_t *packet, uint16_t size){
|
||||
bd_addr_t addr;
|
||||
int i;
|
||||
int index;
|
||||
int numResponses;
|
||||
|
||||
// printf("packet_handler: pt: 0x%02x, packet[0]: 0x%02x\n", packet_type, packet[0]);
|
||||
@ -124,7 +125,7 @@ static void packet_handler (uint8_t packet_type, uint8_t *packet, uint16_t size)
|
||||
for (i=0; i<numResponses && deviceCount < MAX_DEVICES;i++){
|
||||
bt_flip_addr(addr, &packet[offset]);
|
||||
offset += 6;
|
||||
int index = getDeviceIndexForAddress(addr);
|
||||
index = getDeviceIndexForAddress(addr);
|
||||
if (index >= 0) continue; // already in our list
|
||||
memcpy(devices[deviceCount].address, addr, 6);
|
||||
|
||||
@ -172,7 +173,7 @@ static void packet_handler (uint8_t packet_type, uint8_t *packet, uint16_t size)
|
||||
|
||||
case HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE:
|
||||
bt_flip_addr(addr, &packet[3]);
|
||||
int index = getDeviceIndexForAddress(addr);
|
||||
index = getDeviceIndexForAddress(addr);
|
||||
if (index >= 0) {
|
||||
if (packet[2] == 0) {
|
||||
printf("Name: '%s'\n", &packet[9]);
|
||||
|
@ -101,6 +101,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
||||
//static void packet_handler (uint8_t packet_type, uint8_t *packet, uint16_t size){
|
||||
bd_addr_t addr;
|
||||
int i;
|
||||
int index;
|
||||
int numResponses;
|
||||
|
||||
// printf("packet_handler: pt: 0x%02x, packet[0]: 0x%02x\n", packet_type, packet[0]);
|
||||
@ -147,7 +148,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
||||
for (i=0; i<numResponses && deviceCount < MAX_DEVICES;i++){
|
||||
bt_flip_addr(addr, &packet[offset]);
|
||||
offset += 6;
|
||||
int index = getDeviceIndexForAddress(addr);
|
||||
index = getDeviceIndexForAddress(addr);
|
||||
if (index >= 0) continue; // already in our list
|
||||
memcpy(devices[deviceCount].address, addr, 6);
|
||||
|
||||
@ -200,7 +201,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
||||
|
||||
case HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE:
|
||||
bt_flip_addr(addr, &packet[3]);
|
||||
int index = getDeviceIndexForAddress(addr);
|
||||
index = getDeviceIndexForAddress(addr);
|
||||
if (index >= 0) {
|
||||
if (packet[2] == 0) {
|
||||
printf("Name: '%s'\n", &packet[9]);
|
||||
|
@ -142,7 +142,8 @@ static void inquiry_packet_handler (uint8_t packet_type, uint8_t *packet, uint16
|
||||
bd_addr_t addr;
|
||||
int i;
|
||||
int numResponses;
|
||||
|
||||
int index;
|
||||
|
||||
// printf("packet_handler: pt: 0x%02x, packet[0]: 0x%02x\n", packet_type, packet[0]);
|
||||
if (packet_type != HCI_EVENT_PACKET) return;
|
||||
|
||||
@ -156,7 +157,7 @@ static void inquiry_packet_handler (uint8_t packet_type, uint8_t *packet, uint16
|
||||
for (i=0; i<numResponses && deviceCount < MAX_DEVICES;i++){
|
||||
bt_flip_addr(addr, &packet[offset]);
|
||||
offset += 6;
|
||||
int index = getDeviceIndexForAddress(addr);
|
||||
index = getDeviceIndexForAddress(addr);
|
||||
if (index >= 0) continue; // already in our list
|
||||
memcpy(devices[deviceCount].address, addr, 6);
|
||||
|
||||
@ -204,7 +205,7 @@ static void inquiry_packet_handler (uint8_t packet_type, uint8_t *packet, uint16
|
||||
|
||||
case HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE:
|
||||
bt_flip_addr(addr, &packet[3]);
|
||||
int index = getDeviceIndexForAddress(addr);
|
||||
index = getDeviceIndexForAddress(addr);
|
||||
if (index >= 0) {
|
||||
if (packet[2] == 0) {
|
||||
printf("Name: '%s'\n", &packet[9]);
|
||||
|
@ -88,6 +88,7 @@ static void packet_handler (uint8_t packet_type, uint8_t *packet, uint16_t size)
|
||||
bd_addr_t addr;
|
||||
int i;
|
||||
int numResponses;
|
||||
index;
|
||||
|
||||
// printf("packet_handler: pt: 0x%02x, packet[0]: 0x%02x\n", packet_type, packet[0]);
|
||||
if (packet_type != HCI_EVENT_PACKET) return;
|
||||
@ -117,7 +118,7 @@ static void packet_handler (uint8_t packet_type, uint8_t *packet, uint16_t size)
|
||||
numResponses = packet[2];
|
||||
for (i=0; i<numResponses && deviceCount < MAX_DEVICES;i++){
|
||||
bt_flip_addr(addr, &packet[3+i*6]);
|
||||
int index = getDeviceIndexForAddress(addr);
|
||||
index = getDeviceIndexForAddress(addr);
|
||||
if (index >= 0) continue; // already in our list
|
||||
|
||||
memcpy(devices[deviceCount].address, addr, 6);
|
||||
@ -155,7 +156,7 @@ static void packet_handler (uint8_t packet_type, uint8_t *packet, uint16_t size)
|
||||
|
||||
case HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE:
|
||||
bt_flip_addr(addr, &packet[3]);
|
||||
int index = getDeviceIndexForAddress(addr);
|
||||
index = getDeviceIndexForAddress(addr);
|
||||
if (index >= 0) {
|
||||
if (packet[2] == 0) {
|
||||
printf("Name: '%s'\n", &packet[9]);
|
||||
|
@ -86,6 +86,7 @@ static void packet_handler (uint8_t packet_type, uint8_t *packet, uint16_t size)
|
||||
bd_addr_t addr;
|
||||
int i;
|
||||
int numResponses;
|
||||
int index;
|
||||
|
||||
// printf("packet_handler: pt: 0x%02x, packet[0]: 0x%02x\n", packet_type, packet[0]);
|
||||
if (packet_type != HCI_EVENT_PACKET) return;
|
||||
@ -117,7 +118,7 @@ static void packet_handler (uint8_t packet_type, uint8_t *packet, uint16_t size)
|
||||
for (i=0; i<numResponses && deviceCount < MAX_DEVICES;i++){
|
||||
bt_flip_addr(addr, &packet[offset]);
|
||||
offset += 6;
|
||||
int index = getDeviceIndexForAddress(addr);
|
||||
index = getDeviceIndexForAddress(addr);
|
||||
if (index >= 0) continue; // already in our list
|
||||
memcpy(devices[deviceCount].address, addr, 6);
|
||||
|
||||
@ -165,7 +166,7 @@ static void packet_handler (uint8_t packet_type, uint8_t *packet, uint16_t size)
|
||||
|
||||
case HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE:
|
||||
bt_flip_addr(addr, &packet[3]);
|
||||
int index = getDeviceIndexForAddress(addr);
|
||||
index = getDeviceIndexForAddress(addr);
|
||||
if (index >= 0) {
|
||||
if (packet[2] == 0) {
|
||||
printf("Name: '%s'\n", &packet[9]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user