Skip to content
Browse files

get rid of some warnings

  • Loading branch information...
1 parent a34ce64 commit 1f1d4c3a82ef3963ad4523fe82e66ec6f3535c18 @brinchj committed Feb 26, 2012
Showing with 10 additions and 58 deletions.
  1. +3 −1 src/drv_imap.c
  2. +0 −49 src/drv_maildir.c
  3. +5 −5 src/pack.c
  4. +2 −3 src/sync.c
View
4 src/drv_imap.c
@@ -46,6 +46,7 @@
#include <ctype.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
+#include <sys/wait.h>
#ifdef HAVE_SYS_FILIO_H
# include <sys/filio.h>
#endif
@@ -1461,9 +1462,10 @@ imap_open_store( store_conf_t *conf,
dup2(fd[1], fileno(stderr));
close(fd[1]);
// execute authmodule to generate oauth token
- const char **args = { NULL };
+ char *args[] = { NULL };
execv(srvc->authModule, args);
fflush(stdout);
+ fflush(stderr);
exit(0);
} else {
// parent
View
49 src/drv_maildir.c
@@ -48,55 +48,6 @@
#include <db.h>
#endif /* USE_DB */
-static void encode_maildir_box(const char* in, char* out, size_t size)
-{
- const char* p;
- char c;
- size_t out_chars;
-
- for (p = in, out_chars = 0; (c = *p); ++p, ++out, ++out_chars) {
- assert(out_chars < size);
- if (c == '/') {
- assert(out_chars < size - 1);
- *(out++) = '~';
- *out = '-';
- ++out_chars;
- }
- else if (c == '~') {
- assert(out_chars < size - 1);
- *(out++) = '~';
- *out = '~';
- ++out_chars;
- }
- else {
- *out = c;
- }
- }
- assert(out_chars < size);
- *out = 0;
-}
-
-static void decode_maildir_box(const char* in, char* out, size_t size)
-{
- const char* p;
- char c;
- size_t out_chars;
-
- for (p = in, out_chars = 0; (c = *p); ++p, ++out, ++out_chars) {
- assert(out_chars < size);
- if (c == '~') {
- assert(out_chars < size - 1);
- c = *(++p);
- *out = (c == '-' ? '/' : '~');
- ++out_chars;
- }
- else {
- *out = c;
- }
- }
- assert(out_chars < size);
- *out = 0;
-}
typedef struct maildir_store_conf {
store_conf_t gen;
View
10 src/pack.c
@@ -32,7 +32,7 @@ _-+=";
return -1; \
}
-int safe_pack(char *str, char *out, size_t out_len) {
+int safe_pack(const char *str, char *out, size_t out_len) {
// escape unsafe chars (strlen(str) <= strlen(out))
size_t str_len = strlen(str);
@@ -80,7 +80,7 @@ int safe_pack(char *str, char *out, size_t out_len) {
return 0;
}
-int safe_unpack(char *str, char *out, size_t out_len) {
+int safe_unpack(const char *str, char *out, size_t out_len) {
size_t str_len;
if (str == NULL || out == NULL) {
return -1;
@@ -92,7 +92,7 @@ int safe_unpack(char *str, char *out, size_t out_len) {
for (;;) {
// find next quote char
- char *end = strchr(str, QUOTE_CHAR);
+ const char *end = strchr(str, QUOTE_CHAR);
size_t skip;
if(end != NULL) {
// get safe prefix length
@@ -149,7 +149,7 @@ int safe_unpack(char *str, char *out, size_t out_len) {
#define U_SIZE 16 // max size of unsafe string
#define S_SIZE (U_SIZE * 2) // max size of safe string
-int test() {
+int test(void) {
char *unsafe = calloc(1, U_SIZE + 1);
char *safe = calloc(1, S_SIZE + 1);
int i, status = 0;
@@ -192,7 +192,7 @@ int test() {
}
-int run_test () {
+int run_test (void) {
srand(time(NULL) + getpid());
int status = 0;
while (status == 0) {
View
5 src/sync.c
@@ -963,7 +963,7 @@ msgs_found_sel( sync_vars_t *svars, int t )
copy_vars_t *cv;
flag_vars_t *fv;
const char *diag;
- int uid, minwuid, *mexcs, nmexcs, rmexcs, no[2], del[2], todel, nmsgs, t1, t2;
+ int uid, minwuid, *mexcs, nmexcs, rmexcs, no[2], del[2], todel, t1, t2;
int sflags, nflags, aflags, dflags, nex;
char fbuf[16]; /* enlarge when support for keywords is added */
@@ -1081,7 +1081,7 @@ msgs_found_sel( sync_vars_t *svars, int t )
debug( "synchronizing new entries\n" );
svars->osrecadd = svars->srecadd;
for (t = 0; t < 2; t++) {
- for (nmsgs = 0, tmsg = svars->ctx[1-t]->msgs; tmsg; tmsg = tmsg->next)
+ for (tmsg = svars->ctx[1-t]->msgs; tmsg; tmsg = tmsg->next)
if (tmsg->srec ? tmsg->srec->uid[t] < 0 && (tmsg->srec->uid[t] == -1 ? (svars->chan->ops[t] & OP_RENEW) : (svars->chan->ops[t] & OP_NEW)) : (svars->chan->ops[t] & OP_NEW)) {
debug( "new message %d on %s\n", tmsg->uid, str_ms[1-t] );
if ((svars->chan->ops[t] & OP_EXPUNGE) && (tmsg->flags & F_DELETED))
@@ -1696,4 +1696,3 @@ sync_bail2( sync_vars_t *svars )
error( "" );
cb( ret, aux );
}
-

0 comments on commit 1f1d4c3

Please sign in to comment.
Something went wrong with that request. Please try again.