Skip to content

Commit

Permalink
[cwave:r39] clean up compiler warnings - some of which were probably …
Browse files Browse the repository at this point in the history
…bugs, now fixed
  • Loading branch information
smokku committed Dec 15, 2009
1 parent 4b8ae0f commit bffe0bc
Show file tree
Hide file tree
Showing 31 changed files with 65 additions and 44 deletions.
2 changes: 2 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
EXTRA_DIST = Doxyfile.in README.win32 README.protocol contrib UPGRADE tests/Makefile.in

LIBTOOL += --quiet

SUBDIRS = etc man
if USE_LIBSUBST
SUBDIRS += subst
Expand Down
2 changes: 2 additions & 0 deletions c2s/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
LIBTOOL += --quiet

bin_PROGRAMS = c2s

c2s_SOURCES = authreg.c bind.c c2s.c main.c sm.c pbx.c pbx_commands.c
Expand Down
11 changes: 7 additions & 4 deletions c2s/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -802,12 +802,15 @@ JABBER_MAIN("jabberd2c2s", "Jabber 2 C2S", "Jabber Open Source Server: Client to
#endif
if(c2s->packet_stats != NULL) {
int fd = open(c2s->packet_stats, O_TRUNC | O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP);
if(fd) {
if (fd >= 0) {
char buf[100];
int len = snprintf(buf, 100, "%lld\n", c2s->packet_count);
write(fd, buf, len);
close(fd);
} else {
if (write(fd, buf, len) != len) {
close(fd);
fd = -1;
} else close(fd);
}
if (fd < 0) {
log_write(c2s->log, LOG_ERR, "failed to write packet statistics to: %s", c2s->packet_stats);
c2s_shutdown = 1;
}
Expand Down
4 changes: 2 additions & 2 deletions c2s/sm.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static nad_t _sm_build_route(sess_t sess, bres_t res, const char *action, const
ns = nad_add_namespace(nad, uri_COMPONENT, NULL);
nad_append_elem(nad, ns, "route", 0);

nad_append_attr(nad, -1, "to", sess->smcomp?sess->smcomp:res->jid->domain);
nad_append_attr(nad, -1, "to", sess->smcomp?sess->smcomp:((char *) res->jid->domain));
nad_append_attr(nad, -1, "from", sess->c2s->id);

ans = nad_add_namespace(nad, uri_SESSION, "sc");
Expand Down Expand Up @@ -89,7 +89,7 @@ void sm_packet(sess_t sess, bres_t res, nad_t nad) {
ns = nad_add_namespace(nad, uri_COMPONENT, NULL);
nad_wrap_elem(nad, 0, ns, "route");

nad_set_attr(nad, 0, -1, "to", sess->smcomp?sess->smcomp:res->jid->domain, 0);
nad_set_attr(nad, 0, -1, "to", sess->smcomp?sess->smcomp:((char *) res->jid->domain), 0);
nad_set_attr(nad, 0, -1, "from", sess->c2s->id, 0);

ns = nad_append_namespace(nad, 1, uri_SESSION, "sc");
Expand Down
2 changes: 2 additions & 0 deletions etc/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
LIBTOOL += --quiet

sysconf_DATA = c2s.xml.dist router.xml.dist s2s.xml.dist sm.xml.dist jabberd.cfg.dist router-users.xml.dist router-filter.xml.dist
EXTRA_DIST = $(sysconf_DATA:%.dist=%.dist.in)

Expand Down
2 changes: 2 additions & 0 deletions etc/templates/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
templatesdir = $(sysconfdir)/templates

LIBTOOL += --quiet

templates_DATA = roster.xml.dist
EXTRA_DIST = roster.xml.dist.in

Expand Down
2 changes: 2 additions & 0 deletions man/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
man_MANS = jabberd.8 c2s.8 router.8 s2s.8 sm.8
EXTRA_DIST = jabberd.8.in c2s.8.in router.8.in s2s.8.in sm.8.in

LIBTOOL += --quiet

jabberd_bin = router sm s2s c2s

edit = sed \
Expand Down
2 changes: 2 additions & 0 deletions mio/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
LIBTOOL += --quiet

noinst_LTLIBRARIES = libmio.la

noinst_HEADERS = mio.h mio_impl.h mio_epoll.h mio_poll.h mio_select.h mio_kqueue.h
Expand Down
2 changes: 2 additions & 0 deletions router/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
INCLUDES = -DCONFIG_DIR=\"$(sysconfdir)\"

LIBTOOL += --quiet

bin_PROGRAMS = router

noinst_HEADERS = router.h
Expand Down
3 changes: 1 addition & 2 deletions router/filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ int filter_load(router_t r) {

buf = (char *) malloc(sizeof(char) * size);

fread(buf, 1, size, f);
if(ferror(f)) {
if (fread(buf, 1, size, f) != size || ferror(f)) {
log_write(r->log, LOG_ERR, "couldn't read from filter file: %s", strerror(errno));
free(buf);
fclose(f);
Expand Down
3 changes: 1 addition & 2 deletions router/user.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ int user_table_load(router_t r) {

buf = (char *) malloc(sizeof(char) * size);

fread(buf, 1, size, f);
if(ferror(f)) {
if (fread(buf, 1, size, f) != size || ferror(f)) {
log_write(r->log, LOG_ERR, "couldn't read from user table file: %s", strerror(errno));
free(buf);
fclose(f);
Expand Down
2 changes: 2 additions & 0 deletions s2s/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
INCLUDES = -DCONFIG_DIR=\"$(sysconfdir)\"

LIBTOOL += --quiet

bin_PROGRAMS = s2s

noinst_HEADERS = s2s.h
Expand Down
2 changes: 2 additions & 0 deletions sm/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
LIBTOOL += --quiet

bin_PROGRAMS = sm

pkglib_LTLIBRARIES = mod_active.la \
Expand Down
1 change: 0 additions & 1 deletion sm/mod_announce.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ static void _announce_free(module_t mod) {
DLLEXPORT int module_init(mod_instance_t mi, char *arg) {
module_t mod = mi->mod;
moddata_t data;
jid_t jid;

if(mod->init) return 0;

Expand Down
5 changes: 1 addition & 4 deletions sm/mod_echo.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ static mod_ret_t _echo_pkt_sm(mod_instance_t mi, pkt_t pkt)
return mod_HANDLED;
}

static void _echo_free(module_t mod) {
/* data is static so nothing to be done here */
}

DLLEXPORT int module_init(mod_instance_t mi, char *arg) {
module_t mod = mi->mod;

Expand All @@ -68,6 +64,7 @@ DLLEXPORT int module_init(mod_instance_t mi, char *arg) {
mod->private = "echo";

mod->pkt_sm = _echo_pkt_sm;
/* data is static so nothing to free */
/* mod->free = _echo_free; */

return 0;
Expand Down
6 changes: 1 addition & 5 deletions sm/mod_help.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,7 @@ static void _help_disco_extend(mod_instance_t mi, pkt_t pkt)
}
}

static void _help_free(module_t mod) {
/* module data is static so nothing to be done here */
}

DLLEXPORT int module_init(mod_instance_t mi, char *arg) {
jid_t hlpjid;
module_t mod = mi->mod;

if(mod->init) return 0;
Expand All @@ -169,6 +164,7 @@ DLLEXPORT int module_init(mod_instance_t mi, char *arg) {

mod->pkt_sm = _help_pkt_sm;
mod->disco_extend = _help_disco_extend;
/* module data is static so nothing to free */
/* mod->free = _help_free; */

return 0;
Expand Down
1 change: 0 additions & 1 deletion sm/mod_presence.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ static mod_ret_t _presence_pkt_user(mod_instance_t mi, user_t user, pkt_t pkt) {

/* presence packets to the sm */
static mod_ret_t _presence_pkt_sm(mod_instance_t mi, pkt_t pkt) {
time_t t;
module_t mod = mi->mod;
jid_t smjid;

Expand Down
23 changes: 13 additions & 10 deletions sm/mod_roster_publish.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static void _roster_publish_free_group_cache_walker(const char *key, void *val,
* get group's descriptive name by it's text id
* returned value needs to be freed by caller
*/
static char *_roster_publish_get_group_name(sm_t sm, roster_publish_t rp, const char *groupid)
static char *_roster_publish_get_group_name(sm_t sm, roster_publish_t rp, char *groupid)
{
os_t os;
os_object_t o;
Expand Down Expand Up @@ -203,14 +203,11 @@ static int _roster_publish_user_load(mod_instance_t mi, user_t user) {
roster_publish_t roster_publish = (roster_publish_t) mi->mod->private;
os_t os, os_active;
os_object_t o, o_active;
os_type_t ot, ot_active;
char *str, *group, filter[4096], *fetchkey;
int i,j,gpos,found,delete,checksm,userinsm,tmp_to,tmp_from,tmp_do_change;
char *str, *group, filter[4096];
const char *fetchkey;
int i,j,gpos,found,delete,checksm,tmp_to,tmp_from,tmp_do_change;
item_t item;
jid_t jid;
#ifndef NO_SM_CACHE
_roster_publish_active_cache_t active_cached;
#endif

/* update roster to match published roster */
if( roster_publish->publish) {
Expand Down Expand Up @@ -253,6 +250,10 @@ static int _roster_publish_user_load(mod_instance_t mi, user_t user) {
checksm = 1;
}
}
#ifndef NO_SM_CACHE
int userinsm;
_roster_publish_active_cache_t active_cached = 0;
#endif
if( checksm ) {
/* is this a hack? but i want to know was the user activated in sm or no? */
#ifndef NO_SM_CACHE
Expand Down Expand Up @@ -308,7 +309,7 @@ static int _roster_publish_user_load(mod_instance_t mi, user_t user) {
}
} // if( userinsm == -1 )
#endif
} // if( checksm )
} else userinsm = 0; // if( checksm )
item = xhash_get(user->roster,jid_user(jid));
if( item == NULL ) {
/* user has no this jid in his roster */
Expand Down Expand Up @@ -522,10 +523,12 @@ DLLEXPORT int module_init(mod_instance_t mi, char *arg) {
#endif
if( config_get_one(mod->mm->sm->config, "user.template.publish.force-groups", 0) ) {
roster_publish->forcegroups = 1;
if( roster_publish->groupprefix = config_get_one(mod->mm->sm->config, "user.template.publish.force-groups.prefix", 0) ) {
roster_publish->groupprefix = config_get_one(mod->mm->sm->config, "user.template.publish.force-groups.prefix", 0);
if( roster_publish->groupprefix ) {
roster_publish->groupprefixlen = strlen(roster_publish->groupprefix);
}
if( roster_publish->groupsuffix = config_get_one(mod->mm->sm->config, "user.template.publish.force-groups.suffix", 0) ) {
roster_publish->groupsuffix = config_get_one(mod->mm->sm->config, "user.template.publish.force-groups.suffix", 0);
if( roster_publish->groupsuffix ) {
roster_publish->groupsuffixlen = strlen(roster_publish->groupsuffix);
}
} else {
Expand Down
1 change: 0 additions & 1 deletion sm/mod_status.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ static void _status_user_delete(mod_instance_t mi, jid_t jid) {
}

static void _status_free(module_t mod) {
status_t st = (status_t) mod->private;
free(mod->private);
}

Expand Down
3 changes: 1 addition & 2 deletions sm/mod_template_roster.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ static int _template_roster_reload(template_roster_t tr) {

buf = (char *) malloc(sizeof(char) * size);

fread(buf, 1, size, f);
if(ferror(f)) {
if (fread(buf, 1, size, f) != size || ferror(f)) {
log_write(tr->sm->log, LOG_ERR, "couldn't read from roster template %s: %s", tr->filename, strerror(errno));
free(buf);
fclose(f);
Expand Down
2 changes: 0 additions & 2 deletions sm/pres.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ void pres_update(sess_t sess, pkt_t pkt) {
int self;
jid_t scan, next;
sess_t sscan;
user_t user;
int user_connected = 0;

switch(pkt->type) {
case pkt_PRESENCE:
Expand Down
2 changes: 2 additions & 0 deletions storage/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
INCLUDES = -I$(top_srcdir)/sm -I$(top_srcdir)/c2s

LIBTOOL += --quiet

MODULE_LDFLAGS = -module -avoid-version
MODULE_LIBADD = -lexpat -L$(top_srcdir)/util

Expand Down
4 changes: 2 additions & 2 deletions storage/authreg_db.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,11 @@ static int _ar_db_delete_user(authreg_t ar, char *username, char *realm)
return err;
}

static void _ar_db_free_walker(xht realms, const char *realm, void *val, void *arg)
static void _ar_db_free_walker(const char *key, void *val, void *arg)
{
DB *db = (DB *) val;

log_debug(ZONE, "closing '%s' db", realm);
log_debug(ZONE, "closing '%s' db", key);

db->close(db, 0);
}
Expand Down
2 changes: 2 additions & 0 deletions subst/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
LIBTOOL += --quiet

noinst_LTLIBRARIES = libsubst.la

noinst_HEADERS = dirent.h getopt.h ip6_misc.h subst.h syslog.h
Expand Down
2 changes: 2 additions & 0 deletions sx/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
LIBTOOL += --quiet

noinst_LTLIBRARIES = libsx.la
noinst_HEADERS = plugins.h sasl.h sx.h

Expand Down
6 changes: 3 additions & 3 deletions sx/sasl_gsasl.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ static void _sx_sasl_stream(sx_t s, sx_plugin_t p) {
static void _sx_sasl_features(sx_t s, sx_plugin_t p, nad_t nad) {
_sx_sasl_t ctx = (_sx_sasl_t) p->private;
Gsasl_session *sd = (Gsasl_session *) s->plugin_data[p->index];
int ns, nmechs, ret;
int nmechs, ret;
char *mechs, *mech, *c;

if(s->type != type_SERVER)
Expand Down Expand Up @@ -369,12 +369,12 @@ static void _sx_sasl_features(sx_t s, sx_plugin_t p, nad_t nad) {

if ((ctx->cb)(sx_sasl_cb_CHECK_MECH, mech, NULL, s, ctx->cbarg)==sx_sasl_ret_OK) {
if (nmechs == 0) {
ns = nad_add_namespace(nad, uri_SASL, NULL);
int ns = nad_add_namespace(nad, uri_SASL, NULL);
nad_append_elem(nad, ns, "mechanisms", 1);
}
_sx_debug(ZONE, "offering mechanism: %s", mech);

nad_append_elem(nad, ns, "mechanism", 2);
nad_append_elem(nad, -1 /*ns*/, "mechanism", 2);
nad_append_cdata(nad, mech, strlen(mech), 3);
nmechs++;
}
Expand Down
2 changes: 2 additions & 0 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
LIBTOOL += --quiet

bin_PROGRAMS = tests

tests_SOURCES = main.c
Expand Down
2 changes: 2 additions & 0 deletions tools/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
LIBTOOL += --quiet

bin_SCRIPTS = jabberd
EXTRA_DIST = db-setup.mysql db-update.mysql db-setup.pgsql db-setup.oracle db-setup.sqlite db-update.sqlite \
jabberd.in jabberd.rc pipe-auth.pl jabberd-authpipe-pam-0.1.pl pam_jabberd jabberd2.schema \
Expand Down
2 changes: 2 additions & 0 deletions util/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
LIBTOOL += --quiet

noinst_LTLIBRARIES = libutil.la

noinst_HEADERS = inaddr.h md5.h sha1.h util.h util_compat.h xdata.h nad.h pool.h xhash.h uri.h jid.h
Expand Down
2 changes: 1 addition & 1 deletion util/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ int config_load(config_t c, const char *file)
/* parse it */
if(!XML_Parse(p, buf, len, done))
{
fprintf(stderr, "config_load: parse error at line %d: %s\n", XML_GetCurrentLineNumber(p), XML_ErrorString(XML_GetErrorCode(p)));
fprintf(stderr, "config_load: parse error at line %llu: %s\n", (unsigned long long) XML_GetCurrentLineNumber(p), XML_ErrorString(XML_GetErrorCode(p)));
XML_ParserFree(p);
fclose(f);
nad_free(bd.nad);
Expand Down
4 changes: 2 additions & 2 deletions util/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ JABBERD2_API log_t log_new(pool_t p, log_type_t type, char *ident, char *faci
JABBERD2_API void log_write(log_t log, int level, const char *msgfmt, ...);

/* debug logging */
#ifdef DEBUG
#if defined(DEBUG) && 0
JABBERD2_API int log_debug_flag;
void __log_debug(char *file, int line, char *subsys, const char *msgfmt, ...);
void log_debug(char *file, int line, char *subsys, const char *msgfmt, ...);

# define log_debug_get_flag() log_debug_flag
# define log_debug_set_flag(f) (log_debug_flag = f ? 1 : 0)
Expand Down

0 comments on commit bffe0bc

Please sign in to comment.