From 247d3cccb296f7b3ddf8d47b61e696692d9de909 Mon Sep 17 00:00:00 2001 From: twx1232375 Date: Wed, 30 Jul 2025 12:03:37 +0300 Subject: [PATCH] Added comment for unsafe functions --- interop/src/cpp/interop-utils.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/interop/src/cpp/interop-utils.h b/interop/src/cpp/interop-utils.h index a205dff716..7d57f07cb0 100644 --- a/interop/src/cpp/interop-utils.h +++ b/interop/src/cpp/interop-utils.h @@ -23,6 +23,7 @@ #include "securec.h" #define USE_SAFE(name, ...) name##_s(__VA_ARGS__) #else + /* handle possible unsafe case */ #define USE_SAFE(name, ...) name(__VA_ARGS__) #endif @@ -31,6 +32,7 @@ inline char *interop_strcpy(char *dest, size_t destsz, const char *src) #ifdef __STDC_LIB_EXT1__ return reinterpret_cast(USE_SAFE(strcpy, dest, reinterpret_cast(destsz), src)); #else + /* handle possible unsafe case */ return USE_SAFE(strcpy, dest, src); #endif } @@ -40,6 +42,7 @@ inline char *interop_strcat(char *dest, size_t destsz, const char *src) #ifdef __STDC_LIB_EXT1__ return reinterpret_cast(USE_SAFE(strcat, dest, reinterpret_cast(destsz), src)); #else + /* handle possible unsafe case */ return USE_SAFE(strcat, dest, src); #endif } @@ -49,6 +52,7 @@ inline void *interop_memcpy(void *dest, size_t destsz, const void *src, size_t c #ifdef __STDC_LIB_EXT1__ return reinterpret_cast(USE_SAFE(memcpy, dest, reinterpret_cast(destsz), src, count)); #else + /* handle possible unsafe case */ return USE_SAFE(memcpy, dest, src, count); #endif } @@ -58,6 +62,7 @@ inline void *interop_memset(void *dest, size_t destsz, int ch, size_t count) #ifdef __STDC_LIB_EXT1__ return reinterpret_cast(USE_SAFE(memset, dest, reinterpret_cast(destsz), ch, count)) #else + /* handle possible unsafe case */ return USE_SAFE(memset, dest, ch, count); #endif } @@ -68,6 +73,7 @@ inline int interop_sprintf(char *buffer, size_t bufsz, const char *format, T... #ifdef __STDC_LIB_EXT1__ return USE_SAFE(sprintf, buffer, reinterpret_cast(bufsz), format, args...); #else + /* handle possible unsafe case */ return USE_SAFE(sprintf, buffer, format, args...); #endif } @@ -88,6 +94,7 @@ inline size_t interop_strlen(const char *str) #ifdef __STDC_LIB_EXT1__ return USE_SAFE(strnlen, str, UINT_MAX); #else + /* handle possible unsafe case */ return USE_SAFE(strlen, str); #endif } -- Gitee