aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDmitry Volyntsev <xeioex@nginx.com>2025-05-01 17:05:56 -0700
committerDmitry Volyntsev <xeioexception@gmail.com>2025-05-01 18:58:11 -0700
commite3cfb4f70e203866c1bd06e5fb28fcdc7dd967f8 (patch)
treec0d0343cfe00a5909e4664fd63f2bd66bef01641 /src
parent4fbe8a6511949c6137397f98fad9342e0e0bc76c (diff)
downloadnjs-e3cfb4f70e203866c1bd06e5fb28fcdc7dd967f8.tar.gz
njs-e3cfb4f70e203866c1bd06e5fb28fcdc7dd967f8.zip
Fixed GCC 15 build with -Wunterminated-string-initialization.
In file included from src/njs_main.h:48, from src/njs_diyfp.c:12: src/njs_string.h: In function ‘njs_string_encode’: src/njs_string.h:229:36: error: initializer-string for array of ‘unsigned char’ truncates NUL terminator but destination lacks ‘nonstring’ attribute ( 17 chars into 16 available) [-Werror=unterminated-string-initialization] 229 | static const u_char hex[16] = "0123456789ABCDEF";
Diffstat (limited to 'src')
-rw-r--r--src/njs_sprintf.c4
-rw-r--r--src/njs_string.c2
-rw-r--r--src/njs_string.h2
-rw-r--r--src/qjs_buffer.c2
4 files changed, 5 insertions, 5 deletions
diff --git a/src/njs_sprintf.c b/src/njs_sprintf.c
index 16ae9004..64fae9c2 100644
--- a/src/njs_sprintf.c
+++ b/src/njs_sprintf.c
@@ -95,8 +95,8 @@ njs_vsprintf(u_char *buf, u_char *end, const char *fmt, va_list args)
njs_bool_t sign;
njs_sprintf_t spf;
- static const u_char hexadecimal[16] = "0123456789abcdef";
- static const u_char HEXADECIMAL[16] = "0123456789ABCDEF";
+ static const u_char hexadecimal[] = "0123456789abcdef";
+ static const u_char HEXADECIMAL[] = "0123456789ABCDEF";
static const u_char nan[] = "[nan]";
static const u_char infinity[] = "[infinity]";
diff --git a/src/njs_string.c b/src/njs_string.c
index c38f455b..6d7c464d 100644
--- a/src/njs_string.c
+++ b/src/njs_string.c
@@ -252,7 +252,7 @@ njs_encode_hex(njs_str_t *dst, const njs_str_t *src)
size_t i, len;
const u_char *start;
- static const u_char hex[16] = "0123456789abcdef";
+ static const u_char hex[] = "0123456789abcdef";
len = src->length;
start = src->start;
diff --git a/src/njs_string.h b/src/njs_string.h
index 1961152f..225721ed 100644
--- a/src/njs_string.h
+++ b/src/njs_string.h
@@ -226,7 +226,7 @@ njs_string_encode(const uint32_t *escape, size_t size, const u_char *src,
u_char *dst)
{
uint8_t byte;
- static const u_char hex[16] = "0123456789ABCDEF";
+ static const u_char hex[] = "0123456789ABCDEF";
do {
byte = *src++;
diff --git a/src/qjs_buffer.c b/src/qjs_buffer.c
index a45f57ce..890b2028 100644
--- a/src/qjs_buffer.c
+++ b/src/qjs_buffer.c
@@ -2354,7 +2354,7 @@ qjs_hex_encode(JSContext *ctx, const njs_str_t *src, njs_str_t *dst)
size_t i, len;
const u_char *start;
- static const u_char hex[16] = "0123456789abcdef";
+ static const u_char hex[] = "0123456789abcdef";
len = src->length;
start = src->start;