From ceea31999eb8d6361ecfdef8842b5adfcf643a17 Mon Sep 17 00:00:00 2001 From: "matthias.ringwald" Date: Wed, 15 Oct 2014 08:27:13 +0000 Subject: [PATCH] don't declare variables in case block --- MSP-EXP430F5438-CC256x/example/gap_inquiry.c | 5 +++-- example/daemon/inquiry.c | 5 +++-- example/libusb/classic_test.c | 7 ++++--- example/libusb/gap_inquiry.c | 5 +++-- platforms/stm32-f103rb-nucleo/gap_inquiry.c | 5 +++-- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/MSP-EXP430F5438-CC256x/example/gap_inquiry.c b/MSP-EXP430F5438-CC256x/example/gap_inquiry.c index 30cced52d..42f495345 100644 --- a/MSP-EXP430F5438-CC256x/example/gap_inquiry.c +++ b/MSP-EXP430F5438-CC256x/example/gap_inquiry.c @@ -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= 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]); diff --git a/example/daemon/inquiry.c b/example/daemon/inquiry.c index 70f4a3261..825cf4eed 100644 --- a/example/daemon/inquiry.c +++ b/example/daemon/inquiry.c @@ -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= 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]); diff --git a/example/libusb/classic_test.c b/example/libusb/classic_test.c index 60b6f04a4..88a3410a5 100644 --- a/example/libusb/classic_test.c +++ b/example/libusb/classic_test.c @@ -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= 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]); diff --git a/example/libusb/gap_inquiry.c b/example/libusb/gap_inquiry.c index 832a523f0..ff36cc2b8 100644 --- a/example/libusb/gap_inquiry.c +++ b/example/libusb/gap_inquiry.c @@ -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= 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]); diff --git a/platforms/stm32-f103rb-nucleo/gap_inquiry.c b/platforms/stm32-f103rb-nucleo/gap_inquiry.c index b0414f252..84926266f 100644 --- a/platforms/stm32-f103rb-nucleo/gap_inquiry.c +++ b/platforms/stm32-f103rb-nucleo/gap_inquiry.c @@ -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= 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]);