use const for pointer fields of INNER_RES

This commit is contained in:
Vincent Wei
2019-04-15 16:44:37 +08:00
parent fda8b7975d
commit 8fe06d5a07
4 changed files with 12 additions and 10 deletions

View File

@@ -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 */

View File

@@ -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
}

View File

@@ -83,8 +83,10 @@ static pthread_mutex_t timerLock;
#endif /* __LINUX__ */
#ifdef _MG_USE_BETTER_TIMER
#ifdef _MGRM_THREADS
#include <sys/times.h>
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

View File

@@ -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;