From e5ac1354434c288e1cabca8e5eb7b5c750e06044 Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Thu, 23 Jul 2020 18:54:19 +0800 Subject: [PATCH] depress compilation warnings for GCC 9 --- src/control/newtoolbar.c | 6 ++++-- src/font/devfont.c | 5 +++-- src/ial/linux-libinput.c | 2 -- src/misc/misc.c | 4 +++- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/control/newtoolbar.c b/src/control/newtoolbar.c index 8970fb64..7b1802fa 100644 --- a/src/control/newtoolbar.c +++ b/src/control/newtoolbar.c @@ -1428,10 +1428,12 @@ static LRESULT NewToolbarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARA item_info->add_data = item->add_data; if (item_info->which & MTB_WHICH_TEXT) - strncpy (item_info->text, item->text, NTB_TEXT_LEN); + //strncpy (item_info->text, item->text, NTB_TEXT_LEN); + strcpy (item_info->text, item->text); if (item_info->which & MTB_WHICH_TIP) - strncpy (item_info->tip, item->tip, NTB_TIP_LEN); + //strncpy (item_info->tip, item->tip, NTB_TIP_LEN); + strcpy (item_info->tip, item->tip); return NTB_OKAY; } diff --git a/src/font/devfont.c b/src/font/devfont.c index ebbe97f0..f736b994 100644 --- a/src/font/devfont.c +++ b/src/font/devfont.c @@ -1010,8 +1010,9 @@ void GUIAPI DestroyDynamicDevFont (DEVFONT** devfont) { char font_name [LEN_UNIDEVFONT_NAME + 1]; - memset(font_name, 0, LEN_UNIDEVFONT_NAME + 1); - strncpy(font_name, (*devfont)->name, LEN_UNIDEVFONT_NAME); + //memset(font_name, 0, LEN_UNIDEVFONT_NAME + 1); + //strncpy(font_name, (*devfont)->name, LEN_UNIDEVFONT_NAME); + strcpy(font_name, (*devfont)->name); font_DelDevFont (font_name); *devfont = NULL; diff --git a/src/ial/linux-libinput.c b/src/ial/linux-libinput.c index e6d27450..40ff4a58 100644 --- a/src/ial/linux-libinput.c +++ b/src/ial/linux-libinput.c @@ -1243,11 +1243,9 @@ static int wait_event_ex (int maxfd, fd_set *in, fd_set *out, fd_set *except, break; } -#if 0 default: _DBG_PRINTF("IAL>LIBINPUT: got a UNKNOWN event type: %d\n", type); break; -#endif } libinput_event_destroy(event); diff --git a/src/misc/misc.c b/src/misc/misc.c index 7e5f1dd6..27b758da 100644 --- a/src/misc/misc.c +++ b/src/misc/misc.c @@ -1432,7 +1432,9 @@ char * strtrimall( char *src) return src; } - strcpy (src, src + nIndex1); + // VW: use memmove instead of strcpy to avoid overlapping + // strcpy (src, src + nIndex1); + memmove (src, src + nIndex1, nLen - nIndex1 + 1); nLen = strlen (src); nIndex1 = nLen - 1;