Remove the unnecessary cast for main_t, NULL and argv

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-10-16 01:55:16 +08:00 committed by Petro Karashchenko
parent d6f787afca
commit b659f0fbdf
100 changed files with 559 additions and 449 deletions

View File

@ -169,8 +169,7 @@ int exec_builtin(FAR const char *appname, FAR char * const *argv,
/* Start the built-in */
pid = task_spawn(builtin->name, builtin->main, &file_actions,
&attr, (argv) ? &argv[1] : (FAR char * const *)NULL,
(FAR char * const *)NULL);
&attr, argv ? &argv[1] : NULL, NULL);
ret = pid < 0 ? -pid : 0;
}

View File

@ -44,7 +44,7 @@ public:
CThingSayer(void)
{
printf("CThingSayer::CThingSayer: I am!\n");
szWhatToSay = (const char*)NULL;
szWhatToSay = NULL;
}
~CThingSayer(void)
@ -55,7 +55,7 @@ public:
printf("CThingSayer::~CThingSayer: I will never say '%s' again\n",
szWhatToSay);
}
szWhatToSay = (const char*)NULL;
szWhatToSay = NULL;
}
void Initialize(const char *czSayThis)

View File

@ -59,7 +59,7 @@ static CThingSayer MyThingSayer;
CThingSayer::CThingSayer(void)
{
printf("CThingSayer::CThingSayer: I am!\n");
szWhatToSay = (const char*)NULL;
szWhatToSay = NULL;
}
CThingSayer::~CThingSayer(void)
@ -70,7 +70,7 @@ CThingSayer::~CThingSayer(void)
printf("CThingSayer::~CThingSayer: I will never say '%s' again\n",
szWhatToSay);
}
szWhatToSay = (const char*)NULL;
szWhatToSay = NULL;
}
void CThingSayer::Initialize(const char *czSayThis)

View File

@ -76,7 +76,7 @@ static CThingSayer MyThingSayer;
CThingSayer::CThingSayer(void)
{
cout << "CThingSayer::CThingSayer: I am!" << endl;
szWhatToSay = (const char*)NULL;
szWhatToSay = NULL;
}
CThingSayer::~CThingSayer(void)
@ -87,7 +87,7 @@ CThingSayer::~CThingSayer(void)
cout << "CThingSayer::~CThingSayer: I will never say '"
<< szWhatToSay << "' again" << endl;
}
szWhatToSay = (const char*)NULL;
szWhatToSay = NULL;
}
void CThingSayer::Initialize(const char *czSayThis)

View File

@ -118,7 +118,7 @@ const char *MyException::what() const throw()
CThingSayer::CThingSayer(void)
{
cout << "CThingSayer::CThingSayer: I am!" << endl;
szWhatToSay = (const char*)NULL;
szWhatToSay = NULL;
}
CThingSayer::~CThingSayer(void)
@ -129,7 +129,7 @@ CThingSayer::~CThingSayer(void)
cout << "CThingSayer::~CThingSayer: I will never say '"
<< szWhatToSay << "' again" << endl;
}
szWhatToSay = (const char*)NULL;
szWhatToSay = NULL;
}
void CThingSayer::Initialize(const char *czSayThis)

View File

@ -110,7 +110,7 @@ static inline bool net_incomingdata(struct net_listener_s *nls, int sd)
/* Read data from the socket */
#ifdef FIONBIO
for (;;)
for (; ; )
#endif
{
printf("lo_listener: Read data from sd=%d\n", sd);
@ -135,7 +135,7 @@ static inline bool net_incomingdata(struct net_listener_s *nls, int sd)
}
else
{
nls->buffer[ret]='\0';
nls->buffer[ret] = '\0';
printf("lo_listener: Read '%s' (%d bytes)\n", nls->buffer, ret);
/* Echo the data back to the client */
@ -147,9 +147,10 @@ static inline bool net_incomingdata(struct net_listener_s *nls, int sd)
{
if (errno != EINTR)
{
printf("lo_listener: Send failed sd=%d: %d\n", sd, errno);
net_closeclient(nls, sd);
return false;
printf("lo_listener: Send failed sd=%d: %d\n",
sd, errno);
net_closeclient(nls, sd);
return false;
}
}
else
@ -175,10 +176,11 @@ static inline bool net_connection(struct net_listener_s *nls)
/* Loop until all connections have been processed */
#ifdef FIONBIO
for (;;)
for (; ; )
#endif
{
printf("lo_listener: Accepting new connection on sd=%d\n", nls->listensd);
printf("lo_listener: Accepting new connection on sd=%d\n",
nls->listensd);
sd = accept(nls->listensd, NULL, NULL);
if (sd < 0)
@ -231,7 +233,8 @@ static inline bool net_mksocket(struct net_listener_s *nls)
/* Configure the socket */
value = 1;
ret = setsockopt(nls->listensd, SOL_SOCKET, SO_REUSEADDR, (char*)&value, sizeof(int));
ret = setsockopt(nls->listensd, SOL_SOCKET,
SO_REUSEADDR, &value, sizeof(int));
if (ret < 0)
{
printf("lo_listener: setsockopt failed: %d\n", errno);
@ -257,7 +260,8 @@ static inline bool net_mksocket(struct net_listener_s *nls)
nls->addr.sin_family = AF_INET;
nls->addr.sin_port = htons(LISTENER_PORT);
nls->addr.sin_addr.s_addr = htonl(LO_ADDRESS);
ret = bind(nls->listensd, (struct sockaddr *)&nls->addr, sizeof(struct sockaddr_in));
ret = bind(nls->listensd, (struct sockaddr *)&nls->addr,
sizeof(struct sockaddr_in));
if (ret < 0)
{
printf("lo_listener: bind failed: %d\n", errno);
@ -299,7 +303,7 @@ void *lo_listener(pthread_addr_t pvarg)
memset(&nls, 0, sizeof(struct net_listener_s));
if (!net_mksocket(&nls))
{
return (void *)(uintptr_t)1;
return (void *)(uintptr_t)1;
}
/* Initialize the 'master' file descriptor set */
@ -317,13 +321,14 @@ void *lo_listener(pthread_addr_t pvarg)
* on any of the connect sockets.
*/
for (;;)
for (; ; )
{
/* Wait on select */
printf("lo_listener: Calling select(), listener sd=%d\n", nls.listensd);
printf("lo_listener: Calling select(), listener sd=%d\n",
nls.listensd);
memcpy(&nls.working, &nls.master, sizeof(fd_set));
ret = select(nls.mxsd + 1, (FAR fd_set*)&nls.working, (FAR fd_set*)NULL, (FAR fd_set*)NULL, &timeout);
ret = select(nls.mxsd + 1, &nls.working, NULL, NULL, &timeout);
if (ret < 0)
{
printf("lo_listener: select failed: %d\n", errno);
@ -367,7 +372,7 @@ void *lo_listener(pthread_addr_t pvarg)
/* Cleanup */
#if 0 /* Don't get here */
for (i = 0; i <= nls.mxsd; +i++)
for (i = 0; i <= nls.mxsd; +i++)
{
if (FD_ISSET(i, &nls.master))
{
@ -375,5 +380,6 @@ void *lo_listener(pthread_addr_t pvarg)
}
}
#endif
return NULL; /* Keeps some compilers from complaining */
}

View File

@ -44,7 +44,7 @@ public:
CThingSayer(void)
{
printf("CThingSayer::CThingSayer: I am!\n");
szWhatToSay = (const char*)NULL;
szWhatToSay = NULL;
}
~CThingSayer(void)
@ -55,7 +55,7 @@ public:
printf("CThingSayer::~CThingSayer: I will never say '%s' again\n",
szWhatToSay);
}
szWhatToSay = (const char*)NULL;
szWhatToSay = NULL;
}
void Initialize(const char *czSayThis)

View File

@ -59,7 +59,7 @@ static CThingSayer MyThingSayer;
CThingSayer::CThingSayer(void)
{
printf("CThingSayer::CThingSayer: I am!\n");
szWhatToSay = (const char*)NULL;
szWhatToSay = NULL;
}
CThingSayer::~CThingSayer(void)
@ -70,7 +70,7 @@ CThingSayer::~CThingSayer(void)
printf("CThingSayer::~CThingSayer: I will never say '%s' again\n",
szWhatToSay);
}
szWhatToSay = (const char*)NULL;
szWhatToSay = NULL;
}
void CThingSayer::Initialize(const char *czSayThis)

View File

@ -76,7 +76,7 @@ static CThingSayer MyThingSayer;
CThingSayer::CThingSayer(void)
{
cout << "CThingSayer::CThingSayer: I am!" << endl;
szWhatToSay = (const char*)NULL;
szWhatToSay = NULL;
}
CThingSayer::~CThingSayer(void)
@ -87,7 +87,7 @@ CThingSayer::~CThingSayer(void)
cout << "CThingSayer::~CThingSayer: I will never say '"
<< szWhatToSay << "' again" << endl;
}
szWhatToSay = (const char*)NULL;
szWhatToSay = NULL;
}
void CThingSayer::Initialize(const char *czSayThis)

View File

@ -125,7 +125,7 @@ int interlock_test(void)
/* Start the null_writer_thread */
printf("interlock_test: Starting null_writer thread\n");
ret = pthread_create(&writerid, NULL, null_writer, (pthread_addr_t)NULL);
ret = pthread_create(&writerid, NULL, null_writer, NULL);
if (ret != 0)
{
fprintf(stderr, \

View File

@ -233,7 +233,7 @@ static int redirect_writer(int argc, char *argv[])
int redirection_test(void)
{
const char *argv[3];
char *argv[3];
char buffer1[8];
char buffer2[8];
int readerid;
@ -265,7 +265,7 @@ int redirection_test(void)
fd[0]);
readerid = task_create("redirect_reader",
50, CONFIG_EXAMPLES_PIPE_STACKSIZE,
redirect_reader, (FAR char * const *)argv);
redirect_reader, argv);
if (readerid < 0)
{
fprintf(stderr, "redirection_test: "
@ -279,7 +279,7 @@ int redirection_test(void)
fd[1]);
writerid = task_create("redirect_writer",
50, CONFIG_EXAMPLES_PIPE_STACKSIZE,
redirect_writer, (FAR char * const *)argv);
redirect_writer, argv);
if (writerid < 0)
{
fprintf(stderr, "redirection_test: "

View File

@ -207,6 +207,7 @@ static inline bool net_connection(struct net_listener_s *nls)
return true;
}
}
return false;
}
@ -378,8 +379,7 @@ void *net_listener(pthread_addr_t pvarg)
printf("net_listener: Calling select(), listener sd=%d\n",
nls.listensd);
memcpy(&nls.working, &nls.master, sizeof(fd_set));
ret = select(nls.mxsd + 1, (FAR fd_set *)&nls.working,
(FAR fd_set*)NULL, (FAR fd_set *)NULL, &timeout);
ret = select(nls.mxsd + 1, &nls.working, NULL, NULL, &timeout);
if (ret < 0)
{
printf("net_listener: select failed: %d\n", errno);

View File

@ -76,8 +76,9 @@ static void net_configure(void)
uint8_t mac[IFHWADDRLEN];
#endif
/* Configure the network */
/* Many embedded network interfaces must have a software assigned MAC */
/* Configure the network
* Many embedded network interfaces must have a software assigned MAC
*/
#ifdef CONFIG_EXAMPLES_POLL_NOMAC
mac[0] = 0x00;
@ -131,7 +132,7 @@ static void net_receive(int sd)
/* Loop while we have the connection */
for (;;)
for (; ; )
{
/* Wait for incoming message */
@ -139,7 +140,7 @@ static void net_receive(int sd)
{
FD_ZERO(&readset);
FD_SET(sd, &readset);
ret = select(sd + 1, (FAR fd_set*)&readset, (FAR fd_set*)NULL, (FAR fd_set*)NULL, &timeout);
ret = select(sd + 1, &readset, NULL, NULL, &timeout);
}
while (ret < 0 && errno == EINTR);
@ -177,7 +178,7 @@ static void net_receive(int sd)
}
else
{
buffer[ret]='\0';
buffer[ret] = '\0';
printf("net_reader: Read '%s' (%d bytes)\n", buffer, ret);
/* Echo the data back to the client */
@ -189,7 +190,8 @@ static void net_receive(int sd)
{
if (errno != EINTR)
{
printf("net_reader: Send failed sd=%d: %d\n", sd, errno);
printf("net_reader: Send failed sd=%d: %d\n",
sd, errno);
return;
}
}
@ -239,7 +241,8 @@ void *net_reader(pthread_addr_t pvarg)
/* Set socket to reuse address */
optval = 1;
if (setsockopt(listensd, SOL_SOCKET, SO_REUSEADDR, (void*)&optval, sizeof(int)) < 0)
if (setsockopt(listensd, SOL_SOCKET, SO_REUSEADDR,
&optval, sizeof(int)) < 0)
{
printf("net_reader: setsockopt SO_REUSEADDR failure: %d\n", errno);
goto errout_with_listensd;
@ -251,7 +254,8 @@ void *net_reader(pthread_addr_t pvarg)
addr.sin_port = HTONS(LISTENER_PORT);
addr.sin_addr.s_addr = INADDR_ANY;
if (bind(listensd, (struct sockaddr*)&addr, sizeof(struct sockaddr_in)) < 0)
if (bind(listensd, (struct sockaddr *)&addr,
sizeof(struct sockaddr_in)) < 0)
{
printf("net_reader: bind failure: %d\n", errno);
goto errout_with_listensd;
@ -267,13 +271,14 @@ void *net_reader(pthread_addr_t pvarg)
/* Connection loop */
for (;;)
for (; ; )
{
/* Accept only one connection */
printf("net_reader: Accepting new connections on port %d\n", LISTENER_PORT);
printf("net_reader: Accepting new connections on port %d\n",
LISTENER_PORT);
addrlen = sizeof(struct sockaddr_in);
acceptsd = accept(listensd, (struct sockaddr*)&addr, &addrlen);
acceptsd = accept(listensd, (struct sockaddr *)&addr, &addrlen);
if (acceptsd < 0)
{
printf("net_reader: accept failure: %d\n", errno);
@ -282,13 +287,16 @@ void *net_reader(pthread_addr_t pvarg)
printf("net_reader: Connection accepted on sd=%d\n", acceptsd);
/* Configure to "linger" until all data is sent when the socket is closed */
/* Configure to "linger" until all data is sent when the socket is
* closed
*/
#ifdef POLL_HAVE_SOLINGER
ling.l_onoff = 1;
ling.l_linger = 30; /* timeout is seconds */
if (setsockopt(acceptsd, SOL_SOCKET, SO_LINGER, &ling, sizeof(struct linger)) < 0)
if (setsockopt(acceptsd, SOL_SOCKET, SO_LINGER,
&ling, sizeof(struct linger)) < 0)
{
printf("net_reader: setsockopt SO_LINGER failure: %d\n", errno);
goto errout_with_acceptsd;

View File

@ -77,18 +77,18 @@ void *select_listener(pthread_addr_t pvarg)
/* Open the FIFO for non-blocking read */
printf("select_listener: Opening %s for non-blocking read\n", FIFO_PATH2);
fd = open(FIFO_PATH2, O_RDONLY|O_NONBLOCK);
fd = open(FIFO_PATH2, O_RDONLY | O_NONBLOCK);
if (fd < 0)
{
printf("select_listener: ERROR Failed to open FIFO %s: %d\n",
FIFO_PATH2, errno);
close(fd);
return (void*)-1;
return (void *)(uintptr_t)-1;
}
/* Loop forever */
for (;;)
for (; ; )
{
printf("select_listener: Calling select()\n");
@ -101,7 +101,7 @@ void *select_listener(pthread_addr_t pvarg)
timeout = false;
ready = false;
ret = select(fd+1, (FAR fd_set*)&rfds, (FAR fd_set*)NULL, (FAR fd_set*)NULL, &tv);
ret = select(fd + 1, &rfds, NULL, NULL, &tv);
printf("\nselect_listener: select returned: %d\n", ret);
if (ret < 0)
@ -148,18 +148,20 @@ void *select_listener(pthread_addr_t pvarg)
{
printf("select_listener: read failed: %d\n", errno);
}
nbytes = 0;
}
else
{
if (timeout)
{
printf("select_listener: ERROR? Poll timeout, but data read\n");
printf(" (might just be a race condition)\n");
printf("select_listener: ERROR? Poll timeout,\n");
printf("but data read (might just be a race condition)\n");
}
buffer[nbytes] = '\0';
printf("select_listener: Read '%s' (%ld bytes)\n", buffer, (long)nbytes);
printf("select_listener: Read '%s' (%zd bytes)\n",
buffer, nbytes);
}
timeout = false;

View File

@ -486,7 +486,7 @@ INIHANDLE inifile_initialize(FAR const char *inifile_name)
if (!priv)
{
inidbg("ERROR: Failed to allocate state structure\n");
return (INIHANDLE)NULL;
return NULL;
}
/* Open the specified INI file for reading */
@ -504,7 +504,7 @@ INIHANDLE inifile_initialize(FAR const char *inifile_name)
{
inidbg("ERROR: Could not open \"%s\"\n", inifile_name);
free(priv);
return (INIHANDLE)NULL;
return NULL;
}
}

View File

@ -100,7 +100,7 @@ const struct SBitmap NXWidgets::g_checkBoxOff =
0, // width - Width in pixels
0, // height - Height in rows
(0*CONFIG_NXWIDGETS_BPP + 7) / 8, // stride - Width in bytes
(const nxgl_mxpixel_t*)NULL // data - Pointer to the beginning of pixel data
NULL // data - Pointer to the beginning of pixel data
};
#endif // CONFIG_NXWIDGETS_BPP != 8

View File

@ -64,9 +64,9 @@
CButtonTest::CButtonTest()
{
m_bgWindow = (CBgWindow *)NULL;
m_nxFont = (CNxFont *)NULL;
m_text = (CNxString *)NULL;
m_bgWindow = NULL;
m_nxFont = NULL;
m_text = NULL;
}
// CButtonTest Descriptor
@ -122,7 +122,7 @@ void CButtonTest::disconnect(void)
if (m_text)
{
delete m_text;
m_text = (CNxString *)NULL;
m_text = NULL;
}
// Free the default font
@ -130,7 +130,7 @@ void CButtonTest::disconnect(void)
if (m_nxFont)
{
delete m_nxFont;
m_nxFont = (CNxFont *)NULL;
m_nxFont = NULL;
}
// And disconnect from the server
@ -154,7 +154,7 @@ bool CButtonTest::createWindow(void)
{
// Initialize the widget control using the default style
m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
m_widgetControl = new CWidgetControl(NULL);
// Get an (uninitialized) instance of the background window as a class
// that derives from INxWindow.
@ -191,7 +191,7 @@ CButton *CButtonTest::createButton(FAR const char *text)
if (!m_bgWindow->getSize(&windowSize))
{
printf("CButtonTest::createGraphics: Failed to get window size\n");
return (CButton *)NULL;
return NULL;
}
// Create a CNxString instance to contain the C string

View File

@ -64,8 +64,8 @@
CButtonArrayTest::CButtonArrayTest()
{
m_widgetControl = (CWidgetControl *)NULL;
m_bgWindow = (CBgWindow *)NULL;
m_widgetControl = NULL;
m_bgWindow = NULL;
}
// CButtonArrayTest Descriptor
@ -134,7 +134,7 @@ bool CButtonArrayTest::createWindow(void)
{
// Initialize the widget control using the default style
m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
m_widgetControl = new CWidgetControl(NULL);
// Get an (uninitialized) instance of the background window as a class
// that derives from INxWindow.
@ -171,7 +171,7 @@ CButtonArray *CButtonArrayTest::createButtonArray(void)
if (!m_bgWindow->getSize(&windowSize))
{
printf("CButtonArrayTest::createGraphics: Failed to get window size\n");
return (CButtonArray *)NULL;
return NULL;
}
// Pick an X/Y position such that the button array will be centered in the display

View File

@ -68,9 +68,9 @@ CCheckBoxTest::CCheckBoxTest()
{
// Initialize state data
m_widgetControl = (CWidgetControl *)NULL;
m_bgWindow = (CBgWindow *)NULL;
m_checkBox = (CCheckBox *)NULL;
m_widgetControl = NULL;
m_bgWindow = NULL;
m_checkBox = NULL;
}
// CCheckBoxTest Descriptor
@ -109,7 +109,7 @@ void CCheckBoxTest::disconnect(void)
if (m_checkBox)
{
delete m_checkBox;
m_checkBox = (CCheckBox *)NULL;
m_checkBox = NULL;
}
// Close the window
@ -117,7 +117,7 @@ void CCheckBoxTest::disconnect(void)
if (m_bgWindow)
{
delete m_bgWindow;
m_bgWindow = (CBgWindow *)NULL;
m_bgWindow = NULL;
}
// Free the widget control instance
@ -125,7 +125,7 @@ void CCheckBoxTest::disconnect(void)
if (m_widgetControl)
{
delete m_widgetControl;
m_widgetControl = (CWidgetControl *)NULL;
m_widgetControl = NULL;
}
// And disconnect from the server
@ -149,7 +149,7 @@ bool CCheckBoxTest::createWindow(void)
{
// Initialize the widget control using the default style
m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
m_widgetControl = new CWidgetControl(NULL);
// Get an (uninitialized) instance of the background window as a class
// that derives from INxWindow.
@ -193,7 +193,7 @@ bool CCheckBoxTest::createWindow(void)
// Create the checkbox
m_checkBox = new CCheckBox(m_widgetControl, checkboxX, checkboxY,
width, height, (CWidgetStyle *)NULL);
width, height, NULL);
if (!m_checkBox)
{
printf("CCheckBoxTest::createWindow: Failed to create CCheckBox\n");

View File

@ -64,8 +64,8 @@
CGlyphButtonTest::CGlyphButtonTest()
{
m_widgetControl = (CWidgetControl *)NULL;
m_bgWindow = (CBgWindow *)NULL;
m_widgetControl = NULL;
m_bgWindow = NULL;
m_center.x = 0;
m_center.y = 0;
}
@ -136,7 +136,7 @@ bool CGlyphButtonTest::createWindow(void)
{
// Initialize the widget control using the default style
m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
m_widgetControl = new CWidgetControl(NULL);
// Get an (uninitialized) instance of the background window as a class
// that derives from INxWindow.
@ -174,7 +174,7 @@ CGlyphButton *CGlyphButtonTest::createButton(FAR const struct SBitmap *clickGlyp
if (!m_bgWindow->getSize(&windowSize))
{
printf("CGlyphButtonTest::createGraphics: Failed to get window size\n");
return (CGlyphButton *)NULL;
return NULL;
}
// Get the height and width of the glyph display area

View File

@ -112,8 +112,8 @@ CGlyphSliderHorizontalTest::CGlyphSliderHorizontalTest()
{
// Initialize state data
m_widgetControl = (CWidgetControl *)NULL;
m_bgWindow = (CBgWindow *)NULL;
m_widgetControl = NULL;
m_bgWindow = NULL;
}
// CGlyphSliderHorizontalTest Descriptor
@ -152,7 +152,7 @@ void CGlyphSliderHorizontalTest::disconnect(void)
if (m_bgWindow)
{
delete m_bgWindow;
m_bgWindow = (CBgWindow *)NULL;
m_bgWindow = NULL;
}
// Free the widget control instance
@ -160,7 +160,7 @@ void CGlyphSliderHorizontalTest::disconnect(void)
if (m_widgetControl)
{
delete m_widgetControl;
m_widgetControl = (CWidgetControl *)NULL;
m_widgetControl = NULL;
}
// And disconnect from the server
@ -184,7 +184,7 @@ bool CGlyphSliderHorizontalTest::createWindow(void)
{
// Initialize the widget control using the default style
m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
m_widgetControl = new CWidgetControl(NULL);
// Get an (uninitialized) instance of the background window as a class
// that derives from INxWindow.

View File

@ -65,8 +65,8 @@
CImageTest::CImageTest()
{
m_widgetControl = (CWidgetControl *)NULL;
m_bgWindow = (CBgWindow *)NULL;
m_widgetControl = NULL;
m_bgWindow = NULL;
}
// CImageTest Descriptor
@ -135,7 +135,7 @@ bool CImageTest::createWindow(void)
{
// Initialize the widget control using the default style
m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
m_widgetControl = new CWidgetControl(NULL);
// Get an (uninitialized) instance of the background window as a class
// that derives from INxWindow.
@ -172,7 +172,7 @@ CImage *CImageTest::createImage(IBitmap *bitmap)
if (!m_bgWindow->getSize(&windowSize))
{
printf("CImageTest::createGraphics: Failed to get window size\n");
return (CImage *)NULL;
return NULL;
}
// Get the height and width of the image

View File

@ -67,8 +67,8 @@
CKeypadTest::CKeypadTest()
{
m_widgetControl = (CWidgetControl *)NULL;
m_bgWindow = (CBgWindow *)NULL;
m_widgetControl = NULL;
m_bgWindow = NULL;
m_buttonWidth = 0;
m_buttonHeight = 0;
m_displayHeight = 0;
@ -147,7 +147,7 @@ bool CKeypadTest::createWindow(void)
{
// Initialize the widget control using the default style
m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
m_widgetControl = new CWidgetControl(NULL);
// Get an (uninitialized) instance of the background window as a class
// that derives from INxWindow.
@ -234,7 +234,7 @@ CKeypad *CKeypadTest::createKeypad(void)
if (!m_bgWindow->getSize(&windowSize))
{
printf("CKeypadTest::createGraphics: Failed to get window size\n");
return (CKeypad *)NULL;
return NULL;
}
// Pick a height and width. Here we use inside information that the number
@ -262,7 +262,7 @@ CKeypad *CKeypadTest::createKeypad(void)
if (!m_textbox)
{
delete keypad;
keypad = (CKeypad *)NULL;
keypad = NULL;
}
else
{
@ -294,7 +294,7 @@ CTextBox *CKeypadTest::createTextBox(void)
if (!m_bgWindow->getSize(&windowSize))
{
printf("CKeypadTest::createGraphics: Failed to get window size\n");
return (CTextBox *)NULL;
return NULL;
}
// Pick a height and width. Here we use inside information that the number

View File

@ -64,9 +64,9 @@
CLabelTest::CLabelTest()
{
m_bgWindow = (CBgWindow *)NULL;
m_nxFont = (CNxFont *)NULL;
m_text = (CNxString *)NULL;
m_bgWindow = NULL;
m_nxFont = NULL;
m_text = NULL;
}
// CLabelTest Descriptor
@ -122,7 +122,7 @@ void CLabelTest::disconnect(void)
if (m_text)
{
delete m_text;
m_text = (CNxString *)NULL;
m_text = NULL;
}
// Free the default font
@ -130,7 +130,7 @@ void CLabelTest::disconnect(void)
if (m_nxFont)
{
delete m_nxFont;
m_nxFont = (CNxFont *)NULL;
m_nxFont = NULL;
}
// And disconnect from the server
@ -154,7 +154,7 @@ bool CLabelTest::createWindow(void)
{
// Initialize the widget control using the default style
m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
m_widgetControl = new CWidgetControl(NULL);
// Get an (uninitialized) instance of the background window as a class
// that derives from INxWindow.
@ -191,7 +191,7 @@ CLabel *CLabelTest::createLabel(FAR const char *text)
if (!m_bgWindow->getSize(&windowSize))
{
printf("CLabelTest::createGraphics: Failed to get window size\n");
return (CLabel *)NULL;
return NULL;
}
// Create a CNxString instance to contain the C string

View File

@ -64,9 +64,9 @@
CLatchButtonTest::CLatchButtonTest()
{
m_bgWindow = (CBgWindow *)NULL;
m_nxFont = (CNxFont *)NULL;
m_text = (CNxString *)NULL;
m_bgWindow = NULL;
m_nxFont = NULL;
m_text = NULL;
}
// CLatchButtonTest Descriptor
@ -122,7 +122,7 @@ void CLatchButtonTest::disconnect(void)
if (m_text)
{
delete m_text;
m_text = (CNxString *)NULL;
m_text = NULL;
}
// Free the default font
@ -130,7 +130,7 @@ void CLatchButtonTest::disconnect(void)
if (m_nxFont)
{
delete m_nxFont;
m_nxFont = (CNxFont *)NULL;
m_nxFont = NULL;
}
// And disconnect from the server
@ -154,7 +154,7 @@ bool CLatchButtonTest::createWindow(void)
{
// Initialize the widget control using the default style
m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
m_widgetControl = new CWidgetControl(NULL);
// Get an (uninitialized) instance of the background window as a class
// that derives from INxWindow.
@ -191,7 +191,7 @@ CLatchButton *CLatchButtonTest::createButton(FAR const char *text)
if (!m_bgWindow->getSize(&windowSize))
{
printf("CLatchButtonTest::createGraphics: Failed to get window size\n");
return (CLatchButton *)NULL;
return NULL;
}
// Create a CNxString instance to contain the C string

View File

@ -64,8 +64,8 @@
CLatchButtonArrayTest::CLatchButtonArrayTest()
{
m_widgetControl = (CWidgetControl *)NULL;
m_bgWindow = (CBgWindow *)NULL;
m_widgetControl = NULL;
m_bgWindow = NULL;
}
// CLatchButtonArrayTest Descriptor
@ -134,7 +134,7 @@ bool CLatchButtonArrayTest::createWindow(void)
{
// Initialize the widget control using the default style
m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
m_widgetControl = new CWidgetControl(NULL);
// Get an (uninitialized) instance of the background window as a class
// that derives from INxWindow.
@ -171,7 +171,7 @@ CLatchButtonArray *CLatchButtonArrayTest::createButtonArray(void)
if (!m_bgWindow->getSize(&windowSize))
{
printf("CLatchButtonArrayTest::createGraphics: Failed to get window size\n");
return (CLatchButtonArray *)NULL;
return NULL;
}
// Pick an X/Y position such that the button array will be centered in the display

View File

@ -66,8 +66,8 @@ CListBoxTest::CListBoxTest()
{
// Initialize state data
m_widgetControl = (CWidgetControl *)NULL;
m_bgWindow = (CBgWindow *)NULL;
m_widgetControl = NULL;
m_bgWindow = NULL;
}
// CListBoxTest Descriptor
@ -106,7 +106,7 @@ void CListBoxTest::disconnect(void)
if (m_bgWindow)
{
delete m_bgWindow;
m_bgWindow = (CBgWindow *)NULL;
m_bgWindow = NULL;
}
// Free the widget control instance
@ -114,7 +114,7 @@ void CListBoxTest::disconnect(void)
if (m_widgetControl)
{
delete m_widgetControl;
m_widgetControl = (CWidgetControl *)NULL;
m_widgetControl = NULL;
}
// And disconnect from the server
@ -138,7 +138,7 @@ bool CListBoxTest::createWindow(void)
{
// Initialize the widget control using the default style
m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
m_widgetControl = new CWidgetControl(NULL);
// Get an (uninitialized) instance of the background window as a class
// that derives from INxWindow.

View File

@ -66,8 +66,8 @@ CProgressBarTest::CProgressBarTest()
{
// Initialize state data
m_widgetControl = (CWidgetControl *)NULL;
m_bgWindow = (CBgWindow *)NULL;
m_widgetControl = NULL;
m_bgWindow = NULL;
}
// CProgressBarTest Descriptor
@ -106,7 +106,7 @@ void CProgressBarTest::disconnect(void)
if (m_bgWindow)
{
delete m_bgWindow;
m_bgWindow = (CBgWindow *)NULL;
m_bgWindow = NULL;
}
// Free the widget control instance
@ -114,7 +114,7 @@ void CProgressBarTest::disconnect(void)
if (m_widgetControl)
{
delete m_widgetControl;
m_widgetControl = (CWidgetControl *)NULL;
m_widgetControl = NULL;
}
// And disconnect from the server
@ -138,7 +138,7 @@ bool CProgressBarTest::createWindow(void)
{
// Initialize the widget control using the default style
m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
m_widgetControl = new CWidgetControl(NULL);
// Get an (uninitialized) instance of the background window as a class
// that derives from INxWindow.

View File

@ -68,8 +68,8 @@ CRadioButtonTest::CRadioButtonTest()
{
// Initialize state data
m_widgetControl = (CWidgetControl *)NULL;
m_bgWindow = (CBgWindow *)NULL;
m_widgetControl = NULL;
m_bgWindow = NULL;
// Peek at the radio button glyph to get a good estimate of the size
@ -113,7 +113,7 @@ void CRadioButtonTest::disconnect(void)
if (m_radioButtonGroup)
{
delete m_radioButtonGroup;
m_radioButtonGroup = (CRadioButtonGroup *)NULL;
m_radioButtonGroup = NULL;
}
// Close the window
@ -151,7 +151,7 @@ bool CRadioButtonTest::createWindow(void)
{
// Initialize the widget control using the default style
m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
m_widgetControl = new CWidgetControl(NULL);
// Get an (uninitialized) instance of the background window as a class
// that derives from INxWindow.
@ -188,7 +188,7 @@ CRadioButton *CRadioButtonTest::newRadioButton(void)
if (!m_bgWindow->getSize(&windowSize))
{
printf("CRadioButtonTest::newRadioButton: Failed to get window size\n");
return (CRadioButton *)NULL;
return NULL;
}
// Create the radio button group, if we have not already done so
@ -205,7 +205,7 @@ CRadioButton *CRadioButtonTest::newRadioButton(void)
if (!m_radioButtonGroup)
{
printf("CRadioButtonTest::newRadioButton: Failed to create the radio button group\n");
return (CRadioButton *)NULL;
return NULL;
}
}

View File

@ -66,8 +66,8 @@ CScrollbarHorizontalTest::CScrollbarHorizontalTest()
{
// Initialize state data
m_widgetControl = (CWidgetControl *)NULL;
m_bgWindow = (CBgWindow *)NULL;
m_widgetControl = NULL;
m_bgWindow = NULL;
}
// CScrollbarHorizontalTest Descriptor
@ -106,7 +106,7 @@ void CScrollbarHorizontalTest::disconnect(void)
if (m_bgWindow)
{
delete m_bgWindow;
m_bgWindow = (CBgWindow *)NULL;
m_bgWindow = NULL;
}
// Free the widget control instance
@ -114,7 +114,7 @@ void CScrollbarHorizontalTest::disconnect(void)
if (m_widgetControl)
{
delete m_widgetControl;
m_widgetControl = (CWidgetControl *)NULL;
m_widgetControl = NULL;
}
// And disconnect from the server
@ -138,7 +138,7 @@ bool CScrollbarHorizontalTest::createWindow(void)
{
// Initialize the widget control using the default style
m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
m_widgetControl = new CWidgetControl(NULL);
// Get an (uninitialized) instance of the background window as a class
// that derives from INxWindow.

View File

@ -66,8 +66,8 @@ CScrollbarVerticalTest::CScrollbarVerticalTest()
{
// Initialize state data
m_widgetControl = (CWidgetControl *)NULL;
m_bgWindow = (CBgWindow *)NULL;
m_widgetControl = NULL;
m_bgWindow = NULL;
}
// CScrollbarVerticalTest Descriptor
@ -106,7 +106,7 @@ void CScrollbarVerticalTest::disconnect(void)
if (m_bgWindow)
{
delete m_bgWindow;
m_bgWindow = (CBgWindow *)NULL;
m_bgWindow = NULL;
}
// Free the widget control instance
@ -114,7 +114,7 @@ void CScrollbarVerticalTest::disconnect(void)
if (m_widgetControl)
{
delete m_widgetControl;
m_widgetControl = (CWidgetControl *)NULL;
m_widgetControl = NULL;
}
// And disconnect from the server
@ -138,7 +138,7 @@ bool CScrollbarVerticalTest::createWindow(void)
{
// Initialize the widget control using the default style
m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
m_widgetControl = new CWidgetControl(NULL);
// Get an (uninitialized) instance of the background window as a class
// that derives from INxWindow.

View File

@ -66,8 +66,8 @@ CSliderHorizontalTest::CSliderHorizontalTest()
{
// Initialize state data
m_widgetControl = (CWidgetControl *)NULL;
m_bgWindow = (CBgWindow *)NULL;
m_widgetControl = NULL;
m_bgWindow = NULL;
}
// CSliderHorizontalTest Descriptor
@ -106,7 +106,7 @@ void CSliderHorizontalTest::disconnect(void)
if (m_bgWindow)
{
delete m_bgWindow;
m_bgWindow = (CBgWindow *)NULL;
m_bgWindow = NULL;
}
// Free the widget control instance
@ -114,7 +114,7 @@ void CSliderHorizontalTest::disconnect(void)
if (m_widgetControl)
{
delete m_widgetControl;
m_widgetControl = (CWidgetControl *)NULL;
m_widgetControl = NULL;
}
// And disconnect from the server
@ -138,7 +138,7 @@ bool CSliderHorizontalTest::createWindow(void)
{
// Initialize the widget control using the default style
m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
m_widgetControl = new CWidgetControl(NULL);
// Get an (uninitialized) instance of the background window as a class
// that derives from INxWindow.

View File

@ -66,8 +66,8 @@ CSliderVerticalTest::CSliderVerticalTest()
{
// Initialize state data
m_widgetControl = (CWidgetControl *)NULL;
m_bgWindow = (CBgWindow *)NULL;
m_widgetControl = NULL;
m_bgWindow = NULL;
}
// CSliderVerticalTest Descriptor
@ -106,7 +106,7 @@ void CSliderVerticalTest::disconnect(void)
if (m_bgWindow)
{
delete m_bgWindow;
m_bgWindow = (CBgWindow *)NULL;
m_bgWindow = NULL;
}
// Free the widget control instance
@ -114,7 +114,7 @@ void CSliderVerticalTest::disconnect(void)
if (m_widgetControl)
{
delete m_widgetControl;
m_widgetControl = (CWidgetControl *)NULL;
m_widgetControl = NULL;
}
// And disconnect from the server
@ -138,7 +138,7 @@ bool CSliderVerticalTest::createWindow(void)
{
// Initialize the widget control using the default style
m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
m_widgetControl = new CWidgetControl(NULL);
// Get an (uninitialized) instance of the background window as a class
// that derives from INxWindow.

View File

@ -65,9 +65,9 @@
CTextBoxTest::CTextBoxTest()
{
m_bgWindow = (CBgWindow *)NULL;
m_nxFont = (CNxFont *)NULL;
m_text = (CNxString *)NULL;
m_bgWindow = NULL;
m_nxFont = NULL;
m_text = NULL;
}
// CTextBoxTest Descriptor
@ -123,7 +123,7 @@ void CTextBoxTest::disconnect(void)
if (m_text)
{
delete m_text;
m_text = (CNxString *)NULL;
m_text = NULL;
}
// Free the default font
@ -131,7 +131,7 @@ void CTextBoxTest::disconnect(void)
if (m_nxFont)
{
delete m_nxFont;
m_nxFont = (CNxFont *)NULL;
m_nxFont = NULL;
}
// And disconnect from the server
@ -155,7 +155,7 @@ bool CTextBoxTest::createWindow(void)
{
// Initialize the widget control using the default style
m_widgetControl = new CWidgetControl((CWidgetStyle *)NULL);
m_widgetControl = new CWidgetControl(NULL);
// Get an (uninitialized) instance of the background window as a class
// that derives from INxWindow.
@ -192,7 +192,7 @@ CTextBox *CTextBoxTest::createTextBox(void)
if (!m_bgWindow->getSize(&windowSize))
{
printf("CTextBoxTest::createGraphics: Failed to get window size\n");
return (CTextBox *)NULL;
return NULL;
}
// Create an empty CNxString instance to contain the C string

View File

@ -481,7 +481,7 @@ void CListBox::drawContents(CGraphicsPort *port)
int y = m_canvasY + (topOption * optionHeight);
int i = topOption;
const CListBoxDataItem *item = (CListBoxDataItem *)NULL;
const CListBoxDataItem *item = NULL;
// Loop through all options drawing each ones

View File

@ -246,7 +246,7 @@ const CListDataItem *CListData::getSelectedItem(void) const
{
return m_items[index];
}
return (CListDataItem *)NULL;
return NULL;
}
/**

View File

@ -88,7 +88,7 @@ class CDraggableLabel: public CLabel
public:
CDraggableLabel(CWidgetControl *pWidgetControl, nxgl_coord_t x, nxgl_coord_t y,
nxgl_coord_t width, nxgl_coord_t height, const CNxString &text,
CWidgetStyle *style = (CWidgetStyle *)NULL):
CWidgetStyle *style = NULL):
CLabel(pWidgetControl, x, y, width, height, text, style)
{
setDraggable(true);

View File

@ -63,8 +63,8 @@ CNxServer::CNxServer(void)
{
// Initialize server instance state data
m_hDevice = (FAR NX_DRIVERTYPE *)NULL; // LCD/Framebuffer device handle
m_hNxServer = (NXHANDLE)NULL; // NX server handle
m_hDevice = NULL; // LCD/Framebuffer device handle
m_hNxServer = NULL; // NX server handle
m_connected = false; // True: Connected to the server
sem_init(&m_connsem, 0, 0); // Wait for server connection

View File

@ -80,7 +80,7 @@ using namespace NXWidgets;
CNxString::CNxString()
{
m_text = (FAR nxwidget_char_t *)NULL;
m_text = NULL;
m_stringLength = 0;
m_allocatedSize = 0;
m_growAmount = 16;
@ -95,7 +95,7 @@ CNxString::CNxString()
CNxString::CNxString(FAR const char *text)
{
m_text = (FAR nxwidget_char_t *)NULL;
m_text = NULL;
m_stringLength = 0;
m_allocatedSize = 0;
m_growAmount = 16;
@ -110,7 +110,7 @@ CNxString::CNxString(FAR const char *text)
CNxString::CNxString(const nxwidget_char_t text)
{
m_text = (FAR nxwidget_char_t *)NULL;
m_text = NULL;
m_stringLength = 0;
m_allocatedSize = 0;
m_growAmount = 16;
@ -120,7 +120,7 @@ CNxString::CNxString(const nxwidget_char_t text)
CNxString::CNxString(const CNxString &string)
{
m_text = (FAR nxwidget_char_t *)NULL;
m_text = NULL;
m_stringLength = 0;
m_allocatedSize = 0;
m_growAmount = 16;
@ -783,14 +783,14 @@ FAR nxwidget_char_t *CNxString::getCharPointer(const int index) const
if (!hasData())
{
return (FAR nxwidget_char_t*)NULL;
return NULL;
}
// Early exit if the index is greater than the length of the string
if (index >= m_stringLength)
{
return (FAR nxwidget_char_t*)NULL;
return NULL;
}
return &m_text[index];

View File

@ -116,7 +116,7 @@ CNxWidget::CNxWidget(CWidgetControl *pWidgetControl,
// Do we need to fetch the default style?
if (style == (CWidgetStyle *)NULL)
if (style == NULL)
{
// Get the style from the controlling widget. This allows different
// widgets within a window to have the same style, unique to the window.
@ -161,8 +161,8 @@ CNxWidget::CNxWidget(CWidgetControl *pWidgetControl,
// Set hierarchy pointers
m_parent = (CNxWidget *)NULL;
m_focusedChild = (CNxWidget *)NULL;
m_parent = NULL;
m_focusedChild = NULL;
// Double-click
@ -195,11 +195,11 @@ CNxWidget::~CNxWidget(void)
if (m_widgetControl->getClickedWidget() == this)
{
m_widgetControl->setClickedWidget((CNxWidget *)NULL);
m_widgetControl->setClickedWidget(NULL);
}
}
if (m_parent != (CNxWidget *)NULL)
if (m_parent != NULL)
{
m_parent->removeChild(this);
}
@ -229,7 +229,7 @@ CNxWidget::~CNxWidget(void)
nxgl_coord_t CNxWidget::getX(void) const
{
if (m_parent != (CNxWidget *)NULL)
if (m_parent != NULL)
{
return m_parent->getX() + m_rect.getX();
}
@ -245,7 +245,7 @@ nxgl_coord_t CNxWidget::getX(void) const
nxgl_coord_t CNxWidget::getY(void) const
{
if (m_parent != (CNxWidget *)NULL)
if (m_parent != NULL)
{
return m_parent->getY() + m_rect.getY();
}
@ -288,7 +288,7 @@ nxgl_coord_t CNxWidget::getRelativeY(void) const
bool CNxWidget::isDeleted(void) const
{
if (m_parent != (CNxWidget *)NULL)
if (m_parent != NULL)
{
if (m_parent->isDeleted())
{
@ -309,7 +309,7 @@ bool CNxWidget::isDeleted(void) const
bool CNxWidget::isDrawingEnabled(void) const
{
if (m_parent != (CNxWidget *)NULL)
if (m_parent != NULL)
{
if (m_parent->isDrawingEnabled())
{
@ -338,7 +338,7 @@ bool CNxWidget::isDrawingEnabled(void) const
bool CNxWidget::isHidden(void) const
{
if (m_parent != (CNxWidget *)NULL)
if (m_parent != NULL)
{
if (!m_parent->isHidden())
{
@ -365,7 +365,7 @@ bool CNxWidget::isHidden(void) const
bool CNxWidget::isEnabled() const
{
if (m_parent != (CNxWidget *)NULL)
if (m_parent != NULL)
{
if (m_parent->isEnabled())
{
@ -552,7 +552,7 @@ void CNxWidget::close(void)
release(clickedWidget->getX(), clickedWidget->getY());
}
if (m_parent != (CNxWidget *)NULL)
if (m_parent != NULL)
{
m_parent->closeChild(this);
}
@ -648,7 +648,7 @@ bool CNxWidget::click(nxgl_coord_t x, nxgl_coord_t y)
// Take focus away from child widgets
setFocusedWidget((CNxWidget *)NULL);
setFocusedWidget(NULL);
// Tell controlling widget that the clicked widget has changed
@ -731,7 +731,7 @@ bool CNxWidget::doubleClick(nxgl_coord_t x, nxgl_coord_t y)
// Take focus away from child widgets
setFocusedWidget((CNxWidget *)NULL);
setFocusedWidget(NULL);
// Tell controlling widget that the clicked widget has changed
@ -776,7 +776,7 @@ bool CNxWidget::release(nxgl_coord_t x, nxgl_coord_t y)
if (m_widgetControl->getClickedWidget() == this)
{
m_widgetControl->setClickedWidget((CNxWidget *)NULL);
m_widgetControl->setClickedWidget(NULL);
}
// Determine which release event to fire
@ -909,7 +909,7 @@ bool CNxWidget::focus(void)
// Notify parent that this widget has focus
if (m_parent != (CNxWidget *)NULL)
if (m_parent != NULL)
{
m_parent->setFocusedWidget(this);
}
@ -943,10 +943,10 @@ bool CNxWidget::blur(void)
// Take focus away from child widgets
if (m_focusedChild != (CNxWidget *)NULL)
if (m_focusedChild != NULL)
{
m_focusedChild->blur();
m_focusedChild = (CNxWidget *)NULL;
m_focusedChild = NULL;
m_widgetControl->clearFocusedWidget(this);
}
@ -976,7 +976,7 @@ bool CNxWidget::moveTo(nxgl_coord_t x, nxgl_coord_t y)
{
// Enforce widget to stay within parent confines if necessary
if (m_parent != (FAR CNxWidget *)NULL)
if (m_parent != NULL)
{
if (!m_parent->isPermeable())
{
@ -1064,7 +1064,7 @@ bool CNxWidget::resize(nxgl_coord_t width, nxgl_coord_t height)
{
// Enforce widget to stay within parent confines if necessary
if (m_parent != (CNxWidget *)NULL)
if (m_parent != NULL)
{
if (!m_parent->isPermeable())
{
@ -1324,7 +1324,7 @@ void CNxWidget::insertWidget(CNxWidget *widget)
bool CNxWidget::remove(void)
{
if (m_parent != (CNxWidget *)NULL)
if (m_parent != NULL)
{
return m_parent->removeChild(this);
}
@ -1348,7 +1348,7 @@ bool CNxWidget::removeChild(CNxWidget *widget)
if (m_focusedChild == widget)
{
m_focusedChild = (CNxWidget *)NULL;
m_focusedChild = NULL;
m_widgetControl->clearFocusedWidget(this);
}
@ -1362,7 +1362,7 @@ bool CNxWidget::removeChild(CNxWidget *widget)
// Divorce child from parent
widget->setParent((CNxWidget *)NULL);
widget->setParent(NULL);
widget->disableDrawing();
// Locate widget in main vector
@ -1395,7 +1395,7 @@ const CNxWidget *CNxWidget::getChild(int index) const
return m_children[index];
}
return (CNxWidget *)NULL;
return NULL;
}
/**
@ -1479,7 +1479,7 @@ void CNxWidget::closeChild(CNxWidget *widget)
if (m_focusedChild == widget)
{
m_focusedChild = (CNxWidget *)NULL;
m_focusedChild = NULL;
m_widgetControl->clearFocusedWidget(this);
// Try to choose highest widget
@ -1508,7 +1508,7 @@ void CNxWidget::closeChild(CNxWidget *widget)
{
// Give focus to this
setFocusedWidget((CNxWidget *)NULL);
setFocusedWidget(NULL);
}
}

View File

@ -96,7 +96,7 @@ CRadioButtonGroup::CRadioButtonGroup(CWidgetControl *pWidgetControl,
: CNxWidget(pWidgetControl, x, y, 0, 0, WIDGET_BORDERLESS, style)
{
m_widgetControl = pWidgetControl;
m_selectedWidget = (CRadioButton *)NULL;
m_selectedWidget = NULL;
}
/**

View File

@ -107,9 +107,9 @@ CScrollbarPanel::CScrollbarPanel(CWidgetControl *pWidgetControl,
m_flags.borderless = true;
m_widgetControl = pWidgetControl;
m_panel = (CScrollingPanel *)NULL;
m_scrollbarVertical = (CScrollbarVertical *)NULL;
m_scrollbarHorizontal = (CScrollbarHorizontal *)NULL;
m_panel = NULL;
m_scrollbarVertical = NULL;
m_scrollbarHorizontal = NULL;
buildUI();
}

View File

@ -358,7 +358,7 @@ void CScrollingPanel::scrollChildren(int32_t dx, int32_t dy, bool do_redraw)
nxgl_coord_t widgetY = 0;
nxgl_coord_t thisX = getX();
nxgl_coord_t thisY = getY();
CNxWidget *widget = (CNxWidget *)NULL;
CNxWidget *widget = NULL;
for (int32_t i = 0; i < m_children.size(); i++)
{

View File

@ -69,10 +69,10 @@ CWidgetControl::CWidgetControl(FAR const CWidgetStyle *style)
{
// Initialize state
m_port = (CGraphicsPort *)NULL;
m_port = NULL;
m_haveGeometry = false;
m_clickedWidget = (CNxWidget *)NULL;
m_focusedWidget = (CNxWidget *)NULL;
m_clickedWidget = NULL;
m_focusedWidget = NULL;
// Initialize data that we will get from the position callback
@ -110,7 +110,7 @@ CWidgetControl::CWidgetControl(FAR const CWidgetStyle *style)
// Do we need to fetch the default style?
if (style == (CWidgetStyle *)NULL)
if (style == NULL)
{
// Get the style from the controlling widget
@ -312,7 +312,7 @@ void CWidgetControl::setClickedWidget(CNxWidget *widget)
{
// Do we have a clicked widget already?
if (m_clickedWidget != (CNxWidget *)NULL)
if (m_clickedWidget != NULL)
{
// Ensure that the existing clicked widget is released *outside* its bounds
@ -645,7 +645,7 @@ bool CWidgetControl::createGraphicsPort(INxWindow *window)
#else
m_port = new CGraphicsPort(window);
#endif
return m_port != (CGraphicsPort *)NULL;
return m_port != NULL;
}
/**
@ -732,7 +732,7 @@ bool CWidgetControl::handleLeftClick(nxgl_coord_t x, nxgl_coord_t y,
{
// Working with a specific widget or the whole structure?
if (widget == (CNxWidget *)NULL)
if (widget == NULL)
{
// All widgets
@ -801,7 +801,7 @@ bool CWidgetControl::pollMouseEvents(CNxWidget *widget)
{
// The left button is still being held down
if (m_clickedWidget != (CNxWidget *)NULL)
if (m_clickedWidget != NULL)
{
// Handle a mouse drag event
@ -814,7 +814,7 @@ bool CWidgetControl::pollMouseEvents(CNxWidget *widget)
// Check for release event on the clicked widget
if (!mouseEvent && m_clickedWidget != (CNxWidget *)NULL)
if (!mouseEvent && m_clickedWidget != NULL)
{
// Mouse left button release event
@ -849,7 +849,7 @@ bool CWidgetControl::pollKeyboardEvents(void)
// Keyboard presses with no focused widget is not an interesting
// event
if (m_focusedWidget != (CNxWidget *)NULL)
if (m_focusedWidget != NULL)
{
// Forward each character to the widget with the focus
@ -879,7 +879,7 @@ bool CWidgetControl::pollCursorControlEvents(void)
// Cursor controls with no focused widget is not an interesting
// event
if (m_focusedWidget != (CNxWidget *)NULL)
if (m_focusedWidget != NULL)
{
// Forward each cursor control to the widget with the focus

View File

@ -159,7 +159,7 @@ void NXWidgets::freeSingletons(void)
if (g_nullString)
{
delete g_nullString;
g_nullString = (CNxString *)NULL;
g_nullString = NULL;
}
// Delete the default widget style singleton
@ -172,7 +172,7 @@ void NXWidgets::freeSingletons(void)
}
delete g_defaultWidgetStyle;
g_defaultWidgetStyle = (CWidgetStyle *)NULL;
g_defaultWidgetStyle = NULL;
}
// Free the timer list
@ -180,7 +180,7 @@ void NXWidgets::freeSingletons(void)
if (g_nxTimers)
{
delete g_nxTimers;
g_nxTimers = (TNxArray<CNxTimer*> *)NULL;
g_nxTimers = NULL;
}
}

View File

@ -753,7 +753,7 @@ NXWidgets::CNxWindow *CTaskbar::openRawWindow(void)
{
// Create the widget control (with the window messenger) using the default style
CWindowMessenger *control = new CWindowMessenger((NXWidgets::CWidgetStyle *)NULL);
CWindowMessenger *control = new CWindowMessenger(NULL);
// Get an (uninitialized) instance of the background window as a class
// that derives from INxWindow.
@ -790,7 +790,7 @@ NXWidgets::CNxTkWindow *CTaskbar::openFramedWindow(void)
{
// Create the widget control (with the window messenger) using the default style
CWindowMessenger *control = new CWindowMessenger((NXWidgets::CWidgetStyle *)NULL);
CWindowMessenger *control = new CWindowMessenger(NULL);
// Get an (uninitialized) instance of the framed window as a class
// that derives from INxWindow.
@ -957,7 +957,7 @@ bool CTaskbar::createTaskbarWindow(void)
bool CTaskbar::createBackgroundWindow(void)
{
CWindowMessenger *control = new CWindowMessenger((NXWidgets::CWidgetStyle *)NULL);
CWindowMessenger *control = new CWindowMessenger(NULL);
// Create a raw window to present the background image

View File

@ -1,5 +1,5 @@
/****************************************************************************
* apps/graphics/pdcurses/pdc_border.c
* apps/graphics/pdcurs34/pdcurses/pdc_border.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -47,15 +47,18 @@
* const cchar_t *ts, const cchar_t *bs,
* const cchar_t *tl, const cchar_t *tr,
* const cchar_t *bl, const cchar_t *br);
* int box_set(WINDOW *win, const cchar_t *verch, const cchar_t *horch);
* int box_set(WINDOW *win, const cchar_t *verch,
* const cchar_t *horch);
* int hline_set(const cchar_t *wch, int n);
* int vline_set(const cchar_t *wch, int n);
* int whline_set(WINDOW *win, const cchar_t *wch, int n);
* int wvline_set(WINDOW *win, const cchar_t *wch, int n);
* int mvhline_set(int y, int x, const cchar_t *wch, int n);
* int mvvline_set(int y, int x, const cchar_t *wch, int n);
* int mvwhline_set(WINDOW *win, int y, int x, const cchar_t *wch, int n);
* int mvwvline_set(WINDOW *win, int y, int x, const cchar_t *wch, int n);
* int mvwhline_set(WINDOW *win, int y, int x,
* const cchar_t *wch, int n);
* int mvwvline_set(WINDOW *win, int y, int x,
* const cchar_t *wch, int n);
*
* Description:
* border(), wborder(), and box() draw a border around the edge of
@ -143,7 +146,7 @@ static chtype _attr_passthru(WINDOW *win, chtype ch)
}
/* wrs (4/10/93) -- Apply the same sort of logic for the window background,
* in that it only takes precedence if other color attributes are not there.
* in that it only takes precedence if other color attributes aren't there.
*/
if (!(attr & A_COLOR))
@ -239,7 +242,8 @@ int box(WINDOW *win, chtype verch, chtype horch)
int whline(WINDOW *win, chtype ch, int n)
{
chtype *dest;
int startpos, endpos;
int startpos;
int endpos;
PDC_LOG(("whline() - called\n"));
@ -415,8 +419,7 @@ int box_set(WINDOW *win, const cchar_t *verch, const cchar_t *horch)
PDC_LOG(("box_set() - called\n"));
return wborder_set(win, verch, verch, horch, horch,
(const cchar_t *)NULL, (const cchar_t *)NULL,
(const cchar_t *)NULL, (const cchar_t *)NULL);
NULL, NULL, NULL, NULL);
}
int whline_set(WINDOW *win, const cchar_t *wch, int n)

View File

@ -1,5 +1,5 @@
/****************************************************************************
* apps/graphics/pdcurses/pdc_initscr.c
* apps/graphics/pdcurs34/pdcurses/pdc_initscr.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -121,13 +121,13 @@ const char *_curses_notice = "PDCurses 3.4 - Public Domain 2008";
char ttytype[128];
SCREEN *SP = (SCREEN *) NULL; /* curses variables */
WINDOW *curscr = (WINDOW *) NULL; /* the current screen image */
WINDOW *stdscr = (WINDOW *) NULL; /* the default screen window */
WINDOW *pdc_lastscr = (WINDOW *) NULL; /* the last screen image */
SCREEN *SP = NULL; /* curses variables */
WINDOW *curscr = NULL; /* the current screen image */
WINDOW *stdscr = NULL; /* the default screen window */
WINDOW *pdc_lastscr = NULL; /* the last screen image */
int LINES = 0; /* current terminal height */
int COLS = 0; /* current terminal width */
int LINES = 0; /* current terminal height */
int COLS = 0; /* current terminal width */
int TABSIZE = 8;
MOUSE_STATUS Mouse_status, pdc_mouse_status;
@ -188,13 +188,13 @@ WINDOW *Xinitscr(int argc, char *argv[])
exit(4);
}
if ((curscr = newwin(LINES, COLS, 0, 0)) == (WINDOW *)NULL)
if ((curscr = newwin(LINES, COLS, 0, 0)) == NULL)
{
fprintf(stderr, "initscr(): Unable to create curscr.\n");
exit(2);
}
if ((pdc_lastscr = newwin(LINES, COLS, 0, 0)) == (WINDOW *)NULL)
if ((pdc_lastscr = newwin(LINES, COLS, 0, 0)) == NULL)
{
fprintf(stderr, "initscr(): Unable to create pdc_lastscr.\n");
exit(2);
@ -207,7 +207,8 @@ WINDOW *Xinitscr(int argc, char *argv[])
LINES -= SP->slklines;
/* We have to sort out ripped off lines here, and reduce the height of
* stdscr by the number of lines ripped off */
* stdscr by the number of lines ripped off
*/
for (i = 0; i < linesrippedoff; i++)
{
@ -339,15 +340,15 @@ void delscreen(SCREEN *sp)
delwin(stdscr);
delwin(curscr);
delwin(pdc_lastscr);
stdscr = (WINDOW *) NULL;
curscr = (WINDOW *) NULL;
pdc_lastscr = (WINDOW *) NULL;
stdscr = NULL;
curscr = NULL;
pdc_lastscr = NULL;
SP->alive = false;
PDC_scr_free(); /* Free SP and pdc_atrtab */
SP = (SCREEN *)NULL;
SP = NULL;
#ifdef CONFIG_PDCURSES_MULTITHREAD

View File

@ -1,5 +1,5 @@
/****************************************************************************
* apps/graphics/pdcurses/pdc_pad.c
* apps/graphics/pdcurs34/pdcurses/pdc_pad.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -120,13 +120,15 @@ WINDOW *newpad(int nlines, int ncols)
if (!(win = PDC_makenew(nlines, ncols, -1, -1)) ||
!(win = PDC_makelines(win)))
{
return (WINDOW *) NULL;
return NULL;
}
werase(win);
win->_flags = _PAD;
/* save default values in case pechochar() is the first call to prefresh(). */
/* save default values in case pechochar() is the first call to
* prefresh().
*/
save_pminrow = 0;
save_pmincol = 0;
@ -153,7 +155,7 @@ WINDOW *subpad(WINDOW *orig, int nlines, int ncols, int begy, int begx)
if (!orig || !(orig->_flags & _PAD))
{
return (WINDOW *) NULL;
return NULL;
}
/* Make sure window fits inside the original one */
@ -162,7 +164,7 @@ WINDOW *subpad(WINDOW *orig, int nlines, int ncols, int begy, int begx)
(begy + nlines) > (orig->_begy + orig->_maxy) ||
(begx + ncols) > (orig->_begx + orig->_maxx))
{
return (WINDOW *) NULL;
return NULL;
}
if (!nlines)
@ -177,7 +179,7 @@ WINDOW *subpad(WINDOW *orig, int nlines, int ncols, int begy, int begx)
if (!(win = PDC_makenew(nlines, ncols, begy, begx)))
{
return (WINDOW *) NULL;
return NULL;
}
/* Initialize window variables */
@ -236,7 +238,7 @@ int pnoutrefresh(WINDOW *w, int py, int px, int sy1, int sx1, int sy2,
PDC_LOG(("pnoutrefresh() - called\n"));
if (!w || !(w->_flags & (_PAD | _SUBPAD)) || (sy2 >= LINES) || (sy2 >= COLS))
if (!w || !(w->_flags & (_PAD | _SUBPAD)) || sy2 >= LINES || sy2 >= COLS)
{
return ERR;
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* apps/graphics/pdcurses/pdc_scrdump.c
* apps/graphics/pdcurs34/pdcurses/pdc_scrdump.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -134,7 +134,7 @@ WINDOW *getwin(FILE *filep)
if (!(win = malloc(sizeof(WINDOW))))
{
return (WINDOW *)NULL;
return NULL;
}
/* Check for the marker, and load the WINDOW struct */
@ -143,7 +143,7 @@ WINDOW *getwin(FILE *filep)
marker[3] != DUMPVER || !fread(win, sizeof(WINDOW), 1, filep))
{
free(win);
return (WINDOW *)NULL;
return NULL;
}
nlines = win->_maxy;
@ -154,7 +154,7 @@ WINDOW *getwin(FILE *filep)
if (!(win->_y = malloc(nlines * sizeof(chtype *))))
{
free(win);
return (WINDOW *)NULL;
return NULL;
}
/* allocate the minchng and maxchng arrays */
@ -163,7 +163,7 @@ WINDOW *getwin(FILE *filep)
{
free(win->_y);
free(win);
return (WINDOW *)NULL;
return NULL;
}
if (!(win->_lastch = malloc(nlines * sizeof(int))))
@ -171,13 +171,15 @@ WINDOW *getwin(FILE *filep)
free(win->_firstch);
free(win->_y);
free(win);
return (WINDOW *) NULL;
return NULL;
}
/* allocate the lines */
if (!(win = PDC_makelines(win)))
return (WINDOW *) NULL;
{
return NULL;
}
/* read them */
@ -186,7 +188,7 @@ WINDOW *getwin(FILE *filep)
if (!fread(win->_y[i], ncols * sizeof(chtype), 1, filep))
{
delwin(win);
return (WINDOW *) NULL;
return NULL;
}
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* apps/graphics/pdcurses/pdc_slk.c
* apps/graphics/pdcurs34/pdcurses/pdc_slk.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -124,7 +124,7 @@ static int label_fmt = 0;
static int label_line = 0;
static bool hidden = false;
static struct SLK *slk = (struct SLK *)NULL;
static struct SLK *slk = NULL;
#endif
/****************************************************************************
@ -496,7 +496,9 @@ int slk_attr_set(const attr_t attrs, short color_pair, void *opts)
static void _slk_calc(void)
{
int i, center, col = 0;
int i;
int center;
int col = 0;
#ifdef CONFIG_PDCURSES_MULTITHREAD
FAR struct pdc_context_s *ctx = PDC_ctx();
#endif
@ -655,11 +657,11 @@ void PDC_slk_free(void)
if (SP->slk_winptr)
{
delwin(SP->slk_winptr);
SP->slk_winptr = (WINDOW *) NULL;
SP->slk_winptr = NULL;
}
free(slk);
slk = (struct SLK *)NULL;
slk = NULL;
label_length = 0;
labels = 0;
@ -724,7 +726,8 @@ int slk_wset(int labnum, const wchar_t *label, int justify)
}
else
{
int i, j = 0;
int i;
int j = 0;
/* Skip leading spaces */

View File

@ -1,5 +1,5 @@
/****************************************************************************
* apps/graphics/pdcurses/pdc_terminfo.c
* apps/graphics/pdcurs34/pdcurses/pdc_terminfo.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -165,7 +165,7 @@ TERMINAL *set_curterm(TERMINAL * nterm)
{
PDC_LOG(("set_curterm() - called\n"));
return (TERMINAL *) NULL;
return NULL;
}
int setterm(const char *term)
@ -216,14 +216,14 @@ char *tgetstr(const char *id, char **area)
{
PDC_LOG(("tgetstr() - called: id %s\n", id));
return (char *)NULL;
return NULL;
}
char *tgoto(const char *cap, int col, int row)
{
PDC_LOG(("tgoto() - called\n"));
return (char *)NULL;
return NULL;
}
int tigetflag(const char *capname)
@ -244,7 +244,7 @@ char *tigetstr(const char *capname)
{
PDC_LOG(("tigetstr() - called: capname %s\n", capname));
return (char *)(-1);
return NULL;
}
char *tparm(const char *cap, long p1, long p2, long p3, long p4,
@ -252,7 +252,7 @@ char *tparm(const char *cap, long p1, long p2, long p3, long p4,
{
PDC_LOG(("tparm() - called: cap %s\n", cap));
return (char *)NULL;
return NULL;
}
int tputs(const char *str, int affcnt, int (*putfunc) (int))

View File

@ -1,5 +1,5 @@
/****************************************************************************
* apps/graphics/pdcurses/pdc_window.c
* apps/graphics/pdcurs34/pdcurses/pdc_window.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -154,7 +154,7 @@
#include "curspriv.h"
/****************************************************************************
* Public functions
* Public Functions
****************************************************************************/
WINDOW *PDC_makenew(int nlines, int ncols, int begy, int begx)
@ -169,7 +169,7 @@ WINDOW *PDC_makenew(int nlines, int ncols, int begy, int begx)
/* Allocate the window structure itself */
if ((win = calloc(1, sizeof(WINDOW))) == (WINDOW *) NULL)
if ((win = calloc(1, sizeof(WINDOW))) == NULL)
{
return win;
}
@ -179,7 +179,7 @@ WINDOW *PDC_makenew(int nlines, int ncols, int begy, int begx)
if ((win->_y = malloc(nlines * sizeof(chtype *))) == NULL)
{
free(win);
return (WINDOW *)NULL;
return NULL;
}
/* allocate the minchng and maxchng arrays */
@ -188,7 +188,7 @@ WINDOW *PDC_makenew(int nlines, int ncols, int begy, int begx)
{
free(win->_y);
free(win);
return (WINDOW *)NULL;
return NULL;
}
if ((win->_lastch = malloc(nlines * sizeof(int))) == NULL)
@ -196,7 +196,7 @@ WINDOW *PDC_makenew(int nlines, int ncols, int begy, int begx)
free(win->_firstch);
free(win->_y);
free(win);
return (WINDOW *)NULL;
return NULL;
}
/* Initialize window variables */
@ -228,7 +228,7 @@ WINDOW *PDC_makelines(WINDOW *win)
if (!win)
{
return (WINDOW *)NULL;
return NULL;
}
nlines = win->_maxy;
@ -250,7 +250,7 @@ WINDOW *PDC_makelines(WINDOW *win)
free(win->_y);
free(win);
return (WINDOW *)NULL;
return NULL;
}
}
@ -296,7 +296,7 @@ WINDOW *newwin(int nlines, int ncols, int begy, int begx)
!(win = PDC_makenew(nlines, ncols, begy, begx)) ||
!(win = PDC_makelines(win)))
{
return (WINDOW *)NULL;
return NULL;
}
werase(win);
@ -369,7 +369,7 @@ WINDOW *subwin(WINDOW *orig, int nlines, int ncols, int begy, int begx)
(begy + nlines) > (orig->_begy + orig->_maxy) ||
(begx + ncols) > (orig->_begx + orig->_maxx))
{
return (WINDOW *)NULL;
return NULL;
}
if (!nlines)
@ -384,7 +384,7 @@ WINDOW *subwin(WINDOW *orig, int nlines, int ncols, int begy, int begx)
if (!(win = PDC_makenew(nlines, ncols, begy, begx)))
{
return (WINDOW *)NULL;
return NULL;
}
/* Initialize window variables */
@ -417,7 +417,8 @@ WINDOW *derwin(WINDOW *orig, int nlines, int ncols, int begy, int begx)
int mvderwin(WINDOW *win, int pary, int parx)
{
int i, j;
int i;
int j;
WINDOW *mypar;
if (!win || !(win->_parent))
@ -458,7 +459,7 @@ WINDOW *dupwin(WINDOW *win)
if (!win)
{
return (WINDOW *) NULL;
return NULL;
}
nlines = win->_maxy;
@ -469,7 +470,7 @@ WINDOW *dupwin(WINDOW *win)
if (!(new = PDC_makenew(nlines, ncols, begy, begx)) ||
!(new = PDC_makelines(new)))
{
return (WINDOW *) NULL;
return NULL;
}
/* copy the contents of win into new */
@ -526,21 +527,23 @@ WINDOW *resize_window(WINDOW *win, int nlines, int ncols)
if (!win)
{
return (WINDOW *)NULL;
return NULL;
}
if (win->_flags & _SUBPAD)
{
if (!(new = subpad(win->_parent, nlines, ncols, win->_begy, win->_begx)))
if (!(new = subpad(win->_parent, nlines, ncols,
win->_begy, win->_begx)))
{
return (WINDOW *)NULL;
return NULL;
}
}
else if (win->_flags & _SUBWIN)
{
if (!(new = subwin(win->_parent, nlines, ncols, win->_begy, win->_begx)))
if (!(new = subwin(win->_parent, nlines, ncols,
win->_begy, win->_begx)))
{
return (WINDOW *)NULL;
return NULL;
}
}
else
@ -558,7 +561,7 @@ WINDOW *resize_window(WINDOW *win, int nlines, int ncols)
if (!(new = PDC_makenew(nlines, ncols, new_begy, new_begx)))
{
return (WINDOW *)NULL;
return NULL;
}
}
@ -569,7 +572,7 @@ WINDOW *resize_window(WINDOW *win, int nlines, int ncols)
{
if (!(new = PDC_makelines(new)))
{
return (WINDOW *) NULL;
return NULL;
}
werase(new);

View File

@ -215,7 +215,7 @@ namespace NXWidgets
CButton(CWidgetControl *pWidgetControl, nxgl_coord_t x, nxgl_coord_t y,
nxgl_coord_t width, nxgl_coord_t height, const CNxString &text,
CWidgetStyle *style = (CWidgetStyle *)NULL);
CWidgetStyle *style = NULL);
/**
* CButton Destructor.

View File

@ -191,7 +191,7 @@ namespace NXWidgets
nxgl_coord_t x, nxgl_coord_t y,
uint8_t buttonColumns, uint8_t buttonRows,
nxgl_coord_t buttonWidth, nxgl_coord_t buttonHeight,
CWidgetStyle *style = (CWidgetStyle *)NULL);
CWidgetStyle *style = NULL);
/**
* CButtonArray Destructor.

View File

@ -162,7 +162,7 @@ namespace NXWidgets
CCheckBox(CWidgetControl *pWidgetControl, nxgl_coord_t x, nxgl_coord_t y,
nxgl_coord_t width, nxgl_coord_t height,
CWidgetStyle *style = (CWidgetStyle *)NULL);
CWidgetStyle *style = NULL);
/**
* Destructor.

View File

@ -191,7 +191,7 @@ namespace NXWidgets
CCycleButton(CWidgetControl *pWidgetControl,
nxgl_coord_t x, nxgl_coord_t y,
nxgl_coord_t width, nxgl_coord_t height,
CWidgetStyle *style = (CWidgetStyle *)NULL);
CWidgetStyle *style = NULL);
/**
* Destructor.

View File

@ -201,7 +201,7 @@ namespace NXWidgets
nxgl_coord_t bitmapX, nxgl_coord_t bitmapY,
FAR const struct SBitmap *normalGlyph,
FAR const struct SBitmap *clickedGlyph,
CWidgetStyle *style = (CWidgetStyle *)NULL);
CWidgetStyle *style = NULL);
/**
* Destructor.

View File

@ -201,7 +201,7 @@ namespace NXWidgets
CImage(CWidgetControl *pWidgetControl, nxgl_coord_t x, nxgl_coord_t y,
nxgl_coord_t width, nxgl_coord_t height, FAR IBitmap *bitmap,
CWidgetStyle *style = (CWidgetStyle *)NULL);
CWidgetStyle *style = NULL);
/**
* Destructor.

View File

@ -94,7 +94,7 @@ namespace NXWidgets
CKeypad(CWidgetControl *pWidgetControl, NXHANDLE hNxServer,
nxgl_coord_t x, nxgl_coord_t y,
nxgl_coord_t width, nxgl_coord_t height,
CWidgetStyle *style = (CWidgetStyle *)NULL);
CWidgetStyle *style = NULL);
/**
* CKeypad Destructor.

View File

@ -204,7 +204,7 @@ namespace NXWidgets
CLabel(CWidgetControl *pWidgetControl, nxgl_coord_t x, nxgl_coord_t y,
nxgl_coord_t width, nxgl_coord_t height, const CNxString &text,
CWidgetStyle *style = (CWidgetStyle *)NULL);
CWidgetStyle *style = NULL);
/**
* Destructor.

View File

@ -134,7 +134,7 @@ namespace NXWidgets
nxgl_coord_t x, nxgl_coord_t y,
nxgl_coord_t width, nxgl_coord_t height,
const CNxString &text,
CWidgetStyle *style = (CWidgetStyle *)NULL);
CWidgetStyle *style = NULL);
/**
* Destructor.

View File

@ -110,7 +110,7 @@ namespace NXWidgets
nxgl_coord_t x, nxgl_coord_t y,
uint8_t buttonColumns, uint8_t buttonRows,
nxgl_coord_t buttonWidth, nxgl_coord_t buttonHeight,
CWidgetStyle *style = (CWidgetStyle *)NULL);
CWidgetStyle *style = NULL);
/**
* CLatchButtonArray Destructor.

View File

@ -180,7 +180,7 @@ namespace NXWidgets
CListBox(CWidgetControl *pWidgetControl,
nxgl_coord_t x, nxgl_coord_t y,
nxgl_coord_t width, nxgl_coord_t height,
CWidgetStyle *style = (CWidgetStyle *)NULL);
CWidgetStyle *style = NULL);
/**
* Destructor.

View File

@ -384,7 +384,7 @@ namespace NXWidgets
inline virtual ~CMultiLineTextBox(void)
{
delete m_text;
m_text = (CText *)NULL;
m_text = NULL;
}
/**
@ -422,7 +422,7 @@ namespace NXWidgets
nxgl_coord_t width, nxgl_coord_t height,
const CNxString &text, uint32_t flags,
nxgl_coord_t maxRows = 0,
CWidgetStyle *style = (CWidgetStyle *)NULL);
CWidgetStyle *style = NULL);
/**
* Set the horizontal alignment of text within the textbox.

View File

@ -156,7 +156,7 @@ namespace NXWidgets
CNumericEdit(CWidgetControl *pWidgetControl, nxgl_coord_t x, nxgl_coord_t y,
nxgl_coord_t width, nxgl_coord_t height,
CWidgetStyle *style = (CWidgetStyle *)NULL);
CWidgetStyle *style = NULL);
/**
* Destructor.

View File

@ -209,7 +209,7 @@ namespace NXWidgets
virtual inline ~CNxString()
{
delete[] m_text;
m_text = (FAR nxwidget_char_t *)NULL;
m_text = NULL;
};
/**

View File

@ -162,7 +162,7 @@ namespace NXWidgets
inline void detachToolbar(void)
{
m_toolbar = (CNxToolbar *)NULL;
m_toolbar = NULL;
m_toolbarHeight = 0;
}

View File

@ -397,7 +397,7 @@ namespace NXWidgets
nxgl_coord_t x, nxgl_coord_t y,
nxgl_coord_t width, nxgl_coord_t height,
uint32_t flags,
FAR const CWidgetStyle *style = (FAR const CWidgetStyle *)NULL);
FAR const CWidgetStyle *style = NULL);
/**
* Destructor.

View File

@ -166,7 +166,7 @@ namespace NXWidgets
CRadioButton(CWidgetControl *pWidgetControl,
nxgl_coord_t x, nxgl_coord_t y,
nxgl_coord_t width, nxgl_coord_t height,
CWidgetStyle *style = (CWidgetStyle *)NULL);
CWidgetStyle *style = NULL);
/**
* Get the current state of the radio button.

View File

@ -133,7 +133,7 @@ namespace NXWidgets
CRadioButtonGroup(CWidgetControl *pWidgetControl,
nxgl_coord_t x, nxgl_coord_t y,
CWidgetStyle *style = (CWidgetStyle *)NULL);
CWidgetStyle *style = NULL);
/**
* Destructor.

View File

@ -144,7 +144,7 @@ namespace NXWidgets
CScrollbarHorizontal(CWidgetControl *pWidgetControl,
nxgl_coord_t x, nxgl_coord_t y,
nxgl_coord_t width, nxgl_coord_t height,
CWidgetStyle *style = (CWidgetStyle *)NULL);
CWidgetStyle *style = NULL);
/**
* Destructor.

View File

@ -160,7 +160,7 @@ namespace NXWidgets
nxgl_coord_t x, nxgl_coord_t y,
nxgl_coord_t width, nxgl_coord_t height,
uint32_t flags,
CWidgetStyle *style = (CWidgetStyle *)NULL);
CWidgetStyle *style = NULL);
/**
* Scroll the panel by the specified amounts.

View File

@ -143,7 +143,7 @@ namespace NXWidgets
CScrollbarVertical(CWidgetControl *pWidgetControl,
nxgl_coord_t x, nxgl_coord_t y,
nxgl_coord_t width, nxgl_coord_t height,
CWidgetStyle *style = (CWidgetStyle *)NULL);
CWidgetStyle *style = NULL);
/**
* Destructor.

View File

@ -156,7 +156,7 @@ namespace NXWidgets
CScrollingListBox(CWidgetControl *pWidgetControl,
nxgl_coord_t x, nxgl_coord_t y,
nxgl_coord_t width, nxgl_coord_t height,
CWidgetStyle *style = (CWidgetStyle *)NULL);
CWidgetStyle *style = NULL);
/**
* Add a new option to the widget using default colors.

View File

@ -194,7 +194,7 @@ namespace NXWidgets
nxgl_coord_t x, nxgl_coord_t y,
nxgl_coord_t width, nxgl_coord_t height,
uint32_t flags,
CWidgetStyle *style = (CWidgetStyle *)NULL);
CWidgetStyle *style = NULL);
/**
* Scroll the panel by the specified amounts.

View File

@ -163,7 +163,7 @@ namespace NXWidgets
nxgl_coord_t width, nxgl_coord_t height,
const CNxString &text, uint32_t flags,
nxgl_coord_t maxRows = 0,
CWidgetStyle *style = (CWidgetStyle *)NULL);
CWidgetStyle *style = NULL);
/**
* Set the horizontal alignment of text within the textbox.

View File

@ -179,7 +179,7 @@ namespace NXWidgets
nxgl_coord_t x, nxgl_coord_t y,
nxgl_coord_t width, nxgl_coord_t height,
const CNxString &text,
CWidgetStyle *style = (CWidgetStyle *)NULL);
CWidgetStyle *style = NULL);
/**
* Destructor.

View File

@ -104,7 +104,7 @@ namespace NXWidgets
nxgl_coord_t x, nxgl_coord_t y,
uint8_t buttonColumns, uint8_t buttonRows,
nxgl_coord_t buttonWidth, nxgl_coord_t buttonHeight,
CWidgetStyle *style = (CWidgetStyle *)NULL);
CWidgetStyle *style = NULL);
/**
* CStickyButtonArray Destructor.

View File

@ -132,7 +132,7 @@ namespace NXWidgets
CStickyImage(CWidgetControl *pWidgetControl, nxgl_coord_t x, nxgl_coord_t y,
nxgl_coord_t width, nxgl_coord_t height, FAR IBitmap *bitmap,
CWidgetStyle *style = (CWidgetStyle *)NULL);
CWidgetStyle *style = NULL);
/**
* Destructor.

View File

@ -78,7 +78,7 @@ namespace NXWidgets
nxgl_coord_t x, nxgl_coord_t y,
nxgl_coord_t width, nxgl_coord_t height,
nxgl_coord_t buttonHeight,
FAR const CWidgetStyle *style = (FAR const CWidgetStyle *)NULL
FAR const CWidgetStyle *style = NULL
);
inline CNxWidget &page(uint8_t index) { return *m_tabpages.at(index); }

View File

@ -226,7 +226,7 @@ namespace NXWidgets
CTextBox(CWidgetControl *pWidgetControl, nxgl_coord_t x, nxgl_coord_t y,
nxgl_coord_t width, nxgl_coord_t height, const CNxString &text,
CWidgetStyle *style = (CWidgetStyle *)NULL);
CWidgetStyle *style = NULL);
/**
* Sets the cursor display mode.

View File

@ -352,7 +352,7 @@ namespace NXWidgets
* values stored in the defaultCWidgetStyle object.
*/
CWidgetControl(FAR const CWidgetStyle *style = (const CWidgetStyle *)NULL);
CWidgetControl(FAR const CWidgetStyle *style = NULL);
/**
* Destructor.
@ -420,7 +420,7 @@ namespace NXWidgets
* @return True means some interesting event occurred
*/
bool pollEvents(CNxWidget *widget = (CNxWidget *)NULL);
bool pollEvents(CNxWidget *widget = NULL);
/**
* Swaps the depth of the supplied widget.
@ -509,7 +509,7 @@ namespace NXWidgets
{
if (widget == m_focusedWidget)
{
m_focusedWidget = (CNxWidget *)NULL;
m_focusedWidget = NULL;
}
}

View File

@ -118,8 +118,7 @@ namespace NxWM
* values stored in the defaultCWidgetStyle object.
*/
CWindowMessenger(FAR const NXWidgets::CWidgetStyle *style =
(const NXWidgets::CWidgetStyle *)NULL);
CWindowMessenger(FAR const NXWidgets::CWidgetStyle *style = NULL);
/**
* CWindowMessenger Destructor.

View File

@ -215,8 +215,7 @@ namespace Twm4Nx
CWindowEvent(FAR CTwm4Nx *twm4nx, FAR void *client,
FAR const struct SAppEvents &events,
FAR const NXWidgets::CWidgetStyle *style =
(const NXWidgets::CWidgetStyle *)NULL);
FAR const NXWidgets::CWidgetStyle *style = NULL);
/**
* CWindowEvent Destructor.

View File

@ -962,7 +962,7 @@ static int _zmp_telnet(FAR struct telnet_s *telnet, FAR const char *buffer,
size_t size)
{
union telnet_event_u ev;
FAR char **argv;
FAR const char **argv;
FAR const char *c;
size_t i;
size_t argc;
@ -985,7 +985,7 @@ static int _zmp_telnet(FAR struct telnet_s *telnet, FAR const char *buffer,
/* Allocate argument array, bail on error */
if ((argv = (char **)calloc(argc, sizeof(char *))) == 0)
if ((argv = (const char **)calloc(argc, sizeof(char *))) == 0)
{
_error(telnet, __LINE__, __func__, TELNET_ENOMEM, 0,
"calloc() failed: %d", errno);
@ -996,14 +996,14 @@ static int _zmp_telnet(FAR struct telnet_s *telnet, FAR const char *buffer,
for (i = 0, c = buffer; i != argc; ++i)
{
argv[i] = (char *)c;
argv[i] = c;
c += strlen(c) + 1;
}
/* Invoke event with our arguments */
ev.type = TELNET_EV_ZMP;
ev.zmp.argv = (const char **)argv;
ev.zmp.argv = argv;
ev.zmp.argc = argc;
telnet->eh(telnet, &ev, telnet->ud);

View File

@ -344,7 +344,7 @@ void *fdwatch_get_next_client_data(struct fdwatch_s *fw)
if (fw->next >= fw->nwatched)
{
fwinfo("All client data returned: %d\n", fw->next);
return (void *)-1;
return (void *)(uintptr_t)-1;
}
fwinfo("client_data[%d]: %p\n", fw->next, fw->client[fw->next]);

View File

@ -2,7 +2,7 @@
* apps/netutils/thttpd/libhttpd.c
* HTTP Protocol Library
*
* Copyright (C) 2009, 2011, 2013, 2015-2016 Gregory Nutt. All rights reserved.
* Copyright (C) 2011, 2013, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Derived from the file of the same name in the original THTTPD package:
@ -123,10 +123,12 @@ extern CODE char *crypt(const char *key, const char *setting);
static void free_httpd_server(httpd_server *hs);
static int initialize_listen_socket(httpd_sockaddr *saP);
static void add_response(httpd_conn *hc, const char *str);
static void send_mime(httpd_conn *hc, int status, const char *title, const char *encodings,
const char *extraheads, const char *type, off_t length, time_t mod);
static void send_mime(httpd_conn *hc, int status, const char *title,
const char *encodings, const char *extraheads,
const char *type, off_t length, time_t mod);
static void send_response(httpd_conn *hc, int status, const char *title,
const char *extraheads, const char *form, const char *arg);
const char *extraheads, const char *form,
const char *arg);
static void send_response_tail(httpd_conn *hc);
static void defang(const char *str, char *dfstr, int dfsize);
#ifdef CONFIG_THTTPD_ERROR_DIRECTORY
@ -194,7 +196,10 @@ static pid_t main_thread;
/* Names for index file */
static const char *index_names[] = { CONFIG_THTTPD_INDEX_NAMES };
static const char *index_names[] =
{
CONFIG_THTTPD_INDEX_NAMES
};
/****************************************************************************
* Private Functions
@ -242,7 +247,7 @@ static int initialize_listen_socket(httpd_sockaddr *saP)
/* Allow reuse of local addresses. */
on = 1;
if (setsockopt(listen_fd, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) < 0)
if (setsockopt(listen_fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0)
{
nerr("ERROR: setsockopt(SO_REUSEADDR) failed: %d\n", errno);
}
@ -307,8 +312,9 @@ static void add_response(httpd_conn *hc, const char *str)
hc->buflen = resplen;
}
static void send_mime(httpd_conn *hc, int status, const char *title, const char *encodings,
const char *extraheads, const char *type, off_t length, time_t mod)
static void send_mime(httpd_conn *hc, int status, const char *title,
const char *encodings, const char *extraheads,
const char *type, off_t length, time_t mod)
{
struct timeval now;
const char *rfc1123fmt = "%a, %d %b %Y %H:%M:%S GMT";
@ -348,7 +354,8 @@ static void send_mime(httpd_conn *hc, int status, const char *title, const char
}
snprintf(fixed_type, sizeof(fixed_type), type, CONFIG_THTTPD_CHARSET);
snprintf(buf, sizeof(buf), "%.20s %d %s\r\n", hc->protocol, status, title);
snprintf(buf, sizeof(buf), "%.20s %d %s\r\n",
hc->protocol, status, title);
add_response(hc, buf);
snprintf(buf, sizeof(buf), "Server: %s\r\n", "thttpd");
add_response(hc, buf);
@ -387,7 +394,8 @@ static void send_mime(httpd_conn *hc, int status, const char *title, const char
}
else if (length >= 0)
{
snprintf(buf, sizeof(buf), "Content-Length: %ld\r\n", (long)length);
snprintf(buf, sizeof(buf), "Content-Length: %ld\r\n",
(long)length);
add_response(hc, buf);
}
@ -414,15 +422,17 @@ static void send_mime(httpd_conn *hc, int status, const char *title, const char
}
}
static void send_response(httpd_conn *hc, int status, const char *title, const char *extraheads,
const char *form, const char *arg)
static void send_response(httpd_conn *hc, int status, const char *title,
const char *extraheads, const char *form,
const char *arg)
{
char defanged[72];
char buf[128];
ninfo("title: \"%s\" form: \"%s\"\n", title, form);
send_mime(hc, status, title, "", extraheads, "text/html; charset=%s", (off_t)-1, (time_t)0);
send_mime(hc, status, title, "", extraheads,
"text/html; charset=%s", -1, 0);
add_response(hc, html_html);
add_response(hc, html_hdtitle);
snprintf(buf, sizeof(buf), "%d %s", status, title);
@ -443,7 +453,8 @@ static void send_response(httpd_conn *hc, int status, const char *title, const c
add_response(hc, "<!--\n");
for (n = 0; n < 6; ++n)
add_response(hc,
"Padding so that MSIE deigns to show this error instead of its own canned one.\n");
"Padding so that MSIE deigns to show this error "
"instead of its own canned one.\n");
add_response(hc, "-->\n");
}
@ -534,7 +545,8 @@ static void send_authenticate(httpd_conn *hc, char *realm)
static size_t maxheader = 0;
static char headstr[] = "WWW-Authenticate: Basic realm=\"";
httpd_realloc_str(&header, &maxheader, sizeof(headstr) + strlen(realm) + 3);
httpd_realloc_str(&header, &maxheader,
sizeof(headstr) + strlen(realm) + 3);
snprintf(header, maxheader, "%s%s\"\r\n", headstr, realm);
httpd_send_err(hc, 401, err401title, header, err401form, hc->encodedurl);
@ -629,7 +641,8 @@ static int b64_decode(const char *str, unsigned char *space, int size)
break;
case 2:
space[ndx++] = (((prev_decoded & 0xf) << 4) | ((decoded & 0x3packed) >> 2));
space[ndx++] = (((prev_decoded & 0xf) << 4) |
((decoded & 0x3packed) >> 2));
phase = 3;
break;
@ -715,7 +728,8 @@ static int auth_check2(httpd_conn *hc, char *dirname)
/* Does this request contain basic authorization info? */
if (hc->authorization[0] == '\0' || strncmp(hc->authorization, "Basic ", 6) != 0)
if (hc->authorization[0] == '\0' ||
strncmp(hc->authorization, "Basic ", 6) != 0)
{
/* Nope, return a 401 Unauthorized. */
@ -725,7 +739,8 @@ static int auth_check2(httpd_conn *hc, char *dirname)
/* Decode it. */
l = b64_decode(&(hc->authorization[6]), (unsigned char *)authinfo, sizeof(authinfo) - 1);
l = b64_decode(&(hc->authorization[6]),
(unsigned char *)authinfo, sizeof(authinfo) - 1);
authinfo[l] = '\0';
/* Split into user and password. */
@ -787,8 +802,9 @@ static int auth_check2(httpd_conn *hc, char *dirname)
httpd_send_err(hc, 403, err403title, "",
ERROR_FORM(err403form,
"The requested URL '%s' is protected by an authentication file, "
"but the authentication file cannot be opened.\n"),
"The requested URL '%s' is protected by an "
"authentication file, but the "
"authentication file cannot be opened.\n"),
hc->encodedurl);
return -1;
}
@ -829,12 +845,14 @@ static int auth_check2(httpd_conn *hc, char *dirname)
{
/* Ok! */
httpd_realloc_str(&hc->remoteuser, &hc->maxremoteuser, strlen(line));
httpd_realloc_str(&hc->remoteuser, &hc->maxremoteuser,
strlen(line));
strcpy(hc->remoteuser, line);
/* And cache this user's info for next time. */
httpd_realloc_str(&prevauthpath, &maxprevauthpath, strlen(authpath));
httpd_realloc_str(&prevauthpath, &maxprevauthpath,
strlen(authpath));
strcpy(prevauthpath, authpath);
prevmtime = sb.st_mtime;
httpd_realloc_str(&prevuser, &maxprevuser, strlen(authinfo));
@ -877,7 +895,8 @@ static void send_dirredirect(httpd_conn *hc)
*cp = '\0';
}
httpd_realloc_str(&location, &maxlocation, strlen(hc->encodedurl) + 2 + strlen(hc->query));
httpd_realloc_str(&location, &maxlocation,
strlen(hc->encodedurl) + 2 + strlen(hc->query));
snprintf(location, maxlocation, "%s/?%s", hc->encodedurl, hc->query);
}
else
@ -905,7 +924,8 @@ static int httpd_tilde_map1(httpd_conn *hc)
httpd_realloc_str(&temp, &maxtemp, len);
strcpy(temp, &hc->expnfilename[1]);
httpd_realloc_str(&hc->expnfilename, &hc->maxexpnfilename, strlen(prefix) + 1 + len);
httpd_realloc_str(&hc->expnfilename, &hc->maxexpnfilename,
strlen(prefix) + 1 + len);
strcpy(hc->expnfilename, prefix);
if (prefix[0] != '\0')
@ -956,7 +976,8 @@ static int httpd_tilde_map2(httpd_conn *hc)
/* Set up altdir. */
httpd_realloc_str(&hc->altdir, &hc->maxaltdir, strlen(pw->pw_dir) + 1 + strlen(postfix));
httpd_realloc_str(&hc->altdir, &hc->maxaltdir,
strlen(pw->pw_dir) + 1 + strlen(postfix));
strcpy(hc->altdir, pw->pw_dir);
if (postfix[0] != '\0')
{
@ -975,7 +996,8 @@ static int httpd_tilde_map2(httpd_conn *hc)
/* And the filename becomes altdir plus the post-~ part of the original. */
httpd_realloc_str(&hc->expnfilename, &hc->maxexpnfilename, strlen(hc->altdir) + 1 + strlen(cp));
httpd_realloc_str(&hc->expnfilename, &hc->maxexpnfilename,
strlen(hc->altdir) + 1 + strlen(cp));
snprintf(hc->expnfilename, hc->maxexpnfilename, "%s/%s", hc->altdir, cp);
/* For this type of tilde mapping, we want to defeat vhost mapping. */
@ -1042,7 +1064,8 @@ static int vhost_map(httpd_conn *hc)
#ifdef VHOST_DIRLEVELS
httpd_realloc_str(&hc->hostdir, &hc->maxhostdir, strlen(hc->vhostname) + 2 * VHOST_DIRLEVELS);
httpd_realloc_str(&hc->hostdir, &hc->maxhostdir,
strlen(hc->vhostname) + 2 * VHOST_DIRLEVELS);
if (strncmp(hc->vhostname, "www.", 4) == 0)
{
cp1 = &hc->vhostname[4];
@ -1096,7 +1119,8 @@ static int vhost_map(httpd_conn *hc)
len = strlen(hc->expnfilename);
httpd_realloc_str(&tempfilename, &maxtempfilename, len);
strcpy(tempfilename, hc->expnfilename);
httpd_realloc_str(&hc->expnfilename, &hc->maxexpnfilename, strlen(hc->hostdir) + 1 + len);
httpd_realloc_str(&hc->expnfilename, &hc->maxexpnfilename,
strlen(hc->hostdir) + 1 + len);
strcpy(hc->expnfilename, hc->hostdir);
strcat(hc->expnfilename, "/");
strcat(hc->expnfilename, tempfilename);
@ -1114,7 +1138,8 @@ static char *expand_filename(char *path, char **restP, bool tildemapped)
{
static char *checked;
static char *rest;
static size_t maxchecked = 0, maxrest = 0;
static size_t maxchecked = 0;
static size_t maxrest = 0;
size_t checkedlen;
size_t restlen;
#if 0 // REVISIT
@ -1153,12 +1178,14 @@ static char *expand_filename(char *path, char **restP, bool tildemapped)
}
#endif /* 0 */
/* Handle leading / or . and relative paths by copying the default directory into checked */
/* Handle leading / or . and relative paths by copying the default
* directory into checked
*/
if ((path[0] == '/' && strncmp(path, httpd_root, strlen(httpd_root)) != 0) || path[0] != '/')
if (path[0] != '/' || strncmp(path, httpd_root, strlen(httpd_root)) != 0)
{
/* Start out with httpd_root in checked. Allow space in the reallocation
* include NULL terminator and possibly a '/'
/* Start out with httpd_root in checked. Allow space in the
* reallocation include NULL terminator and possibly a '/'
*/
checkedlen = strlen(httpd_root);
@ -1288,7 +1315,8 @@ static char *expand_filename(char *path, char **restP, bool tildemapped)
}
else
{
httpd_realloc_str(&checked, &maxchecked, checkedlen + 1 + restlen);
httpd_realloc_str(&checked, &maxchecked,
checkedlen + 1 + restlen);
if (checkedlen > 0 && checked[checkedlen - 1] != '/')
{
checked[checkedlen++] = '/';
@ -1317,10 +1345,10 @@ static char *expand_filename(char *path, char **restP, bool tildemapped)
static char *bufgets(httpd_conn *hc)
{
int i;
int i = hc->checked_idx;
char c;
for (i = hc->checked_idx; hc->checked_idx < hc->read_idx; ++hc->checked_idx)
for (; hc->checked_idx < hc->read_idx; ++hc->checked_idx)
{
c = hc->read_buf[hc->checked_idx];
if (c == '\012' || c == '\015')
@ -1441,16 +1469,22 @@ static void figure_mime(httpd_conn *hc)
char *prev_dot;
char *dot;
char *ext;
int me_indexes[100], n_me_indexes;
size_t ext_len, encodings_len;
int i, top, bot, mid;
int me_indexes[100];
int n_me_indexes;
size_t ext_len;
int encodings_len;
int i;
int top;
int bot;
int mid;
int r;
char *default_type = "text/plain; charset=%s";
/* Peel off encoding extensions until there aren't any more. */
n_me_indexes = 0;
for (prev_dot = &hc->expnfilename[strlen(hc->expnfilename)]; ; prev_dot = dot)
prev_dot = &hc->expnfilename[strlen(hc->expnfilename)];
for (; ; prev_dot = dot)
{
for (dot = prev_dot - 1; dot >= hc->expnfilename && *dot != '.'; --dot)
;
@ -1637,7 +1671,8 @@ static void ls_child(int argc, char **argv)
{
oldmax = maxnames;
maxnames *= 2;
names = RENEW(names, char, oldmax*(PATH_MAX + 1), maxnames*(PATH_MAX + 1));
names = RENEW(names, char, oldmax * (PATH_MAX + 1),
maxnames * (PATH_MAX + 1));
nameptrs = RENEW(nameptrs, char *, oldmax, maxnames);
}
@ -1690,7 +1725,8 @@ static void ls_child(int argc, char **argv)
}
else
{
snprintf(rname, maxrname, "%s%s", hc->origfilename, nameptrs[i]);
snprintf(rname, maxrname, "%s%s",
hc->origfilename, nameptrs[i]);
}
}
@ -1862,14 +1898,14 @@ static int ls(httpd_conn *hc)
argv[0] = arg;
child = task_create("CGI child", CONFIG_THTTPD_CGI_PRIORITY,
CONFIG_THTTPD_CGI_STACKSIZE,
(main_t)ls_child, (FAR char * const *)argv);
CONFIG_THTTPD_CGI_STACKSIZE, ls_child, argv);
if (child < 0)
{
nerr("ERROR: task_create: %d\n", errno);
closedir(dirp);
INTERNALERROR("task_create");
httpd_send_err(hc, 500, err500title, "", err500form, hc->encodedurl);
httpd_send_err(hc, 500, err500title, "",
err500form, hc->encodedurl);
return -1;
}
@ -1881,7 +1917,8 @@ static int ls(httpd_conn *hc)
#if CONFIG_THTTPD_CGI_TIMELIMIT > 0
client_data.i = child;
if (tmr_create(NULL, cgi_kill, client_data, CONFIG_THTTPD_CGI_TIMELIMIT * 1000L, 0) == NULL)
if (tmr_create(NULL, cgi_kill, client_data,
CONFIG_THTTPD_CGI_TIMELIMIT * 1000L, 0) == NULL)
{
nerr("ERROR: tmr_create(cgi_kill ls) failed\n");
exit(1);
@ -1895,7 +1932,8 @@ static int ls(httpd_conn *hc)
{
closedir(dirp);
NOTIMPLEMENTED(httpd_method_str(hc->method));
httpd_send_err(hc, 501, err501title, "", err501form, httpd_method_str(hc->method));
httpd_send_err(hc, 501, err501title, "",
err501form, httpd_method_str(hc->method));
return -1;
}
@ -1938,7 +1976,8 @@ static int check_referer(httpd_conn *hc)
httpd_ntoa(&hc->client_addr), cp, hc->encodedurl, hc->referer);
httpd_send_err(hc, 403, err403title, "",
ERROR_FORM(err403form,
"You must supply a local referer to get URL '%s' from this server.\n"),
"You must supply a local referer to get URL "
"'%s' from this server.\n"),
hc->encodedurl);
}
@ -2046,7 +2085,8 @@ static int really_check_referer(httpd_conn *hc)
* filename does match the url pattern, it's an illegal reference.
*/
if (fnmatch(lp, refhost, 0) && !fnmatch(CONFIG_THTTPD_URLPATTERN, hc->origfilename, 0))
if (fnmatch(lp, refhost, 0) &&
!fnmatch(CONFIG_THTTPD_URLPATTERN, hc->origfilename, 0))
{
return 0;
}
@ -2145,7 +2185,8 @@ FAR httpd_server *httpd_initialize(FAR httpd_sockaddr *sa)
/* Done initializing. */
ninfo("%s starting on port %d\n", CONFIG_THTTPD_SERVER_SOFTWARE, (int)CONFIG_THTTPD_PORT);
ninfo("%s starting on port %d\n",
CONFIG_THTTPD_SERVER_SOFTWARE, CONFIG_THTTPD_PORT);
return hs;
}
@ -2188,7 +2229,8 @@ void httpd_write_response(httpd_conn *hc)
void httpd_set_ndelay(int fd)
{
int flags, newflags;
int flags;
int newflags;
flags = fcntl(fd, F_GETFL, 0);
if (flags != -1)
@ -2203,7 +2245,8 @@ void httpd_set_ndelay(int fd)
void httpd_clear_ndelay(int fd)
{
int flags, newflags;
int flags;
int newflags;
flags = fcntl(fd, F_GETFL, 0);
if (flags != -1)
@ -2216,8 +2259,9 @@ void httpd_clear_ndelay(int fd)
}
}
void httpd_send_err(httpd_conn *hc, int status, const char *title, const char *extraheads,
const char *form, const char *arg)
void httpd_send_err(httpd_conn *hc, int status, const char *title,
const char *extraheads, const char *form,
const char *arg)
{
#ifdef CONFIG_THTTPD_ERROR_DIRECTORY
char filename[1000];
@ -2230,7 +2274,8 @@ void httpd_send_err(httpd_conn *hc, int status, const char *title, const char *e
if (hc->hostdir[0] != '\0')
{
snprintf(filename, sizeof(filename),
"%s/%s/err%d.html", hc->hostdir, CONFIG_THTTPD_ERROR_DIRECTORY, status);
"%s/%s/err%d.html", hc->hostdir,
CONFIG_THTTPD_ERROR_DIRECTORY, status);
if (send_err_file(hc, status, title, extraheads, filename))
{
ninfo("Sent VHOST error file\n");
@ -2241,7 +2286,8 @@ void httpd_send_err(httpd_conn *hc, int status, const char *title, const char *e
/* Try server-wide error page. */
snprintf(filename, sizeof(filename), "%s/err%d.html", CONFIG_THTTPD_ERROR_DIRECTORY, status);
snprintf(filename, sizeof(filename), "%s/err%d.html",
CONFIG_THTTPD_ERROR_DIRECTORY, status);
if (send_err_file(hc, status, title, extraheads, filename))
{
ninfo("Sent server-wide error page\n");
@ -2285,7 +2331,8 @@ int httpd_get_conn(httpd_server *hs, int listen_fd, httpd_conn *hc)
if (!hc->initialized)
{
hc->read_size = 0;
httpd_realloc_str(&hc->read_buf, &hc->read_size, CONFIG_THTTPD_IOBUFFERSIZE);
httpd_realloc_str(&hc->read_buf, &hc->read_size,
CONFIG_THTTPD_IOBUFFERSIZE);
hc->maxdecodedurl =
hc->maxorigfilename = hc->maxexpnfilename = hc->maxencodings =
hc->maxpathinfo = hc->maxquery = hc->maxaccept =
@ -2392,13 +2439,13 @@ int httpd_get_conn(httpd_server *hs, int listen_fd, httpd_conn *hc)
return GC_OK;
}
/* Checks hc->read_buf to see whether a complete request has been read so far;
* either the first line has two words (an HTTP/0.9 request), or the first
* line has three words and there's a blank line present.
/* Checks hc->read_buf to see whether a complete request has been read so
* far; either the first line has two words (an HTTP/0.9 request), or the
* first line has three words and there's a blank line present.
*
* hc->read_idx is how much has been read in; hc->checked_idx is how much we
* have checked so far; and hc->checked_state is the current state of the
* finite state machine.
* hc->read_idx is how much has been read in; hc->checked_idx is how much
* we have checked so far; and hc->checked_state is the current state of
* the finite state machine.
*/
int httpd_got_request(httpd_conn *hc)
@ -2453,7 +2500,9 @@ int httpd_got_request(httpd_conn *hc)
case '\012':
case '\015':
/* The first line has only two words - an HTTP/0.9 request. */
return GR_GOT_REQUEST;
}
break;
@ -2532,6 +2581,7 @@ int httpd_got_request(httpd_conn *hc)
switch (c)
{
case '\012':
/* Two newlines in a row - a blank line - end of request. */
return GR_GOT_REQUEST;
@ -2554,6 +2604,7 @@ int httpd_got_request(httpd_conn *hc)
break;
case '\015':
/* Two returns in a row - end of request. */
return GR_GOT_REQUEST;
@ -2568,6 +2619,7 @@ int httpd_got_request(httpd_conn *hc)
switch (c)
{
case '\012':
/* Two newlines in a row - end of request. */
return GR_GOT_REQUEST;
@ -2587,6 +2639,7 @@ int httpd_got_request(httpd_conn *hc)
{
case '\012':
case '\015':
/* Two CRLFs or two CRs in a row - end of request. */
return GR_GOT_REQUEST;
@ -2668,7 +2721,8 @@ int httpd_parse_request(httpd_conn *hc)
if (!hc->one_one)
{
BADREQUEST("one_one");
httpd_send_err(hc, 400, httpd_err400title, "", httpd_err400form, "");
httpd_send_err(hc, 400, httpd_err400title, "",
httpd_err400form, "");
return -1;
}
@ -2677,7 +2731,8 @@ int httpd_parse_request(httpd_conn *hc)
if (!url)
{
BADREQUEST("reqhost-1");
httpd_send_err(hc, 400, httpd_err400title, "", httpd_err400form, "");
httpd_send_err(hc, 400, httpd_err400title, "",
httpd_err400form, "");
return -1;
}
@ -2686,7 +2741,8 @@ int httpd_parse_request(httpd_conn *hc)
if (strchr(reqhost, '/') != NULL || reqhost[0] == '.')
{
BADREQUEST("reqhost-2");
httpd_send_err(hc, 400, httpd_err400title, "", httpd_err400form, "");
httpd_send_err(hc, 400, httpd_err400title, "",
httpd_err400form, "");
return -1;
}
@ -2722,10 +2778,12 @@ int httpd_parse_request(httpd_conn *hc)
}
hc->encodedurl = url;
httpd_realloc_str(&hc->decodedurl, &hc->maxdecodedurl, strlen(hc->encodedurl));
httpd_realloc_str(&hc->decodedurl, &hc->maxdecodedurl,
strlen(hc->encodedurl));
httpd_strdecode(hc->decodedurl, hc->encodedurl);
httpd_realloc_str(&hc->origfilename, &hc->maxorigfilename, strlen(hc->decodedurl));
httpd_realloc_str(&hc->origfilename, &hc->maxorigfilename,
strlen(hc->decodedurl));
strcpy(hc->origfilename, &hc->decodedurl[1]);
/* Special case for top-level URL. */
@ -2797,10 +2855,12 @@ int httpd_parse_request(httpd_conn *hc)
*cp = '\0';
}
if (strchr(hc->hdrhost, '/') != NULL || hc->hdrhost[0] == '.')
if (hc->hdrhost[0] == '.' ||
strchr(hc->hdrhost, '/') != NULL)
{
BADREQUEST("hdrhost");
httpd_send_err(hc, 400, httpd_err400title, "", httpd_err400form, "");
httpd_send_err(hc, 400, httpd_err400title, "",
httpd_err400form, "");
return -1;
}
}
@ -2817,7 +2877,8 @@ int httpd_parse_request(httpd_conn *hc)
continue;
}
httpd_realloc_str(&hc->accept, &hc->maxaccept, strlen(hc->accept) + 2 + strlen(cp));
httpd_realloc_str(&hc->accept, &hc->maxaccept,
strlen(hc->accept) + 2 + strlen(cp));
strcat(hc->accept, ", ");
}
else
@ -2840,12 +2901,14 @@ int httpd_parse_request(httpd_conn *hc)
continue;
}
httpd_realloc_str(&hc->accepte, &hc->maxaccepte, strlen(hc->accepte) + 2 + strlen(cp));
httpd_realloc_str(&hc->accepte, &hc->maxaccepte,
strlen(hc->accepte) + 2 + strlen(cp));
strcat(hc->accepte, ", ");
}
else
{
httpd_realloc_str(&hc->accepte, &hc->maxaccepte, strlen(cp));
httpd_realloc_str(&hc->accepte, &hc->maxaccepte,
strlen(cp));
}
strcpy(hc->accepte, cp);
@ -2984,7 +3047,8 @@ int httpd_parse_request(httpd_conn *hc)
if (hc->reqhost[0] == '\0' && hc->hdrhost[0] == '\0')
{
BADREQUEST("reqhost-3");
httpd_send_err(hc, 400, httpd_err400title, "", httpd_err400form, "");
httpd_send_err(hc, 400, httpd_err400title, "",
httpd_err400form, "");
return -1;
}
@ -3018,7 +3082,8 @@ int httpd_parse_request(httpd_conn *hc)
#ifdef CONFIG_THTTPD_TILDE_MAP1
if (!httpd_tilde_map1(hc))
{
httpd_send_err(hc, 404, err404title, "", err404form, hc->encodedurl);
httpd_send_err(hc, 404, err404title, "",
err404form, hc->encodedurl);
return -1;
}
@ -3026,7 +3091,8 @@ int httpd_parse_request(httpd_conn *hc)
#ifdef CONFIG_THTTPD_TILDE_MAP2
if (!httpd_tilde_map2(hc))
{
httpd_send_err(hc, 404, err404title, "", err404form, hc->encodedurl);
httpd_send_err(hc, 404, err404title, "",
err404form, hc->encodedurl);
return -1;
}
@ -3058,7 +3124,8 @@ int httpd_parse_request(httpd_conn *hc)
strcpy(hc->expnfilename, cp);
httpd_realloc_str(&hc->pathinfo, &hc->maxpathinfo, strlen(pi));
strcpy(hc->pathinfo, pi);
ninfo("expnfilename: \"%s\" pathinfo: \"%s\"\n", hc->expnfilename, hc->pathinfo);
ninfo("expnfilename: \"%s\" pathinfo: \"%s\"\n",
hc->expnfilename, hc->pathinfo);
/* Remove pathinfo stuff from the original filename too. */
@ -3083,7 +3150,7 @@ int httpd_parse_request(httpd_conn *hc)
}
#ifdef CONFIG_THTTPD_TILDE_MAP2
else if (hc->altdir[0] != '\0' &&
(strncmp(hc->expnfilename, hc->altdir, strlen(hc->altdir)) == 0 &&
(!strncmp(hc->expnfilename, hc->altdir, strlen(hc->altdir)) &&
(hc->expnfilename[strlen(hc->altdir)] == '\0' ||
hc->expnfilename[strlen(hc->altdir)] == '/')))
{
@ -3095,7 +3162,9 @@ int httpd_parse_request(httpd_conn *hc)
httpd_ntoa(&hc->client_addr), hc->encodedurl);
httpd_send_err(hc, 403, err403title, "",
ERROR_FORM(err403form,
"The requested URL '%s' resolves to a file outside the permitted web server directory tree.\n"),
"The requested URL '%s' resolves to a "
"file outside the permitted web server "
"directory tree.\n"),
hc->encodedurl);
return -1;
}
@ -3190,7 +3259,8 @@ int httpd_start_request(httpd_conn *hc, struct timeval *nowP)
httpd_ntoa(&hc->client_addr), hc->encodedurl);
httpd_send_err(hc, 403, err403title, "",
ERROR_FORM(err403form,
"The requested URL '%s' resolves to a file that is not world-readable.\n"),
"The requested URL '%s' resolves to a file "
"that is not world-readable.\n"),
hc->encodedurl);
return -1;
}
@ -3203,7 +3273,8 @@ int httpd_start_request(httpd_conn *hc, struct timeval *nowP)
if (hc->pathinfo[0] != '\0')
{
httpd_send_err(hc, 404, err404title, "", err404form, hc->encodedurl);
httpd_send_err(hc, 404, err404title, "",
err404form, hc->encodedurl);
return -1;
}
@ -3252,11 +3323,12 @@ int httpd_start_request(httpd_conn *hc, struct timeval *nowP)
if (!(hc->sb.st_mode & S_IROTH))
{
nwarn("WARNING: %s URL \"%s\" tried to index a non-readable directory\n",
httpd_ntoa(&hc->client_addr), hc->encodedurl);
nwarn("WARNING: %s URL \"%s\" tried to index a non-readable "
"directory\n", httpd_ntoa(&hc->client_addr), hc->encodedurl);
httpd_send_err(hc, 403, err403title, "",
ERROR_FORM(err403form,
"The requested URL '%s' resolves to a directory that has indexing disabled.\n"),
"The requested URL '%s' resolves to a "
"directory that has indexing disabled.\n"),
hc->encodedurl);
return -1;
}
@ -3283,11 +3355,14 @@ int httpd_start_request(httpd_conn *hc, struct timeval *nowP)
#else /* CONFIG_THTTPD_GENERATE_INDICES */
/* Indexing is disabled */
nwarn("WARNING: %s URL \"%s\" tried to index a directory with indexing disabled\n",
nwarn("WARNING: %s URL \"%s\" tried to index a directory with "
"indexing disabled\n",
httpd_ntoa(&hc->client_addr), hc->encodedurl);
httpd_send_err(hc, 403, err403title, "",
ERROR_FORM(err403form,
"The requested URL '%s' is a directory, and directory indexing is disabled on this server.\n"),
"The requested URL '%s' is a directory, and "
"directory indexing is disabled on this "
"server.\n"),
hc->encodedurl);
return -1;
#endif /* CONFIG_THTTPD_GENERATE_INDICES */
@ -3302,7 +3377,8 @@ int httpd_start_request(httpd_conn *hc, struct timeval *nowP)
if (cp == NULL || pi[0] != '\0')
{
INTERNALERROR(indexname);
httpd_send_err(hc, 500, err500title, "", err500form, hc->encodedurl);
httpd_send_err(hc, 500, err500title, "",
err500form, hc->encodedurl);
return -1;
}
@ -3314,11 +3390,13 @@ int httpd_start_request(httpd_conn *hc, struct timeval *nowP)
if (!(hc->sb.st_mode & (S_IROTH | S_IXOTH)))
{
nwarn("WARNING: %s URL \"%s\" resolves to a non-world-readable index file\n",
nwarn("WARNING: %s URL \"%s\" resolves to a non-world-readable "
"index file\n",
httpd_ntoa(&hc->client_addr), hc->encodedurl);
httpd_send_err(hc, 403, err403title, "",
ERROR_FORM(err403form,
"The requested URL '%s' resolves to an index file that is not world-readable.\n"),
"The requested URL '%s' resolves to an "
"index file that is not world-readable.\n"),
hc->encodedurl);
return -1;
}
@ -3344,7 +3422,9 @@ int httpd_start_request(httpd_conn *hc, struct timeval *nowP)
return -1;
}
/* Check if the filename is the CONFIG_THTTPD_AUTH_FILE itself - that's verboten. */
/* Check if the filename is the CONFIG_THTTPD_AUTH_FILE itself -
* that's verboten.
*/
if (expnlen == sizeof(CONFIG_THTTPD_AUTH_FILE) - 1)
{
@ -3354,21 +3434,24 @@ int httpd_start_request(httpd_conn *hc, struct timeval *nowP)
httpd_ntoa(&hc->client_addr), hc->encodedurl);
httpd_send_err(hc, 403, err403title, "",
ERROR_FORM(err403form,
"The requested URL '%s' is an authorization file, retrieving it is not permitted.\n"),
"The requested URL '%s' is an "
"authorization file, retrieving it is "
"not permitted.\n"),
hc->encodedurl);
return -1;
}
}
else if (expnlen >= sizeof(CONFIG_THTTPD_AUTH_FILE) &&
strcmp(&(hc->expnfilename[expnlen - sizeof(CONFIG_THTTPD_AUTH_FILE) + 1]),
CONFIG_THTTPD_AUTH_FILE) == 0 &&
hc->expnfilename[expnlen - sizeof(CONFIG_THTTPD_AUTH_FILE)] == '/')
strcmp(&hc->expnfilename[expnlen - sizeof(CONFIG_THTTPD_AUTH_FILE)
+ 1], CONFIG_THTTPD_AUTH_FILE) == 0 &&
hc->expnfilename[expnlen - sizeof(CONFIG_THTTPD_AUTH_FILE)] == '/')
{
nwarn("WARNING: %s URL \"%s\" tried to retrieve an auth file\n",
httpd_ntoa(&hc->client_addr), hc->encodedurl);
httpd_send_err(hc, 403, err403title, "",
ERROR_FORM(err403form,
"The requested URL '%s' is an authorization file, retrieving it is not permitted.\n"),
"The requested URL '%s' is an authorization "
"file, retrieving it is not permitted.\n"),
hc->encodedurl);
return -1;
}
@ -3401,7 +3484,9 @@ int httpd_start_request(httpd_conn *hc, struct timeval *nowP)
httpd_ntoa(&hc->client_addr), hc->encodedurl);
httpd_send_err(hc, 403, err403title, "",
ERROR_FORM(err403form,
"The requested URL '%s' resolves to a file which is marked executable but is not a CGI file; retrieving it is forbidden.\n"),
"The requested URL '%s' resolves to a file "
"which is marked executable but is not a "
"CGI file; retrieving it is forbidden.\n"),
hc->encodedurl);
return -1;
}
@ -3412,7 +3497,9 @@ int httpd_start_request(httpd_conn *hc, struct timeval *nowP)
httpd_ntoa(&hc->client_addr), hc->encodedurl);
httpd_send_err(hc, 403, err403title, "",
ERROR_FORM(err403form,
"The requested URL '%s' resolves to a file plus CGI-style pathinfo, but the file is not a valid CGI file.\n"),
"The requested URL '%s' resolves to a file "
"plus CGI-style pathinfo, but the file is "
"not a valid CGI file.\n"),
hc->encodedurl);
return -1;
}

View File

@ -1060,8 +1060,7 @@ int cgi(httpd_conn *hc)
argv[1] = NULL;
child = task_create("CGI child", CONFIG_THTTPD_CGI_PRIORITY,
CONFIG_THTTPD_CGI_STACKSIZE,
(main_t)cgi_child, (FAR char * const *)argv);
CONFIG_THTTPD_CGI_STACKSIZE, cgi_child, argv);
if (child < 0)
{
nerr("ERROR: task_create: %d\n", errno);

View File

@ -99,7 +99,7 @@ int nsh_builtin(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
* applications.
*/
ret = exec_builtin(cmd, (FAR char * const *)argv, redirfile, oflags);
ret = exec_builtin(cmd, argv, redirfile, oflags);
if (ret >= 0)
{
/* The application was successfully started with pre-emption disabled.

View File

@ -529,7 +529,7 @@ int critmon_start_main(int argc, char **argv)
ret = task_create("Csection Monitor",
CONFIG_SYSTEM_CRITMONITOR_DAEMON_PRIORITY,
CONFIG_SYSTEM_CRITMONITOR_DAEMON_STACKSIZE,
(main_t)critmon_daemon, (FAR char * const *)NULL);
critmon_daemon, NULL);
if (ret < 0)
{
int errcode = errno;

View File

@ -253,10 +253,10 @@ FILE *popen(FAR const char *command, FAR const char *mode)
#ifdef CONFIG_SYSTEM_POPEN_SHPATH
argv[0] = CONFIG_SYSTEM_POPEN_SHPATH;
errcode = posix_spawn(&container->shell, argv[0], &file_actions,
&attr, argv, (FAR char * const *)NULL);
&attr, argv, NULL);
#else
container->shell = task_spawn("popen", nsh_system, &file_actions,
&attr, argv + 1, (FAR char * const *)NULL);
&attr, argv + 1, NULL);
if (container->shell < 0)
{
errcode = -container->shell;

View File

@ -431,8 +431,7 @@ int main(int argc, char **argv)
ret = task_create("Stack Monitor", CONFIG_SYSTEM_STACKMONITOR_PRIORITY,
CONFIG_SYSTEM_STACKMONITOR_STACKSIZE,
(main_t)stackmonitor_daemon,
(FAR char * const *)NULL);
stackmonitor_daemon, NULL);
if (ret < 0)
{
int errcode = errno;

View File

@ -134,11 +134,9 @@ int system(FAR const char *cmd)
#ifdef CONFIG_SYSTEM_SYSTEM_SHPATH
argv[0] = CONFIG_SYSTEM_SYSTEM_SHPATH;
errcode = posix_spawn(&pid, argv[0], NULL, &attr,
argv, (FAR char * const *)NULL);
errcode = posix_spawn(&pid, argv[0], NULL, &attr, argv, NULL);
#else
pid = task_spawn("system", nsh_system, NULL, &attr,
argv + 1, (FAR char * const *)NULL);
pid = task_spawn("system", nsh_system, NULL, &attr, argv + 1, NULL);
if (pid < 0)
{
errcode = -pid;

View File

@ -1629,7 +1629,7 @@ ZMRHANDLE zmr_initialize(int remfd)
{
zmdbg("ERROR: zm_timerinit failed: %d\n", ret);
free(pzmr);
return (ZMRHANDLE)NULL;
return NULL;
}
/* Note that no action is taken now... a timeout of zero is set

View File

@ -1642,7 +1642,7 @@ errout_with_timer:
zm_timerrelease(&pzms->cmn);
errout:
free(pzms);
return (ZMSHANDLE)NULL;
return NULL;
}
/****************************************************************************

View File

@ -72,11 +72,11 @@ static struct aiocb * const g_aiocb_init[AIO_NCTRLBLKS] =
static FAR void * const g_buffers[AIO_NCTRLBLKS] =
{
(FAR void *)g_wrbuffer1,
(FAR void *)NULL,
(FAR void *)g_wrbuffer2,
(FAR void *)NULL,
(FAR void *)g_rdbuffer
(FAR char *)g_wrbuffer1,
NULL,
(FAR char *)g_wrbuffer2,
NULL,
g_rdbuffer
};
static const FAR uint8_t g_offsets[AIO_NCTRLBLKS] =

View File

@ -523,7 +523,7 @@ void priority_inheritance(void)
sparam.sched_priority = PTHREAD_DEFAULT_PRIORITY;
}
my_pri = sparam.sched_priority;
my_pri = sparam.sched_priority;
g_highpri = sched_get_priority_max(SCHED_FIFO);
g_lowpri = sched_get_priority_min(SCHED_FIFO);
@ -712,7 +712,7 @@ void priority_inheritance(void)
snprintf(args[2], sizeof(args[2]), "%d", i == 0 ? 100000 : 1000);
pids[i] = task_create(name, priority, CONFIG_DEFAULT_TASK_STACKSIZE,
adversary, (FAR char * const *)argv);
adversary, argv);
priority += PRIORIY_SPREED;
}

View File

@ -86,7 +86,7 @@ struct i8sak_command_s
static const struct i8sak_command_s g_i8sak_commands[] =
{
{"help", (CODE void *)NULL},
{"help", NULL},
{"acceptassoc", (CODE void *)i8sak_acceptassoc_cmd},
{"assoc", (CODE void *)i8sak_assoc_cmd},
{"blaster", (CODE void *)i8sak_blaster_cmd},

View File

@ -82,7 +82,7 @@ static void iwpan_showusage(FAR const char *progname, int exitcode);
static const struct iwpan_command_s g_iwpan_commands[] =
{
{"help", 0, (CODE void *)NULL},
{"help", 0, NULL},
{"show", 1, (CODE void *)iwpan_show_cmd},
{"cca", 2, (CODE void *)iwpan_cca_cmd},
{"chan", 2, (CODE void *)iwpan_chan_cmd},