From 3d9dd08208e6b3d995a254a644e87761fbee714b Mon Sep 17 00:00:00 2001 From: Conor Patrick Date: Sat, 5 Jan 2019 19:42:28 -0500 Subject: [PATCH] non-c99 compatibility --- fido2/ctap.c | 13 +++-- targets/stm32l432/lib/usbd/usbd_composite.c | 2 +- targets/stm32l432/lib/usbd/usbd_hid.c | 64 ++++++++++----------- 3 files changed, 40 insertions(+), 39 deletions(-) diff --git a/fido2/ctap.c b/fido2/ctap.c index 11c3e39..6b644f3 100644 --- a/fido2/ctap.c +++ b/fido2/ctap.c @@ -1,21 +1,21 @@ /* * Copyright (C) 2018 SoloKeys, Inc. - * + * * This file is part of Solo. - * + * * Solo is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * Solo is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with Solo. If not, see - * + * * This code is available under licenses for commercial use. * Please contact SoloKeys for more information. */ @@ -1030,7 +1030,8 @@ uint8_t ctap_get_assertion(CborEncoder * encoder, uint8_t * request, int length) } printf1(TAG_GA,"resulting order of creds:\n"); - for (int j = 0; j < GA.credLen; j++) + int j; + for (j = 0; j < GA.credLen; j++) { printf1(TAG_GA,"CRED ID (# %d)\n", GA.creds[j].credential.id.count); } diff --git a/targets/stm32l432/lib/usbd/usbd_composite.c b/targets/stm32l432/lib/usbd/usbd_composite.c index 64da3dc..7a3d6f1 100644 --- a/targets/stm32l432/lib/usbd/usbd_composite.c +++ b/targets/stm32l432/lib/usbd/usbd_composite.c @@ -213,7 +213,7 @@ static uint8_t USBD_Composite_Init (USBD_HandleTypeDef *pdev, uint8_t cfgidx) { static uint8_t USBD_Composite_DeInit (USBD_HandleTypeDef *pdev, uint8_t cfgidx) { int i; - for(int i = 0; i < NUM_INTERFACES; i++) { + for(i = 0; i < NUM_INTERFACES; i++) { if (USBD_Classes[i]->DeInit(pdev, cfgidx) != USBD_OK) { return USBD_FAIL; } diff --git a/targets/stm32l432/lib/usbd/usbd_hid.c b/targets/stm32l432/lib/usbd/usbd_hid.c index 3bd7ec8..a1950c3 100644 --- a/targets/stm32l432/lib/usbd/usbd_hid.c +++ b/targets/stm32l432/lib/usbd/usbd_hid.c @@ -250,38 +250,38 @@ void usb_hid_recieve_callback(uint8_t ep) HID_PACKET_SIZE); } -static void dump_pma() -{ - - register uint32_t _wRegBase = (uint32_t)USB; - _wRegBase += (uint32_t)(USB)->BTABLE + 0x400; - - uint16_t * pma_ptr = (uint16_t *)_wRegBase; - uint16_t val; - uint32_t offset = (uint32_t)(USB)->BTABLE; - - printf1(TAG_GREEN,"btable: %02lx\r\n",offset); - - for (int i = 0; i < 2; i++) - { - uint16_t addr_tx = pma_ptr[i * 4 + 0]; - uint16_t cnt_tx = pma_ptr[i * 4 + 1]; - uint16_t addr_rx = pma_ptr[i * 4 + 2]; - uint16_t cnt_rx = pma_ptr[i * 4 + 3]; - - printf1(TAG_GREEN,"EP%d addr_tx == %02x, count_tx == %02x\r\n", i, addr_tx,cnt_tx ); - printf1(TAG_GREEN,"EP%d addr_rx == %02x, count_rx == %02x\r\n", i, addr_rx,cnt_rx ); - } - - uint16_t ep1_tx = pma_ptr[1 * 4 + 0]; - - for (int i = 0; i < 32; i++) - { - val = pma_ptr[ep1_tx + i]; - printf1(TAG_GREEN,"%04x ",val); - } - printf1(TAG_GREEN,"\r\n"); -} +// static void dump_pma() +// { +// +// register uint32_t _wRegBase = (uint32_t)USB; +// _wRegBase += (uint32_t)(USB)->BTABLE + 0x400; +// +// uint16_t * pma_ptr = (uint16_t *)_wRegBase; +// uint16_t val; +// uint32_t offset = (uint32_t)(USB)->BTABLE; +// +// printf1(TAG_GREEN,"btable: %02lx\r\n",offset); +// +// for (int i = 0; i < 2; i++) +// { +// uint16_t addr_tx = pma_ptr[i * 4 + 0]; +// uint16_t cnt_tx = pma_ptr[i * 4 + 1]; +// uint16_t addr_rx = pma_ptr[i * 4 + 2]; +// uint16_t cnt_rx = pma_ptr[i * 4 + 3]; +// +// printf1(TAG_GREEN,"EP%d addr_tx == %02x, count_tx == %02x\r\n", i, addr_tx,cnt_tx ); +// printf1(TAG_GREEN,"EP%d addr_rx == %02x, count_rx == %02x\r\n", i, addr_rx,cnt_rx ); +// } +// +// uint16_t ep1_tx = pma_ptr[1 * 4 + 0]; +// +// for (int i = 0; i < 32; i++) +// { +// val = pma_ptr[ep1_tx + i]; +// printf1(TAG_GREEN,"%04x ",val); +// } +// printf1(TAG_GREEN,"\r\n"); +// } /** * @brief USBD_HID_Init