apps: unify FAR attribute usage across apps

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
Petro Karashchenko 2022-04-04 12:36:53 +02:00 committed by Xiang Xiao
parent aaa950faee
commit 319203d5d8
5 changed files with 49 additions and 46 deletions

View File

@ -42,11 +42,11 @@
struct mqttc_cfg_s
{
struct mqtt_client client;
const FAR char *host;
const FAR char *port;
const FAR char *topic;
const FAR char *msg;
const FAR char *id;
FAR const char *host;
FAR const char *port;
FAR const char *topic;
FAR const char *msg;
FAR const char *id;
uint8_t sendbuf[CONFIG_EXAMPLES_MQTTC_TXSIZE];
uint8_t recvbuf[CONFIG_EXAMPLES_MQTTC_RXSIZE];
uint32_t tmo;
@ -59,9 +59,9 @@ struct mqttc_cfg_s
****************************************************************************/
static FAR void *client_refresher(FAR void *data);
static void parsearg(int argc, char *argv[], struct mqttc_cfg_s *cfg,
int *n);
static int initserver(const FAR struct mqttc_cfg_s *cfg);
static void parsearg(int argc, FAR char *argv[], FAR struct mqttc_cfg_s *cfg,
FAR int *n);
static int initserver(FAR const struct mqttc_cfg_s *cfg);
/****************************************************************************
* Private Functions
@ -95,7 +95,8 @@ static FAR void *client_refresher(FAR void *data)
*
****************************************************************************/
static void parsearg(int argc, char *argv[], struct mqttc_cfg_s *cfg, int *n)
static void parsearg(int argc, FAR char *argv[],
FAR struct mqttc_cfg_s *cfg, FAR int *n)
{
int opt;
@ -138,11 +139,11 @@ static void parsearg(int argc, char *argv[], struct mqttc_cfg_s *cfg, int *n)
*
****************************************************************************/
static int initserver(const FAR struct mqttc_cfg_s *cfg)
static int initserver(FAR const struct mqttc_cfg_s *cfg)
{
struct addrinfo hints;
struct addrinfo *servinfo;
struct addrinfo *itr;
FAR struct addrinfo *servinfo;
FAR struct addrinfo *itr;
int fd;
int ret;
@ -208,7 +209,7 @@ static int initserver(const FAR struct mqttc_cfg_s *cfg)
* Public Functions
****************************************************************************/
int main(int argc, char *argv[])
int main(int argc, FAR char *argv[])
{
int sockfd;
enum MQTTErrors mqtterr;

View File

@ -484,7 +484,7 @@ ftpd_account_search_user(FAR struct ftpd_session_s *session,
FAR const char *user)
{
FAR struct ftpd_account_s *newaccount = NULL;
const FAR struct ftpd_account_s *account;
FAR const struct ftpd_account_s *account;
uint8_t accountflags;
account = session->head;

View File

@ -89,8 +89,8 @@ union ftpd_sockaddr_u
struct ftpd_account_s
{
struct ftpd_account_s *blink;
struct ftpd_account_s *flink;
FAR struct ftpd_account_s *blink;
FAR struct ftpd_account_s *flink;
uint8_t flags; /* See FTPD_ACCOUNTFLAG_* definitions */
FAR char *user; /* User name */
FAR char *password; /* Un-encrypted password */
@ -103,8 +103,8 @@ struct ftpd_server_s
{
int sd; /* Listen socket descriptor */
union ftpd_sockaddr_u addr; /* Listen address */
struct ftpd_account_s *head; /* Head of a list of accounts */
struct ftpd_account_s *tail; /* Tail of a list of accounts */
FAR struct ftpd_account_s *head; /* Head of a list of accounts */
FAR struct ftpd_account_s *tail; /* Tail of a list of accounts */
};
struct ftpd_stream_s
@ -118,8 +118,8 @@ struct ftpd_stream_s
struct ftpd_session_s
{
const FAR struct ftpd_server_s *server;
const FAR struct ftpd_account_s *head;
FAR const struct ftpd_server_s *server;
FAR const struct ftpd_account_s *head;
bool loggedin;
uint8_t flags; /* See TPD_SESSIONFLAG_* definitions */
int rxtimeout;
@ -149,7 +149,7 @@ struct ftpd_session_s
FAR char *renamefrom;
};
typedef int (*ftpd_cmdhandler_t)(struct ftpd_session_s *);
typedef int (*ftpd_cmdhandler_t)(FAR struct ftpd_session_s *);
struct ftpd_cmd_s
{

View File

@ -86,8 +86,9 @@ static void ppp_reject_protocol(FAR struct ppp_context_s *ctx,
FAR uint8_t *sptr;
FAR LCPPKT *pkt;
/* First copy rejected packet back, start from end and work forward, +++ Pay
* attention to buffer management when updated. Assumes fixed PPP blocks.
/* First copy rejected packet back, start from end and work forward, +++
* Pay attention to buffer management when updated. Assumes fixed PPP
* blocks.
*/
DEBUG1(("Rejecting Protocol\n"));
@ -264,11 +265,11 @@ void ppp_poll(FAR struct ppp_context_s *ctx)
#else
if (ctx->lcp_state & LCP_RX_AUTH)
{
/* lcp is asking for authentication but we do not support this. This
* should be communicated upstream but we do not have an interface
* for that right now, so just ignore it; nothing can be done. This
* also should not have been hit because upcall does not know about
* the pap message type.
/* lcp is asking for authentication but we do not support this.
* This should be communicated upstream but we do not have an
* interface for that right now, so just ignore it; nothing can be
* done. This also should not have been hit because upcall does
* not know about the pap message type.
*/
DEBUG1(("Asking for PAP, but we do not know PAP\n"));
@ -352,10 +353,10 @@ void ppp_upcall(FAR struct ppp_context_s *ctx, uint16_t protocol,
****************************************************************************/
uint16_t scan_packet(FAR struct ppp_context_s *ctx, uint16_t protocol,
FAR const FAR uint8_t * list, FAR uint8_t * buffer,
FAR const uint8_t * list, FAR uint8_t * buffer,
FAR uint8_t * options, uint16_t len)
{
FAR const FAR uint8_t *tlist;
FAR const uint8_t *tlist;
FAR uint8_t *bptr;
FAR uint8_t *tptr;
uint8_t bad = 0;
@ -369,8 +370,8 @@ uint16_t scan_packet(FAR struct ppp_context_s *ctx, uint16_t protocol,
while (bptr < options + len)
{
/* Get code and see if it matches somewhere in the list, if not we don't
* support it.
/* Get code and see if it matches somewhere in the list, if not we
* don't support it.
*/
i = *bptr++;

View File

@ -37,11 +37,11 @@
struct cfg_s
{
const FAR char *delim;
const FAR char *format;
FAR const char *format;
FAR const char *delim;
uint8_t positions[CONFIG_BOARDCTL_UNIQUEID_SIZE];
size_t count;
const FAR char *prefix;
FAR const char *prefix;
};
/****************************************************************************
@ -51,13 +51,13 @@ struct cfg_s
static int parse_positions(FAR char *arg, FAR uint8_t *positions,
FAR size_t *count)
{
char *list_save;
char *list_item;
char *range_save;
char *range_item;
char *endptr;
int pos;
int pos2;
FAR char *list_save;
FAR char *list_item;
FAR char *range_save;
FAR char *range_item;
FAR char *endptr;
FAR int pos;
FAR int pos2;
#define APPEND_POSITION(pos) \
do \
@ -227,12 +227,13 @@ static int parsearg(int argc, FAR char *argv[], FAR struct cfg_s *cfg)
int main(int argc, FAR char *argv[])
{
uint8_t uniqueid[CONFIG_BOARDCTL_UNIQUEID_SIZE];
char *formatter;
FAR char *formatter;
int i;
struct cfg_s cfg = {
.format = "02x",
};
struct cfg_s cfg =
{
"02x"
};
if (parsearg(argc, argv, &cfg) != 0)
{