!49 libboundscheck升级至1.1.16

Merge pull request !49 from zhaowenli/master2
This commit is contained in:
openharmony_ci
2023-12-06 08:34:26 +00:00
committed by Gitee
4 changed files with 74 additions and 15 deletions
+15
View File
@@ -85,10 +85,18 @@ typedef int errno_t;
/* If you need export the function of this library in Win32 dll, use __declspec(dllexport) */
#ifndef SECUREC_API
#if defined(SECUREC_DLL_EXPORT)
#if defined(_MSC_VER)
#define SECUREC_API __declspec(dllexport)
#else /* build for linux */
#define SECUREC_API __attribute__((visibility("default")))
#endif /* end of _MSC_VER and SECUREC_DLL_EXPORT */
#elif defined(SECUREC_DLL_IMPORT)
#if defined(_MSC_VER)
#define SECUREC_API __declspec(dllimport)
#else
#define SECUREC_API
#endif /* end of _MSC_VER and SECUREC_DLL_IMPORT */
#else
/*
* Standardized function declaration. If a security function is declared in the your code,
* it may cause a compilation alarm,Please delete the security function you declared.
@@ -106,6 +114,13 @@ typedef int errno_t;
#ifdef __cplusplus
extern "C" {
#endif
/*
* Description: The GetHwSecureCVersion function get SecureC Version string and version number.
* Parameter: verNumber - to store version number (for example value is 0x500 | 0xa)
* Return: version string
*/
SECUREC_API const char *GetHwSecureCVersion(unsigned short *verNumber);
#if SECUREC_ENABLE_MEMSET
/*
* Description: The memset_s function copies the value of c (converted to an unsigned char) into each of
+7 -7
View File
@@ -458,7 +458,7 @@ SECUREC_INLINE int SecExtendFloatLen(SecFloatSpec *floatSpec)
return 0;
}
/* Do not use localeconv()->decimal_pointif onlay support '.' */
/* Do not use localeconv()->decimal_pointif only support '.' */
SECUREC_INLINE int SecIsFloatDecimal(SecChar ch)
{
return (int)(ch == SECUREC_CHAR('.'));
@@ -974,7 +974,7 @@ SECUREC_INLINE int SecIsLongBitEqual(int bitNum)
*/
SECUREC_INLINE int SecHexValueOfChar(SecInt ch)
{
/* Use isdigt Causing tool false alarms */
/* Use isdigit Causing tool false alarms */
return (int)((ch >= '0' && ch <= '9') ? ((unsigned char)ch - '0') :
((((unsigned char)ch | (unsigned char)('a' - 'A')) - ('a')) + 10)); /* Adding 10 is to hex value */
}
@@ -1785,7 +1785,7 @@ SECUREC_INLINE int SecInputString(SecFileStream *stream, SecScanSpec *spec,
#ifdef SECUREC_FOR_WCHAR
/*
* Alloce buffer for wchar version of %[.
* Allocate buffer for wchar version of %[.
* Return 0 OK
*/
SECUREC_INLINE int SecAllocBracketTable(SecBracketTable *bracketTable)
@@ -1839,7 +1839,7 @@ int SecInputS(SecFileStream *stream, const char *cFormat, va_list argList)
spec.ch = 0; /* Need to initialize to 0 */
spec.charCount = 0; /* Need to initialize to 0 */
/* Format must not NULL, use err < 1 to claer 845 */
/* Format must not NULL, use err < 1 to clear 845 */
while (errRet < 1 && *format != SECUREC_CHAR('\0')) {
/* Skip space in format and space in input */
if (SecIsSpace((SecInt)(int)(*format)) != 0) {
@@ -1931,7 +1931,7 @@ int SecInputS(SecFileStream *stream, const char *cFormat, va_list argList)
--spec.arrayWidth;
}
} else {
/* Set argPtr to NULL is necessary, in supress mode we don't use argPtr to store data */
/* Set argPtr to NULL is necessary, in suppress mode we don't use argPtr to store data */
spec.argPtr = NULL;
}
@@ -2175,7 +2175,7 @@ SECUREC_INLINE SecInt SecGetChar(SecFileStream *stream, int *counter)
}
/*
* Unget Public realizatio char for wchar and char version
* Unget Public realization char for wchar and char version
*/
SECUREC_INLINE void SecUnGetCharImpl(SecInt ch, SecFileStream *stream)
{
@@ -2205,7 +2205,7 @@ SECUREC_INLINE void SecUnGetCharImpl(SecInt ch, SecFileStream *stream)
*/
SECUREC_INLINE void SecUnGetChar(SecInt ch, SecFileStream *stream, int *counter)
{
*counter = *counter - 1; /* Always mius 1 */
*counter = *counter - 1; /* Always minus 1 */
if (ch != SECUREC_EOF) {
SecUnGetCharImpl(ch, stream);
}
+37
View File
@@ -42,3 +42,40 @@ int mbtowc(wchar_t *pwc, const char *s, size_t n)
#endif
#endif
/* The V100R001C01 version num is 0x5 (High 8 bits) */
#define SECUREC_C_VERSION 0x500U
#define SECUREC_SPC_VERSION 0x10U
#define SECUREC_VERSION_STR "1.1.16"
/*
* Get version string and version number.
* The rules for version number are as follows:
* 1) SPC verNumber<->verStr like:
* 0x201<->C01
* 0x202<->C01SPC001 Redefine numbers after this version
* 0x502<->C01SPC002
* 0x503<->C01SPC003
* ...
* 0X50a<->SPC010
* 0X50b<->SPC011
* ...
* 0x700<->C02
* 0x701<->C01SPC001
* 0x702<->C02SPC002
* ...
* 2) CP verNumber<->verStr like:
* 0X601<->CP0001
* 0X602<->CP0002
* ...
*/
const char *GetHwSecureCVersion(unsigned short *verNumber)
{
if (verNumber != NULL) {
*verNumber = (unsigned short)(SECUREC_C_VERSION | SECUREC_SPC_VERSION);
}
return SECUREC_VERSION_STR;
}
#if SECUREC_EXPORT_KERNEL_SYMBOL
EXPORT_SYMBOL(GetHwSecureCVersion);
#endif
+15 -8
View File
@@ -23,22 +23,29 @@
#define SECUREC_HANDLE_WFORMAT 1
#endif
#if SECUREC_HANDLE_WFORMAT && defined(__GNUC__) && ((__GNUC__ >= 5) || \
(defined(__GNUC_MINOR__) && (__GNUC__ == 4 && __GNUC_MINOR__ > 7)))
#if defined(__clang__)
#if SECUREC_HANDLE_WFORMAT && defined(__GNUC__) && ((__GNUC__ >= 5) || \
(defined(__GNUC_MINOR__) && (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)))
#define SECUREC_MASK_WFORMAT_WARNING _Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"")
#else
#define SECUREC_MASK_WFORMAT_WARNING _Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"") \
_Pragma("GCC diagnostic ignored \"-Wmissing-format-attribute\"") \
_Pragma("GCC diagnostic ignored \"-Wsuggest-attribute=format\"")
#endif
#define SECUREC_END_MASK_WFORMAT_WARNING _Pragma("GCC diagnostic pop")
#else
#define SECUREC_MASK_WFORMAT_WARNING
#define SECUREC_END_MASK_WFORMAT_WARNING
#endif
#else
#if SECUREC_HANDLE_WFORMAT && defined(__GNUC__) && ((__GNUC__ >= 5 ) || \
(defined(__GNUC_MINOR__) && (__GNUC__ == 4 && __GNUC_MINOR__ > 7)))
#define SECUREC_MASK_WFORMAT_WARNING _Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"") \
_Pragma("GCC diagnostic ignored \"-Wmissing-format-attribute\"") \
_Pragma("GCC diagnostic ignored \"-Wsuggest-attribute=format\"")
#define SECUREC_END_MASK_WFORMAT_WARNING _Pragma("GCC diagnostic pop")
#else
#define SECUREC_MASK_WFORMAT_WARNING
#define SECUREC_END_MASK_WFORMAT_WARNING
#endif
#endif
#define SECUREC_MASK_VSPRINTF_WARNING SECUREC_MASK_WFORMAT_WARNING \
SECUREC_MASK_MSVC_CRT_WARNING