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/nuttx-apps.git

commit 519c4ccb1b987e1be5b28384c6cdb91c666699ea
Author: Xiang Xiao <[email protected]>
AuthorDate: Wed Dec 7 10:36:41 2022 +0800

    examples/camera: Add FAR for all pointer
    
    Signed-off-by: Xiang Xiao <[email protected]>
---
 examples/camera/camera_fileutil.c |  8 ++++----
 examples/camera/camera_fileutil.h |  4 ++--
 examples/camera/camera_main.c     | 36 +++++++++++++++++++-----------------
 3 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/examples/camera/camera_fileutil.c 
b/examples/camera/camera_fileutil.c
index 0e8cdd0bf..463567704 100644
--- a/examples/camera/camera_fileutil.c
+++ b/examples/camera/camera_fileutil.c
@@ -40,7 +40,7 @@
  * Private Data
  ****************************************************************************/
 
-static const char *g_save_dir;
+static FAR const char *g_save_dir;
 static int g_framecount;
 
 /****************************************************************************
@@ -54,7 +54,7 @@ static int g_framecount;
  *   Choose strage to write a file.
  ****************************************************************************/
 
-const char *futil_initialize(void)
+FAR const char *futil_initialize(void)
 {
   int ret;
   struct stat stat_buf;
@@ -83,10 +83,10 @@ const char *futil_initialize(void)
  *   Write a image file to selected storage.
  ****************************************************************************/
 
-int futil_writeimage(uint8_t *data, size_t len, const char *fsuffix)
+int futil_writeimage(FAR uint8_t *data, size_t len, FAR const char *fsuffix)
 {
   char fname[IMAGE_FILENAME_LEN];
-  FILE *fp;
+  FAR FILE *fp;
 
   g_framecount++;
   if (g_framecount >= 1000)
diff --git a/examples/camera/camera_fileutil.h 
b/examples/camera/camera_fileutil.h
index 5e366d9b5..08d2513d7 100644
--- a/examples/camera/camera_fileutil.h
+++ b/examples/camera/camera_fileutil.h
@@ -34,11 +34,11 @@
 
 /* Initialize file util of camera example */
 
-const char *futil_initialize(void);
+FAR const char *futil_initialize(void);
 
 /* Write an image file */
 
-int futil_writeimage(uint8_t *data, size_t len, const char *fsuffix);
+int futil_writeimage(FAR uint8_t *data, size_t len, FAR const char *fsuffix);
 
 #endif  /* __APPS_EXAMPLES_CAMERA_CAMERA_FILEUTIL_H */
 
diff --git a/examples/camera/camera_main.c b/examples/camera/camera_main.c
index e9c9f0bab..0eac422f7 100644
--- a/examples/camera/camera_main.c
+++ b/examples/camera/camera_main.c
@@ -64,7 +64,7 @@
 
 struct v_buffer
 {
-  uint32_t *start;
+  FAR uint32_t *start;
   uint32_t length;
 };
 
@@ -77,14 +77,15 @@ typedef struct v_buffer v_buffer_t;
 static int camera_prepare(int fd, enum v4l2_buf_type type,
                           uint32_t buf_mode, uint32_t pixformat,
                           uint16_t hsize, uint16_t vsize,
-                          struct v_buffer **vbuf,
+                          FAR struct v_buffer **vbuf,
                           uint8_t buffernum, int buffersize);
-static void free_buffer(struct v_buffer *buffers, uint8_t bufnum);
-static int parse_arguments(int argc, char *argv[],
-                           int *capture_num, enum v4l2_buf_type *type);
-static int get_camimage(int fd, struct v4l2_buffer *v4l2_buf,
+static void free_buffer(FAR struct v_buffer *buffers, uint8_t bufnum);
+static int parse_arguments(int argc, FAR char *argv[],
+                           FAR int *capture_num,
+                           FAR enum v4l2_buf_type *type);
+static int get_camimage(int fd, FAR struct v4l2_buffer *v4l2_buf,
                         enum v4l2_buf_type buf_type);
-static int release_camimage(int fd, struct v4l2_buffer *v4l2_buf);
+static int release_camimage(int fd, FAR struct v4l2_buffer *v4l2_buf);
 static int start_stillcapture(int v_fd, enum v4l2_buf_type capture_type);
 static int stop_stillcapture(int v_fd, enum v4l2_buf_type capture_type);
 
@@ -111,7 +112,7 @@ static int stop_stillcapture(int v_fd, enum v4l2_buf_type 
capture_type);
 static int camera_prepare(int fd, enum v4l2_buf_type type,
                           uint32_t buf_mode, uint32_t pixformat,
                           uint16_t hsize, uint16_t vsize,
-                          struct v_buffer **vbuf,
+                          FAR struct v_buffer **vbuf,
                           uint8_t buffernum, int buffersize)
 {
   int ret;
@@ -239,7 +240,7 @@ static int camera_prepare(int fd, enum v4l2_buf_type type,
  *   All free allocated memory of v_buffer.
  ****************************************************************************/
 
-static void free_buffer(struct v_buffer *buffers, uint8_t bufnum)
+static void free_buffer(FAR struct v_buffer *buffers, uint8_t bufnum)
 {
   uint8_t cnt;
   if (buffers)
@@ -263,8 +264,9 @@ static void free_buffer(struct v_buffer *buffers, uint8_t 
bufnum)
  *   Parse and decode commandline arguments.
  ****************************************************************************/
 
-static int parse_arguments(int argc, char *argv[],
-                           int *capture_num, enum v4l2_buf_type *type)
+static int parse_arguments(int argc, FAR char *argv[],
+                           FAR int *capture_num,
+                           FAR enum v4l2_buf_type *type)
 {
   if (argc == 1)
     {
@@ -327,7 +329,7 @@ static int parse_arguments(int argc, char *argv[],
  *   DQBUF camera frame buffer from video driver with taken picture data.
  ****************************************************************************/
 
-static int get_camimage(int fd, struct v4l2_buffer *v4l2_buf,
+static int get_camimage(int fd, FAR struct v4l2_buffer *v4l2_buf,
                         enum v4l2_buf_type buf_type)
 {
   int ret;
@@ -355,7 +357,7 @@ static int get_camimage(int fd, struct v4l2_buffer 
*v4l2_buf,
  *   Re-QBUF to set used frame buffer into video driver.
  ****************************************************************************/
 
-static int release_camimage(int fd, struct v4l2_buffer *v4l2_buf)
+static int release_camimage(int fd, FAR struct v4l2_buffer *v4l2_buf)
 {
   int ret;
 
@@ -466,8 +468,8 @@ int main(int argc, FAR char *argv[])
   struct timeval delta;
   struct timeval wait;
 
-  struct v_buffer *buffers_video = NULL;
-  struct v_buffer *buffers_still = NULL;
+  FAR struct v_buffer *buffers_video = NULL;
+  FAR struct v_buffer *buffers_still = NULL;
 
   /* =====  Parse and Check arguments  ===== */
 
@@ -658,7 +660,7 @@ int main(int argc, FAR char *argv[])
               }
 
 #ifdef CONFIG_EXAMPLES_CAMERA_OUTPUT_LCD
-            nximage_draw((void *)v4l2_buf.m.userptr,
+            nximage_draw((FAR void *)v4l2_buf.m.userptr,
                          VIDEO_HSIZE_QVGA, VIDEO_VSIZE_QVGA);
 #endif
 
@@ -711,7 +713,7 @@ int main(int argc, FAR char *argv[])
                   }
 
                 futil_writeimage(
-                  (uint8_t *)v4l2_buf.m.userptr,
+                  (FAR uint8_t *)v4l2_buf.m.userptr,
                   (size_t)v4l2_buf.bytesused,
                   capture_type == V4L2_BUF_TYPE_VIDEO_CAPTURE ?
                   "RGB" : "JPG");

Reply via email to