Skip to content

Commit

Permalink
compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
pjstevns committed Mar 7, 2009
1 parent 12bdeb6 commit 4566c9f
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 37 deletions.
30 changes: 11 additions & 19 deletions src/clientbase.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ int ci_write(clientbase_t *self, char * msg, ...)
}
self->write_buffer_offset += t;

TRACE(TRACE_INFO, "[%p] S > [%ld/%ld:%s]", self, self->write_buffer_offset, self->write_buffer->len, s);
TRACE(TRACE_INFO, "[%p] S > [%u/%u:%s]", self, self->write_buffer_offset, self->write_buffer->len, s);

client_wbuf_scale(self);

Expand Down Expand Up @@ -325,38 +325,34 @@ void ci_read_cb(clientbase_t *self)
} else {
self->client_state = CLIENT_OK;
g_string_append_len(self->read_buffer, ibuf, t);
TRACE(TRACE_DEBUG,"read [%ld:%s]", t, ibuf);
TRACE(TRACE_DEBUG,"read [%u:%s]", t, ibuf);
}
}

TRACE(TRACE_DEBUG,"[%p] state [%x] read_buffer->len[%ld]", self, self->client_state, self->read_buffer->len);
TRACE(TRACE_DEBUG,"[%p] state [%x] read_buffer->len[%u]", self, self->client_state, self->read_buffer->len);
}

int ci_read(clientbase_t *self, char *buffer, size_t n)
{
assert(buffer);

TRACE(TRACE_DEBUG,"[%p] need [%ld]", self, n);
TRACE(TRACE_DEBUG,"[%p] need [%u]", self, n);
self->len = 0;

char *s = self->read_buffer->str + self->read_buffer_offset;
if ((self->read_buffer_offset + n) <= self->read_buffer->len) {
size_t j,k = 0;
char c;

memset(buffer, 0, sizeof(buffer));
for (j=0; j<n; j++) {
c = s[j];
// if (c == '\r') continue;
buffer[k++] = c;
}
for (j=0; j<n; j++)
buffer[k++] = s[j];
self->read_buffer_offset += n;
self->len += j;
client_rbuf_scale(self);
}

if (self->len)
TRACE(TRACE_DEBUG,"[%p] read [%ld][%s]", self, self->len, buffer);
TRACE(TRACE_DEBUG,"[%p] read [%u:%s]", self, self->len, buffer);

return self->len;
}
Expand All @@ -370,22 +366,18 @@ int ci_readln(clientbase_t *self, char * buffer)
self->len = 0;
char *s = self->read_buffer->str + self->read_buffer_offset;
if ((nl = g_strstr_len(s, -1, "\n"))) {
char c = 0;
size_t j, k = 0, l;
l = stridx(s, '\n');
if (l >= MAX_LINESIZE) {
TRACE(TRACE_ERR, "insane line-length [%ld]", l);
TRACE(TRACE_ERR, "insane line-length [%u]", l);
self->client_state = CLIENT_ERR;
return 0;
}
for (j=0; j<=l; j++) {
c = s[j];
// if (c == '\r') continue;
buffer[k++] = c;
}
for (j=0; j<=l; j++)
buffer[k++] = s[j];
self->read_buffer_offset += l+1;
self->len = k;
TRACE(TRACE_INFO, "[%p] C < %ld:[%s]", self, self->len, buffer);
TRACE(TRACE_INFO, "[%p] C < [%u:%s]", self, self->len, buffer);

client_rbuf_scale(self);
}
Expand Down
4 changes: 2 additions & 2 deletions src/dbmail-imapsession.c
Original file line number Diff line number Diff line change
Expand Up @@ -1882,7 +1882,7 @@ int imap4_tokenizer_main(ImapSession *self, const char *buffer)

max = strlen(s);

TRACE(TRACE_DEBUG,"[%p] tokenize [%ld/%ld] [%s]", self, max, self->rbuff_size, buffer);
TRACE(TRACE_DEBUG,"[%p] tokenize [%u/%u] [%s]", self, max, self->rbuff_size, buffer);

assert(max <= MAX_LINESIZE);

Expand Down Expand Up @@ -1924,7 +1924,7 @@ int imap4_tokenizer_main(ImapSession *self, const char *buffer)
strncat(self->args[self->args_idx], buffer, got);
self->rbuff_size -= got;
if (self->rbuff_size <= 0) {
TRACE(TRACE_DEBUG,"string-literal complete [%ld:%s]", self->rbuff_size, buffer);
TRACE(TRACE_DEBUG,"string-literal complete [%u:%s]", self->rbuff_size, buffer);
self->args_idx++;
i += got;
} else {
Expand Down
9 changes: 2 additions & 7 deletions src/dm_db.c
Original file line number Diff line number Diff line change
Expand Up @@ -2165,11 +2165,9 @@ GList * db_imap_split_mailbox(const char *mailbox, u64_t owner_idnr, const char
assert(errmsg);

GList *mailboxes = NULL;
char *cpy, **chunks = NULL;
char *namespace, *username, *cpy, **chunks = NULL;
const char *simple_name;
char *namespace, *username;
int i, ret = 0, result;
int is_users = 0, is_public = 0;
int i, is_users = 0, is_public = 0;
u64_t mboxid, public;

/* Scratch space as we build the mailbox names. */
Expand Down Expand Up @@ -2272,9 +2270,6 @@ GList * db_imap_split_mailbox(const char *mailbox, u64_t owner_idnr, const char

return mailboxes;

equery:
ret = DM_EQUERY;

egeneral:
mailboxes = g_list_first(mailboxes);
while (mailboxes) {
Expand Down
4 changes: 2 additions & 2 deletions src/dm_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ void trace(trace_t level, const char * module, const char * function, int line,
char date[32];

if (! configured) {
memset(&hostname,'\0',16);
gethostname(&hostname,16);
memset(hostname,'\0',16);
gethostname(hostname,16);
configured=1;
}

Expand Down
2 changes: 1 addition & 1 deletion src/dm_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2321,7 +2321,7 @@ char * dm_base64_decode(const gchar *s, size_t *len)
char *r = NULL, *p = (char *)g_base64_decode((const gchar *)s, len);
r = g_strndup(p, *len);
g_free(p);
TRACE(TRACE_DEBUG,"[%lu][%s]->[%s]", *len, s, r);
TRACE(TRACE_DEBUG,"[%u:%s]->[%s]", *len, s, r);
return r;
}

Expand Down
2 changes: 0 additions & 2 deletions src/imapcommands.c
Original file line number Diff line number Diff line change
Expand Up @@ -2135,10 +2135,8 @@ static int imap_acl_pre_administer(const char *mailboxname,
u64_t executing_userid,
u64_t * mboxid, u64_t * target_userid)
{
int result;
if (! db_findmailbox(mailboxname, executing_userid, mboxid))
return FALSE;

return auth_user_exists(username, target_userid);
}

Expand Down
3 changes: 2 additions & 1 deletion src/lmtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,11 @@ static void lmtp_cb_time(void *arg)
session->state = QUIT;
}

static void lmtp_handle_input(ClientSession_t *session)
static void lmtp_handle_input(void *arg)
{
int l;
char buffer[MAX_LINESIZE]; /* connection buffer */
ClientSession_t *session = (ClientSession_t *)arg;
while (TRUE) {
memset(buffer, 0, sizeof(buffer));

Expand Down
7 changes: 4 additions & 3 deletions src/timsieve.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ static void send_greeting(ClientSession_t *session)
ci_write(session->ci, "OK\r\n");
}

static void tims_handle_input(ClientSession_t *session)
static void tims_handle_input(void *arg)
{
int l = 0;
char buffer[MAX_LINESIZE]; /* connection buffer */
ClientSession_t *session = (ClientSession_t *)arg;

while (TRUE) {
memset(buffer, 0, sizeof(buffer));
Expand Down Expand Up @@ -226,7 +227,7 @@ int tims_tokenizer(ClientSession_t *session, char *buffer)
g_string_printf(session->rbuff,"%s","");
session->parser_state = TRUE;
}
TRACE(TRACE_DEBUG, "state [%d], size [%ld]", session->parser_state, session->rbuff_size);
TRACE(TRACE_DEBUG, "state [%d], size [%u]", session->parser_state, session->rbuff_size);
return session->parser_state;
}

Expand Down Expand Up @@ -380,7 +381,7 @@ int tims(ClientSession_t *session)
script = (char *)session->args->data;

scriptlen = strlen(script);
TRACE(TRACE_INFO, "Client sending script of length [%ld]", scriptlen);
TRACE(TRACE_INFO, "Client sending script of length [%u]", scriptlen);
if (scriptlen >= UINT_MAX)
return tims_error(session, "NO \"Invalid script length.\"\r\n");

Expand Down

0 comments on commit 4566c9f

Please sign in to comment.