1
0
Bryan Drewery 22 жил өмнө
parent
commit
89cb12725d

+ 2 - 2
src/compat/memutil.c

@@ -3,8 +3,8 @@
 #include "memcpy.h"
 #include "memcpy.h"
 #include "src/main.h"
 #include "src/main.h"
 
 
-extern void * __real_malloc(size_t);
-extern void * __real_realloc(void *, size_t);
+extern "C" void * __real_malloc(size_t);
+extern "C" void * __real_realloc(void *, size_t);
 
 
 void *
 void *
 __wrap_malloc(size_t size)
 __wrap_malloc(size_t size)

+ 11 - 3
src/compat/memutil.h

@@ -7,10 +7,18 @@
 #undef str_redup
 #undef str_redup
 #undef strdup
 #undef strdup
 
 
-void *malloc(size_t);
-void *realloc(void *, size_t);
-void *calloc(size_t, size_t);
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void *malloc(size_t) __THROW __attribute_malloc__;
+void *realloc(void *, size_t) __THROW __attribute_malloc__;
+void *calloc(size_t, size_t) __THROW __attribute_malloc__;
 void str_redup(char **, const char *);
 void str_redup(char **, const char *);
 char *strdup(const char *);
 char *strdup(const char *);
 
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* !_MEMUTIL_H */
 #endif /* !_MEMUTIL_H */

+ 7 - 7
src/flags.c

@@ -22,15 +22,15 @@ init_flags()
   unsigned char i;
   unsigned char i;
 
 
   for (i = 0; i < 'A'; i++)
   for (i = 0; i < 'A'; i++)
-    FLAG[i] = 0;
+    FLAG[(int) i] = 0;
   for (; i <= 'Z'; i++)
   for (; i <= 'Z'; i++)
-    FLAG[i] = (flag_t) 1 << (26 + (i - 'A'));
+    FLAG[(int) i] = (flag_t) 1 << (26 + (i - 'A'));
   for (; i < 'a'; i++)
   for (; i < 'a'; i++)
-    FLAG[i] = 0;
+    FLAG[(int) i] = 0;
   for (; i <= 'z'; i++)
   for (; i <= 'z'; i++)
-    FLAG[i] = (flag_t) 1 << (i - 'a');
+    FLAG[(int) i] = (flag_t) 1 << (i - 'a');
   for (; i < 128; i++)
   for (; i < 128; i++)
-    FLAG[i] = 0;
+    FLAG[(int) i] = 0;
 }
 }
 
 
 /* Some flags are mutually exclusive -- this roots them out
 /* Some flags are mutually exclusive -- this roots them out
@@ -163,7 +163,7 @@ break_down_flags(const char *string, struct flag_record *plus, struct flag_recor
         break;                  /* switch() */
         break;                  /* switch() */
       default:
       default:
       {
       {
-        flag_t flagbit = FLAG[(unsigned char) *string];
+        flag_t flagbit = FLAG[(int) *string];
 
 
         if (flagbit) {
         if (flagbit) {
           switch (chan) {
           switch (chan) {
@@ -203,7 +203,7 @@ flag2str(char *string, flag_t flag)
   char *old = string;
   char *old = string;
 
 
   for (c = 0; c < 128; c++)
   for (c = 0; c < 128; c++)
-    if (flag & FLAG[c])
+    if (flag & FLAG[(int) c])
       *string++ = c;
       *string++ = c;
 
 
   if (string == old)
   if (string == old)

+ 24 - 24
src/flags.h

@@ -15,7 +15,7 @@
 
 
 typedef uint64_t flag_t;
 typedef uint64_t flag_t;
 
 
-extern flag_t	FLAG[128];
+extern flag_t FLAG[128];
 
 
 struct flag_record {
 struct flag_record {
   flag_t match;
   flag_t match;
@@ -60,27 +60,27 @@ struct flag_record {
 #define USER_VALID (flag_t) 0xfffffffffffff
 #define USER_VALID (flag_t) 0xfffffffffffff
 #define CHAN_VALID (flag_t) 0xfffffffffffff
 #define CHAN_VALID (flag_t) 0xfffffffffffff
 
 
-#define USER_ADMIN	FLAG['a']
+#define USER_ADMIN	FLAG[(int) 'a']
 /* FIXME; REMOVE AFTER 1.2 */
 /* FIXME; REMOVE AFTER 1.2 */
-#define USER_BOT	FLAG['b']
-#define USER_CHANHUB	FLAG['c']
-#define USER_DEOP	FLAG['d']
-#define USER_EXEMPT	FLAG['e']
-#define USER_HUBA	FLAG['i']
-#define USER_CHUBA	FLAG['j']
-#define USER_KICK	FLAG['k']
-#define USER_DOLIMIT	FLAG['l']
-#define USER_MASTER	FLAG['m']
-#define USER_OWNER	FLAG['n']
-#define USER_OP		FLAG['o']
-#define USER_AUTOOP	FLAG['O']
-#define USER_PARTY	FLAG['p']
-#define USER_QUIET	FLAG['q']
-#define USER_UPDATEHUB	FLAG['u']
-#define USER_VOICE	FLAG['v']
-#define USER_WASOPTEST	FLAG['w']
-#define USER_NOFLOOD	FLAG['x']
-#define USER_DOVOICE	FLAG['y']
+#define USER_BOT	FLAG[(int) 'b']
+#define USER_CHANHUB	FLAG[(int) 'c']
+#define USER_DEOP	FLAG[(int) 'd']
+#define USER_EXEMPT	FLAG[(int) 'e']
+#define USER_HUBA	FLAG[(int) 'i']
+#define USER_CHUBA	FLAG[(int) 'j']
+#define USER_KICK	FLAG[(int) 'k']
+#define USER_DOLIMIT	FLAG[(int) 'l']
+#define USER_MASTER	FLAG[(int) 'm']
+#define USER_OWNER	FLAG[(int) 'n']
+#define USER_OP		FLAG[(int) 'o']
+#define USER_AUTOOP	FLAG[(int) 'O']
+#define USER_PARTY	FLAG[(int) 'p']
+#define USER_QUIET	FLAG[(int) 'q']
+#define USER_UPDATEHUB	FLAG[(int) 'u']
+#define USER_VOICE	FLAG[(int) 'v']
+#define USER_WASOPTEST	FLAG[(int) 'w']
+#define USER_NOFLOOD	FLAG[(int) 'x']
+#define USER_DOVOICE	FLAG[(int) 'y']
 #define USER_DEFAULT	0
 #define USER_DEFAULT	0
 
 
 
 
@@ -125,7 +125,7 @@ struct flag_record {
 #define chan_noflood(x)                        ((x).chan & USER_NOFLOOD)
 #define chan_noflood(x)                        ((x).chan & USER_NOFLOOD)
 #define glob_chanhub(x)                        ((x).global & USER_CHANHUB)
 #define glob_chanhub(x)                        ((x).global & USER_CHANHUB)
 
 
-void init_flags();
+void init_flags(void);
 void get_user_flagrec(struct userrec *, struct flag_record *, const char *);
 void get_user_flagrec(struct userrec *, struct flag_record *, const char *);
 void set_user_flagrec(struct userrec *, struct flag_record *, const char *);
 void set_user_flagrec(struct userrec *, struct flag_record *, const char *);
 void break_down_flags(const char *, struct flag_record *, struct flag_record *);
 void break_down_flags(const char *, struct flag_record *, struct flag_record *);
@@ -142,8 +142,8 @@ int chk_deop(struct flag_record);
 int chk_voice(struct flag_record, struct chanset_t *);
 int chk_voice(struct flag_record, struct chanset_t *);
 int chk_devoice(struct flag_record);
 int chk_devoice(struct flag_record);
 int chk_noflood(struct flag_record);
 int chk_noflood(struct flag_record);
-int ischanhub();
-int isupdatehub();
+int ischanhub(void);
+int isupdatehub(void);
 int dovoice(struct chanset_t *);
 int dovoice(struct chanset_t *);
 int dolimit(struct chanset_t *);
 int dolimit(struct chanset_t *);
 int whois_access(struct userrec *, struct userrec *);
 int whois_access(struct userrec *, struct userrec *);

+ 1 - 1
src/misc.c

@@ -406,7 +406,7 @@ void daysdur(time_t mynow, time_t then, char *out)
 
 
 /* show l33t banner */
 /* show l33t banner */
 static char *fuckyou = " _   _ _      __            _                            ____\n| | | (_)    / _|_   _  ___| | __  _   _  ___  _   _   _|  _ \\\n| |_| | |   | |_| | | |/ __| |/ / | | | |/ _ \\| | | | (_) | | |\n|  _  | |_  |  _| |_| | (__|   <  | |_| | (_) | |_| |  _| |_| |\n|_| |_|_( ) |_|  \\__,_|\\___|_|\\_\\  \\__, |\\___/ \\__,_| (_)____/\n        |/                         |___/\n";
 static char *fuckyou = " _   _ _      __            _                            ____\n| | | (_)    / _|_   _  ___| | __  _   _  ___  _   _   _|  _ \\\n| |_| | |   | |_| | | |/ __| |/ / | | | |/ _ \\| | | | (_) | | |\n|  _  | |_  |  _| |_| | (__|   <  | |_| | (_) | |_| |  _| |_| |\n|_| |_|_( ) |_|  \\__,_|\\___|_|\\_\\  \\__, |\\___/ \\__,_| (_)____/\n        |/                         |___/\n";
-char *wbanner() {
+char *wbanner(void) {
   if (fuckyou) { ; } /* gcc warnings */
   if (fuckyou) { ; } /* gcc warnings */
 
 
   switch (randint(9)) {
   switch (randint(9)) {

+ 1 - 1
src/misc.h

@@ -12,7 +12,7 @@
 #define LOG_TS "[%H:%M]"
 #define LOG_TS "[%H:%M]"
 
 
 
 
-char *wbanner();
+char *wbanner(void);
 void restart(int) __attribute__((noreturn));
 void restart(int) __attribute__((noreturn));
 int coloridx(int);
 int coloridx(int);
 char *color(int, int, int);
 char *color(int, int, int);

+ 3 - 3
src/mod/channels.mod/cmdschan.c

@@ -10,14 +10,14 @@ static struct flag_record user	 = {FR_GLOBAL | FR_CHAN, 0, 0, 0 };
 static struct flag_record victim = {FR_GLOBAL | FR_CHAN, 0, 0, 0 };
 static struct flag_record victim = {FR_GLOBAL | FR_CHAN, 0, 0, 0 };
 
 
 
 
-static void cmd_pls_mask(char type, int idx, char *par)
+static void cmd_pls_mask(const char type, int idx, char *par)
 {
 {
-  char *chname = NULL, *who = NULL, s[UHOSTLEN] = "", s1[UHOSTLEN] = "", *p = NULL, *p_expire = NULL, *cmd = NULL;
+  char *chname = NULL, *who = NULL, s[UHOSTLEN] = "", s1[UHOSTLEN] = "", *p = NULL, *p_expire = NULL;
+  const char *cmd = (type == 'b' ? "ban" : type == 'e' ? "exempt" : "invite");
   unsigned long int expire_time = 0, expire_foo;
   unsigned long int expire_time = 0, expire_foo;
   int sticky = 0;
   int sticky = 0;
   struct chanset_t *chan = NULL;
   struct chanset_t *chan = NULL;
 
 
-  cmd = type == 'b' ? "ban" : type == 'e' ? "exempt" : "invite";
   if (!par[0]) {
   if (!par[0]) {
     dprintf(idx, "Usage: +%s <hostmask> [channel] [%%<XdXhXm>] [reason]\n", cmd);
     dprintf(idx, "Usage: +%s <hostmask> [channel] [%%<XdXhXm>] [reason]\n", cmd);
     return;
     return;

+ 1 - 4
src/users.h

@@ -156,11 +156,8 @@ int def_kill(struct user_entry *e);
 int def_write_userfile(FILE *f, struct userrec *u, struct user_entry *e);
 int def_write_userfile(FILE *f, struct userrec *u, struct user_entry *e);
 void *def_get(struct userrec *u, struct user_entry *e);
 void *def_get(struct userrec *u, struct user_entry *e);
 int def_set(struct userrec *u, struct user_entry *e, void *buf);
 int def_set(struct userrec *u, struct user_entry *e, void *buf);
-int def_gotshare(struct userrec *u, struct user_entry *e,
-		 char *data, int idx);
+int def_gotshare(struct userrec *u, struct user_entry *e, char *data, int idx);
 void def_display(int idx, struct user_entry *e, struct userrec *u);
 void def_display(int idx, struct user_entry *e, struct userrec *u);
-int def_dupuser(struct userrec *new, struct userrec *old,
-		struct user_entry *e);
 
 
 
 
 #ifdef HUB
 #ifdef HUB