suppress some warnings reported by GCC 12

This commit is contained in:
Vincent Wei
2022-09-15 15:01:30 +08:00
parent 4a22a38e63
commit 9141e13640
9 changed files with 28 additions and 14 deletions

View File

@@ -15,7 +15,7 @@
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
* This program is free software: you can redistribute it and/or modify
@@ -493,10 +493,15 @@ LRESULT ScrollViewCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
break;
}
case MSG_DESTROY:
scrollview_destroy (psvdata);
free (psvdata);
case MSG_DESTROY: {
/* suppress a warning about calling free() before using the pointer */
PSVDATA svdata = (PSVDATA) GetWindowAdditionalData2 (hWnd);
if (svdata) {
scrollview_destroy(svdata);
free (svdata);
}
break;
}
case MSG_GETDLGCODE:
return DLGC_WANTARROWS;

View File

@@ -15,7 +15,7 @@
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
* This program is free software: you can redistribute it and/or modify
@@ -283,7 +283,7 @@ static void DrawCoolBox (HWND hWnd, HDC hdc, PCOOLBARCTRL pdata)
WINDOWINFO *info;
RECT rc;
if (tmpdata->Caption == NULL || tmpdata->Caption [0] == '\0')
if (tmpdata->Caption [0] == '\0')
break;
GetTextExtent (hdc, tmpdata->Caption, -1, &size);

View File

@@ -15,7 +15,7 @@
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
* This program is free software: you can redistribute it and/or modify
@@ -803,7 +803,7 @@ BOOL GUIAPI InitWindowElementAttrs (PWERENDERER rdr)
char buff [20];
DWORD rgba;
if (!rdr || !rdr->name || rdr->name[0] == '\0')
if (!rdr || rdr->name[0] == '\0')
return FALSE;
_DBG_PRINTF ("GUI>InitWEA: Initialize %s renderer window element attributes.\n",

View File

@@ -3704,6 +3704,8 @@ BOOL GUIAPI ShowScrollBar (HWND hWnd, int iSBar, BOOL bShow)
return TRUE;
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
/* moved here from desktop.c; can be used on virtual window */
static void guiAddNewHostedMainWindow (PMAINWIN pHosting, PMAINWIN pHosted)
{
@@ -3755,6 +3757,7 @@ static void guiRemoveHostedMainWindow (PMAINWIN pHosting, PMAINWIN pHosted)
}
#endif /* debug code */
}
#pragma GCC diagnostic pop
/************************* Support for virtual window ************************/
#ifdef _MGHAVE_VIRTUAL_WINDOW

View File

@@ -1,5 +1,6 @@
# also for makefile.ng and makefile.msvc
AM_CPPFLAGS = -I$(abs_top_srcdir)/src/include -I$(abs_top_srcdir)/include
AM_CFLAGS = -Wno-zero-length-bounds
noinst_LTLIBRARIES = libkernel.la

View File

@@ -15,7 +15,7 @@
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
* Copyright (C) 2002~2021, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
* This program is free software: you can redistribute it and/or modify
@@ -489,7 +489,7 @@ const CompositorOps* GUIAPI ServerGetCompositorOps (const char* name)
return NULL;
for (i = 0; i < MAX_NR_COMPOSITORS; i++) {
if (compositors [i].name && strcmp (compositors [i].name, name) == 0) {
if (strcmp (compositors [i].name, name) == 0) {
return compositors [i].ops;
}
}

View File

@@ -15,7 +15,7 @@
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -15,7 +15,7 @@
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
* Copyright (C) 2002~2021, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
* This program is free software: you can redistribute it and/or modify
@@ -106,7 +106,8 @@ void* __mg_init_webp(MG_RWops *fp, MYBITMAP *mybmp, RGB *pal)
else
goto error;
sc = WebPGetFeatures(info->data, info->sz_data, &info->config.input);
sc = WebPGetFeatures((const uint8_t *)info->data, info->sz_data,
&info->config.input);
if (sc == VP8_STATUS_OK) {
break;
}
@@ -210,7 +211,8 @@ int __mg_load_webp(MG_RWops *fp, void *init_info, MYBITMAP *mybmp,
while (1) {
int n;
VP8StatusCode status = WebPIAppend(idec, info->data, info->sz_data);
VP8StatusCode status = WebPIAppend(idec,
(const uint8_t *)info->data, info->sz_data);
if (status != VP8_STATUS_OK && status != VP8_STATUS_SUSPENDED) {
_ERR_PRINTF ("__mg_load_webp: WebPIAppend failed: %d\n", status);
rc = ERR_BMP_LOAD;

View File

@@ -747,6 +747,8 @@ void GUIAPI UpdateTopmostLayer (const RECT* dirty_rc)
SendMessage (HWND_DESKTOP, MSG_PAINT, 0, 0);
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wzero-length-bounds"
int GUIAPI ServerGetTopmostZNodeOfType (MG_Layer* layer, DWORD type, int* cli)
{
ZORDERINFO* zi;
@@ -774,6 +776,7 @@ int GUIAPI ServerGetTopmostZNodeOfType (MG_Layer* layer, DWORD type, int* cli)
return topmost;
}
#pragma GCC diagnostic pop
int GUIAPI ServerGetNextZNode (MG_Layer* layer, int idx_znode, int* cli)
{