From 8fe06d5a07c25f702bd8da2954199ce1ed40a179 Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Mon, 15 Apr 2019 16:44:37 +0800 Subject: [PATCH] use const for pointer fields of INNER_RES --- include/window.h | 12 +++++------- src/include/drawsemop.h | 2 ++ src/kernel/timer.c | 4 +++- src/sysres/resmgr.c | 4 ++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/include/window.h b/include/window.h index b9b5ed19..f70a0d81 100644 --- a/include/window.h +++ b/include/window.h @@ -4584,17 +4584,15 @@ typedef unsigned long RES_KEY; /* define the incore res type */ typedef struct _INNER_RES { RES_KEY key; - Uint8* data; + const Uint8* data; int data_len; - /* special param recognized by the TYPE_OPS - * normal is null. - * is the data is a mem of raw png, jpeg, bmp - * and so on, it should be the extention name - * of the filename. eg. + /* A special param recognized by the TYPE_OPS; normally is NULL. + * If the data is a raw png, jpeg, bmp file content, + * it should be the extention name of the filename: * INNER_RES res[]= { ... { ..., ... ,.., "png" } .. }; * */ - void* additional; + const void* additional; } INNER_RES; /* the type of resource */ diff --git a/src/include/drawsemop.h b/src/include/drawsemop.h index 5261d385..0822e51a 100644 --- a/src/include/drawsemop.h +++ b/src/include/drawsemop.h @@ -112,6 +112,8 @@ static inline void reset_hidecursor_sem (void) #ifdef _DEBUG if (ret == -1) perror ("reset_hidecursor_sem"); +#else + ret = ret + 0; #endif } diff --git a/src/kernel/timer.c b/src/kernel/timer.c index 8e39d8a8..f8e10de0 100644 --- a/src/kernel/timer.c +++ b/src/kernel/timer.c @@ -83,8 +83,10 @@ static pthread_mutex_t timerLock; #endif /* __LINUX__ */ #ifdef _MG_USE_BETTER_TIMER +#ifdef _MGRM_THREADS #include static clock_t g_timer_started; +#endif static clock_t g_last_tick; #endif @@ -95,7 +97,7 @@ static void __mg_timer_action (void *data) SHAREDRES_TIMER_COUNTER += 1; #else -#if defined(__uClinux__) && defined(_MGRM_STANDALONE) +#if defined(_MGRM_STANDALONE) __mg_timer_counter += 10; #else # ifdef _MG_USE_BETTER_TIMER diff --git a/src/sysres/resmgr.c b/src/sysres/resmgr.c index 8b050499..b61e5d5b 100644 --- a/src/sysres/resmgr.c +++ b/src/sysres/resmgr.c @@ -931,7 +931,7 @@ static void* img_get_res_data(RESOURCE* res, int src_type, DWORD usr_param) INNER_RES* inner = res->source.inner; if(inner->additional == NULL) { // raw bitmap - res->data = inner->data; + res->data = (void*)inner->data; } else { BITMAP *pbmp = NEW(BITMAP); @@ -1174,7 +1174,7 @@ static void* etc_get_res_data(RESOURCE* res, int src_type, DWORD usr_param) break; } case REF_SRC_INNER: - res->data = res->source.inner->data; + res->data = (void*)res->source.inner->data; break; default: return NULL;