This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new 1707be397 graphics: Fix nxstyle errors
1707be397 is described below
commit 1707be39777f19870a0f7d5059ff35b56b1e388a
Author: simbit18 <[email protected]>
AuthorDate: Tue May 2 18:34:07 2023 +0200
graphics: Fix nxstyle errors
error: Bad alignment
error: Right brace must be followed by a blank line
error: Long line found
---
graphics/tiff/tiff_finalize.c | 39 ++++++++++++++--------
include/graphics/tiff.h | 78 +++++++++++++++++++++++--------------------
2 files changed, 66 insertions(+), 51 deletions(-)
diff --git a/graphics/tiff/tiff_finalize.c b/graphics/tiff/tiff_finalize.c
index 11409e785..7c8d5d6dd 100644
--- a/graphics/tiff/tiff_finalize.c
+++ b/graphics/tiff/tiff_finalize.c
@@ -122,7 +122,7 @@ static int tiff_writeifdentry(int fd, off_t offset,
/* Then write the IFD entry */
- return tiff_write(fd, ifdentry, SIZEOF_IFD_ENTRY);
+ return tiff_write(fd, ifdentry, SIZEOF_IFD_ENTRY);
}
/****************************************************************************
@@ -148,18 +148,21 @@ static void tiff_cleanup(FAR struct tiff_info_s *info)
{
close(info->outfd);
}
+
info->outfd = -1;
if (info->tmp1fd >= 0)
{
close(info->tmp1fd);
}
+
info->tmp1fd = -1;
if (info->tmp2fd >= 0)
{
close(info->tmp2fd);
}
+
info->tmp2fd = -1;
/* And remove the temporary files */
@@ -200,20 +203,21 @@ int tiff_finalize(FAR struct tiff_info_s *info)
int i;
int j;
- /* Put all of the pieces together to create the final output file. There
- * are three pieces:
+ /* Put all of the pieces together to create the final output file.
+ * There are three pieces:
*
* 1) outfile: The partial output file containing the header, IFD and strip
* counts. This includes the StripOffsets and StripByteCounts that need
* to be updated. Size=outsize;
- * 2) tmpfile1: This contains the offsets into tmpfile3 for each strip. The
- * size of this file is tmp1size. These offsets are relative to the
+ * 2) tmpfile1: This contains the offsets into tmpfile3 for each strip.
+ * The size of this file is tmp1size. These offsets are relative to the
* beginning of tmpfile3 and need to be offset by outsize+tmp1size.
* 3) tmpfile3: The strip data. Size is tmp2size. This is raw image data;
* no fixups are required.
*/
- DEBUGASSERT(info && info->outfd >= 0 && info->tmp1fd >= 0 && info->tmp2fd >=
0);
+ DEBUGASSERT(info && info->outfd >= 0 &&
+ info->tmp1fd >= 0 && info->tmp2fd >= 0);
DEBUGASSERT((info->outsize & 3) == 0 && (info->tmp1size & 3) == 0);
/* Fix-up the count value in the StripByteCounts IFD entry in the outfile.
@@ -221,7 +225,8 @@ int tiff_finalize(FAR struct tiff_info_s *info)
* was written.
*/
- ret = tiff_readifdentry(info->outfd, info->filefmt->sbcifdoffset, &ifdentry);
+ ret = tiff_readifdentry(info->outfd, info->filefmt->sbcifdoffset,
+ &ifdentry);
if (ret < 0)
{
goto errout;
@@ -229,7 +234,8 @@ int tiff_finalize(FAR struct tiff_info_s *info)
tiff_put32(ifdentry.count, info->nstrips);
- ret = tiff_writeifdentry(info->outfd, info->filefmt->sbcifdoffset,
&ifdentry);
+ ret = tiff_writeifdentry(info->outfd, info->filefmt->sbcifdoffset,
+ &ifdentry);
if (ret < 0)
{
goto errout;
@@ -240,7 +246,8 @@ int tiff_finalize(FAR struct tiff_info_s *info)
* outfile, hence, the correct offset is outsize.
*/
- ret = tiff_readifdentry(info->outfd, info->filefmt->soifdoffset, &ifdentry);
+ ret = tiff_readifdentry(info->outfd, info->filefmt->soifdoffset,
+ &ifdentry);
if (ret < 0)
{
goto errout;
@@ -249,7 +256,8 @@ int tiff_finalize(FAR struct tiff_info_s *info)
tiff_put32(ifdentry.count, info->nstrips);
tiff_put32(ifdentry.offset, info->outsize);
- ret = tiff_writeifdentry(info->outfd, info->filefmt->soifdoffset, &ifdentry);
+ ret = tiff_writeifdentry(info->outfd, info->filefmt->soifdoffset,
+ &ifdentry);
if (ret < 0)
{
goto errout;
@@ -333,6 +341,7 @@ int tiff_finalize(FAR struct tiff_info_s *info)
total += nbytes;
#endif
}
+
#ifdef CONFIG_DEBUG_GRAPHICS
DEBUGASSERT(total == info->tmp1size);
#endif
@@ -351,7 +360,7 @@ int tiff_finalize(FAR struct tiff_info_s *info)
#ifdef CONFIG_DEBUG_GRAPHICS
total = 0;
#endif
- for (;;)
+ for (; ; )
{
ssize_t nbytes;
@@ -383,6 +392,7 @@ int tiff_finalize(FAR struct tiff_info_s *info)
total += nbytes;
#endif
}
+
#ifdef CONFIG_DEBUG_GRAPHICS
DEBUGASSERT(total == info->tmp2size);
#endif
@@ -397,19 +407,20 @@ errout:
return ret;
}
-/************************************************************************************
+/****************************************************************************
* Name: tiff_abort
*
* Description:
* Abort the TIFF file creation and create-up resources.
*
* Input Parameters:
- * info - A pointer to the caller allocated parameter passing/TIFF state
instance.
+ * info - A pointer to the caller allocated parameter passing/TIFF state
+ * instance.
*
* Returned Value:
* None
*
-
************************************************************************************/
+ ****************************************************************************/
void tiff_abort(FAR struct tiff_info_s *info)
{
diff --git a/include/graphics/tiff.h b/include/graphics/tiff.h
index 553434d98..f4c21148c 100644
--- a/include/graphics/tiff.h
+++ b/include/graphics/tiff.h
@@ -1,4 +1,4 @@
-/************************************************************************************
+/****************************************************************************
* apps/include/graphics/tiff.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -16,7 +16,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*
-
************************************************************************************/
+ ****************************************************************************/
/* Reference:
* "TIFF, Revision 6.0, Final," June 3, 1992, Adobe Developers Association.
@@ -25,21 +25,21 @@
#ifndef __APPS_INCLUDE_GRAPHICS_TIFF_H
#define __APPS_INCLUDE_GRAPHICS_TIFF_H
-/************************************************************************************
+/****************************************************************************
* Included Files
-
************************************************************************************/
+ ****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <nuttx/nx/nxglib.h>
-/************************************************************************************
+/****************************************************************************
* Pre-processor Definitions
-
************************************************************************************/
+ ****************************************************************************/
-/* Configuration
********************************************************************/
+/* Configuration ************************************************************/
-/* TIFF File Format Definitions
*****************************************************/
+/* TIFF File Format Definitions *********************************************/
/* Values for the IFD field type */
@@ -207,11 +207,11 @@
#define IFD_TAG_REFERENCEBW 532 /* ReferenceBlackWhite, RATIONAL */
#define IFD_TAG_COPYRIGHT 33432 /* Copyright, ASCII */
-/************************************************************************************
+/****************************************************************************
* Public Types
-
************************************************************************************/
+ ****************************************************************************/
-/* TIFF File Format Structure
*******************************************************/
+/* TIFF File Format Structure ***********************************************/
/* "A TIFF file begins with an 8-byte image file header that points to an
* image file directory (IFD). An image file directory contains information
@@ -243,10 +243,10 @@ struct tiff_ifdentry_s
};
#define SIZEOF_IFD_ENTRY 12
-/************************************************************************************/
+/****************************************************************************/
-/* Structures needed to interface with the TIFF file creation library) and also
- * structures used only internally by the TIFF file creation library).
+/* Structures needed to interface with the TIFF file creation library) and
+ * also structures used only internally by the TIFF file creation library).
*/
/* This structure describes on strip in tmpfile2 */
@@ -257,8 +257,8 @@ struct tiff_strip_s
uint32_t count; /* Count of pixels in the strip */
};
-/* This structure is used only internally by the TIFF file creation library to
- * manage file offsets.
+/* This structure is used only internally by the TIFF file creation library
+ * to manage file offsets.
*/
struct tiff_filefmt_s
@@ -290,8 +290,8 @@ struct tiff_info_s
*
* colorfmt - Specifies the form of the color data that will be provided
* in the strip data. These are the FB_FMT_* definitions
- * provided in include/nuttx/video/fb.h. Only the following
values
- * are supported:
+ * provided in include/nuttx/video/fb.h. Only the following
+ * values are supported:
*
* FB_FMT_Y1 BPP=1, monochrome, 0=black
* FB_FMT_Y4 BPP=4, 4-bit greyscale, 0=black
@@ -345,9 +345,9 @@ struct tiff_info_s
FAR const struct tiff_filefmt_s *filefmt;
};
-/************************************************************************************
+/****************************************************************************
* Public Function Prototypes
-
************************************************************************************/
+ ****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
@@ -357,12 +357,12 @@ extern "C"
#define EXTERN extern
#endif
-/************************************************************************************
+/****************************************************************************
* Name: tiff_initialize
*
* Description:
- * Setup to create a new TIFF file. The overall steps to creating a TIFF
file are
- * as follows:
+ * Setup to create a new TIFF file. The overall steps to creating a
+ * TIFF file are as follows:
*
* 1) Create an initialize a struct tiff_info_s instance
* 2) Call tiff_initialize() to setup the file creation
@@ -370,21 +370,23 @@ extern "C"
* 4) Call tiff_finalize() to complete the file creation.
*
* Input Parameters:
- * info - A pointer to the caller allocated parameter passing/TIFF state
instance.
+ * info - A pointer to the caller allocated parameter passing/TIFF state
+ * instance.
*
* Returned Value:
* Zero (OK) on success. A negated errno value on failure.
*
-
************************************************************************************/
+ ****************************************************************************/
int tiff_initialize(FAR struct tiff_info_s *info);
-/************************************************************************************
+/****************************************************************************
* Name: tiff_addstrip
*
* Description:
- * Add an image data strip. The size of the strip in pixels must be equal to
- * the RowsPerStrip x ImageWidth values that were provided to
tiff_initialize().
+ * Add an image data strip. The size of the strip in pixels
+ * must be equal to the RowsPerStrip x ImageWidth values
+ * that were provided to tiff_initialize().
*
* Input Parameters:
* info - A pointer to the caller allocated parameter passing/TIFF state
@@ -394,43 +396,45 @@ int tiff_initialize(FAR struct tiff_info_s *info);
* Returned Value:
* Zero (OK) on success. A negated errno value on failure.
*
-
************************************************************************************/
+ ****************************************************************************/
int tiff_addstrip(FAR struct tiff_info_s *info, FAR const uint8_t *strip);
-/************************************************************************************
+/****************************************************************************
* Name: tiff_finalize
*
* Description:
* Finalize the TIFF output file, completing the TIFF file creation steps.
*
* Input Parameters:
- * info - A pointer to the caller allocated parameter passing/TIFF state
instance.
+ * info - A pointer to the caller allocated parameter passing/TIFF state
+ * instance.
*
* Returned Value:
* Zero (OK) on success. A negated errno value on failure.
*
-
************************************************************************************/
+ ****************************************************************************/
int tiff_finalize(FAR struct tiff_info_s *info);
-/************************************************************************************
+/****************************************************************************
* Name: tiff_abort
*
* Description:
* Abort the TIFF file creation and create-up resources.
*
* Input Parameters:
- * info - A pointer to the caller allocated parameter passing/TIFF state
instance.
+ * info - A pointer to the caller allocated parameter passing/TIFF state
+ * instance.
*
* Returned Value:
* None
*
-
************************************************************************************/
+ ****************************************************************************/
void tiff_abort(FAR struct tiff_info_s *info);
-/************************************************************************************
+/****************************************************************************
* Name: tiff_put/get16/32
*
* Description:
@@ -445,7 +449,7 @@ void tiff_abort(FAR struct tiff_info_s *info);
* None (put)
* The extracted value (get)
*
-
************************************************************************************/
+ ****************************************************************************/
void tiff_put16(FAR uint8_t *dest, uint16_t value);
void tiff_put32(FAR uint8_t *dest, uint32_t value);