From e75144e0699f9b8fb265a1638e0ce29081db3f75 Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Fri, 10 Jan 2020 16:25:52 +0800 Subject: [PATCH] cleanup and eliminate compilation errors --- include/window.h | 2 +- src/newgdi/bitmap.c | 2 +- src/server/request.c | 8 ++++++-- src/sysres/cursor/cursors.c | 2 +- src/sysres/incoreres.c | 6 +++--- src/sysres/resmgr.h | 37 ++++++++++++++++++++++--------------- 6 files changed, 34 insertions(+), 23 deletions(-) diff --git a/include/window.h b/include/window.h index d9280fbf..ade1d591 100644 --- a/include/window.h +++ b/include/window.h @@ -5548,7 +5548,7 @@ MG_EXPORT const char* GetResPath (void); MG_EXPORT int SetResPath (const char* path); /** - * \fn int AddInnerRes (INNER_RES* inner_res, int count, BOOL copy) + * \fn int AddInnerRes (const INNER_RES* inner_res, int count, BOOL copy) * \brief Add some incore resource into the resource manager in order to * call LoadResource to get those resource. * diff --git a/src/newgdi/bitmap.c b/src/newgdi/bitmap.c index cbb470f3..384049c1 100644 --- a/src/newgdi/bitmap.c +++ b/src/newgdi/bitmap.c @@ -2516,7 +2516,7 @@ static const RGB WindowsStdColor [] = { {0xFF, 0xFF, 0xFF}, // light white --15 }; -const RGB* __mg_bitmap_get_std_16c (void) +const RGB* __mg_bmp_get_std_16c (void) { return WindowsStdColor; } diff --git a/src/server/request.c b/src/server/request.c index 535f79a8..a7d95a80 100644 --- a/src/server/request.c +++ b/src/server/request.c @@ -82,6 +82,7 @@ struct GlobalRes ReleaseProc release_proc; }; +#if defined(_MGHAVE_CURSOR) || defined(_MGGAL_MLSHADOW) || defined(_MGUSE_SHAREDFB) static void add_global_res (int cli, void* key, void* res, ReleaseProc release_proc) { @@ -106,10 +107,13 @@ static void add_global_res (int cli, void* key, } } } +#endif // defined(_MGHAVE_CURSOR) || defined(_MGGAL_MLSHADOW) || defined(_MGUSE_SHAREDFB) + #ifdef _MGGAL_MLSHADOW - extern int MLSHADOW_Server(void* request, void* reply); - extern void srvMLSHADOW_DelSurface(void *res); +extern int MLSHADOW_Server(void* request, void* reply); +extern void srvMLSHADOW_DelSurface(void *res); #endif + static void del_global_res (int cli, void* key) { MG_Client* client = mgClients + cli; diff --git a/src/sysres/cursor/cursors.c b/src/sysres/cursor/cursors.c index be406086..efd71618 100644 --- a/src/sysres/cursor/cursors.c +++ b/src/sysres/cursor/cursors.c @@ -74,7 +74,7 @@ const int __mg_cursors_offset [] = { 766*11 + 326*9 + 518*2, }; -const const unsigned char __mg_cursors_data[] = { +const unsigned char __mg_cursors_data[] = { #ifdef __TARGET_FMSOFT__ 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0x02, diff --git a/src/sysres/incoreres.c b/src/sysres/incoreres.c index a1506fb1..04fe6684 100644 --- a/src/sysres/incoreres.c +++ b/src/sysres/incoreres.c @@ -86,9 +86,9 @@ BOOL sysres_init_inner_resource() { #ifdef _MGINCORE_RES - AddInnerRes(__mgir_bmp_inner_res, TABLESIZE(__mgir_bmp_inner_res), FALSE); - AddInnerRes(__mgir_icon_inner_res, TABLESIZE(__mgir_icon_inner_res),FALSE); - AddInnerRes(__mgir_font_inner_res, TABLESIZE(__mgir_font_inner_res),FALSE); + AddInnerRes((INNER_RES*)__mgir_bmp_inner_res, TABLESIZE(__mgir_bmp_inner_res), FALSE); + AddInnerRes((INNER_RES*)__mgir_icon_inner_res, TABLESIZE(__mgir_icon_inner_res),FALSE); + AddInnerRes((INNER_RES*)__mgir_font_inner_res, TABLESIZE(__mgir_font_inner_res),FALSE); #endif return TRUE; } diff --git a/src/sysres/resmgr.h b/src/sysres/resmgr.h index aec13074..dfe7afbe 100644 --- a/src/sysres/resmgr.h +++ b/src/sysres/resmgr.h @@ -11,40 +11,40 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * 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) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* -** resmgr.h: This head file include some functions for resource manager. +** resmgr.h: This head file include some functions for resource manager. ** ** Create date: 2008/08/05 ** @@ -58,7 +58,7 @@ typedef struct _RES_TYPE_INFO{ short type; unsigned short flag; int ops_ref; - int def_source; + int def_source; RES_TYPE_OPS *ops; }RES_TYPE_INFO; #define RETIF_AUTO_DELETE 0x01 @@ -88,16 +88,23 @@ typedef struct _RES_ENTRY{ #define DEF_HASH_SIZE 97 -typedef struct _HASH_TABLE{ +typedef struct _HASH_TABLE { int size; //size of array of entries int count; //count of current RES_ENTRY in table RES_ENTRY** entries; -}HASH_TABLE; +} HASH_TABLE; + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ BOOL InitializeResManager(int hash_table_size); - void TerminateResManager(void); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #define NEWEX(type, count) (type*)calloc(count,sizeof(type)) #define NEW(type) NEWEX(type,1) @@ -115,5 +122,5 @@ void TerminateResManager(void); #define MG_RES_PATH "MG_RES_PATH" -#endif +#endif /* RES_MANAGER_H */