summaryrefslogtreecommitdiff
path: root/src/bin/common
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2017-05-15 12:21:30 +0200
committerEven Rouault <even.rouault@spatialys.com>2017-05-15 12:21:30 +0200
commit3c2972f924857016bb454201c7e92f25de9105ee (patch)
treedee91c4c200c2e97c83fd4c46588bf923f23852c /src/bin/common
parent28d2eabca79d06378843d1e94fecfb4a5e22178d (diff)
Reformat: apply reformattin on .h files (#128)
Diffstat (limited to 'src/bin/common')
-rw-r--r--src/bin/common/color.h6
-rw-r--r--src/bin/common/format_defs.h6
-rw-r--r--src/bin/common/opj_getopt.h23
-rw-r--r--src/bin/common/opj_string.h44
4 files changed, 39 insertions, 40 deletions
diff --git a/src/bin/common/color.h b/src/bin/common/color.h
index 0cd78e89..24792544 100644
--- a/src/bin/common/color.h
+++ b/src/bin/common/color.h
@@ -1,6 +1,6 @@
/*
- * The copyright in this software is being made available under the 2-clauses
- * BSD License, included below. This software may be subject to other third
+ * The copyright in this software is being made available under the 2-clauses
+ * BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@@ -8,7 +8,7 @@
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
- * Copyright (c) 2003-2007, Francois-Olivier Devaux
+ * Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* All rights reserved.
diff --git a/src/bin/common/format_defs.h b/src/bin/common/format_defs.h
index 608d7b3a..1985b54f 100644
--- a/src/bin/common/format_defs.h
+++ b/src/bin/common/format_defs.h
@@ -1,6 +1,6 @@
/*
- * The copyright in this software is being made available under the 2-clauses
- * BSD License, included below. This software may be subject to other third
+ * The copyright in this software is being made available under the 2-clauses
+ * BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@@ -8,7 +8,7 @@
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
- * Copyright (c) 2003-2007, Francois-Olivier Devaux
+ * Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* All rights reserved.
diff --git a/src/bin/common/opj_getopt.h b/src/bin/common/opj_getopt.h
index f97e8b35..18ac24d4 100644
--- a/src/bin/common/opj_getopt.h
+++ b/src/bin/common/opj_getopt.h
@@ -3,17 +3,16 @@
#ifndef _GETOPT_H_
#define _GETOPT_H_
-typedef struct opj_option
-{
- const char *name;
- int has_arg;
- int *flag;
- int val;
-}opj_option_t;
+typedef struct opj_option {
+ const char *name;
+ int has_arg;
+ int *flag;
+ int val;
+} opj_option_t;
-#define NO_ARG 0
-#define REQ_ARG 1
-#define OPT_ARG 2
+#define NO_ARG 0
+#define REQ_ARG 1
+#define OPT_ARG 2
extern int opj_opterr;
extern int opj_optind;
@@ -23,7 +22,7 @@ extern char *opj_optarg;
extern int opj_getopt(int nargc, char *const *nargv, const char *ostr);
extern int opj_getopt_long(int argc, char * const argv[], const char *optstring,
- const opj_option_t *longopts, int totlen);
+ const opj_option_t *longopts, int totlen);
extern void opj_reset_options_reading(void);
-#endif /* _GETOPT_H_ */
+#endif /* _GETOPT_H_ */
diff --git a/src/bin/common/opj_string.h b/src/bin/common/opj_string.h
index 8829926a..f704a8c9 100644
--- a/src/bin/common/opj_string.h
+++ b/src/bin/common/opj_string.h
@@ -39,34 +39,34 @@
/* keep in mind there still is a buffer read overflow possible */
static size_t opj_strnlen_s(const char *src, size_t max_len)
{
- size_t len;
-
- if (src == NULL) {
- return 0U;
- }
- for (len = 0U; (*src != '\0') && (len < max_len); src++, len++);
- return len;
+ size_t len;
+
+ if (src == NULL) {
+ return 0U;
+ }
+ for (len = 0U; (*src != '\0') && (len < max_len); src++, len++);
+ return len;
}
/* should be equivalent to C11 function except for the handler */
/* keep in mind there still is a buffer read overflow possible */
static int opj_strcpy_s(char* dst, size_t dst_size, const char* src)
{
- size_t src_len = 0U;
- if ((dst == NULL) || (dst_size == 0U)) {
- return EINVAL;
- }
- if (src == NULL) {
- dst[0] = '\0';
- return EINVAL;
- }
- src_len = opj_strnlen_s(src, dst_size);
- if (src_len >= dst_size) {
- return ERANGE;
- }
- memcpy(dst, src, src_len);
- dst[src_len] = '\0';
- return 0;
+ size_t src_len = 0U;
+ if ((dst == NULL) || (dst_size == 0U)) {
+ return EINVAL;
+ }
+ if (src == NULL) {
+ dst[0] = '\0';
+ return EINVAL;
+ }
+ src_len = opj_strnlen_s(src, dst_size);
+ if (src_len >= dst_size) {
+ return ERANGE;
+ }
+ memcpy(dst, src, src_len);
+ dst[src_len] = '\0';
+ return 0;
}
#endif /* OPJ_STRING_H */