mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Fixed warning
Check if we are at the end of the string properly
This commit is contained in:
parent
dec1a31bc7
commit
712bc3818d
1 changed files with 6 additions and 3 deletions
9
BTD.cpp
9
BTD.cpp
|
@ -503,9 +503,12 @@ void BTD::HCI_event_task() {
|
|||
break;
|
||||
|
||||
case EV_REMOTE_NAME_COMPLETE:
|
||||
if (!hcibuf[2]) { // check if reading is OK
|
||||
for (uint8_t i = 0; i < min(sizeof (remote_name), sizeof (hcibuf) - 9); i++)
|
||||
if (!hcibuf[2]) { // Check if reading is OK
|
||||
for (uint8_t i = 0; i < min(sizeof (remote_name), sizeof (hcibuf) - 9); i++) {
|
||||
remote_name[i] = hcibuf[9 + i];
|
||||
if (remote_name[i] == '\0') // End of string
|
||||
break;
|
||||
}
|
||||
hci_event_flag |= HCI_FLAG_REMOTE_NAME_COMPLETE;
|
||||
}
|
||||
break;
|
||||
|
@ -789,7 +792,7 @@ void BTD::HCI_task() {
|
|||
#ifdef DEBUG_USB_HOST
|
||||
Notify(PSTR("\r\nRemote Name: "), 0x80);
|
||||
for (uint8_t i = 0; i < 30; i++) {
|
||||
if (remote_name[i] == NULL)
|
||||
if (remote_name[i] == '\0') // End of string
|
||||
break;
|
||||
Notifyc(remote_name[i], 0x80);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue