Skip to content

Commit d84bf7f

Browse files
author
Cruz Monrreal
authored
Merge pull request ARMmbed#7692 from 0xc0170/fix_netsocket_style
netsocket: astyle fix
2 parents 54bc12f + 88a7416 commit d84bf7f

26 files changed

+156
-145
lines changed

features/netsocket/CellularBase.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ class CellularBase: public NetworkInterface {
112112
*/
113113
virtual const char *get_gateway() = 0;
114114

115-
virtual CellularBase *cellularBase() {
115+
virtual CellularBase *cellularBase()
116+
{
116117
return this;
117118
}
118119

features/netsocket/DNS.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class DNS {
3535
* @return 0 on success, negative error code on failure
3636
*/
3737
virtual nsapi_error_t gethostbyname(const char *host,
38-
SocketAddress *address, nsapi_version_t version = NSAPI_UNSPEC) = 0;
38+
SocketAddress *address, nsapi_version_t version = NSAPI_UNSPEC) = 0;
3939

4040
/** Hostname translation callback (asynchronous)
4141
*
@@ -75,7 +75,7 @@ class DNS {
7575
* and can be passed to cancel
7676
*/
7777
virtual nsapi_value_or_error_t gethostbyname_async(const char *host, hostbyname_cb_t callback,
78-
nsapi_version_t version = NSAPI_UNSPEC) = 0;
78+
nsapi_version_t version = NSAPI_UNSPEC) = 0;
7979

8080
/** Cancels asynchronous hostname translation
8181
*

features/netsocket/EMACInterface.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ nsapi_error_t EMACInterface::connect()
6161
}
6262

6363
return _interface->bringup(_dhcp,
64-
_ip_address[0] ? _ip_address : 0,
65-
_netmask[0] ? _netmask : 0,
66-
_gateway[0] ? _gateway : 0,
67-
DEFAULT_STACK,
68-
_blocking);
64+
_ip_address[0] ? _ip_address : 0,
65+
_netmask[0] ? _netmask : 0,
66+
_gateway[0] ? _gateway : 0,
67+
DEFAULT_STACK,
68+
_blocking);
6969
}
7070

7171
nsapi_error_t EMACInterface::disconnect()

features/netsocket/EMACInterface.h

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@
3636
* the credentials have been set. This is necessary to support specialised
3737
* applications such as 6LoWPAN mesh border routers.
3838
*/
39-
class EMACInterface : public virtual NetworkInterface
40-
{
39+
class EMACInterface : public virtual NetworkInterface {
4140
public:
4241
/** Create an EMAC-based network interface.
4342
*
@@ -52,9 +51,8 @@ class EMACInterface : public virtual NetworkInterface
5251
* @param emac Reference to EMAC to use
5352
* @param stack Reference to onboard-network stack to use
5453
*/
55-
EMACInterface(
56-
EMAC &emac = EMAC::get_default_instance(),
57-
OnboardNetworkStack &stack = OnboardNetworkStack::get_default_instance());
54+
EMACInterface(EMAC &emac = EMAC::get_default_instance(),
55+
OnboardNetworkStack &stack = OnboardNetworkStack::get_default_instance());
5856

5957
/** Set a static IP address
6058
*
@@ -67,8 +65,7 @@ class EMACInterface : public virtual NetworkInterface
6765
* @param gateway Null-terminated representation of the local gateway
6866
* @return 0 on success, negative error code on failure
6967
*/
70-
virtual nsapi_error_t set_network(
71-
const char *ip_address, const char *netmask, const char *gateway);
68+
virtual nsapi_error_t set_network(const char *ip_address, const char *netmask, const char *gateway);
7269

7370
/** Enable or disable DHCP on the network
7471
*
@@ -94,7 +91,7 @@ class EMACInterface : public virtual NetworkInterface
9491
* Provided MAC address is intended for info or debug purposes and
9592
* may not be provided if the underlying network interface does not
9693
* provide a MAC address
97-
*
94+
*
9895
* @return Null-terminated representation of the local MAC address
9996
* or null if no MAC address is available
10097
*/
@@ -109,7 +106,7 @@ class EMACInterface : public virtual NetworkInterface
109106

110107
/** Get the local network mask
111108
*
112-
* @return Null-terminated representation of the local network mask
109+
* @return Null-terminated representation of the local network mask
113110
* or null if no network mask has been recieved
114111
*/
115112
virtual const char *get_netmask();
@@ -148,16 +145,20 @@ class EMACInterface : public virtual NetworkInterface
148145
*
149146
* @return Reference to the EMAC in use
150147
*/
151-
EMAC &get_emac() const { return _emac; }
148+
EMAC &get_emac() const
149+
{
150+
return _emac;
151+
}
152152

153-
virtual EMACInterface *emacInterface() {
153+
virtual EMACInterface *emacInterface()
154+
{
154155
return this;
155156
}
156157

157158
protected:
158159
/** Provide access to the underlying stack
159160
*
160-
* @return The underlying network stack
161+
* @return The underlying network stack
161162
*/
162163
virtual NetworkStack *get_stack();
163164

features/netsocket/EthInterface.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727
*
2828
* Common interface that is shared between ethernet hardware.
2929
*/
30-
class EthInterface : public virtual NetworkInterface
31-
{
30+
class EthInterface : public virtual NetworkInterface {
3231
public:
3332

34-
virtual EthInterface *ethInterface() {
33+
virtual EthInterface *ethInterface()
34+
{
3535
return this;
3636
}
3737

features/netsocket/EthernetInterface.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
/** EthernetInterface class
2626
* Implementation of the NetworkStack for an EMAC-based Ethernet driver
2727
*/
28-
class EthernetInterface : public EMACInterface, public EthInterface
29-
{
28+
class EthernetInterface : public EMACInterface, public EthInterface {
3029
public:
3130
/** Create an EMAC-based ethernet interface.
3231
*
@@ -41,9 +40,8 @@ class EthernetInterface : public EMACInterface, public EthInterface
4140
* @param emac Reference to EMAC to use
4241
* @param stack Reference to onboard-network stack to use
4342
*/
44-
EthernetInterface(
45-
EMAC &emac = EMAC::get_default_instance(),
46-
OnboardNetworkStack &stack = OnboardNetworkStack::get_default_instance()) : EMACInterface(emac, stack) { }
43+
EthernetInterface(EMAC &emac = EMAC::get_default_instance(),
44+
OnboardNetworkStack &stack = OnboardNetworkStack::get_default_instance()) : EMACInterface(emac, stack) { }
4745
};
4846

4947
#endif

features/netsocket/InternetSocket.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ nsapi_error_t InternetSocket::getsockopt(int level, int optname, void *optval, u
186186
}
187187
void InternetSocket::event()
188188
{
189-
_event_flag.set(READ_FLAG|WRITE_FLAG);
189+
_event_flag.set(READ_FLAG | WRITE_FLAG);
190190

191191
_pending += 1;
192192
if (_callback && _pending == 1) {

features/netsocket/InternetSocket.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ class InternetSocket : public Socket {
5050
nsapi_error_t open(NetworkStack *stack);
5151

5252
template <typename S>
53-
nsapi_error_t open(S *stack) {
53+
nsapi_error_t open(S *stack)
54+
{
5455
return open(nsapi_create_stack(stack));
5556
}
5657

@@ -196,8 +197,8 @@ class InternetSocket : public Socket {
196197
* mbed OS and has been known to cause confusion. Replaced by Socket::sigio.
197198
*/
198199
MBED_DEPRECATED_SINCE("mbed-os-5.4",
199-
"The behaviour of Socket::attach differs from other attach functions in "
200-
"mbed OS and has been known to cause confusion. Replaced by Socket::sigio.")
200+
"The behaviour of Socket::attach differs from other attach functions in "
201+
"mbed OS and has been known to cause confusion. Replaced by Socket::sigio.")
201202
void attach(mbed::Callback<void()> func);
202203

203204
/** Register a callback on state change of the socket
@@ -209,9 +210,10 @@ class InternetSocket : public Socket {
209210
*/
210211
template <typename T, typename M>
211212
MBED_DEPRECATED_SINCE("mbed-os-5.1",
212-
"The attach function does not support cv-qualifiers. Replaced by "
213-
"attach(callback(obj, method)).")
214-
void attach(T *obj, M method) {
213+
"The attach function does not support cv-qualifiers. Replaced by "
214+
"attach(callback(obj, method)).")
215+
void attach(T *obj, M method)
216+
{
215217
attach(mbed::callback(obj, method));
216218
}
217219

features/netsocket/MeshInterface.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727
*
2828
* Common interface that is shared between mesh hardware
2929
*/
30-
class MeshInterface : public virtual NetworkInterface
31-
{
30+
class MeshInterface : public virtual NetworkInterface {
3231
public:
3332

34-
virtual MeshInterface *meshInterface() {
33+
virtual MeshInterface *meshInterface()
34+
{
3535
return this;
3636
}
3737

features/netsocket/NetworkInterface.h

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ class NetworkInterface: public DNS {
122122
* @param gateway Null-terminated representation of the local gateway
123123
* @return 0 on success, negative error code on failure
124124
*/
125-
virtual nsapi_error_t set_network(
126-
const char *ip_address, const char *netmask, const char *gateway);
125+
virtual nsapi_error_t set_network(const char *ip_address, const char *netmask, const char *gateway);
127126

128127
/** Enable or disable DHCP on the network
129128
*
@@ -163,7 +162,7 @@ class NetworkInterface: public DNS {
163162
* @return 0 on success, negative error code on failure
164163
*/
165164
virtual nsapi_error_t gethostbyname(const char *host,
166-
SocketAddress *address, nsapi_version_t version = NSAPI_UNSPEC);
165+
SocketAddress *address, nsapi_version_t version = NSAPI_UNSPEC);
167166

168167
/** Hostname translation callback (asynchronous)
169168
*
@@ -203,7 +202,7 @@ class NetworkInterface: public DNS {
203202
* and can be passed to cancel
204203
*/
205204
virtual nsapi_value_or_error_t gethostbyname_async(const char *host, hostbyname_cb_t callback,
206-
nsapi_version_t version = NSAPI_UNSPEC);
205+
nsapi_version_t version = NSAPI_UNSPEC);
207206

208207
/** Cancels asynchronous hostname translation
209208
*
@@ -245,27 +244,32 @@ class NetworkInterface: public DNS {
245244
virtual nsapi_error_t set_blocking(bool blocking);
246245

247246
/** Dynamic downcast to an EthInterface */
248-
virtual EthInterface *ethInterface() {
247+
virtual EthInterface *ethInterface()
248+
{
249249
return 0;
250250
}
251251

252252
/** Dynamic downcast to a WiFiInterface */
253-
virtual WiFiInterface *wifiInterface() {
253+
virtual WiFiInterface *wifiInterface()
254+
{
254255
return 0;
255256
}
256257

257258
/** Dynamic downcast to a MeshInterface */
258-
virtual MeshInterface *meshInterface() {
259+
virtual MeshInterface *meshInterface()
260+
{
259261
return 0;
260262
}
261263

262264
/** Dynamic downcast to a CellularBase */
263-
virtual CellularBase *cellularBase() {
265+
virtual CellularBase *cellularBase()
266+
{
264267
return 0;
265268
}
266269

267270
/** Dynamic downcast to an EMACInterface */
268-
virtual EMACInterface *emacInterface() {
271+
virtual EMACInterface *emacInterface()
272+
{
269273
return 0;
270274
}
271275

features/netsocket/NetworkStack.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,13 @@ call_in_callback_cb_t NetworkStack::get_call_in_callback()
148148
}
149149

150150
// NetworkStackWrapper class for encapsulating the raw nsapi_stack structure
151-
class NetworkStackWrapper : public NetworkStack
152-
{
151+
class NetworkStackWrapper : public NetworkStack {
153152
private:
154153
inline nsapi_stack_t *_stack()
155154
{
156155
return reinterpret_cast<nsapi_stack_t *>(
157-
reinterpret_cast<uint8_t *>(this)
158-
- offsetof(nsapi_stack_t, _stack_buffer));
156+
reinterpret_cast<uint8_t *>(this)
157+
- offsetof(nsapi_stack_t, _stack_buffer));
159158
}
160159

161160
inline const nsapi_stack_api_t *_stack_api()
@@ -358,7 +357,7 @@ class NetworkStackWrapper : public NetworkStack
358357
NetworkStack *nsapi_create_stack(nsapi_stack_t *stack)
359358
{
360359
MBED_STATIC_ASSERT(sizeof stack->_stack_buffer >= sizeof(NetworkStackWrapper),
361-
"The nsapi_stack_t stack buffer must fit a NetworkStackWrapper");
360+
"The nsapi_stack_t stack buffer must fit a NetworkStackWrapper");
362361
return new (stack->_stack_buffer) NetworkStackWrapper;
363362
}
364363

0 commit comments

Comments
 (0)