diff options
| author | Antonin Descampe <antonin@gmail.com> | 2016-01-25 23:22:06 +0100 |
|---|---|---|
| committer | Antonin Descampe <antonin@gmail.com> | 2016-01-25 23:22:06 +0100 |
| commit | 0febbff19e05cb1a6c2613eee76ad46a669c96cd (patch) | |
| tree | b6442d01348e2ba6404d0fd6abcc4eb6d6cc1390 /src/bin/common/opj_string.h | |
| parent | bede1568b197021bb576b935422af6c1d0a79e21 (diff) | |
processed all c/h files through astyle with opj_astyle.cfgcodingstyle
Diffstat (limited to 'src/bin/common/opj_string.h')
| -rw-r--r-- | src/bin/common/opj_string.h | 44 |
1 files changed, 22 insertions, 22 deletions
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 */ |
