Browse Source

* Fix C++ compilation issues.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@14955 54d463be-8e91-2dee-dedb-b68131a5f0ec
flaviojs 13 years ago
parent
commit
9703374f8a

+ 4 - 0
3rdparty/msinttypes/include/stdint.h

@@ -47,8 +47,12 @@
 // or compiler give many errors like this:
 // or compiler give many errors like this:
 //   error C2733: second C linkage of overloaded function 'wmemchr' not allowed
 //   error C2733: second C linkage of overloaded function 'wmemchr' not allowed
 #ifdef __cplusplus
 #ifdef __cplusplus
+#if _MSC_VER < 1300
+extern "C++" {
+#else
 extern "C" {
 extern "C" {
 #endif
 #endif
+#endif
 #  include <wchar.h>
 #  include <wchar.h>
 #ifdef __cplusplus
 #ifdef __cplusplus
 }
 }

+ 2 - 0
Changelog-Trunk.txt

@@ -1,5 +1,7 @@
 Date	Added
 Date	Added
 
 
+2011/09/08
+	* Fix C++ compilation issues. [FlavioJS]
 2011/09/05
 2011/09/05
 	* Add consistency checks to the shortlist. [FlavioJS]
 	* Add consistency checks to the shortlist. [FlavioJS]
 	* Restrict intif_quest_save to sql only. txt char-server doesn't support the packet and disconnects the map-server.
 	* Restrict intif_quest_save to sql only. txt char-server doesn't support the packet and disconnects the map-server.

+ 2 - 2
src/char/char.c

@@ -436,7 +436,7 @@ int search_character_online(int aid, int cid)
 {
 {
 	//Look for online character.
 	//Look for online character.
 	struct online_char_data* character;
 	struct online_char_data* character;
-	character = idb_get(online_char_db, aid);
+	character = (struct online_char_data*)idb_get(online_char_db, aid);
 	if(character &&
 	if(character &&
 		character->char_id == cid &&
 		character->char_id == cid &&
 		character->server > -1) 
 		character->server > -1) 
@@ -2208,7 +2208,7 @@ int parse_fromlogin(int fd)
 				memcpy(sd->email, RFIFOP(fd,6), 40);
 				memcpy(sd->email, RFIFOP(fd,6), 40);
 				sd->expiration_time = (time_t)RFIFOL(fd,46);
 				sd->expiration_time = (time_t)RFIFOL(fd,46);
 				sd->gmlevel = RFIFOB(fd,50);
 				sd->gmlevel = RFIFOB(fd,50);
-				safestrncpy(sd->birthdate, RFIFOP(fd,51), sizeof(sd->birthdate));
+				safestrncpy(sd->birthdate, (const char*)RFIFOP(fd,51), sizeof(sd->birthdate));
 
 
 				// continued from char_auth_ok...
 				// continued from char_auth_ok...
 				if( max_connect_user && count_users() >= max_connect_user && sd->gmlevel < gm_allow_level )
 				if( max_connect_user && count_users() >= max_connect_user && sd->gmlevel < gm_allow_level )

+ 1 - 1
src/char_sql/char.c

@@ -1964,7 +1964,7 @@ int parse_fromlogin(int fd)
 				memcpy(sd->email, RFIFOP(fd,6), 40);
 				memcpy(sd->email, RFIFOP(fd,6), 40);
 				sd->expiration_time = (time_t)RFIFOL(fd,46);
 				sd->expiration_time = (time_t)RFIFOL(fd,46);
 				sd->gmlevel = RFIFOB(fd,50);
 				sd->gmlevel = RFIFOB(fd,50);
-				safestrncpy(sd->birthdate, RFIFOP(fd,51), sizeof(sd->birthdate));
+				safestrncpy(sd->birthdate, (const char*)RFIFOP(fd,51), sizeof(sd->birthdate));
 
 
 				// continued from char_auth_ok...
 				// continued from char_auth_ok...
 				if( max_connect_user && count_users() >= max_connect_user && sd->gmlevel < gm_allow_level )
 				if( max_connect_user && count_users() >= max_connect_user && sd->gmlevel < gm_allow_level )

+ 29 - 0
src/common/cbasetypes.h

@@ -77,6 +77,12 @@
 // portable printf/scanf format macros and integer definitions
 // portable printf/scanf format macros and integer definitions
 // NOTE: Visual C++ uses <inttypes.h> and <stdint.h> provided in /3rdparty
 // NOTE: Visual C++ uses <inttypes.h> and <stdint.h> provided in /3rdparty
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
+#ifdef __cplusplus
+#define __STDC_CONSTANT_MACROS
+#define __STDC_FORMAT_MACROS
+#define __STDC_LIMIT_MACROS
+#endif
+
 #include <inttypes.h>
 #include <inttypes.h>
 #include <stdint.h>
 #include <stdint.h>
 #include <limits.h>
 #include <limits.h>
@@ -326,4 +332,27 @@ typedef char bool;
 #endif
 #endif
 #endif
 #endif
 
 
+
+//////////////////////////////////////////////////////////////////////////
+// Set a pointer variable to a pointer value.
+#ifdef __cplusplus
+template <typename T1, typename T2>
+void SET_POINTER(T1*&var, T2* p)
+{
+	var = static_cast<T1*>(p);
+}
+template <typename T1, typename T2>
+void SET_FUNCPOINTER(T1& var, T2 p)
+{
+	char ASSERT_POINTERSIZE[sizeof(T1) == sizeof(void*) && sizeof(T2) == sizeof(void*)?1:-1];// 1 if true, -1 if false
+	union{ T1 out; T2 in; } tmp;// /!\ WARNING casting a pointer to a function pointer is against the C++ standard
+	tmp.in = p;
+	var = tmp.out;
+}
+#else
+#define SET_POINTER(var,p) (var) = (p)
+#define SET_FUNCPOINTER(var,p) (var) = (p)
+#endif
+
+
 #endif /* _CBASETYPES_H_ */
 #endif /* _CBASETYPES_H_ */

+ 3 - 3
src/common/db.h

@@ -994,8 +994,8 @@ void  linkdb_foreach( struct linkdb_node** head, LinkDBFunc func, ...  );
 	do{ \
 	do{ \
 		if( (__n) > VECTOR_CAPACITY(__vec) ) \
 		if( (__n) > VECTOR_CAPACITY(__vec) ) \
 		{ /* increase size */ \
 		{ /* increase size */ \
-			if( VECTOR_CAPACITY(__vec) == 0 ) VECTOR_DATA(__vec) = aMalloc((__n)*sizeof(VECTOR_FIRST(__vec))); /* allocate new */ \
-			else VECTOR_DATA(__vec) = aRealloc(VECTOR_DATA(__vec),(__n)*sizeof(VECTOR_FIRST(__vec))); /* reallocate */ \
+			if( VECTOR_CAPACITY(__vec) == 0 ) SET_POINTER(VECTOR_DATA(__vec), aMalloc((__n)*sizeof(VECTOR_FIRST(__vec)))); /* allocate new */ \
+			else SET_POINTER(VECTOR_DATA(__vec), aRealloc(VECTOR_DATA(__vec),(__n)*sizeof(VECTOR_FIRST(__vec)))); /* reallocate */ \
 			memset(VECTOR_DATA(__vec)+VECTOR_LENGTH(__vec), 0, (VECTOR_CAPACITY(__vec)-VECTOR_LENGTH(__vec))*sizeof(VECTOR_FIRST(__vec))); /* clear new data */ \
 			memset(VECTOR_DATA(__vec)+VECTOR_LENGTH(__vec), 0, (VECTOR_CAPACITY(__vec)-VECTOR_LENGTH(__vec))*sizeof(VECTOR_FIRST(__vec))); /* clear new data */ \
 			VECTOR_CAPACITY(__vec) = (__n); /* update capacity */ \
 			VECTOR_CAPACITY(__vec) = (__n); /* update capacity */ \
 		} \
 		} \
@@ -1007,7 +1007,7 @@ void  linkdb_foreach( struct linkdb_node** head, LinkDBFunc func, ...  );
 		} \
 		} \
 		else if( (__n) < VECTOR_CAPACITY(__vec) ) \
 		else if( (__n) < VECTOR_CAPACITY(__vec) ) \
 		{ /* reduce size */ \
 		{ /* reduce size */ \
-			VECTOR_DATA(__vec) = aRealloc(VECTOR_DATA(__vec),(__n)*sizeof(VECTOR_FIRST(__vec))); /* reallocate */ \
+			SET_POINTER(VECTOR_DATA(__vec), aRealloc(VECTOR_DATA(__vec),(__n)*sizeof(VECTOR_FIRST(__vec)))); /* reallocate */ \
 			VECTOR_CAPACITY(__vec) = (__n); /* update capacity */ \
 			VECTOR_CAPACITY(__vec) = (__n); /* update capacity */ \
 			if( VECTOR_LENGTH(__vec) > (__n) ) VECTOR_LENGTH(__vec) = (__n); /* update length */ \
 			if( VECTOR_LENGTH(__vec) > (__n) ) VECTOR_LENGTH(__vec) = (__n); /* update length */ \
 		} \
 		} \

+ 4 - 4
src/common/grfio.c

@@ -223,17 +223,17 @@ unsigned long grfio_crc32 (const unsigned char* buf, unsigned int len)
 
 
 ///////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////
 ///	Grf data sub : zip decode
 ///	Grf data sub : zip decode
-int decode_zip(unsigned char* dest, unsigned long* destLen, const unsigned char* source, unsigned long sourceLen)
+int decode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen)
 {
 {
-	return uncompress(dest, destLen, source, sourceLen);
+	return uncompress((Bytef*)dest, destLen, (const Bytef*)source, sourceLen);
 }
 }
 
 
 
 
 ///////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////
 ///	Grf data sub : zip encode 
 ///	Grf data sub : zip encode 
-int encode_zip(unsigned char* dest, unsigned long* destLen, const unsigned char* source, unsigned long sourceLen)
+int encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen)
 {
 {
-	return compress(dest, destLen, source, sourceLen);
+	return compress((Bytef*)dest, destLen, (const Bytef*)source, sourceLen);
 }
 }
 
 
 
 

+ 2 - 2
src/common/grfio.h

@@ -14,7 +14,7 @@ char *grfio_find_file(char *fname);
 int grfio_size(char*);			// GRFIO data file size get
 int grfio_size(char*);			// GRFIO data file size get
 unsigned long grfio_crc32(const unsigned char *buf, unsigned int len);
 unsigned long grfio_crc32(const unsigned char *buf, unsigned int len);
 
 
-int decode_zip(unsigned char* dest, unsigned long* destLen, const unsigned char* source, unsigned long sourceLen);
-int encode_zip(unsigned char* dest, unsigned long* destLen, const unsigned char* source, unsigned long sourceLen);
+int decode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen);
+int encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen);
 
 
 #endif /* _GRFIO_H_ */
 #endif /* _GRFIO_H_ */

+ 1 - 1
src/common/plugin.h

@@ -50,7 +50,7 @@ typedef void Plugin_Event_Func(void);
 #define PLUGIN_MAP			8
 #define PLUGIN_MAP			8
 #define PLUGIN_CORE			16
 #define PLUGIN_CORE			16
 
 
-#define IMPORT_SYMBOL(s,n)	(s) = plugin_call_table[n]
+#define IMPORT_SYMBOL(s,n)	SET_FUNCPOINTER((s), plugin_call_table[n])
 
 
 #define SYMBOL_SERVER_TYPE				0
 #define SYMBOL_SERVER_TYPE				0
 #define SYMBOL_SERVER_NAME				1
 #define SYMBOL_SERVER_NAME				1

+ 2 - 2
src/common/strlib.c

@@ -245,7 +245,7 @@ char* _strtok_r(char *s1, const char *s2, char **lasts)
    If no '\0' terminator is found in that many characters, return MAXLEN.  */
    If no '\0' terminator is found in that many characters, return MAXLEN.  */
 size_t strnlen (const char* string, size_t maxlen)
 size_t strnlen (const char* string, size_t maxlen)
 {
 {
-  const char* end = memchr (string, '\0', maxlen);
+  const char* end = (const char*)memchr(string, '\0', maxlen);
   return end ? (size_t) (end - string) : maxlen;
   return end ? (size_t) (end - string) : maxlen;
 }
 }
 #endif
 #endif
@@ -980,7 +980,7 @@ bool sv_readdb(const char* directory, const char* filename, char delim, int minc
 
 
 	// allocate enough memory for the maximum requested amount of columns plus the reserved one
 	// allocate enough memory for the maximum requested amount of columns plus the reserved one
 	fields_length = maxcols+1;
 	fields_length = maxcols+1;
-	fields = aMalloc(fields_length*sizeof(char*));
+	fields = (char**)aMalloc(fields_length*sizeof(char*));
 
 
 	// process rows one by one
 	// process rows one by one
 	while( fgets(line, sizeof(line), fp) )
 	while( fgets(line, sizeof(line), fp) )

+ 4 - 4
src/login/account_txt.c

@@ -283,7 +283,7 @@ static bool account_db_txt_create(AccountDB* self, struct mmo_account* acc)
 		return false;
 		return false;
 
 
 	// check if the account_id is free
 	// check if the account_id is free
-	tmp = idb_get(accounts, account_id);
+	tmp = (struct mmo_account*)idb_get(accounts, account_id);
 	if( tmp != NULL )
 	if( tmp != NULL )
 	{// error condition - entry already present
 	{// error condition - entry already present
 		ShowError("account_db_txt_create: cannot create account %d:'%s', this id is already occupied by %d:'%s'!\n", account_id, acc->userid, account_id, tmp->userid);
 		ShowError("account_db_txt_create: cannot create account %d:'%s', this id is already occupied by %d:'%s'!\n", account_id, acc->userid, account_id, tmp->userid);
@@ -316,7 +316,7 @@ static bool account_db_txt_remove(AccountDB* self, const int account_id)
 	DBMap* accounts = db->accounts;
 	DBMap* accounts = db->accounts;
 
 
 	//TODO: find out if this really works
 	//TODO: find out if this really works
-	struct mmo_account* tmp = idb_remove(accounts, account_id);
+	struct mmo_account* tmp = (struct mmo_account*)idb_remove(accounts, account_id);
 	if( tmp == NULL )
 	if( tmp == NULL )
 	{// error condition - entry not present
 	{// error condition - entry not present
 		ShowError("account_db_txt_remove: no such account with id %d\n", account_id);
 		ShowError("account_db_txt_remove: no such account with id %d\n", account_id);
@@ -337,7 +337,7 @@ static bool account_db_txt_save(AccountDB* self, const struct mmo_account* acc)
 	int account_id = acc->account_id;
 	int account_id = acc->account_id;
 
 
 	// retrieve previous data
 	// retrieve previous data
-	struct mmo_acount* tmp = idb_get(accounts, account_id);
+	struct mmo_account* tmp = (struct mmo_account*)idb_get(accounts, account_id);
 	if( tmp == NULL )
 	if( tmp == NULL )
 	{// error condition - entry not found
 	{// error condition - entry not found
 		return false;
 		return false;
@@ -360,7 +360,7 @@ static bool account_db_txt_load_num(AccountDB* self, struct mmo_account* acc, co
 	DBMap* accounts = db->accounts;
 	DBMap* accounts = db->accounts;
 
 
 	// retrieve data
 	// retrieve data
-	struct mmo_account* tmp = idb_get(accounts, account_id);
+	struct mmo_account* tmp = (struct mmo_account*)idb_get(accounts, account_id);
 	if( tmp == NULL )
 	if( tmp == NULL )
 	{// entry not found
 	{// entry not found
 		return false;
 		return false;

+ 1 - 1
src/map/clif.c

@@ -11160,7 +11160,7 @@ void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd)
 		return;
 		return;
 	}
 	}
 
 
-	guild_change_emblem(sd, emblem_len, emblem);
+	guild_change_emblem(sd, emblem_len, (const char*)emblem);
 }
 }
 
 
 /*==========================================
 /*==========================================

+ 4 - 4
src/map/map.c

@@ -2676,7 +2676,7 @@ static char *map_init_mapcache(FILE *fp)
 	fseek(fp, 0, SEEK_SET);
 	fseek(fp, 0, SEEK_SET);
 
 
 	// Allocate enough space
 	// Allocate enough space
-	CREATE(buffer, unsigned char, size);
+	CREATE(buffer, char, size);
 
 
 	// No memory? Return..
 	// No memory? Return..
 	nullpo_ret(buffer);
 	nullpo_ret(buffer);
@@ -2699,7 +2699,7 @@ int map_readfromcache(struct map_data *m, char *buffer, char *decode_buffer)
 	int i;
 	int i;
 	struct map_cache_main_header *header = (struct map_cache_main_header *)buffer;
 	struct map_cache_main_header *header = (struct map_cache_main_header *)buffer;
 	struct map_cache_map_info *info = NULL;
 	struct map_cache_map_info *info = NULL;
-	unsigned char *p = buffer + sizeof(struct map_cache_main_header);
+	char *p = buffer + sizeof(struct map_cache_main_header);
 
 
 	for(i = 0; i < header->map_count; i++) {
 	for(i = 0; i < header->map_count; i++) {
 		info = (struct map_cache_map_info *)p;
 		info = (struct map_cache_map_info *)p;
@@ -2906,8 +2906,8 @@ int map_readallmaps (void)
 	int i;
 	int i;
 	FILE* fp=NULL;
 	FILE* fp=NULL;
 	int maps_removed = 0;
 	int maps_removed = 0;
-	unsigned char *map_cache_buffer = NULL; // Has the uncompressed gat data of all maps, so just one allocation has to be made
-	unsigned char map_cache_decode_buffer[MAX_MAP_SIZE];
+	char *map_cache_buffer = NULL; // Has the uncompressed gat data of all maps, so just one allocation has to be made
+	char map_cache_decode_buffer[MAX_MAP_SIZE];
 
 
 	if( enable_grf )
 	if( enable_grf )
 		ShowStatus("Loading maps (using GRF files)...\n");
 		ShowStatus("Loading maps (using GRF files)...\n");

+ 15 - 11
src/map/mob.c

@@ -3964,6 +3964,21 @@ static bool mob_parse_row_mobskilldb(char** str, int columns, int current)
 	static const struct {
 	static const struct {
 		char str[32];
 		char str[32];
 		enum MobSkillState id;
 		enum MobSkillState id;
+	} state[] = {
+		{	"any",		MSS_ANY		}, //All states except Dead
+		{	"idle",		MSS_IDLE	},
+		{	"walk",		MSS_WALK	},
+		{	"loot",		MSS_LOOT	},
+		{	"dead",		MSS_DEAD	},
+		{	"attack",	MSS_BERSERK	}, //Retaliating attack
+		{	"angry",	MSS_ANGRY	}, //Preemptive attack (aggressive mobs)
+		{	"chase",	MSS_RUSH	}, //Chase escaping target
+		{	"follow",	MSS_FOLLOW	}, //Preemptive chase (aggressive mobs)
+		{	"anytarget",MSS_ANYTARGET	}, //Berserk+Angry+Rush+Follow
+	};
+	static const struct {
+		char str[32];
+		int id;
 	} cond1[] = {
 	} cond1[] = {
 		{ "always",            MSC_ALWAYS            },
 		{ "always",            MSC_ALWAYS            },
 		{ "myhpltmaxrate",     MSC_MYHPLTMAXRATE     },
 		{ "myhpltmaxrate",     MSC_MYHPLTMAXRATE     },
@@ -4001,17 +4016,6 @@ static bool mob_parse_row_mobskilldb(char** str, int columns, int current)
 		{	"blind",		SC_BLIND		},
 		{	"blind",		SC_BLIND		},
 		{	"hiding",		SC_HIDING		},
 		{	"hiding",		SC_HIDING		},
 		{	"sight",		SC_SIGHT		},
 		{	"sight",		SC_SIGHT		},
-	}, state[] = {
-		{	"any",		MSS_ANY		}, //All states except Dead
-		{	"idle",		MSS_IDLE	},
-		{	"walk",		MSS_WALK	},
-		{	"loot",		MSS_LOOT	},
-		{	"dead",		MSS_DEAD	},
-		{	"attack",	MSS_BERSERK	}, //Retaliating attack
-		{	"angry",	MSS_ANGRY	}, //Preemptive attack (aggressive mobs)
-		{	"chase",	MSS_RUSH	}, //Chase escaping target
-		{	"follow",	MSS_FOLLOW	}, //Preemptive chase (aggressive mobs)
-		{	"anytarget",MSS_ANYTARGET	}, //Berserk+Angry+Rush+Follow
 	}, target[] = {
 	}, target[] = {
 		{	"target",	MST_TARGET	},
 		{	"target",	MST_TARGET	},
 		{	"randomtarget",	MST_RANDOM	},
 		{	"randomtarget",	MST_RANDOM	},

+ 1 - 1
src/map/npc.c

@@ -2340,7 +2340,7 @@ const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const ch
 	nd->speed = 200;
 	nd->speed = 200;
 	nd->src_id = src_id;
 	nd->src_id = src_id;
 	nd->bl.type = BL_NPC;
 	nd->bl.type = BL_NPC;
-	nd->subtype = type;
+	nd->subtype = (enum npc_subtype)type;
 	switch( type )
 	switch( type )
 	{
 	{
 	case SCRIPT:
 	case SCRIPT:

+ 7 - 7
src/map/npc_chat.c

@@ -73,8 +73,8 @@
 struct pcrematch_entry {
 struct pcrematch_entry {
 	struct pcrematch_entry* next;
 	struct pcrematch_entry* next;
 	char* pattern;
 	char* pattern;
-	pcre* pcre;
-	pcre_extra* pcre_extra;
+	pcre* pcre_;
+	pcre_extra* pcre_extra_;
 	char* label;
 	char* label;
 };
 };
 
 
@@ -108,8 +108,8 @@ struct npc_parse {
  */
  */
 void finalize_pcrematch_entry(struct pcrematch_entry* e)
 void finalize_pcrematch_entry(struct pcrematch_entry* e)
 {
 {
-	pcre_free(e->pcre);
-	pcre_free(e->pcre_extra);
+	pcre_free(e->pcre_);
+	pcre_free(e->pcre_extra_);
 	aFree(e->pattern);
 	aFree(e->pattern);
 	aFree(e->label);
 	aFree(e->label);
 }
 }
@@ -316,8 +316,8 @@ void npc_chat_def_pattern(struct npc_data* nd, int setid, const char* pattern, c
 	struct pcrematch_entry *e = create_pcrematch_entry(s);
 	struct pcrematch_entry *e = create_pcrematch_entry(s);
 	e->pattern = aStrdup(pattern);
 	e->pattern = aStrdup(pattern);
 	e->label = aStrdup(label);
 	e->label = aStrdup(label);
-	e->pcre = pcre_compile(pattern, PCRE_CASELESS, &err, &erroff, NULL);
-	e->pcre_extra = pcre_study(e->pcre, 0, &err);
+	e->pcre_ = pcre_compile(pattern, PCRE_CASELESS, &err, &erroff, NULL);
+	e->pcre_extra_ = pcre_study(e->pcre_, 0, &err);
 }
 }
 
 
 /**
 /**
@@ -373,7 +373,7 @@ int npc_chat_sub(struct block_list* bl, va_list ap)
 			int offsets[2*10 + 10]; // 1/3 reserved for temp space requred by pcre_exec
 			int offsets[2*10 + 10]; // 1/3 reserved for temp space requred by pcre_exec
 			
 			
 			// perform pattern match
 			// perform pattern match
-			int r = pcre_exec(e->pcre, e->pcre_extra, msg, len, 0, 0, offsets, ARRAYLENGTH(offsets));
+			int r = pcre_exec(e->pcre_, e->pcre_extra_, msg, len, 0, 0, offsets, ARRAYLENGTH(offsets));
 			if (r > 0)
 			if (r > 0)
 			{
 			{
 				// save out the matched strings
 				// save out the matched strings

+ 1 - 1
src/map/script.c

@@ -901,7 +901,7 @@ int add_word(const char* p)
 		disp_error_message("script:add_word: invalid word. A word consists of undercores and/or alfanumeric characters, and valid variable prefixes/postfixes.", p);
 		disp_error_message("script:add_word: invalid word. A word consists of undercores and/or alfanumeric characters, and valid variable prefixes/postfixes.", p);
 
 
 	// Duplicate the word
 	// Duplicate the word
-	word = aMalloc(len+1);
+	word = (char*)aMalloc(len+1);
 	memcpy(word, p, len);
 	memcpy(word, p, len);
 	word[len] = 0;
 	word[len] = 0;
 	
 	

+ 2 - 2
src/map/searchstore.c

@@ -184,7 +184,7 @@ void searchstore_query(struct map_session_data* sd, unsigned char type, unsigned
 	searchstore_clear(sd);
 	searchstore_clear(sd);
 
 
 	// allocate max. amount of results
 	// allocate max. amount of results
-	sd->searchstore.items = aMalloc(sizeof(struct s_search_store_info_item)*battle_config.searchstore_maxresults);
+	sd->searchstore.items = (struct s_search_store_info_item*)aMalloc(sizeof(struct s_search_store_info_item)*battle_config.searchstore_maxresults);
 
 
 	// search
 	// search
 	s.search_sd  = sd;
 	s.search_sd  = sd;
@@ -215,7 +215,7 @@ void searchstore_query(struct map_session_data* sd, unsigned char type, unsigned
 	if( sd->searchstore.count )
 	if( sd->searchstore.count )
 	{
 	{
 		// reclaim unused memory
 		// reclaim unused memory
-		sd->searchstore.items = aRealloc(sd->searchstore.items, sizeof(struct s_search_store_info_item)*sd->searchstore.count);
+		sd->searchstore.items = (struct s_search_store_info_item*)aRealloc(sd->searchstore.items, sizeof(struct s_search_store_info_item)*sd->searchstore.count);
 
 
 		// present results
 		// present results
 		clif_search_store_info_ack(sd);
 		clif_search_store_info_ack(sd);

+ 1 - 1
src/map/status.c

@@ -2723,7 +2723,7 @@ void status_calc_regen_rate(struct block_list *bl, struct regen_data *regen, str
 
 
 /// Recalculates parts of an object's battle status according to the specified flags.
 /// Recalculates parts of an object's battle status according to the specified flags.
 /// @param flag bitfield of values from enum scb_flag
 /// @param flag bitfield of values from enum scb_flag
-void status_calc_bl_main(struct block_list *bl, enum scb_flag flag)
+void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag)
 {
 {
 	const struct status_data *b_status = status_get_base_status(bl);
 	const struct status_data *b_status = status_get_base_status(bl);
 	struct status_data *status = status_get_status_data(bl);
 	struct status_data *status = status_get_status_data(bl);

+ 1 - 1
src/map/status.h

@@ -1293,7 +1293,7 @@ int status_change_timer_sub(struct block_list* bl, va_list ap);
 int status_change_clear(struct block_list* bl, int type);
 int status_change_clear(struct block_list* bl, int type);
 int status_change_clear_buffs(struct block_list* bl, int type);
 int status_change_clear_buffs(struct block_list* bl, int type);
 
 
-#define status_calc_bl(bl, flag) status_calc_bl_(bl, flag, false)
+#define status_calc_bl(bl, flag) status_calc_bl_(bl, (enum scb_flag)(flag), false)
 #define status_calc_mob(md, first) status_calc_bl_(&(md)->bl, SCB_ALL, first)
 #define status_calc_mob(md, first) status_calc_bl_(&(md)->bl, SCB_ALL, first)
 #define status_calc_pet(pd, first) status_calc_bl_(&(pd)->bl, SCB_ALL, first)
 #define status_calc_pet(pd, first) status_calc_bl_(&(pd)->bl, SCB_ALL, first)
 #define status_calc_pc(sd, first) status_calc_bl_(&(sd)->bl, SCB_ALL, first)
 #define status_calc_pc(sd, first) status_calc_bl_(&(sd)->bl, SCB_ALL, first)

+ 6 - 1
src/plugins/sig.c

@@ -88,7 +88,12 @@ sigfunc *compat_signal(int signo, sigfunc *func)
  */
  */
 #ifdef CYGWIN
 #ifdef CYGWIN
 	#define FOPEN_ freopen
 	#define FOPEN_ freopen
+	#ifdef __cplusplus
+	extern "C" void cygwin_stackdump();
+	#else
 	extern void cygwin_stackdump();
 	extern void cygwin_stackdump();
+	#endif
+	
 #else
 #else
 	#define FOPEN_(fn,m,s) fopen(fn,m)
 	#define FOPEN_(fn,m,s) fopen(fn,m)
 #endif
 #endif
@@ -186,7 +191,7 @@ int sig_final ()
  */
  */
 int sig_init ()
 int sig_init ()
 {
 {
-	void (*func) = sig_dump;
+	void (*func)(int) = sig_dump;
 #ifdef CYGWIN	// test if dumper is enabled
 #ifdef CYGWIN	// test if dumper is enabled
 	char *buf = getenv ("CYGWIN");
 	char *buf = getenv ("CYGWIN");
 	if (buf && strstr(buf, "error_start") != NULL)
 	if (buf && strstr(buf, "error_start") != NULL)

+ 1 - 1
src/tool/mapcache.c

@@ -246,7 +246,7 @@ void process_args(int argc, char *argv[])
 
 
 }
 }
 
 
-int do_init(int argc, char *argv[])
+int do_init(int argc, char** argv)
 {
 {
 	FILE *list;
 	FILE *list;
 	char line[1024];
 	char line[1024];