From: pk910 Date: Tue, 28 Jun 2011 14:48:07 +0000 (+0200) Subject: changed variable type for storing modes to a 64bit type (unsigned long long) X-Git-Tag: WGN5~56 X-Git-Url: http://git.pk910.de/?p=ircu2.10.12-pk.git;a=commitdiff_plain;h=6b49deb63fcbb99794833c38df7feb358e8e6b61;ds=sidebyside changed variable type for storing modes to a 64bit type (unsigned long long) --- diff --git a/include/channel.h b/include/channel.h index 353aeae..6bbf821 100644 --- a/include/channel.h +++ b/include/channel.h @@ -37,6 +37,14 @@ struct SLink; struct Client; +#if defined(_MSC_VER) || defined(__BORLANDC__) +typedef unsigned __int64 ulong64; +typedef signed __int64 long64; +#else +typedef unsigned long long ulong64; +typedef signed long long long64; +#endif + /* * General defines */ @@ -246,7 +254,7 @@ struct Membership { /** Mode information for a channel */ struct Mode { - unsigned int mode; + ulong64 mode; unsigned int limit; unsigned int access; char key[KEYLEN + 1]; @@ -312,15 +320,15 @@ struct ListingArgs { }; struct ModeBuf { - unsigned int mb_add; /**< Modes to add */ - unsigned int mb_rem; /**< Modes to remove */ + ulong64 mb_add; /**< Modes to add */ + ulong64 mb_rem; /**< Modes to remove */ struct Client *mb_source; /**< Source of MODE changes */ struct Client *mb_connect; /**< Connection of MODE changes */ struct Channel *mb_channel; /**< Channel they affect */ unsigned int mb_dest; /**< Destination of MODE changes */ unsigned int mb_count; /**< Number of modes w/args */ struct { - unsigned int mbm_type; /**< Type of argument */ + ulong64 mbm_type; /**< Type of argument */ union { unsigned int mbma_uint; /**< A limit */ char *mbma_string; /**< A string */ @@ -427,12 +435,12 @@ extern void CheckDelayedJoins(struct Channel *chan); extern void modebuf_init(struct ModeBuf *mbuf, struct Client *source, struct Client *connect, struct Channel *chan, unsigned int dest); -extern void modebuf_mode(struct ModeBuf *mbuf, unsigned int mode); -extern void modebuf_mode_uint(struct ModeBuf *mbuf, unsigned int mode, +extern void modebuf_mode(struct ModeBuf *mbuf, ulong64 mode); +extern void modebuf_mode_uint(struct ModeBuf *mbuf, ulong64 mode, unsigned int uint); -extern void modebuf_mode_string(struct ModeBuf *mbuf, unsigned int mode, +extern void modebuf_mode_string(struct ModeBuf *mbuf, ulong64 mode, char *string, int free); -extern void modebuf_mode_client(struct ModeBuf *mbuf, unsigned int mode, +extern void modebuf_mode_client(struct ModeBuf *mbuf, ulong64 mode, struct Client *client, int oplevel); extern int modebuf_flush(struct ModeBuf *mbuf); extern void modebuf_extract(struct ModeBuf *mbuf, char *buf); diff --git a/ircd/channel.c b/ircd/channel.c index 01d2507..fa8412e 100644 --- a/ircd/channel.c +++ b/ircd/channel.c @@ -1577,7 +1577,7 @@ static int modebuf_flush_int(struct ModeBuf *mbuf, int all) { /* we only need the flags that don't take args right now */ - static int flags[] = { + static ulong64 flags[] = { /* MODE_CHANOP, 'o', */ /* MODE_VOICE, 'v', */ MODE_PRIVATE, 'p', @@ -1605,12 +1605,12 @@ modebuf_flush_int(struct ModeBuf *mbuf, int all) MODE_QUARANTINE, 'Q', 0x0, 0x0 }; - static int local_flags[] = { + static ulong64 local_flags[] = { MODE_WASDELJOINS, 'd', 0x0, 0x0 }; int i; - int *flag_p; + ulong64 *flag_p; struct Client *app_source; /* where the MODE appears to come from */ @@ -1633,8 +1633,8 @@ modebuf_flush_int(struct ModeBuf *mbuf, int all) char limitbuf[20],accessbuf[20]; /* convert limits to strings */ - unsigned int limitdel = MODE_LIMIT; - unsigned int accessdel = MODE_ACCESS; + ulong64 limitdel = MODE_LIMIT; + ulong64 accessdel = MODE_ACCESS; assert(0 != mbuf); @@ -2032,7 +2032,7 @@ modebuf_init(struct ModeBuf *mbuf, struct Client *source, * @param mode MODE_ADD or MODE_DEL OR'd with MODE_PRIVATE etc. */ void -modebuf_mode(struct ModeBuf *mbuf, unsigned int mode) +modebuf_mode(struct ModeBuf *mbuf, ulong64 mode) { assert(0 != mbuf); assert(0 != (mode & (MODE_ADD | MODE_DEL))); @@ -2054,10 +2054,10 @@ modebuf_mode(struct ModeBuf *mbuf, unsigned int mode) } } -/** Append a mode that takes an int argument to the modebuf +/** Append a mode that takes an ulong64 argument to the modebuf * * This routine adds a mode to be added or deleted that takes a unsigned - * int parameter; mode may *only* be the relevant mode flag ORed with one + * ulong64 parameter; mode may *only* be the relevant mode flag ORed with one * of MODE_ADD or MODE_DEL * * @param mbuf The mode buffer to append to. @@ -2065,7 +2065,7 @@ modebuf_mode(struct ModeBuf *mbuf, unsigned int mode) * @param uint The argument to the mode. */ void -modebuf_mode_uint(struct ModeBuf *mbuf, unsigned int mode, unsigned int uint) +modebuf_mode_uint(struct ModeBuf *mbuf, ulong64 mode, unsigned int uint) { assert(0 != mbuf); assert(0 != (mode & (MODE_ADD | MODE_DEL))); @@ -2098,7 +2098,7 @@ modebuf_mode_uint(struct ModeBuf *mbuf, unsigned int mode, unsigned int uint) * @param free If the string should be free'd later. */ void -modebuf_mode_string(struct ModeBuf *mbuf, unsigned int mode, char *string, +modebuf_mode_string(struct ModeBuf *mbuf, ulong64 mode, char *string, int free) { assert(0 != mbuf); @@ -2124,7 +2124,7 @@ modebuf_mode_string(struct ModeBuf *mbuf, unsigned int mode, char *string, * @param oplevel The oplevel the user had or will have */ void -modebuf_mode_client(struct ModeBuf *mbuf, unsigned int mode, +modebuf_mode_client(struct ModeBuf *mbuf, ulong64 mode, struct Client *client, int oplevel) { assert(0 != mbuf); @@ -2192,7 +2192,7 @@ modebuf_flush(struct ModeBuf *mbuf) void modebuf_extract(struct ModeBuf *mbuf, char *buf) { - static int flags[] = { + static ulong64 flags[] = { /* MODE_CHANOP, 'o', */ /* MODE_VOICE, 'v', */ MODE_PRIVATE, 'p', @@ -2220,9 +2220,9 @@ modebuf_extract(struct ModeBuf *mbuf, char *buf) MODE_ACCESS, 'a', 0x0, 0x0 }; - unsigned int add; + ulong64 add; int i, bufpos = 0, len; - int *flag_p; + ulong64 *flag_p; char *key = 0, limitbuf[20], accessbuf[20]; char *apass = 0, *upass = 0, *altchan = 0; @@ -2375,7 +2375,7 @@ send_notoper(struct ParseState *state) * @param flag_p ? */ static void -mode_parse_limit(struct ParseState *state, int *flag_p) +mode_parse_limit(struct ParseState *state, ulong64 *flag_p) { unsigned int t_limit; @@ -2440,7 +2440,7 @@ mode_parse_limit(struct ParseState *state, int *flag_p) static void -mode_parse_access(struct ParseState *state, int *flag_p) +mode_parse_access(struct ParseState *state, ulong64 *flag_p) { unsigned int t_access; @@ -2513,7 +2513,7 @@ mode_parse_access(struct ParseState *state, int *flag_p) static void -mode_parse_altchan(struct ParseState *state, int *flag_p) +mode_parse_altchan(struct ParseState *state, ulong64 *flag_p) { char *t_str; @@ -2597,7 +2597,7 @@ mode_parse_altchan(struct ParseState *state, int *flag_p) } static void -mode_parse_quarantine(struct ParseState *state, int *flag_p) +mode_parse_quarantine(struct ParseState *state, ulong64 *flag_p) { } @@ -2643,7 +2643,7 @@ is_clean_key(struct ParseState *state, char *s, char *command) * Helper function to convert keys */ static void -mode_parse_key(struct ParseState *state, int *flag_p) +mode_parse_key(struct ParseState *state, ulong64 *flag_p) { char *t_str; @@ -2730,7 +2730,7 @@ mode_parse_key(struct ParseState *state, int *flag_p) * Helper function to convert user passes */ static void -mode_parse_upass(struct ParseState *state, int *flag_p) +mode_parse_upass(struct ParseState *state, ulong64 *flag_p) { char *t_str; @@ -2849,7 +2849,7 @@ mode_parse_upass(struct ParseState *state, int *flag_p) * Helper function to convert admin passes */ static void -mode_parse_apass(struct ParseState *state, int *flag_p) +mode_parse_apass(struct ParseState *state, ulong64 *flag_p) { struct Membership *memb; char *t_str; @@ -3102,7 +3102,7 @@ int apply_ban(struct Ban **banlist, struct Ban *newban, int do_free) /* Removes MODE_WASDELJOINS in a channel. * Reveals all hidden users. */ -static void reveal_hidden_chan_users(struct ParseState *state, int *flag_p) { +static void reveal_hidden_chan_users(struct ParseState *state, ulong64 *flag_p) { struct Membership *member; /* If the channel is not +d, do nothing. */ @@ -3120,7 +3120,7 @@ static void reveal_hidden_chan_users(struct ParseState *state, int *flag_p) { * Helper function to convert bans */ static void -mode_parse_ban(struct ParseState *state, int *flag_p) +mode_parse_ban(struct ParseState *state, ulong64 *flag_p) { char *t_str, *s; struct Ban *ban, *newban; @@ -3284,7 +3284,7 @@ mode_process_bans(struct ParseState *state) * Helper function to process client changes */ static void -mode_parse_client(struct ParseState *state, int *flag_p) +mode_parse_client(struct ParseState *state, ulong64 *flag_p) { char *t_str; char *colon; @@ -3495,7 +3495,7 @@ mode_process_clients(struct ParseState *state) * Helper function to process the simple modes */ static void -mode_parse_mode(struct ParseState *state, int *flag_p) +mode_parse_mode(struct ParseState *state, ulong64 *flag_p) { /* If they're not an oper, they can't change modes */ if (state->flags & (MODE_PARSE_NOTOPER | MODE_PARSE_NOTMEMBER)) { @@ -3550,7 +3550,7 @@ mode_parse(struct ModeBuf *mbuf, struct Client *cptr, struct Client *sptr, struct Channel *chptr, int parc, char *parv[], unsigned int flags, struct Membership* member) { - static int chan_flags[] = { + static ulong64 chan_flags[] = { MODE_CHANOP, 'o', MODE_VOICE, 'v', MODE_PRIVATE, 'p', @@ -3582,8 +3582,8 @@ mode_parse(struct ModeBuf *mbuf, struct Client *cptr, struct Client *sptr, 0x0, 0x0 }; int i; - int *flag_p; - unsigned int t_mode; + ulong64 *flag_p; + ulong64 t_mode; char *modestr; struct ParseState state;