From 3b639d59d78bbca0ab504e2cf5c49ffc7494871e Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Fri, 14 Feb 2020 22:43:13 +0800 Subject: [PATCH] cleanup --- include/control.h | 8 ++++---- include/ctrl/animation.h | 1 - include/endianrw.h | 23 +++++++++++------------ include/gdi.h | 8 +++++--- include/minigui.h | 3 +-- src/ex_ctrl/listview.c | 4 ++-- src/gui/window.c | 8 +++----- 7 files changed, 26 insertions(+), 29 deletions(-) diff --git a/include/control.h b/include/control.h index 5bb745de..47eef671 100644 --- a/include/control.h +++ b/include/control.h @@ -65,10 +65,6 @@ #ifndef _MGUI_CONTROL_H #define _MGUI_CONTROL_H -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include "ctrl/ctrlhelper.h" /** @@ -166,6 +162,10 @@ extern "C" { #include "ctrl/animation.h" #endif /* _MGCTRL_ANIMATION */ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/include/ctrl/animation.h b/include/ctrl/animation.h index b3ab9a27..abecfd32 100644 --- a/include/ctrl/animation.h +++ b/include/ctrl/animation.h @@ -62,7 +62,6 @@ #ifndef EXT_ANIMATION_H #define EXT_ANIMATION_H - #ifdef __cplusplus extern "C" { #endif diff --git a/include/endianrw.h b/include/endianrw.h index 2e369568..326aa82b 100644 --- a/include/endianrw.h +++ b/include/endianrw.h @@ -69,6 +69,17 @@ #ifndef _MGUI_ENDIAN_RW_H #define _MGUI_ENDIAN_RW_H +/* The macros used to swap values */ +/* Try to use superfast macros on systems that support them */ +#ifdef linux +#include +#ifdef __arch__swab16 +#define ArchSwap16 __arch__swab16 +#endif +#ifdef __arch__swab32 +#define ArchSwap32 __arch__swab32 +#endif +#endif /* linux */ /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus @@ -404,18 +415,6 @@ MG_EXPORT int MGUI_RWgetc (MG_RWops* area); * @{ */ -/* The macros used to swap values */ -/* Try to use superfast macros on systems that support them */ -#ifdef linux -#include -#ifdef __arch__swab16 -#define ArchSwap16 __arch__swab16 -#endif -#ifdef __arch__swab32 -#define ArchSwap32 __arch__swab32 -#endif -#endif /* linux */ - /* Use inline functions for compilers that support them, and static functions for those that do not. Because these functions become static for compilers that do not support inline functions, this diff --git a/include/gdi.h b/include/gdi.h index eb714c35..6910c8dd 100644 --- a/include/gdi.h +++ b/include/gdi.h @@ -64,7 +64,12 @@ #ifndef _MGUI_GDI_H #define _MGUI_GDI_H +#include "common.h" + #include +#include +#include + #include "endianrw.h" #ifdef __cplusplus @@ -8385,9 +8390,6 @@ MG_EXPORT int GUIAPI GetTabbedTextExtentPoint (HDC hdc, #ifdef _MGCHARSET_UNICODE -#include -#include - /** * \fn int GUIAPI MB2WCEx (PLOGFONT log_font, void* dest, BOOL wc32, \ * const unsigned char* mstr, int n) diff --git a/include/minigui.h b/include/minigui.h index f900c386..a57b46cf 100644 --- a/include/minigui.h +++ b/include/minigui.h @@ -65,6 +65,7 @@ #define _MGUI_MINIGUI_H #include +#include #ifdef __cplusplus extern "C" { @@ -173,8 +174,6 @@ MG_EXPORT RECT GUIAPI GetScreenRect (void); * @{ */ -#include - /** * \fn BOOL GUIAPI IsServer(void); * \brief Check whether the current process is the server of MiniGUI-Processes. diff --git a/src/ex_ctrl/listview.c b/src/ex_ctrl/listview.c index 12a483a0..c19e6be1 100644 --- a/src/ex_ctrl/listview.c +++ b/src/ex_ctrl/listview.c @@ -1440,7 +1440,7 @@ static LRESULT ListViewCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM { int mouseX = LOSWORD (lParam); int mouseY = HISWORD (lParam); - PITEMDATA pi; + PITEMDATA pi = NULL; int nCols; PLSTHDR p1; @@ -1511,7 +1511,7 @@ static LRESULT ListViewCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM RECT rect, rcClient; PLSTHDR p1; - PITEMDATA pi; + PITEMDATA pi = NULL; GetClientRect (hWnd, &rcClient); diff --git a/src/gui/window.c b/src/gui/window.c index 525f70dd..49ff4d96 100644 --- a/src/gui/window.c +++ b/src/gui/window.c @@ -3469,9 +3469,7 @@ BOOL GUIAPI ShowScrollBar (HWND hWnd, int iSBar, BOOL bShow) /*************************** Main window creation ****************************/ #ifdef _MGRM_THREADS int GUIAPI CreateThreadForMainWindow (pthread_t* thread, - pthread_attr_t* attr, - void * (*start_routine)(void *), - void * arg) + pthread_attr_t* attr, void * (*start_routine)(void *), void* arg) { pthread_attr_t new_attr; int ret; @@ -3504,7 +3502,7 @@ int GUIAPI WaitMainWindowClose (HWND hWnd, void** returnval) return pthread_join (th, returnval); } -#endif +#endif /* _MGRM_THREADS */ void GUIAPI MainWindowThreadCleanup (HWND hMainWnd) { @@ -3526,7 +3524,7 @@ void GUIAPI MainWindowThreadCleanup (HWND hMainWnd) #endif #ifdef __THREADX__ - /* to avoid threadx keep pWin's value,which will lead to wrong way */ + /* to avoid threadx keep pWin's value, which will lead to wrong way */ memset (pWin, 0xcc, sizeof(MAINWIN)); #endif