You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/10/16 19:19:51 UTC

[GitHub] [incubator-nuttx-apps] xiaoxiang781216 opened a new pull request, #1353: Remove the unnecessary cast for main_t, NULL and argv

xiaoxiang781216 opened a new pull request, #1353:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1353

   ## Summary
   
   ## Impact
   Minor, code refactor
   
   ## Testing
   Pass CI
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx-apps] pkarashchenko merged pull request #1353: Remove the unnecessary cast for main_t, NULL and argv

Posted by GitBox <gi...@apache.org>.
pkarashchenko merged PR #1353:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1353


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx-apps] xiaoxiang781216 commented on a diff in pull request #1353: Remove the unnecessary cast for main_t, NULL and argv

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #1353:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1353#discussion_r996491703


##########
graphics/nxwidgets/UnitTests/CButton/cbuttontest.cxx:
##########
@@ -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;

Review Comment:
   nullptr doesn't exist before c++11, but NULL will be defined to nullptr after c++11.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx-apps] xiaoxiang781216 commented on a diff in pull request #1353: Remove the unnecessary cast for main_t, NULL and argv

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #1353:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1353#discussion_r996491703


##########
graphics/nxwidgets/UnitTests/CButton/cbuttontest.cxx:
##########
@@ -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;

Review Comment:
   nullptr doesn't exist before c++11, NULL will be defined to nullptr after c++11.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx-apps] xiaoxiang781216 commented on a diff in pull request #1353: Remove the unnecessary cast for main_t, NULL and argv

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #1353:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1353#discussion_r996496659


##########
examples/poll/select_listener.c:
##########
@@ -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 *)-1;

Review Comment:
   Done.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx-apps] pkarashchenko commented on a diff in pull request #1353: Remove the unnecessary cast for main_t, NULL and argv

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #1353:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1353#discussion_r996485995


##########
graphics/pdcurs34/pdcurses/pdc_terminfo.c:
##########
@@ -244,15 +244,15 @@ char *tigetstr(const char *capname)
 {
   PDC_LOG(("tigetstr() - called: capname %s\n", capname));
 
-  return (char *)(-1);
+  return (-1);

Review Comment:
   why cast is removed here? Isn't compiler warning produced?



##########
graphics/nxwidgets/UnitTests/CGlyphButton/cglyphbuttontest.cxx:
##########
@@ -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 CWidgetControlNULL);

Review Comment:
   ```suggestion
     m_widgetControl = new CWidgetControl(NULL);
   ```



##########
graphics/nxwidgets/UnitTests/CCheckBox/ccheckboxtest.cxx:
##########
@@ -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 CWidgetControlNULL);

Review Comment:
   ```suggestion
     m_widgetControl = new CWidgetControl(NULL);
   ```



##########
netutils/thttpd/libhttpd.c:
##########
@@ -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));

Review Comment:
   ```suggestion
                 names     = RENEW(names, char, oldmax * (PATH_MAX + 1),
                                   maxnames * (PATH_MAX + 1));
   ```



##########
graphics/nxwidgets/UnitTests/CButton/cbuttontest.cxx:
##########
@@ -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;

Review Comment:
   just for my understanding. a generic question not related to this PR. shouldn't cxx code use `nullptr`?



##########
graphics/nxwidgets/UnitTests/CButton/cbuttontest.cxx:
##########
@@ -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 CWidgetControlNULL);

Review Comment:
   ```suggestion
     m_widgetControl = new CWidgetControl(NULL);
   ```



##########
graphics/nxwidgets/UnitTests/CButtonArray/cbuttonarraytest.cxx:
##########
@@ -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 CWidgetControlNULL);

Review Comment:
   ```suggestion
     m_widgetControl = new CWidgetControl(NULL);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx-apps] pkarashchenko commented on a diff in pull request #1353: Remove the unnecessary cast for main_t, NULL and argv

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #1353:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1353#discussion_r996492804


##########
examples/poll/select_listener.c:
##########
@@ -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 *)-1;

Review Comment:
   ```suggestion
         return (void *)(uintptr_t)-1;
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx-apps] xiaoxiang781216 commented on pull request #1353: Remove the unnecessary cast for main_t, NULL and argv

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #1353:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1353#issuecomment-1282630669

   @pkarashchenko could you merge this patch?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org