From 333c2fa67278bd8d7480b9721d15ca42d1006d90 Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Wed, 18 Dec 2024 03:33:21 +0800 Subject: [PATCH] Update CPJ_ZSTR_ARG --- include/cpj.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/cpj.h b/include/cpj.h index cf3fa33..ec7b104 100644 --- a/include/cpj.h +++ b/include/cpj.h @@ -5,6 +5,7 @@ #include #include +#include #if defined(_WIN32) || defined(__CYGWIN__) #define CPJ_EXPORT __declspec(dllexport) @@ -34,14 +35,15 @@ extern "C" typedef char cpj_char_t; typedef size_t cpj_size_t; +#define CPJ_SIZE_MAX SIZE_MAX /** * Description of a JerryScript string for arguments passing */ typedef struct { - const cpj_char_t - *ptr; /**< pointer to the zero-terminated ASCII/UTF-8/CESU-8 string */ + /**< pointer to the zero-terminated ASCII/UTF-8/CESU-8 string */ + const cpj_char_t *ptr; cpj_size_t size; /**< size of the string, excluding '\0' terminator */ } cpj_string_t; @@ -85,7 +87,7 @@ typedef enum } cpj_path_style_t; /** - * Helper to to ensure str is a string literal + * Helper to generate a string literal with type const cpj_char_t * */ #define CPJ_ZSTR_LITERAL(str) (const cpj_char_t *)(str "") @@ -94,7 +96,7 @@ typedef enum * pair. */ #define CPJ_ZSTR_ARG(str) \ - ((CPJ_ZSTR_LITERAL(str))), ((cpj_size_t)(sizeof(str) - 1)) + (CPJ_ZSTR_LITERAL(str)), ((cpj_size_t)(sizeof(str) - 1)) /** * @brief Generates an absolute path based on a base.