You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ag...@apache.org on 2020/02/11 20:15:21 UTC

[incubator-nuttx] 04/04: Run files modified by PR239 through nxstyle.

This is an automated email from the ASF dual-hosted git repository.

aguettouche pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 2ff43fb8a85708e06dfa36655d55766a0638491c
Author: Ouss4 <ab...@gmail.com>
AuthorDate: Tue Feb 11 21:05:55 2020 +0000

    Run files modified by PR239 through nxstyle.
---
 arch/sim/src/sim/up_ajoystick.c      | 12 +++++---
 arch/sim/src/sim/up_framebuffer.c    | 54 ++++++++++++++++++++++++------------
 arch/sim/src/sim/up_touchscreen.c    | 39 ++++++++++++++------------
 arch/sim/src/sim/up_x11framebuffer.c | 44 +++++++++++++++++------------
 4 files changed, 91 insertions(+), 58 deletions(-)

diff --git a/arch/sim/src/sim/up_ajoystick.c b/arch/sim/src/sim/up_ajoystick.c
index d6adee5..3b15244 100644
--- a/arch/sim/src/sim/up_ajoystick.c
+++ b/arch/sim/src/sim/up_ajoystick.c
@@ -61,10 +61,12 @@
  * Private Function Prototypes
  ****************************************************************************/
 
-static ajoy_buttonset_t ajoy_supported(FAR const struct ajoy_lowerhalf_s *lower);
+static ajoy_buttonset_t ajoy_supported(
+  FAR const struct ajoy_lowerhalf_s *lower);
 static int ajoy_sample(FAR const struct ajoy_lowerhalf_s *lower,
                        FAR struct ajoy_sample_s *sample);
-static ajoy_buttonset_t ajoy_buttons(FAR const struct ajoy_lowerhalf_s *lower);
+static ajoy_buttonset_t ajoy_buttons(
+  FAR const struct ajoy_lowerhalf_s *lower);
 static void ajoy_enable(FAR const struct ajoy_lowerhalf_s *lower,
                          ajoy_buttonset_t press, ajoy_buttonset_t release,
                          ajoy_handler_t handler, FAR void *arg);
@@ -107,7 +109,8 @@ static ajoy_buttonset_t g_ajoy_rset;       /* Set of releases waited for */
  *
  ****************************************************************************/
 
-static ajoy_buttonset_t ajoy_supported(FAR const struct ajoy_lowerhalf_s *lower)
+static ajoy_buttonset_t ajoy_supported(
+  FAR const struct ajoy_lowerhalf_s *lower)
 {
   return (ajoy_buttonset_t)AJOY_SUPPORTED;
 }
@@ -137,7 +140,8 @@ static int ajoy_sample(FAR const struct ajoy_lowerhalf_s *lower,
  *
  ****************************************************************************/
 
-static ajoy_buttonset_t ajoy_buttons(FAR const struct ajoy_lowerhalf_s *lower)
+static ajoy_buttonset_t ajoy_buttons(
+  FAR const struct ajoy_lowerhalf_s *lower)
 {
   g_ajoy_valid   = false;
   g_ajoy_buttons = g_ajoy_sample.as_buttons;
diff --git a/arch/sim/src/sim/up_framebuffer.c b/arch/sim/src/sim/up_framebuffer.c
index ab0ffac..b81185b 100644
--- a/arch/sim/src/sim/up_framebuffer.c
+++ b/arch/sim/src/sim/up_framebuffer.c
@@ -94,24 +94,34 @@
  * Private Function Prototypes
  ****************************************************************************/
 
-  /* Get information about the video controller configuration and the configuration
-   * of each color plane.
-   */
+/* Get information about the video controller configuration and the
+ * configuration of each color plane.
+ */
 
-static int up_getvideoinfo(FAR struct fb_vtable_s *vtable, FAR struct fb_videoinfo_s *vinfo);
-static int up_getplaneinfo(FAR struct fb_vtable_s *vtable, int planeno, FAR struct fb_planeinfo_s *pinfo);
+static int up_getvideoinfo(FAR struct fb_vtable_s *vtable,
+                           FAR struct fb_videoinfo_s *vinfo);
+static int up_getplaneinfo(FAR struct fb_vtable_s *vtable, int planeno,
+                           FAR struct fb_planeinfo_s *pinfo);
 
-  /* The following is provided only if the video hardware supports RGB color mapping */
+/* The following is provided only if the video hardware supports
+ * RGB color mapping.
+ */
 
 #ifdef CONFIG_FB_CMAP
-static int up_getcmap(FAR struct fb_vtable_s *vtable, FAR struct fb_cmap_s *cmap);
-static int up_putcmap(FAR struct fb_vtable_s *vtable, FAR const struct fb_cmap_s *cmap);
+static int up_getcmap(FAR struct fb_vtable_s *vtable,
+                      FAR struct fb_cmap_s *cmap);
+static int up_putcmap(FAR struct fb_vtable_s *vtable,
+                      FAR const struct fb_cmap_s *cmap);
 #endif
-  /* The following is provided only if the video hardware supports a hardware cursor */
+  /* The following is provided only if the video hardware supports
+   * a hardware cursor
+   */
 
 #ifdef CONFIG_FB_HWCURSOR
-static int up_getcursor(FAR struct fb_vtable_s *vtable, FAR struct fb_cursorattrib_s *attrib);
-static int up_setcursor(FAR struct fb_vtable_s *vtable, FAR struct fb_setcursor_s *setttings);
+static int up_getcursor(FAR struct fb_vtable_s *vtable,
+                        FAR struct fb_cursorattrib_s *attrib);
+static int up_setcursor(FAR struct fb_vtable_s *vtable,
+                        FAR struct fb_setcursor_s *setttings);
 #endif
 
 /****************************************************************************
@@ -165,8 +175,8 @@ static struct fb_cursorsize_s g_csize;
 #endif
 #endif
 
-/* The framebuffer object -- There is no private state information in this simple
- * framebuffer simulation.
+/* The framebuffer object -- There is no private state information
+ * in this simple framebuffer simulation.
  */
 
 struct fb_vtable_s g_fbobject =
@@ -228,7 +238,8 @@ static int up_getplaneinfo(FAR struct fb_vtable_s *vtable, int planeno,
  ****************************************************************************/
 
 #ifdef CONFIG_FB_CMAP
-static int up_getcmap(FAR struct fb_vtable_s *vtable, FAR struct fb_cmap_s *cmap)
+static int up_getcmap(FAR struct fb_vtable_s *vtable,
+                      FAR struct fb_cmap_s *cmap)
 {
   int len;
   int i;
@@ -260,10 +271,12 @@ static int up_getcmap(FAR struct fb_vtable_s *vtable, FAR struct fb_cmap_s *cmap
  ****************************************************************************/
 
 #ifdef CONFIG_FB_CMAP
-static int up_putcmap(FAR struct fb_vtable_s *vtable, FAR const struct fb_cmap_s *cmap)
+static int up_putcmap(FAR struct fb_vtable_s *vtable,
+                      FAR const struct fb_cmap_s *cmap)
 {
 #ifdef CONFIG_SIM_X11FB
-  return up_x11cmap(cmap->first, cmap->len, cmap->red, cmap->green, cmap->blue, NULL);
+  return up_x11cmap(cmap->first, cmap->len, cmap->red, cmap->green,
+                    cmap->blue, NULL);
 #else
   ginfo("vtable=%p cmap=%p len=%d\n", vtable, cmap, cmap->len);
   if (vtable && cmap)
@@ -324,6 +337,7 @@ static int up_setcursor(FAR struct fb_vtable_s *vtable,
           g_cpos = settings->pos;
           ginfo("pos:     (h:%d, w:%d)\n", g_cpos.x, g_cpos.y);
         }
+
 #ifdef CONFIG_FB_HWCURSORSIZE
       if ((flags & FB_CUR_SETSIZE) != 0)
         {
@@ -331,12 +345,15 @@ static int up_setcursor(FAR struct fb_vtable_s *vtable,
           ginfo("size:    (h:%d, w:%d)\n", g_csize.h, g_csize.w);
         }
 #endif
+
 #ifdef CONFIG_FB_HWCURSORIMAGE
       if ((flags & FB_CUR_SETIMAGE) != 0)
         {
           ginfo("image:   (h:%d, w:%d) @ %p\n",
-               settings->img.height, settings->img.width, settings->img.image);
+               settings->img.height, settings->img.width,
+               settings->img.image);
         }
+
 #endif
       return OK;
     }
@@ -400,7 +417,8 @@ int up_fbinitialize(int display)
  *
  * Description:
  *   Return a a reference to the framebuffer object for the specified video
- *   plane of the specified plane.  Many OSDs support multiple planes of video.
+ *   plane of the specified plane.  Many OSDs support multiple planes of
+ *   video.
  *
  * Input Parameters:
  *   display - In the case of hardware with multiple displays, this
diff --git a/arch/sim/src/sim/up_touchscreen.c b/arch/sim/src/sim/up_touchscreen.c
index f5703b4..39e1050 100644
--- a/arch/sim/src/sim/up_touchscreen.c
+++ b/arch/sim/src/sim/up_touchscreen.c
@@ -186,17 +186,17 @@ static void up_notify(FAR struct up_dev_s *priv)
   iinfo("contact=%d nwaiters=%d\n", priv->sample.contact, priv->nwaiters);
   if (priv->nwaiters > 0)
     {
-      /* After posting this semaphore, we need to exit because the touchscreen
-       * is no longer avaialable.
+      /* After posting this semaphore, we need to exit because
+       * the touchscreen is no longer avaialable.
        */
 
       nxsem_post(&priv->waitsem);
     }
 
-  /* If there are threads waiting on poll() for touchscreen data to become available,
-   * then wake them up now.  NOTE: we wake up all waiting threads because we
-   * do not know what they are going to do.  If they all try to read the data,
-   * then some make end up blocking after all.
+  /* If there are threads waiting on poll() for touchscreen data to become
+   * available, then wake them up now.  NOTE: we wake up all waiting threads
+   * because we do not know what they are going to do.  If they all try to
+   * read the data then some make end up blocking after all.
    */
 
   for (i = 0; i < CONFIG_SIM_TCNWAITERS; i++)
@@ -243,11 +243,11 @@ static int up_sample(FAR struct up_dev_s *priv,
           priv->id++;
         }
       else if (sample->contact == CONTACT_DOWN)
-       {
+        {
           /* First report -- next report will be a movement */
 
-         priv->sample.contact = CONTACT_MOVE;
-       }
+          priv->sample.contact = CONTACT_MOVE;
+        }
 
       priv->penchange = false;
       iinfo("penchange=%d contact=%d id=%d\n",
@@ -307,8 +307,8 @@ static int up_waitsample(FAR struct up_dev_s *priv,
         }
     }
 
-  /* Re-acquire the semaphore that manages mutually exclusive access to
-   * the device structure.  We may have to wait here.  But we have our sample.
+  /* Re-acquire the semaphore that manages mutually exclusive access to the
+   * device structure.  We may have to wait here.  But we have our sample.
    * Interrupts and pre-emption will be re-enabled while we wait.
    */
 
@@ -407,7 +407,7 @@ static ssize_t up_read(FAR struct file *filep, FAR char *buffer, size_t len)
         {
           ret = -EAGAIN;
           goto errout;
-       }
+        }
 
       /* Wait for sample data */
 
@@ -446,13 +446,15 @@ static ssize_t up_read(FAR struct file *filep, FAR char *buffer, size_t len)
     {
       /* First contact */
 
-      report->point[0].flags  = TOUCH_DOWN | TOUCH_ID_VALID | TOUCH_POS_VALID | TOUCH_PRESSURE_VALID;
+      report->point[0].flags  = TOUCH_DOWN | TOUCH_ID_VALID |
+                                TOUCH_POS_VALID | TOUCH_PRESSURE_VALID;
     }
   else /* if (sample->contact == CONTACT_MOVE) */
     {
       /* Movement of the same contact */
 
-      report->point[0].flags  = TOUCH_MOVE | TOUCH_ID_VALID | TOUCH_POS_VALID | TOUCH_PRESSURE_VALID;
+      report->point[0].flags  = TOUCH_MOVE | TOUCH_ID_VALID |
+                                TOUCH_POS_VALID | TOUCH_PRESSURE_VALID;
     }
 
   ret = SIZEOF_TOUCH_SAMPLE_S(1);
@@ -736,8 +738,9 @@ void up_buttonevent(int x, int y, int buttons)
 
   if (!pendown)
     {
-      /* Ignore the pend up if the pen was already up (CONTACT_NONE == pen up and
-       * already reported.  CONTACT_UP == pen up, but not reported)
+      /* Ignore the pend up if the pen was already up
+       * (CONTACT_NONE == pen up and  already reported.
+       *  CONTACT_UP == pen up, but not reported)
        */
 
       if (priv->sample.contact == CONTACT_NONE)
@@ -756,8 +759,8 @@ void up_buttonevent(int x, int y, int buttons)
       priv->sample.x = x;
       priv->sample.y = y;
 
-      /* Note the availability of new measurements */
-      /* If this is the first (acknowledged) pen down report, then report
+      /* Note the availability of new measurements:
+       * If this is the first (acknowledged) pen down report, then report
        * this as the first contact.  If contact == CONTACT_DOWN, it will be
        * set to set to CONTACT_MOVE after the contact is first sampled.
        */
diff --git a/arch/sim/src/sim/up_x11framebuffer.c b/arch/sim/src/sim/up_x11framebuffer.c
index 2cd767b..28f4c26 100644
--- a/arch/sim/src/sim/up_x11framebuffer.c
+++ b/arch/sim/src/sim/up_x11framebuffer.c
@@ -266,7 +266,8 @@ static inline int up_x11mapsharedmem(int depth, unsigned int fblen)
       printf("Using shared memory.\n");
 
       up_x11traperrors();
-      g_image = XShmCreateImage(g_display, DefaultVisual(g_display, g_screen),
+      g_image = XShmCreateImage(g_display,
+                                DefaultVisual(g_display, g_screen),
                                 depth, ZPixmap, NULL, &g_xshminfo,
                                 g_fbpixelwidth, g_fbpixelheight);
       if (up_x11untraperrors())
@@ -274,11 +275,13 @@ static inline int up_x11mapsharedmem(int depth, unsigned int fblen)
           up_x11uninitialize();
           goto shmerror;
         }
+
       if (!g_image)
         {
           fprintf(stderr, "Unable to create g_image.");
           return -1;
         }
+
       g_shmcheckpoint++;
 
       g_xshminfo.shmid = shmget(IPC_PRIVATE,
@@ -289,6 +292,7 @@ static inline int up_x11mapsharedmem(int depth, unsigned int fblen)
           up_x11uninitialize();
           goto shmerror;
         }
+
       g_shmcheckpoint++;
 
       g_image->data = (char *) shmat(g_xshminfo.shmid, 0, 0);
@@ -297,6 +301,7 @@ static inline int up_x11mapsharedmem(int depth, unsigned int fblen)
           up_x11uninitialize();
           goto shmerror;
         }
+
       g_shmcheckpoint++;
 
       g_xshminfo.shmaddr = g_image->data;
@@ -324,18 +329,20 @@ shmerror:
 
       g_framebuffer = (unsigned char *)malloc(fblen);
 
-      g_image = XCreateImage(g_display, DefaultVisual(g_display, g_screen), depth,
-                             ZPixmap, 0, (char *)g_framebuffer, g_fbpixelwidth, g_fbpixelheight,
+      g_image = XCreateImage(g_display, DefaultVisual(g_display, g_screen),
+                             depth, ZPixmap, 0, (char *)g_framebuffer,
+                             g_fbpixelwidth, g_fbpixelheight,
                              8, 0);
 
       if (g_image == NULL)
-         {
-            fprintf(stderr, "Unable to create g_image\n");
-            return -1;
-         }
+        {
+          fprintf(stderr, "Unable to create g_image\n");
+          return -1;
+        }
 
       g_shmcheckpoint++;
     }
+
   return 0;
 }
 
@@ -374,7 +381,8 @@ int up_x11initialize(unsigned short width, unsigned short height,
 
   /* Determine the supported pixel bpp of the current window */
 
-  XGetWindowAttributes(g_display, DefaultRootWindow(g_display), &windowAttributes);
+  XGetWindowAttributes(g_display, DefaultRootWindow(g_display),
+                       &windowAttributes);
 
   /* Get the pixel depth.  If the depth is 24-bits, use 32 because X expects
    * 32-bit aligment anyway.
@@ -422,18 +430,18 @@ int up_x11cmap(unsigned short first, unsigned short len,
        * ranges from 0-255; for X11 the range is 0-65536
        */
 
-     color.red   = (short)(*red++) << 8;
-     color.green = (short)(*green++) << 8;
-     color.blue  = (short)(*blue++) << 8;
-     color.flags = DoRed | DoGreen | DoBlue;
+      color.red   = (short)(*red++) << 8;
+      color.green = (short)(*green++) << 8;
+      color.blue  = (short)(*blue++) << 8;
+      color.flags = DoRed | DoGreen | DoBlue;
 
-     /* Then allocate a color for this selection */
+      /* Then allocate a color for this selection */
 
-     if (!XAllocColor(g_display, cMap, &color))
-       {
-         fprintf(stderr, "Failed to allocate color%d\n", ndx);
-         return -1;
-       }
+      if (!XAllocColor(g_display, cMap, &color))
+        {
+          fprintf(stderr, "Failed to allocate color%d\n", ndx);
+          return -1;
+        }
     }
 
   return 0;