Skip to content

Commit 15331ed

Browse files
committed
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";
1 parent 30b5331 commit 15331ed

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

external/qjs_query_string_module.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ qjs_string_encode(const uint32_t *escape, size_t size, const u_char *src,
537537
u_char *dst)
538538
{
539539
uint8_t byte;
540-
static const u_char hex[16] = "0123456789ABCDEF";
540+
static const u_char hex[] = "0123456789ABCDEF";
541541

542542
do {
543543
byte = *src++;

src/njs_sprintf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ njs_vsprintf(u_char *buf, u_char *end, const char *fmt, va_list args)
9595
njs_bool_t sign;
9696
njs_sprintf_t spf;
9797

98-
static const u_char hexadecimal[16] = "0123456789abcdef";
99-
static const u_char HEXADECIMAL[16] = "0123456789ABCDEF";
98+
static const u_char hexadecimal[] = "0123456789abcdef";
99+
static const u_char HEXADECIMAL[] = "0123456789ABCDEF";
100100
static const u_char nan[] = "[nan]";
101101
static const u_char infinity[] = "[infinity]";
102102

src/njs_string.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ njs_encode_hex(njs_str_t *dst, const njs_str_t *src)
252252
size_t i, len;
253253
const u_char *start;
254254

255-
static const u_char hex[16] = "0123456789abcdef";
255+
static const u_char hex[] = "0123456789abcdef";
256256

257257
len = src->length;
258258
start = src->start;

src/njs_string.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ njs_string_encode(const uint32_t *escape, size_t size, const u_char *src,
226226
u_char *dst)
227227
{
228228
uint8_t byte;
229-
static const u_char hex[16] = "0123456789ABCDEF";
229+
static const u_char hex[] = "0123456789ABCDEF";
230230

231231
do {
232232
byte = *src++;

src/qjs_buffer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2354,7 +2354,7 @@ qjs_hex_encode(JSContext *ctx, const njs_str_t *src, njs_str_t *dst)
23542354
size_t i, len;
23552355
const u_char *start;
23562356

2357-
static const u_char hex[16] = "0123456789abcdef";
2357+
static const u_char hex[] = "0123456789abcdef";
23582358

23592359
len = src->length;
23602360
start = src->start;

0 commit comments

Comments
 (0)