fix:wifi_app mistake (#13)
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
/*
|
||||
* Copyright (c) Huawei Technologies Co., Ltd. 2014-2018. All rights reserved.
|
||||
* Description: Define macro, data struct, and declare internal used function
|
||||
* prototype, which is used by secure functions. Author: lishunda Create:
|
||||
* 2014-02-25
|
||||
* Description: Define macro, data struct, and declare internal used function prototype,
|
||||
* which is used by secure functions.
|
||||
* Author: lishunda
|
||||
* Create: 2014-02-25
|
||||
*/
|
||||
|
||||
#ifndef SECURECUTIL_H_46C86578_F8FF_4E49_8E64_9B175241761F
|
||||
@@ -10,28 +11,23 @@
|
||||
#include "securec.h"
|
||||
|
||||
#if (defined(_MSC_VER)) && (_MSC_VER >= 1400)
|
||||
/* Shield compilation alerts using discarded functions and Constant expression
|
||||
* to maximize code compatibility */
|
||||
#define SECUREC_MASK_MSVC_CRT_WARNING \
|
||||
__pragma(warning(push)) __pragma(warning(disable : 4996 4127))
|
||||
#define SECUREC_END_MASK_MSVC_CRT_WARNING __pragma(warning(pop))
|
||||
/* Shield compilation alerts using discarded functions and Constant expression to maximize code compatibility */
|
||||
#define SECUREC_MASK_MSVC_CRT_WARNING __pragma(warning(push)) \
|
||||
__pragma(warning(disable : 4996 4127))
|
||||
#define SECUREC_END_MASK_MSVC_CRT_WARNING __pragma(warning(pop))
|
||||
#else
|
||||
#define SECUREC_MASK_MSVC_CRT_WARNING
|
||||
#define SECUREC_END_MASK_MSVC_CRT_WARNING
|
||||
#endif
|
||||
#define SECUREC_WHILE_ZERO \
|
||||
SECUREC_MASK_MSVC_CRT_WARNING while (0) SECUREC_END_MASK_MSVC_CRT_WARNING
|
||||
#define SECUREC_WHILE_ZERO SECUREC_MASK_MSVC_CRT_WARNING while (0) SECUREC_END_MASK_MSVC_CRT_WARNING
|
||||
|
||||
/* Automatically identify the platform that supports strnlen function, and use
|
||||
* this function to improve performance */
|
||||
/* Automatically identify the platform that supports strnlen function, and use this function to improve performance */
|
||||
#ifndef SECUREC_HAVE_STRNLEN
|
||||
#if (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 700) || \
|
||||
(defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809L)
|
||||
#if (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 700) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809L)
|
||||
#if SECUREC_IN_KERNEL
|
||||
#define SECUREC_HAVE_STRNLEN 0
|
||||
#else
|
||||
#if defined(__GLIBC__) && __GLIBC__ >= 2 && defined(__GLIBC_MINOR__) && \
|
||||
__GLIBC_MINOR__ >= 10
|
||||
#if defined(__GLIBC__) && __GLIBC__ >= 2 && defined(__GLIBC_MINOR__) && __GLIBC_MINOR__ >= 10
|
||||
#define SECUREC_HAVE_STRNLEN 1
|
||||
#else
|
||||
#define SECUREC_HAVE_STRNLEN 0
|
||||
@@ -109,135 +105,118 @@
|
||||
#define SECUREC_STREAM_STDIN stdin
|
||||
#endif
|
||||
|
||||
#define SECUREC_INT_MAX 2147483647
|
||||
#define SECUREC_MUL_SIXTEEN(x) ((x) << 4)
|
||||
#define SECUREC_MUL_EIGHT(x) ((x) << 3)
|
||||
#define SECUREC_MUL_TEN(x) ((((x) << 2) + (x)) << 1)
|
||||
#define SECUREC_INT_MAX 2147483647
|
||||
#define SECUREC_MUL_SIXTEEN(x) ((x) << 4)
|
||||
#define SECUREC_MUL_EIGHT(x) ((x) << 3)
|
||||
#define SECUREC_MUL_TEN(x) ((((x) << 2) + (x)) << 1)
|
||||
/* Limited format input and output width */
|
||||
#define SECUREC_MAX_WIDTH_LEN_DIV_TEN 21474836
|
||||
#define SECUREC_MAX_WIDTH_LEN SECUREC_MUL_TEN(SECUREC_MAX_WIDTH_LEN_DIV_TEN)
|
||||
#define SECUREC_MAX_WIDTH_LEN_DIV_TEN 21474836
|
||||
#define SECUREC_MAX_WIDTH_LEN SECUREC_MUL_TEN(SECUREC_MAX_WIDTH_LEN_DIV_TEN)
|
||||
/* Is the x multiplied by 10 greater than */
|
||||
#define SECUREC_MUL_TEN_ADD_BEYOND_MAX(x) \
|
||||
(((x) > SECUREC_MAX_WIDTH_LEN_DIV_TEN))
|
||||
#define SECUREC_MUL_TEN_ADD_BEYOND_MAX(x) (((x) > SECUREC_MAX_WIDTH_LEN_DIV_TEN))
|
||||
|
||||
#define SECUREC_FLOAT_BUFSIZE (309 + 40) /* Max length of double value */
|
||||
#define SECUREC_FLOAT_BUFSIZE_LB \
|
||||
(4932 + 40) /* Max length of long double value */
|
||||
#define SECUREC_FLOAT_DEFAULT_PRECISION 6
|
||||
#define SECUREC_FLOAT_BUFSIZE (309 + 40) /* Max length of double value */
|
||||
#define SECUREC_FLOAT_BUFSIZE_LB (4932 + 40) /* Max length of long double value */
|
||||
#define SECUREC_FLOAT_DEFAULT_PRECISION 6
|
||||
|
||||
/* This macro does not handle pointer equality or integer overflow */
|
||||
#define SECUREC_MEMORY_NO_OVERLAP(dest, src, count) \
|
||||
(((src) < (dest) && ((const char *)(src) + (count)) <= (char *)(dest)) || \
|
||||
((dest) < (src) && ((char *)(dest) + (count)) <= (const char *)(src)))
|
||||
#define SECUREC_MEMORY_NO_OVERLAP(dest, src, count) \
|
||||
(((src) < (dest) && ((const char *)(src) + (count)) <= (char *)(dest)) || \
|
||||
((dest) < (src) && ((char *)(dest) + (count)) <= (const char *)(src)))
|
||||
|
||||
#define SECUREC_MEMORY_IS_OVERLAP(dest, src, count) \
|
||||
(((src) < (dest) && ((const char *)(src) + (count)) > (char *)(dest)) || \
|
||||
((dest) < (src) && ((char *)(dest) + (count)) > (const char *)(src)))
|
||||
#define SECUREC_MEMORY_IS_OVERLAP(dest, src, count) \
|
||||
(((src) < (dest) && ((const char *)(src) + (count)) > (char *)(dest)) || \
|
||||
((dest) < (src) && ((char *)(dest) + (count)) > (const char *)(src)))
|
||||
|
||||
/*
|
||||
* Check whether the strings overlap, len is the length of the string not
|
||||
* include terminator Length is related to data type char or wchar , do not
|
||||
* force conversion of types
|
||||
* Check whether the strings overlap, len is the length of the string not include terminator
|
||||
* Length is related to data type char or wchar , do not force conversion of types
|
||||
*/
|
||||
#define SECUREC_STRING_NO_OVERLAP(dest, src, len) \
|
||||
(((src) < (dest) && ((src) + (len)) < (dest)) || \
|
||||
((dest) < (src) && ((dest) + (len)) < (src)))
|
||||
#define SECUREC_STRING_NO_OVERLAP(dest, src, len) \
|
||||
(((src) < (dest) && ((src) + (len)) < (dest)) || \
|
||||
((dest) < (src) && ((dest) + (len)) < (src)))
|
||||
|
||||
/*
|
||||
* Check whether the strings overlap for strcpy wcscpy function, dest len and
|
||||
* src Len are not include terminator Length is related to data type char or
|
||||
* wchar , do not force conversion of types
|
||||
* Check whether the strings overlap for strcpy wcscpy function, dest len and src Len are not include terminator
|
||||
* Length is related to data type char or wchar , do not force conversion of types
|
||||
*/
|
||||
#define SECUREC_STRING_IS_OVERLAP(dest, src, len) \
|
||||
(((src) < (dest) && ((src) + (len)) >= (dest)) || \
|
||||
((dest) < (src) && ((dest) + (len)) >= (src)))
|
||||
#define SECUREC_STRING_IS_OVERLAP(dest, src, len) \
|
||||
(((src) < (dest) && ((src) + (len)) >= (dest)) || \
|
||||
((dest) < (src) && ((dest) + (len)) >= (src)))
|
||||
|
||||
/*
|
||||
* Check whether the strings overlap for strcat wcscat function, dest len and
|
||||
* src Len are not include terminator Length is related to data type char or
|
||||
* wchar , do not force conversion of types
|
||||
* Check whether the strings overlap for strcat wcscat function, dest len and src Len are not include terminator
|
||||
* Length is related to data type char or wchar , do not force conversion of types
|
||||
*/
|
||||
#define SECUREC_CAT_STRING_IS_OVERLAP(dest, destLen, src, srcLen) \
|
||||
(((dest) < (src) && ((dest) + (destLen) + (srcLen)) >= (src)) || \
|
||||
((src) < (dest) && ((src) + (srcLen)) >= (dest)))
|
||||
#define SECUREC_CAT_STRING_IS_OVERLAP(dest, destLen, src, srcLen) \
|
||||
(((dest) < (src) && ((dest) + (destLen) + (srcLen)) >= (src)) || \
|
||||
((src) < (dest) && ((src) + (srcLen)) >= (dest)))
|
||||
|
||||
|
||||
#if SECUREC_HAVE_STRNLEN
|
||||
#define SECUREC_CALC_STR_LEN(str, maxLen, outLen) \
|
||||
do { \
|
||||
*(outLen) = strnlen((str), (maxLen)); \
|
||||
} \
|
||||
SECUREC_WHILE_ZERO
|
||||
#define SECUREC_CALC_STR_LEN_OPT(str, maxLen, outLen) \
|
||||
do { \
|
||||
if ((maxLen) > 8) { \
|
||||
/* Optimization or len less then 8 */ \
|
||||
if (*((str) + 0) == '\0') { \
|
||||
*(outLen) = 0; \
|
||||
} else if (*((str) + 1) == '\0') { \
|
||||
*(outLen) = 1; \
|
||||
} else if (*((str) + 2) == '\0') { \
|
||||
*(outLen) = 2; \
|
||||
} else if (*((str) + 3) == '\0') { \
|
||||
*(outLen) = 3; \
|
||||
} else if (*((str) + 4) == '\0') { \
|
||||
*(outLen) = 4; \
|
||||
} else if (*((str) + 5) == '\0') { \
|
||||
*(outLen) = 5; \
|
||||
} else if (*((str) + 6) == '\0') { \
|
||||
*(outLen) = 6; \
|
||||
} else if (*((str) + 7) == '\0') { \
|
||||
*(outLen) = 7; \
|
||||
} else if (*((str) + 8) == '\0') { \
|
||||
/* Optimization with a length of 8 */ \
|
||||
*(outLen) = 8; \
|
||||
} else { \
|
||||
/* The offset is 8 because the performance of 8 byte alignment is high \
|
||||
*/ \
|
||||
*(outLen) = 8 + strnlen((str) + 8, (maxLen)-8); \
|
||||
} \
|
||||
} else { \
|
||||
SECUREC_CALC_STR_LEN((str), (maxLen), (outLen)); \
|
||||
} \
|
||||
} \
|
||||
SECUREC_WHILE_ZERO
|
||||
#define SECUREC_CALC_STR_LEN(str, maxLen, outLen) do { \
|
||||
*(outLen) = strnlen((str), (maxLen)); \
|
||||
} SECUREC_WHILE_ZERO
|
||||
#define SECUREC_CALC_STR_LEN_OPT(str, maxLen, outLen) do { \
|
||||
if ((maxLen) > 8) { \
|
||||
/* Optimization or len less then 8 */ \
|
||||
if (*((str) + 0) == '\0') { \
|
||||
*(outLen) = 0; \
|
||||
} else if (*((str) + 1) == '\0') { \
|
||||
*(outLen) = 1; \
|
||||
} else if (*((str) + 2) == '\0') { \
|
||||
*(outLen) = 2; \
|
||||
} else if (*((str) + 3) == '\0') { \
|
||||
*(outLen) = 3; \
|
||||
} else if (*((str) + 4) == '\0') { \
|
||||
*(outLen) = 4; \
|
||||
} else if (*((str) + 5) == '\0') { \
|
||||
*(outLen) = 5; \
|
||||
} else if (*((str) + 6) == '\0') { \
|
||||
*(outLen) = 6; \
|
||||
} else if (*((str) + 7) == '\0') { \
|
||||
*(outLen) = 7; \
|
||||
} else if (*((str) + 8) == '\0') { \
|
||||
/* Optimization with a length of 8 */ \
|
||||
*(outLen) = 8; \
|
||||
} else { \
|
||||
/* The offset is 8 because the performance of 8 byte alignment is high */ \
|
||||
*(outLen) = 8 + strnlen((str) + 8, (maxLen) - 8); \
|
||||
} \
|
||||
} else { \
|
||||
SECUREC_CALC_STR_LEN((str), (maxLen), (outLen)); \
|
||||
} \
|
||||
} SECUREC_WHILE_ZERO
|
||||
#else
|
||||
#define SECUREC_CALC_STR_LEN(str, maxLen, outLen) \
|
||||
do { \
|
||||
const char *strEnd = (const char *)(str); \
|
||||
size_t availableSize = (size_t)(maxLen); \
|
||||
while (availableSize > 0 && *strEnd != '\0') { \
|
||||
--availableSize; \
|
||||
++strEnd; \
|
||||
} \
|
||||
*(outLen) = (size_t)(strEnd - (str)); \
|
||||
} \
|
||||
SECUREC_WHILE_ZERO
|
||||
#define SECUREC_CALC_STR_LEN(str, maxLen, outLen) do { \
|
||||
const char *strEnd = (const char *)(str); \
|
||||
size_t availableSize = (size_t)(maxLen); \
|
||||
while (availableSize > 0 && *strEnd != '\0') { \
|
||||
--availableSize; \
|
||||
++strEnd; \
|
||||
} \
|
||||
*(outLen) = (size_t)(strEnd - (str)); \
|
||||
} SECUREC_WHILE_ZERO
|
||||
#define SECUREC_CALC_STR_LEN_OPT SECUREC_CALC_STR_LEN
|
||||
#endif
|
||||
|
||||
#define SECUREC_CALC_WSTR_LEN(str, maxLen, outLen) \
|
||||
do { \
|
||||
const wchar_t *strEnd = (const wchar_t *)(str); \
|
||||
size_t len = 0; \
|
||||
while (len < (maxLen) && *strEnd != L'\0') { \
|
||||
++len; \
|
||||
++strEnd; \
|
||||
} \
|
||||
*(outLen) = len; \
|
||||
} \
|
||||
SECUREC_WHILE_ZERO
|
||||
#define SECUREC_CALC_WSTR_LEN(str, maxLen, outLen) do { \
|
||||
const wchar_t *strEnd = (const wchar_t *)(str); \
|
||||
size_t len = 0; \
|
||||
while (len < (maxLen) && *strEnd != L'\0') { \
|
||||
++len; \
|
||||
++strEnd; \
|
||||
} \
|
||||
*(outLen) = len; \
|
||||
} SECUREC_WHILE_ZERO
|
||||
|
||||
/* Performance optimization, product may disable inline function */
|
||||
#ifdef SECUREC_USE_ASM
|
||||
#define SECUREC_MEMCPY_WARP_OPT(dest, src, count) \
|
||||
(void)memcpy_opt((dest), (src), (count))
|
||||
#define SECUREC_MEMSET_WARP_OPT(dest, c, count) \
|
||||
(void)memset_opt((dest), (c), (count))
|
||||
#define SECUREC_MEMCPY_WARP_OPT(dest, src, count) (void)memcpy_opt((dest), (src), (count))
|
||||
#define SECUREC_MEMSET_WARP_OPT(dest, c, count) (void)memset_opt((dest), (c), (count))
|
||||
#else
|
||||
#define SECUREC_MEMCPY_WARP_OPT(dest, src, count) \
|
||||
(void)memcpy((dest), (src), (count))
|
||||
#define SECUREC_MEMSET_WARP_OPT(dest, c, count) \
|
||||
(void)memset((dest), (c), (count))
|
||||
#define SECUREC_MEMCPY_WARP_OPT(dest, src, count) (void)memcpy((dest), (src), (count))
|
||||
#define SECUREC_MEMSET_WARP_OPT(dest, c, count) (void)memset((dest), (c), (count))
|
||||
#endif
|
||||
|
||||
#ifdef SECUREC_FORMAT_OUTPUT_INPUT
|
||||
@@ -278,12 +257,11 @@ typedef unsigned int SecUnsignedInt;
|
||||
* Determine whether the address is 8-byte aligned
|
||||
* Some systems do not have uintptr_t type, so use NULL to clear tool alarm 507
|
||||
*/
|
||||
#define SECUREC_ADDR_ALIGNED_8(addr) \
|
||||
((((size_t)(addr)) & 7) == 0) /* Use 7 to check aligned 8 */
|
||||
#define SECUREC_ADDR_ALIGNED_8(addr) ((((size_t)(addr)) & 7) == 0) /* Use 7 to check aligned 8 */
|
||||
|
||||
/*
|
||||
* If you define the memory allocation function, you need to define the function
|
||||
* prototype. You can define this macro as a header file.
|
||||
* If you define the memory allocation function, you need to define the function prototype.
|
||||
* You can define this macro as a header file.
|
||||
*/
|
||||
#if defined(SECUREC_MALLOC_PROTOTYPE)
|
||||
SECUREC_MALLOC_PROTOTYPE
|
||||
@@ -294,265 +272,201 @@ SECUREC_MALLOC_PROTOTYPE
|
||||
#endif
|
||||
|
||||
#ifndef SECUREC_FREE
|
||||
#define SECUREC_FREE(x) free((void *)(x))
|
||||
#define SECUREC_FREE(x) free((void *)(x))
|
||||
#endif
|
||||
|
||||
/* Struct for performance */
|
||||
typedef struct {
|
||||
unsigned char buf[1]; /* Performance optimization code structure assignment
|
||||
length 1 bytes */
|
||||
unsigned char buf[1]; /* Performance optimization code structure assignment length 1 bytes */
|
||||
} SecStrBuf1;
|
||||
typedef struct {
|
||||
unsigned char buf[2]; /* Performance optimization code structure assignment
|
||||
length 2 bytes */
|
||||
unsigned char buf[2]; /* Performance optimization code structure assignment length 2 bytes */
|
||||
} SecStrBuf2;
|
||||
typedef struct {
|
||||
unsigned char buf[3]; /* Performance optimization code structure assignment
|
||||
length 3 bytes */
|
||||
unsigned char buf[3]; /* Performance optimization code structure assignment length 3 bytes */
|
||||
} SecStrBuf3;
|
||||
typedef struct {
|
||||
unsigned char buf[4]; /* Performance optimization code structure assignment
|
||||
length 4 bytes */
|
||||
unsigned char buf[4]; /* Performance optimization code structure assignment length 4 bytes */
|
||||
} SecStrBuf4;
|
||||
typedef struct {
|
||||
unsigned char buf[5]; /* Performance optimization code structure assignment
|
||||
length 5 bytes */
|
||||
unsigned char buf[5]; /* Performance optimization code structure assignment length 5 bytes */
|
||||
} SecStrBuf5;
|
||||
typedef struct {
|
||||
unsigned char buf[6]; /* Performance optimization code structure assignment
|
||||
length 6 bytes */
|
||||
unsigned char buf[6]; /* Performance optimization code structure assignment length 6 bytes */
|
||||
} SecStrBuf6;
|
||||
typedef struct {
|
||||
unsigned char buf[7]; /* Performance optimization code structure assignment
|
||||
length 7 bytes */
|
||||
unsigned char buf[7]; /* Performance optimization code structure assignment length 7 bytes */
|
||||
} SecStrBuf7;
|
||||
typedef struct {
|
||||
unsigned char buf[8]; /* Performance optimization code structure assignment
|
||||
length 8 bytes */
|
||||
unsigned char buf[8]; /* Performance optimization code structure assignment length 8 bytes */
|
||||
} SecStrBuf8;
|
||||
typedef struct {
|
||||
unsigned char buf[9]; /* Performance optimization code structure assignment
|
||||
length 9 bytes */
|
||||
unsigned char buf[9]; /* Performance optimization code structure assignment length 9 bytes */
|
||||
} SecStrBuf9;
|
||||
typedef struct {
|
||||
unsigned char buf[10]; /* Performance optimization code structure assignment
|
||||
length 10 bytes */
|
||||
unsigned char buf[10]; /* Performance optimization code structure assignment length 10 bytes */
|
||||
} SecStrBuf10;
|
||||
typedef struct {
|
||||
unsigned char buf[11]; /* Performance optimization code structure assignment
|
||||
length 11 bytes */
|
||||
unsigned char buf[11]; /* Performance optimization code structure assignment length 11 bytes */
|
||||
} SecStrBuf11;
|
||||
typedef struct {
|
||||
unsigned char buf[12]; /* Performance optimization code structure assignment
|
||||
length 12 bytes */
|
||||
unsigned char buf[12]; /* Performance optimization code structure assignment length 12 bytes */
|
||||
} SecStrBuf12;
|
||||
typedef struct {
|
||||
unsigned char buf[13]; /* Performance optimization code structure assignment
|
||||
length 13 bytes */
|
||||
unsigned char buf[13]; /* Performance optimization code structure assignment length 13 bytes */
|
||||
} SecStrBuf13;
|
||||
typedef struct {
|
||||
unsigned char buf[14]; /* Performance optimization code structure assignment
|
||||
length 14 bytes */
|
||||
unsigned char buf[14]; /* Performance optimization code structure assignment length 14 bytes */
|
||||
} SecStrBuf14;
|
||||
typedef struct {
|
||||
unsigned char buf[15]; /* Performance optimization code structure assignment
|
||||
length 15 bytes */
|
||||
unsigned char buf[15]; /* Performance optimization code structure assignment length 15 bytes */
|
||||
} SecStrBuf15;
|
||||
typedef struct {
|
||||
unsigned char buf[16]; /* Performance optimization code structure assignment
|
||||
length 16 bytes */
|
||||
unsigned char buf[16]; /* Performance optimization code structure assignment length 16 bytes */
|
||||
} SecStrBuf16;
|
||||
typedef struct {
|
||||
unsigned char buf[17]; /* Performance optimization code structure assignment
|
||||
length 17 bytes */
|
||||
unsigned char buf[17]; /* Performance optimization code structure assignment length 17 bytes */
|
||||
} SecStrBuf17;
|
||||
typedef struct {
|
||||
unsigned char buf[18]; /* Performance optimization code structure assignment
|
||||
length 18 bytes */
|
||||
unsigned char buf[18]; /* Performance optimization code structure assignment length 18 bytes */
|
||||
} SecStrBuf18;
|
||||
typedef struct {
|
||||
unsigned char buf[19]; /* Performance optimization code structure assignment
|
||||
length 19 bytes */
|
||||
unsigned char buf[19]; /* Performance optimization code structure assignment length 19 bytes */
|
||||
} SecStrBuf19;
|
||||
typedef struct {
|
||||
unsigned char buf[20]; /* Performance optimization code structure assignment
|
||||
length 20 bytes */
|
||||
unsigned char buf[20]; /* Performance optimization code structure assignment length 20 bytes */
|
||||
} SecStrBuf20;
|
||||
typedef struct {
|
||||
unsigned char buf[21]; /* Performance optimization code structure assignment
|
||||
length 21 bytes */
|
||||
unsigned char buf[21]; /* Performance optimization code structure assignment length 21 bytes */
|
||||
} SecStrBuf21;
|
||||
typedef struct {
|
||||
unsigned char buf[22]; /* Performance optimization code structure assignment
|
||||
length 22 bytes */
|
||||
unsigned char buf[22]; /* Performance optimization code structure assignment length 22 bytes */
|
||||
} SecStrBuf22;
|
||||
typedef struct {
|
||||
unsigned char buf[23]; /* Performance optimization code structure assignment
|
||||
length 23 bytes */
|
||||
unsigned char buf[23]; /* Performance optimization code structure assignment length 23 bytes */
|
||||
} SecStrBuf23;
|
||||
typedef struct {
|
||||
unsigned char buf[24]; /* Performance optimization code structure assignment
|
||||
length 24 bytes */
|
||||
unsigned char buf[24]; /* Performance optimization code structure assignment length 24 bytes */
|
||||
} SecStrBuf24;
|
||||
typedef struct {
|
||||
unsigned char buf[25]; /* Performance optimization code structure assignment
|
||||
length 25 bytes */
|
||||
unsigned char buf[25]; /* Performance optimization code structure assignment length 25 bytes */
|
||||
} SecStrBuf25;
|
||||
typedef struct {
|
||||
unsigned char buf[26]; /* Performance optimization code structure assignment
|
||||
length 26 bytes */
|
||||
unsigned char buf[26]; /* Performance optimization code structure assignment length 26 bytes */
|
||||
} SecStrBuf26;
|
||||
typedef struct {
|
||||
unsigned char buf[27]; /* Performance optimization code structure assignment
|
||||
length 27 bytes */
|
||||
unsigned char buf[27]; /* Performance optimization code structure assignment length 27 bytes */
|
||||
} SecStrBuf27;
|
||||
typedef struct {
|
||||
unsigned char buf[28]; /* Performance optimization code structure assignment
|
||||
length 28 bytes */
|
||||
unsigned char buf[28]; /* Performance optimization code structure assignment length 28 bytes */
|
||||
} SecStrBuf28;
|
||||
typedef struct {
|
||||
unsigned char buf[29]; /* Performance optimization code structure assignment
|
||||
length 29 bytes */
|
||||
unsigned char buf[29]; /* Performance optimization code structure assignment length 29 bytes */
|
||||
} SecStrBuf29;
|
||||
typedef struct {
|
||||
unsigned char buf[30]; /* Performance optimization code structure assignment
|
||||
length 30 bytes */
|
||||
unsigned char buf[30]; /* Performance optimization code structure assignment length 30 bytes */
|
||||
} SecStrBuf30;
|
||||
typedef struct {
|
||||
unsigned char buf[31]; /* Performance optimization code structure assignment
|
||||
length 31 bytes */
|
||||
unsigned char buf[31]; /* Performance optimization code structure assignment length 31 bytes */
|
||||
} SecStrBuf31;
|
||||
typedef struct {
|
||||
unsigned char buf[32]; /* Performance optimization code structure assignment
|
||||
length 32 bytes */
|
||||
unsigned char buf[32]; /* Performance optimization code structure assignment length 32 bytes */
|
||||
} SecStrBuf32;
|
||||
typedef struct {
|
||||
unsigned char buf[33]; /* Performance optimization code structure assignment
|
||||
length 33 bytes */
|
||||
unsigned char buf[33]; /* Performance optimization code structure assignment length 33 bytes */
|
||||
} SecStrBuf33;
|
||||
typedef struct {
|
||||
unsigned char buf[34]; /* Performance optimization code structure assignment
|
||||
length 34 bytes */
|
||||
unsigned char buf[34]; /* Performance optimization code structure assignment length 34 bytes */
|
||||
} SecStrBuf34;
|
||||
typedef struct {
|
||||
unsigned char buf[35]; /* Performance optimization code structure assignment
|
||||
length 35 bytes */
|
||||
unsigned char buf[35]; /* Performance optimization code structure assignment length 35 bytes */
|
||||
} SecStrBuf35;
|
||||
typedef struct {
|
||||
unsigned char buf[36]; /* Performance optimization code structure assignment
|
||||
length 36 bytes */
|
||||
unsigned char buf[36]; /* Performance optimization code structure assignment length 36 bytes */
|
||||
} SecStrBuf36;
|
||||
typedef struct {
|
||||
unsigned char buf[37]; /* Performance optimization code structure assignment
|
||||
length 37 bytes */
|
||||
unsigned char buf[37]; /* Performance optimization code structure assignment length 37 bytes */
|
||||
} SecStrBuf37;
|
||||
typedef struct {
|
||||
unsigned char buf[38]; /* Performance optimization code structure assignment
|
||||
length 38 bytes */
|
||||
unsigned char buf[38]; /* Performance optimization code structure assignment length 38 bytes */
|
||||
} SecStrBuf38;
|
||||
typedef struct {
|
||||
unsigned char buf[39]; /* Performance optimization code structure assignment
|
||||
length 39 bytes */
|
||||
unsigned char buf[39]; /* Performance optimization code structure assignment length 39 bytes */
|
||||
} SecStrBuf39;
|
||||
typedef struct {
|
||||
unsigned char buf[40]; /* Performance optimization code structure assignment
|
||||
length 40 bytes */
|
||||
unsigned char buf[40]; /* Performance optimization code structure assignment length 40 bytes */
|
||||
} SecStrBuf40;
|
||||
typedef struct {
|
||||
unsigned char buf[41]; /* Performance optimization code structure assignment
|
||||
length 41 bytes */
|
||||
unsigned char buf[41]; /* Performance optimization code structure assignment length 41 bytes */
|
||||
} SecStrBuf41;
|
||||
typedef struct {
|
||||
unsigned char buf[42]; /* Performance optimization code structure assignment
|
||||
length 42 bytes */
|
||||
unsigned char buf[42]; /* Performance optimization code structure assignment length 42 bytes */
|
||||
} SecStrBuf42;
|
||||
typedef struct {
|
||||
unsigned char buf[43]; /* Performance optimization code structure assignment
|
||||
length 43 bytes */
|
||||
unsigned char buf[43]; /* Performance optimization code structure assignment length 43 bytes */
|
||||
} SecStrBuf43;
|
||||
typedef struct {
|
||||
unsigned char buf[44]; /* Performance optimization code structure assignment
|
||||
length 44 bytes */
|
||||
unsigned char buf[44]; /* Performance optimization code structure assignment length 44 bytes */
|
||||
} SecStrBuf44;
|
||||
typedef struct {
|
||||
unsigned char buf[45]; /* Performance optimization code structure assignment
|
||||
length 45 bytes */
|
||||
unsigned char buf[45]; /* Performance optimization code structure assignment length 45 bytes */
|
||||
} SecStrBuf45;
|
||||
typedef struct {
|
||||
unsigned char buf[46]; /* Performance optimization code structure assignment
|
||||
length 46 bytes */
|
||||
unsigned char buf[46]; /* Performance optimization code structure assignment length 46 bytes */
|
||||
} SecStrBuf46;
|
||||
typedef struct {
|
||||
unsigned char buf[47]; /* Performance optimization code structure assignment
|
||||
length 47 bytes */
|
||||
unsigned char buf[47]; /* Performance optimization code structure assignment length 47 bytes */
|
||||
} SecStrBuf47;
|
||||
typedef struct {
|
||||
unsigned char buf[48]; /* Performance optimization code structure assignment
|
||||
length 48 bytes */
|
||||
unsigned char buf[48]; /* Performance optimization code structure assignment length 48 bytes */
|
||||
} SecStrBuf48;
|
||||
typedef struct {
|
||||
unsigned char buf[49]; /* Performance optimization code structure assignment
|
||||
length 49 bytes */
|
||||
unsigned char buf[49]; /* Performance optimization code structure assignment length 49 bytes */
|
||||
} SecStrBuf49;
|
||||
typedef struct {
|
||||
unsigned char buf[50]; /* Performance optimization code structure assignment
|
||||
length 50 bytes */
|
||||
unsigned char buf[50]; /* Performance optimization code structure assignment length 50 bytes */
|
||||
} SecStrBuf50;
|
||||
typedef struct {
|
||||
unsigned char buf[51]; /* Performance optimization code structure assignment
|
||||
length 51 bytes */
|
||||
unsigned char buf[51]; /* Performance optimization code structure assignment length 51 bytes */
|
||||
} SecStrBuf51;
|
||||
typedef struct {
|
||||
unsigned char buf[52]; /* Performance optimization code structure assignment
|
||||
length 52 bytes */
|
||||
unsigned char buf[52]; /* Performance optimization code structure assignment length 52 bytes */
|
||||
} SecStrBuf52;
|
||||
typedef struct {
|
||||
unsigned char buf[53]; /* Performance optimization code structure assignment
|
||||
length 53 bytes */
|
||||
unsigned char buf[53]; /* Performance optimization code structure assignment length 53 bytes */
|
||||
} SecStrBuf53;
|
||||
typedef struct {
|
||||
unsigned char buf[54]; /* Performance optimization code structure assignment
|
||||
length 54 bytes */
|
||||
unsigned char buf[54]; /* Performance optimization code structure assignment length 54 bytes */
|
||||
} SecStrBuf54;
|
||||
typedef struct {
|
||||
unsigned char buf[55]; /* Performance optimization code structure assignment
|
||||
length 55 bytes */
|
||||
unsigned char buf[55]; /* Performance optimization code structure assignment length 55 bytes */
|
||||
} SecStrBuf55;
|
||||
typedef struct {
|
||||
unsigned char buf[56]; /* Performance optimization code structure assignment
|
||||
length 56 bytes */
|
||||
unsigned char buf[56]; /* Performance optimization code structure assignment length 56 bytes */
|
||||
} SecStrBuf56;
|
||||
typedef struct {
|
||||
unsigned char buf[57]; /* Performance optimization code structure assignment
|
||||
length 57 bytes */
|
||||
unsigned char buf[57]; /* Performance optimization code structure assignment length 57 bytes */
|
||||
} SecStrBuf57;
|
||||
typedef struct {
|
||||
unsigned char buf[58]; /* Performance optimization code structure assignment
|
||||
length 58 bytes */
|
||||
unsigned char buf[58]; /* Performance optimization code structure assignment length 58 bytes */
|
||||
} SecStrBuf58;
|
||||
typedef struct {
|
||||
unsigned char buf[59]; /* Performance optimization code structure assignment
|
||||
length 59 bytes */
|
||||
unsigned char buf[59]; /* Performance optimization code structure assignment length 59 bytes */
|
||||
} SecStrBuf59;
|
||||
typedef struct {
|
||||
unsigned char buf[60]; /* Performance optimization code structure assignment
|
||||
length 60 bytes */
|
||||
unsigned char buf[60]; /* Performance optimization code structure assignment length 60 bytes */
|
||||
} SecStrBuf60;
|
||||
typedef struct {
|
||||
unsigned char buf[61]; /* Performance optimization code structure assignment
|
||||
length 61 bytes */
|
||||
unsigned char buf[61]; /* Performance optimization code structure assignment length 61 bytes */
|
||||
} SecStrBuf61;
|
||||
typedef struct {
|
||||
unsigned char buf[62]; /* Performance optimization code structure assignment
|
||||
length 62 bytes */
|
||||
unsigned char buf[62]; /* Performance optimization code structure assignment length 62 bytes */
|
||||
} SecStrBuf62;
|
||||
typedef struct {
|
||||
unsigned char buf[63]; /* Performance optimization code structure assignment
|
||||
length 63 bytes */
|
||||
unsigned char buf[63]; /* Performance optimization code structure assignment length 63 bytes */
|
||||
} SecStrBuf63;
|
||||
typedef struct {
|
||||
unsigned char buf[64]; /* Performance optimization code structure assignment
|
||||
length 64 bytes */
|
||||
unsigned char buf[64]; /* Performance optimization code structure assignment length 64 bytes */
|
||||
} SecStrBuf64;
|
||||
|
||||
/*
|
||||
@@ -561,29 +475,23 @@ typedef struct {
|
||||
*/
|
||||
#if defined(_DEBUG) || defined(DEBUG)
|
||||
#if defined(SECUREC_ERROR_HANDLER_BY_ASSERT)
|
||||
#define SECUREC_ERROR_INVALID_PARAMTER(msg) \
|
||||
assert(msg "invalid argument" == NULL)
|
||||
#define SECUREC_ERROR_INVALID_RANGE(msg) \
|
||||
assert(msg "invalid dest buffer size" == NULL)
|
||||
#define SECUREC_ERROR_BUFFER_OVERLAP(msg) assert(msg "buffer overlap" == NULL)
|
||||
#define SECUREC_ERROR_INVALID_PARAMTER(msg) assert(msg "invalid argument" == NULL)
|
||||
#define SECUREC_ERROR_INVALID_RANGE(msg) assert(msg "invalid dest buffer size" == NULL)
|
||||
#define SECUREC_ERROR_BUFFER_OVERLAP(msg) assert(msg "buffer overlap" == NULL)
|
||||
#elif defined(SECUREC_ERROR_HANDLER_BY_PRINTF)
|
||||
#if SECUREC_IN_KERNEL
|
||||
#define SECUREC_ERROR_INVALID_PARAMTER(msg) printk("%s invalid argument\n", msg)
|
||||
#define SECUREC_ERROR_INVALID_RANGE(msg) \
|
||||
printk("%s invalid dest buffer size\n", msg)
|
||||
#define SECUREC_ERROR_BUFFER_OVERLAP(msg) printk("%s buffer overlap\n", msg)
|
||||
#define SECUREC_ERROR_INVALID_RANGE(msg) printk("%s invalid dest buffer size\n", msg)
|
||||
#define SECUREC_ERROR_BUFFER_OVERLAP(msg) printk("%s buffer overlap\n", msg)
|
||||
#else
|
||||
#define SECUREC_ERROR_INVALID_PARAMTER(msg) printf("%s invalid argument\n", msg)
|
||||
#define SECUREC_ERROR_INVALID_RANGE(msg) \
|
||||
printf("%s invalid dest buffer size\n", msg)
|
||||
#define SECUREC_ERROR_BUFFER_OVERLAP(msg) printf("%s buffer overlap\n", msg)
|
||||
#define SECUREC_ERROR_INVALID_RANGE(msg) printf("%s invalid dest buffer size\n", msg)
|
||||
#define SECUREC_ERROR_BUFFER_OVERLAP(msg) printf("%s buffer overlap\n", msg)
|
||||
#endif
|
||||
#elif defined(SECUREC_ERROR_HANDLER_BY_FILE_LOG)
|
||||
#define SECUREC_ERROR_INVALID_PARAMTER(msg) \
|
||||
LogSecureCRuntimeError(msg " EINVAL\n")
|
||||
#define SECUREC_ERROR_INVALID_RANGE(msg) LogSecureCRuntimeError(msg " ERANGE\n")
|
||||
#define SECUREC_ERROR_BUFFER_OVERLAP(msg) \
|
||||
LogSecureCRuntimeError(msg " EOVERLAP\n")
|
||||
#define SECUREC_ERROR_INVALID_PARAMTER(msg) LogSecureCRuntimeError(msg " EINVAL\n")
|
||||
#define SECUREC_ERROR_INVALID_RANGE(msg) LogSecureCRuntimeError(msg " ERANGE\n")
|
||||
#define SECUREC_ERROR_BUFFER_OVERLAP(msg) LogSecureCRuntimeError(msg " EOVERLAP\n")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -592,10 +500,10 @@ typedef struct {
|
||||
#define SECUREC_ERROR_INVALID_PARAMTER(msg) ((void)0)
|
||||
#endif
|
||||
#ifndef SECUREC_ERROR_INVALID_RANGE
|
||||
#define SECUREC_ERROR_INVALID_RANGE(msg) ((void)0)
|
||||
#define SECUREC_ERROR_INVALID_RANGE(msg) ((void)0)
|
||||
#endif
|
||||
#ifndef SECUREC_ERROR_BUFFER_OVERLAP
|
||||
#define SECUREC_ERROR_BUFFER_OVERLAP(msg) ((void)0)
|
||||
#define SECUREC_ERROR_BUFFER_OVERLAP(msg) ((void)0)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -604,15 +512,16 @@ extern "C" {
|
||||
|
||||
/* Assembly language memory copy and memory set for X86 or MIPS ... */
|
||||
#ifdef SECUREC_USE_ASM
|
||||
extern void *memcpy_opt(void *, const void *, size_t);
|
||||
extern void *memset_opt(void *, int, size_t);
|
||||
extern void *memcpy_opt(void *, const void *, size_t);
|
||||
extern void *memset_opt(void *, int, size_t);
|
||||
#endif
|
||||
|
||||
#if defined(SECUREC_ERROR_HANDLER_BY_FILE_LOG)
|
||||
extern void LogSecureCRuntimeError(const char *errDetail);
|
||||
extern void LogSecureCRuntimeError(const char *errDetail);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user