From 59c9d7700d5a1614e779ed55149f96ef3ff3da4a Mon Sep 17 00:00:00 2001 From: Kimmo Vaisanen Date: Tue, 17 Dec 2019 12:20:27 +0200 Subject: [PATCH] Astyle fix --- .../SAMSUNG_S5JS100_L3IP_Driver.cpp | 38 +++++++------------ .../SAMSUNG_S5JS100_L3IP_Driver.h | 5 +-- 2 files changed, 15 insertions(+), 28 deletions(-) diff --git a/features/cellular/framework/targets/Samsung/TARGET_S5JS100/SAMSUNG_S5JS100_L3IP_Driver.cpp b/features/cellular/framework/targets/Samsung/TARGET_S5JS100/SAMSUNG_S5JS100_L3IP_Driver.cpp index 2905e9a65cd..add8643833c 100644 --- a/features/cellular/framework/targets/Samsung/TARGET_S5JS100/SAMSUNG_S5JS100_L3IP_Driver.cpp +++ b/features/cellular/framework/targets/Samsung/TARGET_S5JS100/SAMSUNG_S5JS100_L3IP_Driver.cpp @@ -25,7 +25,7 @@ #define S5JS100_BUFF_ALIGNMENT 0 -SAMSUNG_S5JS100_L3IP_Driver::SAMSUNG_S5JS100_L3IP_Driver(const char* ifname, int mtu) +SAMSUNG_S5JS100_L3IP_Driver::SAMSUNG_S5JS100_L3IP_Driver(const char *ifname, int mtu) : _io_device(NULL), _mtu(mtu) { @@ -49,13 +49,11 @@ bool SAMSUNG_S5JS100_L3IP_Driver::link_out(net_stack_mem_buf_t *buf) const int total_len = _memory_manager->get_total_len(buf); net_stack_mem_buf_t *cont_buf = _memory_manager->alloc_heap(total_len, S5JS100_BUFF_ALIGNMENT); - if (cont_buf) - { + if (cont_buf) { uint8_t *cont_buf_ptr = (uint8_t *)_memory_manager->get_ptr(cont_buf); /* copy all frames to continuous buffer */ - for (net_stack_mem_buf_t *q = buf; q != NULL; q = _memory_manager->get_next(q)) - { + for (net_stack_mem_buf_t *q = buf; q != NULL; q = _memory_manager->get_next(q)) { const uint8_t *ptr = (const uint8_t *)_memory_manager->get_ptr(q); const uint16_t len = _memory_manager->get_len(q); @@ -63,17 +61,14 @@ bool SAMSUNG_S5JS100_L3IP_Driver::link_out(net_stack_mem_buf_t *buf) cont_buf_ptr += len; } - const int sent = _io_device->write((const char*)_memory_manager->get_ptr(cont_buf), total_len); + const int sent = _io_device->write((const char *)_memory_manager->get_ptr(cont_buf), total_len); tr_debug("link_out (%s): sent %d/%d bytes", _ifname, sent, total_len); - if (sent != total_len) - { + if (sent != total_len) { result = false; } _memory_manager->free(cont_buf); - } - else - { + } else { tr_error("Unable to allocate buffer for TX data!"); result = false; } @@ -87,14 +82,11 @@ bool SAMSUNG_S5JS100_L3IP_Driver::power_up() { _io_device = getModemIoDeviceByName(_ifname); tr_debug("power_up: io_device = %p", _io_device); - if (_io_device) - { + if (_io_device) { _io_device->register_ReadCb(read_cb, this); _l3ip_link_state_cb(true); return true; - } - else - { + } else { tr_error("Unable to get modem IO device!"); return false; } @@ -150,8 +142,7 @@ void SAMSUNG_S5JS100_L3IP_Driver::set_all_multicast(bool all) void SAMSUNG_S5JS100_L3IP_Driver::power_down() { tr_debug("power_down"); - if (_io_device) - { + if (_io_device) { _io_device->register_ReadCb(NULL, NULL); _io_device = NULL; } @@ -167,22 +158,19 @@ void SAMSUNG_S5JS100_L3IP_Driver::read_cb(mio_buf *buf, void *param) MBED_ASSERT(buf); MBED_ASSERT(param); - SAMSUNG_S5JS100_L3IP_Driver *driver = (SAMSUNG_S5JS100_L3IP_Driver*)param; + SAMSUNG_S5JS100_L3IP_Driver *driver = (SAMSUNG_S5JS100_L3IP_Driver *)param; driver->packet_rx(buf); } -void SAMSUNG_S5JS100_L3IP_Driver::packet_rx(mio_buf * buf) +void SAMSUNG_S5JS100_L3IP_Driver::packet_rx(mio_buf *buf) { tr_debug("packet_rx (%s): buf = %p, len = %d, ch = %d", _ifname, buf->data, buf->len, buf->ch); net_stack_mem_buf_t *read_buf = _memory_manager->alloc_heap(buf->len, S5JS100_BUFF_ALIGNMENT); - if (read_buf) - { + if (read_buf) { _memory_manager->copy_to_buf(read_buf, buf->data, buf->len); _l3ip_link_input_cb(read_buf); - } - else - { + } else { tr_error("Unable to allocate buffer for RX data!"); } } diff --git a/features/cellular/framework/targets/Samsung/TARGET_S5JS100/SAMSUNG_S5JS100_L3IP_Driver.h b/features/cellular/framework/targets/Samsung/TARGET_S5JS100/SAMSUNG_S5JS100_L3IP_Driver.h index 55774989047..28d90f978ed 100644 --- a/features/cellular/framework/targets/Samsung/TARGET_S5JS100/SAMSUNG_S5JS100_L3IP_Driver.h +++ b/features/cellular/framework/targets/Samsung/TARGET_S5JS100/SAMSUNG_S5JS100_L3IP_Driver.h @@ -21,8 +21,7 @@ #include "L3IP.h" #include "modem_io_device.h" -class SAMSUNG_S5JS100_L3IP_Driver : public L3IP -{ +class SAMSUNG_S5JS100_L3IP_Driver : public L3IP { public: @@ -151,7 +150,7 @@ class SAMSUNG_S5JS100_L3IP_Driver : public L3IP l3ip_link_state_change_cb_t _l3ip_link_state_cb; /**< Link state change callback */ NetStackMemoryManager *_memory_manager; /**< Memory manager */ - ModemIoDevice* _io_device; /**< Handle to modem */ + ModemIoDevice *_io_device; /**< Handle to modem */ char _ifname[32]; /**< Interface name */ int _mtu; /**< MTU */ };