summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorflaviojs <flaviojs@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-09-08 19:47:26 +0000
committerflaviojs <flaviojs@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-09-08 19:47:26 +0000
commit6fc804e12ad7db569e82229cc11a361066cec682 (patch)
treeddfdf820c20e373e6666b6ae4428099702b47744
parent49a1de65bf592bbfe194a06b2b4c41f9865ea8b3 (diff)
downloadhercules-6fc804e12ad7db569e82229cc11a361066cec682.tar.gz
hercules-6fc804e12ad7db569e82229cc11a361066cec682.tar.bz2
hercules-6fc804e12ad7db569e82229cc11a361066cec682.tar.xz
hercules-6fc804e12ad7db569e82229cc11a361066cec682.zip
* Fix C++ compilation issues.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14955 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--3rdparty/msinttypes/include/stdint.h4
-rw-r--r--Changelog-Trunk.txt2
-rw-r--r--src/char/char.c4
-rw-r--r--src/char_sql/char.c2
-rw-r--r--src/common/cbasetypes.h29
-rw-r--r--src/common/db.h6
-rw-r--r--src/common/grfio.c8
-rw-r--r--src/common/grfio.h4
-rw-r--r--src/common/plugin.h2
-rw-r--r--src/common/strlib.c4
-rw-r--r--src/login/account_txt.c8
-rw-r--r--src/map/clif.c2
-rw-r--r--src/map/map.c8
-rw-r--r--src/map/mob.c26
-rw-r--r--src/map/npc.c2
-rw-r--r--src/map/npc_chat.c14
-rw-r--r--src/map/script.c2
-rw-r--r--src/map/searchstore.c4
-rw-r--r--src/map/status.c2
-rw-r--r--src/map/status.h2
-rw-r--r--src/plugins/sig.c7
-rw-r--r--src/tool/mapcache.c2
22 files changed, 94 insertions, 50 deletions
diff --git a/3rdparty/msinttypes/include/stdint.h b/3rdparty/msinttypes/include/stdint.h
index d02608a59..cbb023bf9 100644
--- a/3rdparty/msinttypes/include/stdint.h
+++ b/3rdparty/msinttypes/include/stdint.h
@@ -47,8 +47,12 @@
// or compiler give many errors like this:
// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
#ifdef __cplusplus
+#if _MSC_VER < 1300
+extern "C++" {
+#else
extern "C" {
#endif
+#endif
# include <wchar.h>
#ifdef __cplusplus
}
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index d10207c3c..7ad1e3d79 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -1,5 +1,7 @@
Date Added
+2011/09/08
+ * Fix C++ compilation issues. [FlavioJS]
2011/09/05
* 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.
diff --git a/src/char/char.c b/src/char/char.c
index 6e7100403..dfcbc9230 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -436,7 +436,7 @@ int search_character_online(int aid, int cid)
{
//Look for online 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 &&
character->char_id == cid &&
character->server > -1)
@@ -2208,7 +2208,7 @@ int parse_fromlogin(int fd)
memcpy(sd->email, RFIFOP(fd,6), 40);
sd->expiration_time = (time_t)RFIFOL(fd,46);
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...
if( max_connect_user && count_users() >= max_connect_user && sd->gmlevel < gm_allow_level )
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index f7c9e0fa0..0654be60a 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -1964,7 +1964,7 @@ int parse_fromlogin(int fd)
memcpy(sd->email, RFIFOP(fd,6), 40);
sd->expiration_time = (time_t)RFIFOL(fd,46);
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...
if( max_connect_user && count_users() >= max_connect_user && sd->gmlevel < gm_allow_level )
diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h
index 27420edbf..58acad2c7 100644
--- a/src/common/cbasetypes.h
+++ b/src/common/cbasetypes.h
@@ -77,6 +77,12 @@
// portable printf/scanf format macros and integer definitions
// 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 <stdint.h>
#include <limits.h>
@@ -326,4 +332,27 @@ typedef char bool;
#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_ */
diff --git a/src/common/db.h b/src/common/db.h
index d33b8ec2e..e5515803c 100644
--- a/src/common/db.h
+++ b/src/common/db.h
@@ -994,8 +994,8 @@ void linkdb_foreach( struct linkdb_node** head, LinkDBFunc func, ... );
do{ \
if( (__n) > VECTOR_CAPACITY(__vec) ) \
{ /* 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 */ \
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) ) \
{ /* 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 */ \
if( VECTOR_LENGTH(__vec) > (__n) ) VECTOR_LENGTH(__vec) = (__n); /* update length */ \
} \
diff --git a/src/common/grfio.c b/src/common/grfio.c
index cb242fe5d..1d1ce756f 100644
--- a/src/common/grfio.c
+++ b/src/common/grfio.c
@@ -223,17 +223,17 @@ unsigned long grfio_crc32 (const unsigned char* buf, unsigned int len)
///////////////////////////////////////////////////////////////////////////////
/// 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
-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);
}
diff --git a/src/common/grfio.h b/src/common/grfio.h
index d0baa6609..0fc9f958d 100644
--- a/src/common/grfio.h
+++ b/src/common/grfio.h
@@ -14,7 +14,7 @@ char *grfio_find_file(char *fname);
int grfio_size(char*); // GRFIO data file size get
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_ */
diff --git a/src/common/plugin.h b/src/common/plugin.h
index a367d2537..ec6399c57 100644
--- a/src/common/plugin.h
+++ b/src/common/plugin.h
@@ -50,7 +50,7 @@ typedef void Plugin_Event_Func(void);
#define PLUGIN_MAP 8
#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_NAME 1
diff --git a/src/common/strlib.c b/src/common/strlib.c
index 097f499e6..7f79a5ef0 100644
--- a/src/common/strlib.c
+++ b/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. */
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;
}
#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
fields_length = maxcols+1;
- fields = aMalloc(fields_length*sizeof(char*));
+ fields = (char**)aMalloc(fields_length*sizeof(char*));
// process rows one by one
while( fgets(line, sizeof(line), fp) )
diff --git a/src/login/account_txt.c b/src/login/account_txt.c
index 821e26df5..79e22ac3b 100644
--- a/src/login/account_txt.c
+++ b/src/login/account_txt.c
@@ -283,7 +283,7 @@ static bool account_db_txt_create(AccountDB* self, struct mmo_account* acc)
return false;
// 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 )
{// 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);
@@ -316,7 +316,7 @@ static bool account_db_txt_remove(AccountDB* self, const int account_id)
DBMap* accounts = db->accounts;
//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 )
{// error condition - entry not present
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;
// 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 )
{// error condition - entry not found
return false;
@@ -360,7 +360,7 @@ static bool account_db_txt_load_num(AccountDB* self, struct mmo_account* acc, co
DBMap* accounts = db->accounts;
// 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 )
{// entry not found
return false;
diff --git a/src/map/clif.c b/src/map/clif.c
index 5e8ef2367..5d6a828d3 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -11160,7 +11160,7 @@ void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd)
return;
}
- guild_change_emblem(sd, emblem_len, emblem);
+ guild_change_emblem(sd, emblem_len, (const char*)emblem);
}
/*==========================================
diff --git a/src/map/map.c b/src/map/map.c
index 559cab96d..39077de6c 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -2676,7 +2676,7 @@ static char *map_init_mapcache(FILE *fp)
fseek(fp, 0, SEEK_SET);
// Allocate enough space
- CREATE(buffer, unsigned char, size);
+ CREATE(buffer, char, size);
// No memory? Return..
nullpo_ret(buffer);
@@ -2699,7 +2699,7 @@ int map_readfromcache(struct map_data *m, char *buffer, char *decode_buffer)
int i;
struct map_cache_main_header *header = (struct map_cache_main_header *)buffer;
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++) {
info = (struct map_cache_map_info *)p;
@@ -2906,8 +2906,8 @@ int map_readallmaps (void)
int i;
FILE* fp=NULL;
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 )
ShowStatus("Loading maps (using GRF files)...\n");
diff --git a/src/map/mob.c b/src/map/mob.c
index c20672a13..5272b17e8 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -3964,6 +3964,21 @@ static bool mob_parse_row_mobskilldb(char** str, int columns, int current)
static const struct {
char str[32];
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[] = {
{ "always", MSC_ALWAYS },
{ "myhpltmaxrate", MSC_MYHPLTMAXRATE },
@@ -4001,17 +4016,6 @@ static bool mob_parse_row_mobskilldb(char** str, int columns, int current)
{ "blind", SC_BLIND },
{ "hiding", SC_HIDING },
{ "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", MST_TARGET },
{ "randomtarget", MST_RANDOM },
diff --git a/src/map/npc.c b/src/map/npc.c
index dd3a671b0..ceb1f3f1d 100644
--- a/src/map/npc.c
+++ b/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->src_id = src_id;
nd->bl.type = BL_NPC;
- nd->subtype = type;
+ nd->subtype = (enum npc_subtype)type;
switch( type )
{
case SCRIPT:
diff --git a/src/map/npc_chat.c b/src/map/npc_chat.c
index 99fa40a20..77c875a7e 100644
--- a/src/map/npc_chat.c
+++ b/src/map/npc_chat.c
@@ -73,8 +73,8 @@
struct pcrematch_entry {
struct pcrematch_entry* next;
char* pattern;
- pcre* pcre;
- pcre_extra* pcre_extra;
+ pcre* pcre_;
+ pcre_extra* pcre_extra_;
char* label;
};
@@ -108,8 +108,8 @@ struct npc_parse {
*/
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->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);
e->pattern = aStrdup(pattern);
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
// 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)
{
// save out the matched strings
diff --git a/src/map/script.c b/src/map/script.c
index 66b61a419..0da5e21aa 100644
--- a/src/map/script.c
+++ b/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);
// Duplicate the word
- word = aMalloc(len+1);
+ word = (char*)aMalloc(len+1);
memcpy(word, p, len);
word[len] = 0;
diff --git a/src/map/searchstore.c b/src/map/searchstore.c
index 76f0d4e2e..c59c13bed 100644
--- a/src/map/searchstore.c
+++ b/src/map/searchstore.c
@@ -184,7 +184,7 @@ void searchstore_query(struct map_session_data* sd, unsigned char type, unsigned
searchstore_clear(sd);
// 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
s.search_sd = sd;
@@ -215,7 +215,7 @@ void searchstore_query(struct map_session_data* sd, unsigned char type, unsigned
if( sd->searchstore.count )
{
// 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
clif_search_store_info_ack(sd);
diff --git a/src/map/status.c b/src/map/status.c
index 00708428e..89ad5c483 100644
--- a/src/map/status.c
+++ b/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.
/// @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);
struct status_data *status = status_get_status_data(bl);
diff --git a/src/map/status.h b/src/map/status.h
index c7ad8a9cf..d3f5a2f48 100644
--- a/src/map/status.h
+++ b/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_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_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)
diff --git a/src/plugins/sig.c b/src/plugins/sig.c
index 9db0638ca..e0d10ba43 100644
--- a/src/plugins/sig.c
+++ b/src/plugins/sig.c
@@ -88,7 +88,12 @@ sigfunc *compat_signal(int signo, sigfunc *func)
*/
#ifdef CYGWIN
#define FOPEN_ freopen
+ #ifdef __cplusplus
+ extern "C" void cygwin_stackdump();
+ #else
extern void cygwin_stackdump();
+ #endif
+
#else
#define FOPEN_(fn,m,s) fopen(fn,m)
#endif
@@ -186,7 +191,7 @@ int sig_final ()
*/
int sig_init ()
{
- void (*func) = sig_dump;
+ void (*func)(int) = sig_dump;
#ifdef CYGWIN // test if dumper is enabled
char *buf = getenv ("CYGWIN");
if (buf && strstr(buf, "error_start") != NULL)
diff --git a/src/tool/mapcache.c b/src/tool/mapcache.c
index f1a7559f1..b3bfec01b 100644
--- a/src/tool/mapcache.c
+++ b/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;
char line[1024];