ircd
+ircd-cxx
ircd.exe
setpass
config.mk
lua_pushvalue(L, 2);
return 1;
case MAPTYPE_CLIENT:
- *(struct client_data **)lua_newuserdatauv(L, sizeof(struct client_data *), 0) = value;
+ *(struct client_data **)lua_newuserdatauv(L, sizeof(struct client_data *), 0) = (struct client_data *)value;
luaL_setmetatable(L, "client");
return 1;
case MAPTYPE_CHANNEL:
- *(struct channel **)lua_newuserdatauv(L, sizeof(struct channel *), 0) = value;
+ *(struct channel **)lua_newuserdatauv(L, sizeof(struct channel *), 0) = (struct channel *)value;
luaL_setmetatable(L, "channel");
return 1;
}
(void)map_set(m, key, key, 0);
break;
case MAPTYPE_CLIENT: {
- void **p = luaL_checkudata(L, 3, "client");
+ void **p = (void **)luaL_checkudata(L, 3, "client");
(void)map_set(m, key, *p, 0);
break;
}
case MAPTYPE_CHANNEL: {
- void **p = luaL_checkudata(L, 3, "channel");
+ void **p = (void **)luaL_checkudata(L, 3, "channel");
(void)map_set(m, key, *p, 0);
break;
}
}
static int map_iter_next(lua_State *L)
{
- map_iter_t *it = luaL_checkudata(L, 1, "map_iter");
+ map_iter_t *it = (map_iter_t *)luaL_checkudata(L, 1, "map_iter");
lua_getiuservalue(L, 1, 2);
- const char *key = lua_touserdata(L, -1);
+ const char *key = (const char *)lua_touserdata(L, -1);
lua_pop(L, 1);
void *value;
if (!map_foriter(it, &key, &value))
return 2;
case MAPTYPE_CLIENT:
lua_pushstring(L, key);
- *(struct client_data **)lua_newuserdatauv(L, sizeof(struct client_data *), 0) = value;
+ *(struct client_data **)lua_newuserdatauv(L, sizeof(struct client_data *), 0) = (struct client_data *)value;
luaL_setmetatable(L, "client");
return 2;
case MAPTYPE_CHANNEL:
lua_pushstring(L, key);
- *(struct channel **)lua_newuserdatauv(L, sizeof(struct channel *), 0) = value;
+ *(struct channel **)lua_newuserdatauv(L, sizeof(struct channel *), 0) = (struct channel *)value;
luaL_setmetatable(L, "channel");
return 2;
}
{
map_t *m = *(map_t **)luaL_checkudata(L, 1, "map");
lua_pushcfunction(L, map_iter_next);
- map_iter_t *it = lua_newuserdatauv(L, sizeof(map_iter_t), 2);
+ map_iter_t *it = (map_iter_t *)lua_newuserdatauv(L, sizeof(map_iter_t), 2);
memset(it, 0, sizeof(*it));
it->root = m;
luaL_setmetatable(L, "map_iter");
char key[33];
memcpy(key, channel, chanlen+1);
stringlower(key);
- struct channel *chan = map_get(&channel_map, key);
+ struct channel *chan = (struct channel *)map_get(&channel_map, key);
if (!chan) {
chan = channel_new(channel, key, creation ? creation : get_time());
if (map_set(&channel_map, key, chan, NULL) == -1)
} else {
lua_pushnil(L);
}
- txt ? lua_pushstring(L, txt) : lua_pushnil(L);
+ if (txt)
+ lua_pushstring(L, txt);
+ else
+ lua_pushnil(L);
if (LUA_OK != lua_pcall(L, 5, 1, 0)) {
fprintf(stderr, "%s\n", lua_tostring(L, -1));
lua_pop(L, 1);
{
char *p = client->buf;
{ // remove \r
- char *end = memchr(p, '\n', client->bufLen);
+ char *end = (char *)memchr(p, '\n', client->bufLen);
if (end > p && end[-1] == '\r')
*--end = '\n';
if (memchr(p, '\0', end-p)) {
int res;
res = -1;
if (!client->saslexternal) {
- username = strchr(client->saslbuf, '\0')+1;
+ char *p = strchr(client->saslbuf, '\0')+1;
+ username = p;
if (username > client->saslbuf + client->saslbufLen)
goto saslerr;
- char *password = strchr(username, '\0')+1;
+ char *password = strchr(p, '\0')+1;
if (password > client->saslbuf + client->saslbufLen)
goto saslerr;
job_password_check(client, username, password, getdatafile("users.txt"), cont_sasl);
if (!args[0])
return err_needmoreparams(client, command), sendbuf(client), 0;
if (!strcmp(args[0], "0")) {
- for (struct channel *chan; (chan = map_pop(&client->channels)); )
+ for (struct channel *chan; (chan = (struct channel *)map_pop(&client->channels)); )
channel_part(client, chan, "I fell for a classic prank", NULL);
return 0;
}
if (map_set(&client->monitor, nick, /* dummy */ nick, (void **)&existing) == -1)
abort();
monitor_count += !existing;
- struct client_data *cl = map_get(&client_map, nick);
+ struct client_data *cl = (struct client_data *)map_get(&client_map, nick);
if (cl)
rpl_mononline(client, cl), sendbuf(client);
else
case 'S': {
const char *key;
map_foreach(&client->monitor, &key, 0) {
- struct client_data *cl = map_get(&client_map, key);
+ struct client_data *cl = (struct client_data *)map_get(&client_map, key);
if (cl)
rpl_mononline(client, cl), sendbuf(client);
else
}
static void updateNuh(struct client_data *client) {
- char *n = client->nick ? client->nick : "*";
- char *u = client->username ? client->username : "*";
- char *h = client->hostname;
+ const char *n = client->nick ? client->nick : "*";
+ const char *u = client->username ? client->username : "*";
+ const char *h = client->hostname;
free(client->nuh);
client->nuh = (char *)malloc(strlen(n) + strlen(u) + strlen(h) + 3);
if (!client->nuh)
char key[33];
memcpy(key, channel, chanlen+1);
stringlower(key);
- struct channel *chan = map_get(&channel_map, key);
+ struct channel *chan = (struct channel *)map_get(&channel_map, key);
int newchan = !chan;
if (!chan) {
chan = channel_new(channel, key, get_time());
return NULL;
memcpy(key, nickname, len+1);
stringlower(key);
- return map_get(&client_map, key);
+ return (struct client_data *)map_get(&client_map, key);
}
struct channel *findChannel(const char *channel)
{
char key[33];
memcpy(key, channel, chanlen+1);
stringlower(key);
- return map_get(&channel_map, key);
+ return (struct channel *)map_get(&channel_map, key);
}
accept_from_sock((struct listener *)pfd.assoc);
break;
case SOCKTYPE_CLIENT: {
- struct client_data *cl = pfd.assoc;
+ struct client_data *cl = (struct client_data *)pfd.assoc;
int isr = ev & NETPOLL_IN;
int isw = ev & NETPOLL_OUT;
/* NOTE: recvProc can kill the client, so writing should be done first. */
break;
}
case SOCKTYPE_DYING: {
- struct client_data *cl = pfd.assoc;
+ struct client_data *cl = (struct client_data *)pfd.assoc;
int isr = ev & NETPOLL_IN;
int isw = ev & NETPOLL_OUT;
if (cl->wbufLen)
#endif
free(databuf.buf);
/* free any persistent channels */
- for (struct channel *chan; (chan = map_pop(&channel_map)); )
+ for (struct channel *chan; (chan = (struct channel *)map_pop(&channel_map)); )
channel_kill(chan);
map_free(&client_map);
map_free(&channel_map);
}
update_poll_reg(cl);
/* Part all channels */
- for (struct channel *chan; (chan = map_pop(&cl->channels)); )
+ for (struct channel *chan; (chan = (struct channel *)map_pop(&cl->channels)); )
channel_part(cl, chan, NULL, NULL);
/* Remove from client_map and get rid of the pending invites */
if (cl->key) {
}
cl->bufLen += bytesRead;
while(1){
- x = memchr(cl->buf, '\n', cl->bufLen);
+ x = (char *)memchr(cl->buf, '\n', cl->bufLen);
if(!x) break;
packetReturn = parsePacket(cl);
// Client QUIT
}
static void net_poll_add_impl(int i)
{
- struct epoll_event e = { .data.ptr = fds[i] };
+ struct epoll_event e = { .data = { .ptr = fds[i] }};
if (epoll_ctl(epollfd, EPOLL_CTL_ADD, fds[i]->fd, &e) == -1) {
perror("epoll_ctl(EPOLL_CTL_ADD)");
abort();
}
static void net_poll_reg_impl(int i, int ev)
{
- struct epoll_event e = { .data.ptr = fds[i] };
+ struct epoll_event e = { .data = { .ptr = fds[i] }};
e.events = (ev & NETPOLL_IN ? EPOLLIN : 0) | (ev & NETPOLL_OUT ? EPOLLOUT : 0);
if (epoll_ctl(epollfd, EPOLL_CTL_MOD, fds[i]->fd, &e) == -1) {
perror("epoll_ctl(EPOLL_CTL_MOD)");
memmove(fds+i+1, fds+i, sizeof(fds[0])*(nfds-i));
nfds++;
fds[i] = t;
- REF(fds[i]) = (struct net_pollfd){ .fd = fd, .type = type, .assoc = assoc };
+ REF(fds[i]) = (struct net_pollfd){ .assoc = assoc, .fd = fd, .type = type };
net_poll_add_impl(i);
}
void net_poll_del(SOCKET fd)
va_list ap;
va_start(ap, s);
for (;;) {
- char *end = strchr(s, '%');
+ const char *end = strchr(s, '%');
if (!end) {
// if format string ends with \n, append \r\n
int len = strlen(s);