Skip to content

Commit f3c104b

Browse files
xiaoxiang781216patacongo
authored andcommitted
Fix nxstyle warning
Signed-off-by: Xiang Xiao <[email protected]>
1 parent 86080a1 commit f3c104b

File tree

6 files changed

+55
-33
lines changed

6 files changed

+55
-33
lines changed

examples/modbus/modbus_main.c

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/****************************************************************************
2-
* apps/examples/modbus/main.c
2+
* apps/examples/modbus/modbus_main.c
33
*
44
* Licensed to the Apache Software Foundation (ASF) under one or more
55
* contributor license agreements. See the NOTICE file distributed with
@@ -140,7 +140,10 @@ static void modbus_showusage(FAR const char *progname, int exitcode);
140140
****************************************************************************/
141141

142142
static struct modbus_state_s g_modbus;
143-
static const uint8_t g_slaveid[] = { 0xaa, 0xbb, 0xcc };
143+
static const uint8_t g_slaveid[] =
144+
{
145+
0xaa, 0xbb, 0xcc
146+
};
144147

145148
/****************************************************************************
146149
* Private Functions
@@ -191,7 +194,8 @@ static inline int modbus_initialize(void)
191194
*/
192195

193196
mberr = eMBInit(MB_RTU, 0x0a, CONFIG_EXAMPLES_MODBUS_PORT,
194-
CONFIG_EXAMPLES_MODBUS_BAUD, CONFIG_EXAMPLES_MODBUS_PARITY);
197+
CONFIG_EXAMPLES_MODBUS_BAUD,
198+
CONFIG_EXAMPLES_MODBUS_PARITY);
195199
if (mberr != MB_ENOERR)
196200
{
197201
fprintf(stderr, "modbus_main: "
@@ -231,6 +235,7 @@ static inline int modbus_initialize(void)
231235
return OK;
232236

233237
errout_with_modbus:
238+
234239
/* Release hardware resources. */
235240

236241
eMBClose();
@@ -376,7 +381,8 @@ static inline int modbus_create_pollthread(void)
376381

377382
if (g_modbus.threadstate == STOPPED)
378383
{
379-
ret = pthread_create(&g_modbus.threadid, NULL, modbus_pollthread, NULL);
384+
ret = pthread_create(&g_modbus.threadid, NULL,
385+
modbus_pollthread, NULL);
380386
}
381387
else
382388
{
@@ -444,7 +450,8 @@ int main(int argc, FAR char *argv[])
444450
if (ret != OK)
445451
{
446452
fprintf(stderr, "modbus_main: "
447-
"ERROR: modbus_create_pollthread failed: %d\n", ret);
453+
"ERROR: modbus_create_pollthread failed: %d\n",
454+
ret);
448455
exit(EXIT_FAILURE);
449456
}
450457
}
@@ -536,8 +543,8 @@ eMBErrorCode eMBRegInputCB(uint8_t *buffer, uint16_t address, uint16_t nregs)
536543
*
537544
****************************************************************************/
538545

539-
eMBErrorCode eMBRegHoldingCB(uint8_t *buffer, uint16_t address, uint16_t nregs,
540-
eMBRegisterMode mode)
546+
eMBErrorCode eMBRegHoldingCB(uint8_t *buffer, uint16_t address,
547+
uint16_t nregs, eMBRegisterMode mode)
541548
{
542549
eMBErrorCode mberr = MB_ENOERR;
543550
int index;
@@ -551,6 +558,7 @@ eMBErrorCode eMBRegHoldingCB(uint8_t *buffer, uint16_t address, uint16_t nregs,
551558
switch (mode)
552559
{
553560
/* Pass current register values to the protocol stack. */
561+
554562
case MB_REG_READ:
555563
while (nregs > 0)
556564
{
@@ -592,8 +600,8 @@ eMBErrorCode eMBRegHoldingCB(uint8_t *buffer, uint16_t address, uint16_t nregs,
592600
*
593601
****************************************************************************/
594602

595-
eMBErrorCode eMBRegCoilsCB(uint8_t *buffer, uint16_t address, uint16_t ncoils,
596-
eMBRegisterMode mode)
603+
eMBErrorCode eMBRegCoilsCB(uint8_t *buffer, uint16_t address,
604+
uint16_t ncoils, eMBRegisterMode mode)
597605
{
598606
eMBErrorCode mberr = MB_ENOERR;
599607
int index;
@@ -649,7 +657,8 @@ eMBErrorCode eMBRegCoilsCB(uint8_t *buffer, uint16_t address, uint16_t ncoils,
649657
*
650658
****************************************************************************/
651659

652-
eMBErrorCode eMBRegDiscreteCB(uint8_t *buffer, uint16_t address, uint16_t ndiscrete)
660+
eMBErrorCode eMBRegDiscreteCB(uint8_t *buffer, uint16_t address,
661+
uint16_t ndiscrete)
653662
{
654663
return MB_ENOREG;
655664
}

interpreters/bas/bas_fs.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
* The above copyright notice and this permission notice shall be included in
1414
* all copies or substantial portions of the Software.
1515
*
16-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17-
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1818
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
1919
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2020
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
@@ -69,20 +69,24 @@
6969

7070
struct FileStream
7171
{
72-
int dev,tty;
72+
int dev;
73+
int tty;
7374
int recLength;
7475

7576
int infd;
7677
char inBuf[1024];
77-
size_t inSize,inCapacity;
78+
size_t inSize;
79+
size_t inCapacity;
7880

7981
int outfd;
8082
int outPos;
8183
int outLineWidth;
8284
int outColWidth;
8385
char outBuf[1024];
84-
size_t outSize,outCapacity;
85-
int outforeground,outbackground;
86+
size_t outSize;
87+
size_t outCapacity;
88+
int outforeground;
89+
int outbackground;
8690

8791
int randomfd;
8892
int recPos;

modbus/nuttx/portserial.c

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,8 @@ bool xMBPortSerialInit(uint8_t ucPort, speed_t ulBaudRate,
214214
}
215215
else if (tcgetattr(iSerialFd, &xOldTIO) != 0)
216216
{
217-
vMBPortLog(MB_LOG_ERROR, "SER-INIT", "Can't get settings from port %s: %d\n",
217+
vMBPortLog(MB_LOG_ERROR,
218+
"SER-INIT", "Can't get settings from port %s: %d\n",
218219
szDevice, errno);
219220
}
220221
else
@@ -261,22 +262,24 @@ bool xMBPortSerialInit(uint8_t ucPort, speed_t ulBaudRate,
261262
*
262263
* (1) In NuttX, cfset[i|o]speed always return OK so failures will
263264
* really only be reported when tcsetattr() is called.
264-
* (2) NuttX does not support separate input and output speeds so it
265-
* is not necessary to call both cfsetispeed() and
265+
* (2) NuttX does not support separate input and output speeds so
266+
* it is not necessary to call both cfsetispeed() and
266267
* cfsetospeed(), and
267268
* (3) In NuttX, the input value to cfiset[i|o]speed is not
268-
* encoded, but is the absolute baud value. The following might
269-
* not be
269+
* encoded, but is the absolute baud value. The following
270+
* might not be
270271
*/
271272

272273
if (cfsetispeed(&xNewTIO, ulBaudRate) != 0 /* || cfsetospeed(&xNewTIO, ulBaudRate) != 0 */)
273274
{
274-
vMBPortLog(MB_LOG_ERROR, "SER-INIT", "Can't set baud rate %ld for port %s: %d\n",
275+
vMBPortLog(MB_LOG_ERROR, "SER-INIT",
276+
"Can't set baud rate %ld for port %s: %d\n",
275277
ulBaudRate, szDevice, errno);
276278
}
277279
else if (tcsetattr(iSerialFd, TCSANOW, &xNewTIO) != 0)
278280
{
279-
vMBPortLog(MB_LOG_ERROR, "SER-INIT", "Can't set settings for port %s: %d\n",
281+
vMBPortLog(MB_LOG_ERROR,
282+
"SER-INIT", "Can't set settings for port %s: %d\n",
280283
szDevice, errno);
281284
}
282285
else
@@ -344,7 +347,8 @@ bool xMBPortSerialPoll(void)
344347
}
345348
else
346349
{
347-
vMBPortLog(MB_LOG_ERROR, "SER-POLL", "read failed on serial device: %d\n",
350+
vMBPortLog(MB_LOG_ERROR,
351+
"SER-POLL", "read failed on serial device: %d\n",
348352
errno);
349353
bStatus = false;
350354
}
@@ -361,7 +365,8 @@ bool xMBPortSerialPoll(void)
361365

362366
if (!prvbMBPortSerialWrite(&ucBuffer[0], uiTxBufferPos))
363367
{
364-
vMBPortLog(MB_LOG_ERROR, "SER-POLL", "write failed on serial device: %d\n",
368+
vMBPortLog(MB_LOG_ERROR,
369+
"SER-POLL", "write failed on serial device: %d\n",
365370
errno);
366371
bStatus = false;
367372
}

modbus/nuttx/portserial_m.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ static struct termios xOldTIO;
8787

8888
static bool prvbMBMasterPortSerialRead(uint8_t *pucBuffer, uint16_t usNBytes,
8989
uint16_t *usNBytesRead);
90-
static bool prvbMBMasterPortSerialWrite(uint8_t *pucBuffer, uint16_t usNBytes);
90+
static bool prvbMBMasterPortSerialWrite(uint8_t *pucBuffer,
91+
uint16_t usNBytes);
9192

9293
/****************************************************************************
9394
* Private Functions
@@ -142,7 +143,8 @@ static bool prvbMBMasterPortSerialRead(uint8_t *pucBuffer, uint16_t usNBytes,
142143
return bResult;
143144
}
144145

145-
static bool prvbMBMasterPortSerialWrite(uint8_t *pucBuffer, uint16_t usNBytes)
146+
static bool prvbMBMasterPortSerialWrite(uint8_t *pucBuffer,
147+
uint16_t usNBytes)
146148
{
147149
ssize_t res;
148150
size_t left = (size_t) usNBytes;
@@ -268,12 +270,12 @@ bool xMBMasterPortSerialInit(uint8_t ucPort, speed_t ulBaudRate,
268270
*
269271
* (1) In NuttX, cfset[i|o]speed always return OK so failures will
270272
* really only be reported when tcsetattr() is called.
271-
* (2) NuttX does not support separate input and output speeds so it
272-
* is not necessary to call both cfsetispeed() and
273+
* (2) NuttX does not support separate input and output speeds so
274+
* it is not necessary to call both cfsetispeed() and
273275
* cfsetospeed(), and
274276
* (3) In NuttX, the input value to cfiset[i|o]speed is not
275-
* encoded, but is the absolute baud value. The following might
276-
* not be
277+
* encoded, but is the absolute baud value. The following
278+
* might not be
277279
*/
278280

279281
if (cfsetispeed(&xNewTIO, ulBaudRate) != 0 /* || cfsetospeed(&xNewTIO, ulBaudRate) != 0 */)
@@ -313,7 +315,7 @@ bool xMBMasterPortSerialSetTimeout(uint32_t ulNewTimeoutMs)
313315
return true;
314316
}
315317

316-
void vMBMasterPortClose( void )
318+
void vMBMasterPortClose(void)
317319
{
318320
if (iSerialFd != -1)
319321
{
@@ -323,7 +325,7 @@ void vMBMasterPortClose( void )
323325
}
324326
}
325327

326-
bool xMBMasterPortSerialPoll( void )
328+
bool xMBMasterPortSerialPoll(void)
327329
{
328330
bool bStatus = true;
329331
uint16_t usBytesRead;

system/zmodem/rz_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ int main(int argc, FAR char *argv[])
160160
zmr_release(handle);
161161

162162
errout_with_device:
163+
163164
/* Flush the serial output to assure do not hang trying to drain it */
164165

165166
tcflush(fd, TCIOFLUSH);

system/zmodem/sz_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ int main(int argc, FAR char *argv[])
260260
zms_release(handle);
261261

262262
errout_with_device:
263+
263264
/* Flush the serial output to assure do not hang trying to drain it */
264265

265266
tcflush(fd, TCIOFLUSH);

0 commit comments

Comments
 (0)