Skip to content

Commit e18655c

Browse files
Brahmajit Dassmfrench
authored andcommitted
smb: server: Fix building with GCC 15
GCC 15 introduces -Werror=unterminated-string-initialization by default, this results in the following build error fs/smb/server/smb_common.c:21:35: error: initializer-string for array of 'char' is too long [-Werror=unterminated-string-ini tialization] 21 | static const char basechars[43] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_-!@#$%"; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors To this we are replacing char basechars[43] with a character pointer and then using strlen to get the length. Signed-off-by: Brahmajit Das <[email protected]> Acked-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 40384c8 commit e18655c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/smb/server/smb_common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#include "mgmt/share_config.h"
1919

2020
/*for shortname implementation */
21-
static const char basechars[43] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_-!@#$%";
22-
#define MANGLE_BASE (sizeof(basechars) / sizeof(char) - 1)
21+
static const char *basechars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_-!@#$%";
22+
#define MANGLE_BASE (strlen(basechars) - 1)
2323
#define MAGIC_CHAR '~'
2424
#define PERIOD '.'
2525
#define mangle(V) ((char)(basechars[(V) % MANGLE_BASE]))

0 commit comments

Comments
 (0)