You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/06/15 19:23:30 UTC
[incubator-nuttx-apps] branch master updated: Remove the non standard c++ header file inclusion
This is an automated email from the ASF dual-hosted git repository.
pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new 7ce7eff9a Remove the non standard c++ header file inclusion
7ce7eff9a is described below
commit 7ce7eff9a908e8df0912ecde028c00b410757994
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Wed Jun 15 12:36:15 2022 +0800
Remove the non standard c++ header file inclusion
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
graphics/nxwidgets/src/cwidgetcontrol.cxx | 3 ++-
graphics/nxwm/src/ccalibration.cxx | 4 ++--
graphics/nxwm/src/ckeyboard.cxx | 12 ++++++------
graphics/nxwm/src/cnxterm.cxx | 10 +++++-----
graphics/nxwm/src/cstartwindow.cxx | 5 +++--
graphics/nxwm/src/ctouchscreen.cxx | 9 ++++-----
graphics/nxwm/src/cwindowmessenger.cxx | 2 +-
graphics/nxwm/src/nxwm_main.cxx | 4 ++--
graphics/twm4nx/apps/ccalibration.cxx | 4 ++--
graphics/twm4nx/apps/cclock.cxx | 6 +++---
graphics/twm4nx/apps/cnxterm.cxx | 12 ++++++------
graphics/twm4nx/src/cbackground.cxx | 3 ++-
graphics/twm4nx/src/ciconwidget.cxx | 5 +++--
graphics/twm4nx/src/cinput.cxx | 20 ++++++++++----------
graphics/twm4nx/src/cmainmenu.cxx | 2 +-
graphics/twm4nx/src/ctwm4nx.cxx | 2 +-
graphics/twm4nx/src/cwindow.cxx | 2 +-
graphics/twm4nx/src/cwindowevent.cxx | 2 +-
18 files changed, 55 insertions(+), 52 deletions(-)
diff --git a/graphics/nxwidgets/src/cwidgetcontrol.cxx b/graphics/nxwidgets/src/cwidgetcontrol.cxx
index eeb5e4180..09b783d15 100644
--- a/graphics/nxwidgets/src/cwidgetcontrol.cxx
+++ b/graphics/nxwidgets/src/cwidgetcontrol.cxx
@@ -27,9 +27,10 @@
#include <cstdint>
#include <cstdbool>
#include <cstring>
-#include <csched>
#include <cerrno>
+
#include <debug.h>
+#include <sched.h>
#include "graphics/nxwidgets/nxconfig.hxx"
#include "graphics/nxwidgets/cnxserver.hxx"
diff --git a/graphics/nxwm/src/ccalibration.cxx b/graphics/nxwm/src/ccalibration.cxx
index e13bdb52b..1c8f5cd8d 100644
--- a/graphics/nxwm/src/ccalibration.cxx
+++ b/graphics/nxwm/src/ccalibration.cxx
@@ -23,13 +23,13 @@
****************************************************************************/
#include <cinttypes>
-#include <cunistd>
#include <cerrno>
#include <sched.h>
#include <limits.h>
#include <assert.h>
#include <debug.h>
+#include <unistd.h>
#ifdef CONFIG_NXWM_TOUCHSCREEN_CONFIGDATA
# include "platform/configdata.h"
@@ -628,7 +628,7 @@ FAR void *CCalibration::calibration(FAR void *arg)
{
// Sleep for a while (or until we receive a signal)
- std::usleep(500*1000);
+ usleep(500*1000);
}
else
{
diff --git a/graphics/nxwm/src/ckeyboard.cxx b/graphics/nxwm/src/ckeyboard.cxx
index 73cde0258..826ed9b1e 100644
--- a/graphics/nxwm/src/ckeyboard.cxx
+++ b/graphics/nxwm/src/ckeyboard.cxx
@@ -24,14 +24,14 @@
#include <nuttx/config.h>
-#include <cunistd>
#include <cerrno>
-#include <cfcntl>
+#include <fcntl.h>
#include <sched.h>
#include <pthread.h>
#include <assert.h>
#include <debug.h>
+#include <unistd.h>
#include "graphics/nxwm/nxwmconfig.hxx"
#include "graphics/nxwm/ckeyboard.hxx"
@@ -84,7 +84,7 @@ CKeyboard::~CKeyboard(void)
if (m_kbdFd >= 0)
{
- std::close(m_kbdFd);
+ close(m_kbdFd);
}
}
@@ -167,7 +167,7 @@ int CKeyboard::open(void)
{
// Try to open the keyboard device
- fd = std::open(CONFIG_NXWM_KEYBOARD_DEVPATH, O_RDONLY);
+ fd = ::open(CONFIG_NXWM_KEYBOARD_DEVPATH, O_RDONLY);
if (fd < 0)
{
int errcode = errno;
@@ -193,7 +193,7 @@ int CKeyboard::open(void)
// Sleep a bit and try again
ginfo("WAITING for a USB device\n");
- std::sleep(2);
+ sleep(2);
}
// Anything else would be really bad.
@@ -366,7 +366,7 @@ FAR void *CKeyboard::listener(FAR void *arg)
// Close the keyboard device
- std::close(This->m_kbdFd);
+ close(This->m_kbdFd);
This->m_kbdFd = -1;
}
diff --git a/graphics/nxwm/src/cnxterm.cxx b/graphics/nxwm/src/cnxterm.cxx
index c2391bdd2..1143f0032 100644
--- a/graphics/nxwm/src/cnxterm.cxx
+++ b/graphics/nxwm/src/cnxterm.cxx
@@ -26,7 +26,6 @@
#include <cstdio>
#include <cstdlib>
-#include <cunistd>
#include <ctime>
#include <sys/boardctl.h>
@@ -35,6 +34,7 @@
#include <sched.h>
#include <assert.h>
#include <debug.h>
+#include <unistd.h>
#include "nshlib/nshlib.h"
@@ -489,16 +489,16 @@ int CNxTerm::nxterm(int argc, char *argv[])
std::fflush(stderr);
#ifdef CONFIG_NXTERM_NXKBDIN
- std::dup2(fd, 0);
+ dup2(fd, 0);
#endif
- std::dup2(fd, 1);
- std::dup2(fd, 2);
+ dup2(fd, 1);
+ dup2(fd, 2);
// And we can close our original driver file descriptor
if (fd > 2)
{
- std::close(fd);
+ ::close(fd);
}
// Inform the parent thread that we successfully initialized
diff --git a/graphics/nxwm/src/cstartwindow.cxx b/graphics/nxwm/src/cstartwindow.cxx
index c4fa30e27..b19a7ae58 100644
--- a/graphics/nxwm/src/cstartwindow.cxx
+++ b/graphics/nxwm/src/cstartwindow.cxx
@@ -25,10 +25,11 @@
#include <nuttx/config.h>
#include <cstdlib>
-#include <cfcntl>
-#include <csched>
#include <cerrno>
+#include <fcntl.h>
+#include <sched.h>
+
#include "graphics/nxwidgets/cwidgetcontrol.hxx"
#include "graphics/nxwm/nxwmconfig.hxx"
diff --git a/graphics/nxwm/src/ctouchscreen.cxx b/graphics/nxwm/src/ctouchscreen.cxx
index d4e10052a..fbb751700 100644
--- a/graphics/nxwm/src/ctouchscreen.cxx
+++ b/graphics/nxwm/src/ctouchscreen.cxx
@@ -25,16 +25,15 @@
#include <nuttx/config.h>
#include <cinttypes>
-#include <cunistd>
#include <cerrno>
-#include <cfcntl>
#include <sys/prctl.h>
-
+#include <fcntl.h>
#include <sched.h>
#include <pthread.h>
#include <assert.h>
#include <debug.h>
+#include <unistd.h>
#include <nuttx/nx/nxglib.h>
@@ -103,7 +102,7 @@ CTouchscreen::~CTouchscreen(void)
if (m_touchFd >= 0)
{
- std::close(m_touchFd);
+ close(m_touchFd);
}
// Destroy the semaphores that we created.
@@ -253,7 +252,7 @@ FAR void *CTouchscreen::listener(FAR void *arg)
// Open the touchscreen device that we just created.
- This->m_touchFd = std::open(CONFIG_NXWM_TOUCHSCREEN_DEVPATH, O_RDONLY);
+ This->m_touchFd = open(CONFIG_NXWM_TOUCHSCREEN_DEVPATH, O_RDONLY);
if (This->m_touchFd < 0)
{
gerr("ERROR Failed to open %s for reading: %d\n",
diff --git a/graphics/nxwm/src/cwindowmessenger.cxx b/graphics/nxwm/src/cwindowmessenger.cxx
index 7262ff745..9a33086b3 100644
--- a/graphics/nxwm/src/cwindowmessenger.cxx
+++ b/graphics/nxwm/src/cwindowmessenger.cxx
@@ -24,10 +24,10 @@
#include <nuttx/config.h>
-#include <cfcntl>
#include <cerrno>
#include <debug.h>
+#include <fcntl.h>
#include "graphics/nxwm/nxwmconfig.hxx"
#include "graphics/nxwm/cstartwindow.hxx"
diff --git a/graphics/nxwm/src/nxwm_main.cxx b/graphics/nxwm/src/nxwm_main.cxx
index 7365ea92c..f1255729b 100644
--- a/graphics/nxwm/src/nxwm_main.cxx
+++ b/graphics/nxwm/src/nxwm_main.cxx
@@ -26,8 +26,8 @@
#include <cstdio>
#include <cstdlib>
-#include <cunistd>
+#include <unistd.h>
#include <sys/boardctl.h>
#ifdef CONFIG_NXWM_TOUCHSCREEN_CONFIGDATA
@@ -604,7 +604,7 @@ int main(int argc, char *argv[])
printf("nxwm_main: Waiting for touchscreen calibration\n");
while (!g_nxwmtest.touchscreen->isCalibrated())
{
- std::sleep(2);
+ sleep(2);
}
// This is how we would then recover the calibration data. After the
diff --git a/graphics/twm4nx/apps/ccalibration.cxx b/graphics/twm4nx/apps/ccalibration.cxx
index cd505a927..5b8bc4759 100644
--- a/graphics/twm4nx/apps/ccalibration.cxx
+++ b/graphics/twm4nx/apps/ccalibration.cxx
@@ -25,14 +25,14 @@
#include <nuttx/config.h>
#include <cinttypes>
-#include <cunistd>
-#include <csched>
#include <cassert>
#include <cerrno>
#include <limits.h>
#include <semaphore.h>
#include <debug.h>
+#include <sched.h>
+#include <unistd.h>
#include <nuttx/semaphore.h>
#include <nuttx/nx/nxbe.h>
diff --git a/graphics/twm4nx/apps/cclock.cxx b/graphics/twm4nx/apps/cclock.cxx
index fcf3e876b..dac1ac286 100644
--- a/graphics/twm4nx/apps/cclock.cxx
+++ b/graphics/twm4nx/apps/cclock.cxx
@@ -26,12 +26,12 @@
#include <ctime>
#include <cstring>
-#include <csched>
#include <cassert>
-#include <cunistd>
#include <semaphore.h>
#include <debug.h>
+#include <sched.h>
+#include <unistd.h>
#include <nuttx/semaphore.h>
@@ -361,7 +361,7 @@ void CClock::stop(void)
// Then delete the NSH task, possibly stranding resources
- std::task_delete(pid);
+ task_delete(pid);
}
}
diff --git a/graphics/twm4nx/apps/cnxterm.cxx b/graphics/twm4nx/apps/cnxterm.cxx
index 957b96c9d..3bd9821e6 100644
--- a/graphics/twm4nx/apps/cnxterm.cxx
+++ b/graphics/twm4nx/apps/cnxterm.cxx
@@ -26,14 +26,14 @@
#include <cstdio>
#include <cstdlib>
-#include <cunistd>
-#include <cfcntl>
#include <ctime>
#include <cassert>
#include <sys/boardctl.h>
#include <semaphore.h>
+#include <fcntl.h>
#include <debug.h>
+#include <unistd.h>
#include "nshlib/nshlib.h"
@@ -402,16 +402,16 @@ int CNxTerm::nxterm(int argc, char *argv[])
std::fflush(stderr);
#ifdef CONFIG_NXTERM_NXKBDIN
- std::dup2(fd, 0);
+ dup2(fd, 0);
#endif
- std::dup2(fd, 1);
- std::dup2(fd, 2);
+ dup2(fd, 1);
+ dup2(fd, 2);
// And we can close our original driver file descriptor
if (fd > 2)
{
- std::close(fd);
+ close(fd);
}
// Inform the parent thread that we successfully initialized
diff --git a/graphics/twm4nx/src/cbackground.cxx b/graphics/twm4nx/src/cbackground.cxx
index 8ff48f5d9..ef1f0ae31 100644
--- a/graphics/twm4nx/src/cbackground.cxx
+++ b/graphics/twm4nx/src/cbackground.cxx
@@ -24,9 +24,10 @@
#include <nuttx/config.h>
-#include <cfcntl>
#include <cerrno>
+#include <fcntl.h>
+
#include <nuttx/nx/nxglib.h>
#include "graphics/nxwidgets/cscaledbitmap.hxx"
diff --git a/graphics/twm4nx/src/ciconwidget.cxx b/graphics/twm4nx/src/ciconwidget.cxx
index 46f43ac2d..ec4e66d38 100644
--- a/graphics/twm4nx/src/ciconwidget.cxx
+++ b/graphics/twm4nx/src/ciconwidget.cxx
@@ -24,11 +24,12 @@
#include <nuttx/config.h>
-#include <sys/types.h>
#include <cstdint>
#include <cstdbool>
-#include <cfcntl>
#include <cerrno>
+
+#include <sys/types.h>
+#include <fcntl.h>
#include <mqueue.h>
#include <nuttx/nx/nxglib.h>
diff --git a/graphics/twm4nx/src/cinput.cxx b/graphics/twm4nx/src/cinput.cxx
index 8c7788daa..ebe290a1f 100644
--- a/graphics/twm4nx/src/cinput.cxx
+++ b/graphics/twm4nx/src/cinput.cxx
@@ -24,14 +24,14 @@
#include <nuttx/config.h>
-#include <cunistd>
#include <cerrno>
-#include <cfcntl>
+#include <fcntl.h>
#include <sched.h>
#include <poll.h>
#include <pthread.h>
#include <assert.h>
+#include <unistd.h>
#include <nuttx/semaphore.h>
#include <nuttx/nx/nxglib.h>
@@ -127,7 +127,7 @@ CInput::~CInput(void)
if (m_kbdFd >= 0)
{
- std::close(m_kbdFd);
+ close(m_kbdFd);
}
#endif
@@ -136,7 +136,7 @@ CInput::~CInput(void)
if (m_mouseFd >= 0)
{
- std::close(m_mouseFd);
+ close(m_mouseFd);
}
#endif
}
@@ -220,7 +220,7 @@ int CInput::keyboardOpen(void)
{
// Try to open the keyboard device non-blocking.
- fd = std::open(CONFIG_TWM4NX_KEYBOARD_DEVPATH, O_RDONLY | O_NONBLOCK);
+ fd = open(CONFIG_TWM4NX_KEYBOARD_DEVPATH, O_RDONLY | O_NONBLOCK);
if (fd < 0)
{
int errcode = errno;
@@ -246,7 +246,7 @@ int CInput::keyboardOpen(void)
// Sleep a bit and try again
twminfo("WAITING for a USB keyboard\n");
- std::sleep(2);
+ sleep(2);
}
// Anything else would be really bad.
@@ -296,7 +296,7 @@ inline int CInput::mouseOpen(void)
{
// Try to open the mouse device non-blocking
- fd = std::open(CONFIG_TWM4NX_MOUSE_DEVPATH, O_RDONLY | O_NONBLOCK);
+ fd = open(CONFIG_TWM4NX_MOUSE_DEVPATH, O_RDONLY | O_NONBLOCK);
if (fd < 0)
{
int errcode = errno;
@@ -322,7 +322,7 @@ inline int CInput::mouseOpen(void)
// Sleep a bit and try again
twminfo("WAITING for a USB mouse\n");
- std::sleep(2);
+ sleep(2);
}
// Anything else would be really bad.
@@ -956,14 +956,14 @@ FAR void *CInput::listener(FAR void *arg)
#ifndef CONFIG_TWM4NX_NOKEYBOARD
// Close the keyboard device
- std::close(This->m_kbdFd);
+ close(This->m_kbdFd);
This->m_kbdFd = -1;
#endif
#ifndef CONFIG_TWM4NX_NOMOUSE
// Close the mouse device
- std::close(This->m_mouseFd);
+ close(This->m_mouseFd);
This->m_mouseFd = -1;
#endif
}
diff --git a/graphics/twm4nx/src/cmainmenu.cxx b/graphics/twm4nx/src/cmainmenu.cxx
index 4e47fcde8..6282a9e7f 100644
--- a/graphics/twm4nx/src/cmainmenu.cxx
+++ b/graphics/twm4nx/src/cmainmenu.cxx
@@ -24,7 +24,7 @@
#include <nuttx/config.h>
-#include <cunistd>
+#include <unistd.h>
#include <debug.h>
#include <graphics/nxwidgets/cnxstring.hxx>
diff --git a/graphics/twm4nx/src/ctwm4nx.cxx b/graphics/twm4nx/src/ctwm4nx.cxx
index b0391eeb7..e88c773d1 100644
--- a/graphics/twm4nx/src/ctwm4nx.cxx
+++ b/graphics/twm4nx/src/ctwm4nx.cxx
@@ -41,11 +41,11 @@
#include <cstdbool>
#include <csignal>
#include <cstdio>
-#include <cfcntl>
#include <cstring>
#include <cassert>
#include <cerrno>
+#include <fcntl.h>
#include <semaphore.h>
#include <nuttx/semaphore.h>
diff --git a/graphics/twm4nx/src/cwindow.cxx b/graphics/twm4nx/src/cwindow.cxx
index cdf22577e..bb87c5055 100644
--- a/graphics/twm4nx/src/cwindow.cxx
+++ b/graphics/twm4nx/src/cwindow.cxx
@@ -37,11 +37,11 @@
#include <nuttx/config.h>
-#include <cfcntl>
#include <cstring>
#include <cassert>
#include <cerrno>
+#include <fcntl.h>
#include <mqueue.h>
#include <nuttx/nx/nxglib.h>
diff --git a/graphics/twm4nx/src/cwindowevent.cxx b/graphics/twm4nx/src/cwindowevent.cxx
index b329423ec..4ec9e3013 100644
--- a/graphics/twm4nx/src/cwindowevent.cxx
+++ b/graphics/twm4nx/src/cwindowevent.cxx
@@ -55,9 +55,9 @@
#include <nuttx/config.h>
-#include <cfcntl>
#include <cerrno>
+#include <fcntl.h>
#include <semaphore.h>
#include <mqueue.h>