From 21e05da99c855481b638a7789ad5600b5b283680 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 16 Aug 2020 17:57:10 -0700 Subject: XKB: Mark key name arrays as not NUL-terminated strings They are fixed length (4 characters), and don't need NUL-terminators. This makes gcc stop warning when they're not NUL-terminated, and instead warn if they are passed to functions expecting NUL-terminated strings. Signed-off-by: Alan Coopersmith Reviewed-by: Matt Turner --- include/X11/extensions/XKBproto.h | 7 ++++--- include/X11/extensions/XKBstr.h | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/X11/extensions/XKBproto.h b/include/X11/extensions/XKBproto.h index 43b18d8..6eaec95 100644 --- a/include/X11/extensions/XKBproto.h +++ b/include/X11/extensions/XKBproto.h @@ -28,6 +28,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define _XKBPROTO_H_ #include +#include #include #define Window CARD32 @@ -675,7 +676,7 @@ typedef struct _xkbRowWireDesc { #define sz_xkbRowWireDesc 8 typedef struct _xkbKeyWireDesc { - CARD8 name[XkbKeyNameLength]; + CARD8 name[XkbKeyNameLength] _X_NONSTRING; INT16 gap; CARD8 shapeNdx; CARD8 colorNdx; @@ -698,8 +699,8 @@ typedef struct _xkbOverlayRowWireDesc { #define sz_xkbOverlayRowWireDesc 4 typedef struct _xkbOverlayKeyWireDesc { - CARD8 over[XkbKeyNameLength]; - CARD8 under[XkbKeyNameLength]; + CARD8 over[XkbKeyNameLength] _X_NONSTRING; + CARD8 under[XkbKeyNameLength] _X_NONSTRING; } xkbOverlayKeyWireDesc; #define sz_xkbOverlayKeyWireDesc 8 diff --git a/include/X11/extensions/XKBstr.h b/include/X11/extensions/XKBstr.h index ef26911..eaefae8 100644 --- a/include/X11/extensions/XKBstr.h +++ b/include/X11/extensions/XKBstr.h @@ -27,6 +27,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifndef _XKBSTR_H_ #define _XKBSTR_H_ +#include #include #define XkbCharToInt(v) ((v)&0x80?(int)((v)|(~0xff)):(int)((v)&0x7f)) @@ -401,12 +402,12 @@ typedef struct _XkbIndicatorRec { } XkbIndicatorRec,*XkbIndicatorPtr; typedef struct _XkbKeyNameRec { - char name[XkbKeyNameLength]; + char name[XkbKeyNameLength] _X_NONSTRING; } XkbKeyNameRec,*XkbKeyNamePtr; typedef struct _XkbKeyAliasRec { - char real[XkbKeyNameLength]; - char alias[XkbKeyNameLength]; + char real[XkbKeyNameLength] _X_NONSTRING; + char alias[XkbKeyNameLength] _X_NONSTRING; } XkbKeyAliasRec,*XkbKeyAliasPtr; /* -- cgit v1.2.3