Fixed 32bits/64bits conversions (fixed #162)

pull/2/merge
Hoa V. DINH 2014-10-20 22:29:52 -07:00
parent 705023bc1e
commit 6de5766e8f
53 changed files with 162 additions and 160 deletions

View File

@ -348,7 +348,7 @@ int mail_cache_db_clean_up(struct mail_cache_db * cache_db,
chashdatum hash_data;
hash_key.data = db_key.data;
hash_key.len = db_key.size;
hash_key.len = (unsigned int) db_key.size;
r = chash_get(exist, &hash_key, &hash_data);
if (r < 0) {
@ -475,7 +475,7 @@ int mail_cache_db_get_keys(struct mail_cache_db * cache_db,
chashdatum hash_data;
hash_key.data = db_key.data;
hash_key.len = db_key.size;
hash_key.len = (unsigned int) db_key.size;
hash_data.data = NULL;
hash_data.len = 0;

View File

@ -255,7 +255,7 @@ static int lock_common(const char * filename, int fd, short locktype)
fd2 = open(lockfilename, O_WRONLY|O_EXCL|O_CREAT, 0);
if (fd2 >= 0) {
/* defeat lock checking programs which test pid */
r = write(fd2, "0", 2);
r = (int) write(fd2, "0", 2);
close(fd2);
break;
}

View File

@ -174,7 +174,7 @@ void mailstream_cancel_notify(struct mailstream_cancel * cancel)
ch = 0;
#ifndef WIN32
r = write(cancel->ms_fds[1], &ch, 1);
r = (int) write(cancel->ms_fds[1], &ch, 1);
#else
SetEvent(ms_internal->event);
#endif
@ -185,7 +185,7 @@ void mailstream_cancel_ack(struct mailstream_cancel * cancel)
#ifndef WIN32
char ch;
int r;
r = read(cancel->ms_fds[0], &ch, 1);
r = (int) read(cancel->ms_fds[0], &ch, 1);
#endif
}

View File

@ -166,7 +166,7 @@ static ssize_t mailstream_low_compress_read(mailstream_low * s, void * buf, size
do {
/* if there is no compressed data, read more */
if (strm->avail_in == 0) {
int read = data->ms->driver->mailstream_read(data->ms, data->input_buf, CHUNK_SIZE);
int read = (int) data->ms->driver->mailstream_read(data->ms, data->input_buf, CHUNK_SIZE);
if (read <= 0) {
return read;
}
@ -176,7 +176,7 @@ static ssize_t mailstream_low_compress_read(mailstream_low * s, void * buf, size
/* set the output buffer */
strm->next_out = buf;
strm->avail_out = count;
strm->avail_out = (int) count;
/* uncompress any waiting data */
zr = inflate(strm, Z_NO_FLUSH);
@ -209,7 +209,7 @@ static ssize_t mailstream_low_compress_write(mailstream_low * s, const void * bu
strm->next_in = (Bytef *)buf;
/* we won't try to compress more than CHUNK_SIZE at a time so we always have enough buffer space */
int compress_len = MIN(count, CHUNK_SIZE);
int compress_len = MIN((int) count, CHUNK_SIZE);
strm->avail_in = compress_len;
strm->avail_out = CHUNK_SIZE;
strm->next_out = data->output_buf;

View File

@ -95,7 +95,7 @@ static inline void mailstream_logger_internal(mailstream_low * s, int is_stream_
if (f != NULL) { \
int nmemb; \
maillock_write_lock(LOG_FILE, fileno(f)); \
nmemb = fwrite((buf), 1, (size), f); \
nmemb = fwrite((buf), 1, (size_t) (size), f); \
maillock_write_unlock(LOG_FILE, fileno(f)); \
fclose(f); \
} \
@ -122,7 +122,7 @@ static inline void mailstream_logger_internal(mailstream_low * s, int is_stream_
if (f != NULL) { \
int nmemb; \
maillock_write_lock(LOG_FILE, fileno(f)); \
nmemb = fwrite((buf), 1, (size), f); \
nmemb = fwrite((buf), 1, (size_t) (size), f); \
maillock_write_unlock(LOG_FILE, fileno(f)); \
fclose(f); \
} \

View File

@ -837,7 +837,7 @@ static ssize_t mailstream_low_ssl_read(mailstream_low * s,
while (1) {
int ssl_r;
r = SSL_read(ssl_data->ssl_conn, buf, count);
r = SSL_read(ssl_data->ssl_conn, buf, (int) count);
if (r > 0)
return r;
@ -985,7 +985,7 @@ static ssize_t mailstream_low_ssl_write(mailstream_low * s,
if (r <= 0)
return r;
r = SSL_write(ssl_data->ssl_conn, buf, count);
r = SSL_write(ssl_data->ssl_conn, buf, (int) count);
if (r > 0)
return r;

View File

@ -504,19 +504,19 @@ static int expunge_folder(mailsession * session)
if (!deleted) {
snprintf(key_value, sizeof(key_value), "%lu", (unsigned long) num);
key.data = key_value;
key.len = strlen(key_value);
key.len = (unsigned int) strlen(key_value);
chash_set(msg_table, &key, &value, NULL);
snprintf(key_value, sizeof(key_value), "%lu-envelope",
(unsigned long) num);
key.data = key_value;
key.len = strlen(key_value);
key.len = (unsigned int) strlen(key_value);
chash_set(msg_table, &key, &value, NULL);
snprintf(key_value, sizeof(key_value), "%lu-flags",
(unsigned long) num);
key.data = key_value;
key.len = strlen(key_value);
key.len = (unsigned int) strlen(key_value);
chash_set(msg_table, &key, &value, NULL);
i ++;
@ -1039,7 +1039,7 @@ static int get_message(mailsession * session,
size = 0;
snprintf(key, sizeof(key), "%lu", (unsigned long) num);
r = mail_cache_db_get_size(maildb, key, strlen(key), &size);
r = mail_cache_db_get_size(maildb, key, (size_t) strlen(key), &size);
/* ignore error */
r = mailmessage_init(msg, session, db_message_driver,
@ -1065,7 +1065,7 @@ static int get_message_by_uid(mailsession * session,
{
uint32_t msg_num;
msg_num = strtoul(uid, NULL, 10);
msg_num = (uint32_t) strtoul(uid, NULL, 10);
return get_message(session, msg_num, result);
}

View File

@ -390,7 +390,7 @@ static inline int quote_word(const char * display_charset,
if (mmap_string_append(mmapstr, "?Q?") == NULL)
return -1;
col = mmapstr->len;
col = (int) mmapstr->len;
cur = word;
for(i = 0 ; i < size ; i ++) {
@ -409,7 +409,7 @@ static inline int quote_word(const char * display_charset,
if (mmap_string_append(mmapstr, " ") == NULL)
return -1;
old_pos = mmapstr->len;
old_pos = (int) mmapstr->len;
if (mmap_string_append(mmapstr, "=?") == NULL)
return -1;
@ -418,7 +418,7 @@ static inline int quote_word(const char * display_charset,
if (mmap_string_append(mmapstr, "?Q?") == NULL)
return -1;
col = mmapstr->len - old_pos;
col = (int) mmapstr->len - old_pos;
}
do_quote_char = 0;

View File

@ -196,5 +196,5 @@ static int feed_fetch_size(mailmessage * msg_info,
}
msg = msg_info->msg_data;
return msg->msg_length;
return (int) msg->msg_length;
}

View File

@ -1210,12 +1210,12 @@ static int imapdriver_get_message_by_uid(mailsession * session,
if (uid == NULL)
return MAIL_ERROR_INVAL;
uidvalidity = strtoul(uid, &p1, 10);
uidvalidity = (uint32_t) strtoul(uid, &p1, 10);
if (p1 == uid || * p1 != '-')
return MAIL_ERROR_INVAL;
p1++;
num = strtoul(p1, &p2, 10);
num = (uint32_t) strtoul(p1, &p2, 10);
if (p2 == p1 || * p2 != '\0')
return MAIL_ERROR_INVAL;

View File

@ -316,7 +316,7 @@ static int update_uid_cache(mailsession * session,
}
msg = carray_get(env_list->msg_tab, i);
cache_item->uid = msg->msg_index;
cache_item->size = msg->msg_size;
cache_item->size = (uint32_t) msg->msg_size;
carray_set(data->imap_uid_list, i, cache_item);
}
@ -934,7 +934,7 @@ static int boostrap_cache(mailsession * session)
get_uid_from_filename(msg_uid);
key.data = msg_uid;
key.len = strlen(msg_uid) + 1;
key.len = (unsigned int) strlen(msg_uid) + 1;
value.data = NULL;
value.len = 0;
chash_set(keys_uid, &key, &value, NULL);
@ -951,14 +951,14 @@ static int boostrap_cache(mailsession * session)
chash_key(iter, &key);
uid = key.data;
uidvalidity = strtoul(uid, &p1, 10);
uidvalidity = (uint32_t) strtoul(uid, &p1, 10);
if (p1 == uid || * p1 != '-')
continue;
data->imap_uidvalidity = uidvalidity;
p1++;
indx = strtoul(p1, &p2, 10);
indx = (uint32_t) strtoul(p1, &p2, 10);
if (p2 == p1 || * p2 != '\0')
continue;
@ -1514,12 +1514,12 @@ static int imapdriver_cached_get_message_by_uid(mailsession * session,
if (uid == NULL)
return MAIL_ERROR_INVAL;
uidvalidity = strtoul(uid, &p1, 10);
uidvalidity = (uint32_t) strtoul(uid, &p1, 10);
if (p1 == uid || * p1 != '-')
return MAIL_ERROR_INVAL;
p1++;
num = strtoul(p1, &p2, 10);
num = (uint32_t) strtoul(p1, &p2, 10);
if (p2 == p1 || * p2 != '\0')
return MAIL_ERROR_INVAL;

View File

@ -413,7 +413,7 @@ static int append_message_flags(mailsession * session,
goto exit;
key.data = uid;
key.len = strlen(uid);
key.len = (unsigned int) strlen(uid);
r = chash_get(md->mdir_msg_hash, &key, &value);
if (r < 0)
goto exit;
@ -506,7 +506,7 @@ static int get_envelopes_list(mailsession * session,
msg = carray_get(env_list->msg_tab, i);
key.data = msg->msg_uid;
key.len = strlen(msg->msg_uid);
key.len = (unsigned int) strlen(msg->msg_uid);
r = chash_get(md->mdir_msg_hash, &key, &value);
if (r < 0)
continue;

View File

@ -523,7 +523,7 @@ static int append_message_flags(mailsession * session,
goto exit;
key.data = uid;
key.len = strlen(uid);
key.len = (unsigned int) strlen(uid);
r = chash_get(md->mdir_msg_hash, &key, &value);
if (r < 0)
goto exit;
@ -581,7 +581,7 @@ static int uid_clean_up(struct mail_cache_db * uid_db,
value.len = 0;
key.data = msg->msg_uid;
key.len = strlen(msg->msg_uid);
key.len = (unsigned int) strlen(msg->msg_uid);
r = chash_set(hash_exist, &key, &value, NULL);
if (r < 0) {
res = MAIL_ERROR_MEMORY;
@ -591,7 +591,7 @@ static int uid_clean_up(struct mail_cache_db * uid_db,
snprintf(key_str, sizeof(key_str), "uid-%lu",
(unsigned long) msg->msg_index);
key.data = key_str;
key.len = strlen(key_str);
key.len = (unsigned int) strlen(key_str);
r = chash_set(hash_exist, &key, &value, NULL);
if (r < 0) {
res = MAIL_ERROR_MEMORY;
@ -623,9 +623,9 @@ static int get_messages_list(mailsession * session,
struct mail_cache_db * uid_db;
void * value;
size_t value_len;
unsigned long i;
struct maildir_cached_session_state_data * data;
char key[PATH_MAX];
unsigned int i;
data = get_cached_data(session);

View File

@ -327,7 +327,7 @@ static int get_flags(mailmessage * msg_info,
return MAIL_ERROR_BAD_STATE;
key.data = msg_info->msg_uid;
key.len = strlen(msg_info->msg_uid);
key.len = (unsigned int) strlen(msg_info->msg_uid);
r = chash_get(md->mdir_msg_hash, &key, &value);
if (r < 0)
return MAIL_ERROR_MSG_NOT_FOUND;

View File

@ -246,7 +246,7 @@ static int get_flags(mailmessage * msg_info,
return MAIL_ERROR_BAD_STATE;
key.data = msg_info->msg_uid;
key.len = strlen(msg_info->msg_uid);
key.len = (unsigned int) strlen(msg_info->msg_uid);
r = chash_get(md->mdir_msg_hash, &key, &value);
if (r < 0)
return MAIL_ERROR_MSG_NOT_FOUND;

View File

@ -497,7 +497,7 @@ static int mboxdriver_get_message_by_uid(mailsession * session,
if (uid == NULL)
return MAIL_ERROR_INVAL;
num = strtoul(uid, &p, 10);
num = (uint32_t) strtoul(uid, &p, 10);
if (p == uid || * p != '-')
return MAIL_ERROR_INVAL;

View File

@ -519,7 +519,7 @@ static int write_max_uid_value(mailsession * session)
goto free_mmapstr;
}
r = fwrite(mmapstr->str, 1, mmapstr->len, f);
r = (int) fwrite(mmapstr->str, 1, mmapstr->len, f);
if ((size_t) r != mmapstr->len) {
res = MAIL_ERROR_FILE;
goto free_mmapstr;
@ -1320,7 +1320,7 @@ static int mboxdriver_cached_get_message_by_uid(mailsession * session,
if (uid == NULL)
return MAIL_ERROR_INVAL;
num = strtoul(uid, &p, 10);
num = (uint32_t) strtoul(uid, &p, 10);
if (p == uid || * p != '-')
return MAIL_ERROR_INVAL;

View File

@ -861,7 +861,7 @@ static int mhdriver_get_message_by_uid(mailsession * session,
if (uid == NULL)
return MAIL_ERROR_INVAL;
indx = strtoul(uid, &p, 10);
indx = (uint32_t) strtoul(uid, &p, 10);
if (p == uid || * p != '-')
return MAIL_ERROR_INVAL;

View File

@ -287,7 +287,7 @@ static int write_max_uid_value(mailsession * session)
goto free_mmapstr;
}
r = fwrite(mmapstr->str, 1, mmapstr->len, f);
r = (int) fwrite(mmapstr->str, 1, mmapstr->len, f);
if ((size_t) r != mmapstr->len) {
res = MAIL_ERROR_FILE;
goto free_mmapstr;
@ -1281,7 +1281,7 @@ static int mhdriver_cached_get_message_by_uid(mailsession * session,
if (uid == NULL)
return MAIL_ERROR_INVAL;
indx = strtoul(uid, &p, 10);
indx = (uint32_t) strtoul(uid, &p, 10);
if (p == uid || * p != '-')
return MAIL_ERROR_INVAL;

View File

@ -1182,7 +1182,7 @@ static int nntpdriver_get_message_by_uid(mailsession * session,
if (uid == NULL)
return MAIL_ERROR_INVAL;
num = strtoul(uid, &p, 10);
num = (uint32_t) strtoul(uid, &p, 10);
if ((p == uid) || (* p != '\0'))
return MAIL_ERROR_INVAL;

View File

@ -1061,7 +1061,7 @@ static int nntpdriver_cached_get_message_by_uid(mailsession * session,
if (uid == NULL)
return MAIL_ERROR_INVAL;
num = strtoul(uid, &p, 10);
num = (uint32_t) strtoul(uid, &p, 10);
if ((p == uid) || (* p != '\0'))
return MAIL_ERROR_INVAL;

View File

@ -664,7 +664,7 @@ int maildriver_cache_clean_up(struct mail_cache_db * cache_db_env,
snprintf(keyname, PATH_MAX, "%s-envelope", msg->msg_uid);
key.data = keyname;
key.len = strlen(keyname);
key.len = (unsigned int) strlen(keyname);
r = chash_set(hash_exist, &key, &value, NULL);
if (r < 0) {
res = MAIL_ERROR_MEMORY;
@ -676,7 +676,7 @@ int maildriver_cache_clean_up(struct mail_cache_db * cache_db_env,
snprintf(keyname, PATH_MAX, "%s-flags", msg->msg_uid);
key.data = keyname;
key.len = strlen(keyname);
key.len = (unsigned int) strlen(keyname);
r = chash_set(hash_exist, &key, &value, NULL);
if (r < 0) {
res = MAIL_ERROR_MEMORY;
@ -741,7 +741,7 @@ int maildriver_message_cache_clean_up(char * cache_dir,
msg = carray_get(env_list->msg_tab, i);
key.data = msg->msg_uid;
key.len = strlen(msg->msg_uid);
key.len = (unsigned int) strlen(msg->msg_uid);
value.data = NULL;
value.len = 0;
r = chash_set(hash_exist, &key, &value, NULL);
@ -774,7 +774,7 @@ int maildriver_message_cache_clean_up(char * cache_dir,
continue;
key.data = keyname;
key.len = strlen(keyname);
key.len = (unsigned int) strlen(keyname);
r = chash_get(hash_exist, &key, &value);
if (r < 0) {

View File

@ -75,7 +75,7 @@
static void do_exec_command(int fd, const char *command,
char *servername, uint16_t port)
{
int i, maxopen;
long i, maxopen;
#ifndef HAVE_SETENV
char env_buffer[ENV_BUFFER_SIZE];
#endif
@ -127,7 +127,7 @@ static void do_exec_command(int fd, const char *command,
maxopen = sysconf(_SC_OPEN_MAX);
for (i=3; i < maxopen; i++)
close(i);
close((int) i);
#ifdef TIOCNOTTY
/* Detach from the controlling tty if we have one. Otherwise,

View File

@ -226,7 +226,7 @@ int mailimf_cache_string_write(MMAPString * mmapstr, size_t * indx,
if (r != MAIL_NO_ERROR)
return r;
r = mailimf_cache_int_write(mmapstr, indx, length);
r = mailimf_cache_int_write(mmapstr, indx, (uint32_t) length);
if (r != MAIL_NO_ERROR)
return r;

View File

@ -772,7 +772,7 @@ mail_build_thread_references(char * default_from,
}
else {
hashkey.data = msgid;
hashkey.len = strlen(msgid);
hashkey.len = (unsigned int) strlen(msgid);
if (chash_get(msg_id_hash, &hashkey, &hashdata) == 0)
msgid = mailimf_get_message_id();
@ -801,7 +801,7 @@ mail_build_thread_references(char * default_from,
}
hashkey.data = msgid;
hashkey.len = strlen(msgid);
hashkey.len = (unsigned int) strlen(msgid);
hashdata.data = env_tree;
hashdata.len = 0;
@ -858,7 +858,7 @@ mail_build_thread_references(char * default_from,
msgid = clist_content(cur_ref);
hashkey.data = msgid;
hashkey.len = strlen(msgid);
hashkey.len = (unsigned int) strlen(msgid);
r = chash_get(msg_id_hash, &hashkey, &hashdata);
if (r < 0) {
@ -884,7 +884,7 @@ mail_build_thread_references(char * default_from,
}
hashkey.data = msgid;
hashkey.len = strlen(msgid);
hashkey.len = (unsigned int) strlen(msgid);
hashdata.data = env_cur_tree;
hashdata.len = 0;
@ -1062,7 +1062,7 @@ mail_build_thread_references(char * default_from,
*/
key.data = base_subject;
key.len = strlen(base_subject);
key.len = (unsigned int) strlen(base_subject);
r = chash_get(subject_hash, &key, &data);
@ -1166,7 +1166,7 @@ mail_build_thread_references(char * default_from,
*/
key.data = env_tree->node_base_subject;
key.len = strlen(env_tree->node_base_subject);
key.len = (unsigned int) strlen(env_tree->node_base_subject);
r = chash_get(subject_hash, &key, &data);
if (r < 0)

View File

@ -286,7 +286,7 @@ folder_info_get_msg_by_uid(struct folder_ref_info * ref_info,
int r;
key.data = uid;
key.len = strlen(uid);
key.len = (unsigned int) strlen(uid);
r = chash_get(ref_info->uid_hash, &key, &data);
if (r < 0)
return NULL;
@ -381,7 +381,7 @@ static int folder_message_add(struct folder_ref_info * ref_info,
if (msg->msg_uid != NULL) {
key.data = msg->msg_uid;
key.len = strlen(msg->msg_uid);
key.len = (unsigned int) strlen(msg->msg_uid);
data.data = msg;
data.len = 0;
@ -411,7 +411,7 @@ static void folder_message_remove(struct folder_ref_info * ref_info,
if (msg->msg_uid != NULL) {
key.data = msg->msg_uid;
key.len = strlen(msg->msg_uid);
key.len = (unsigned int) strlen(msg->msg_uid);
chash_delete(ref_info->uid_hash, &key, NULL);
}

View File

@ -3003,9 +3003,9 @@ int mailprivacy_gnupg_set_encryption_id(struct mailprivacy * privacy,
}
key.data = buf;
key.len = strlen(buf) + 1;
key.len = (unsigned int) strlen(buf) + 1;
value.data = passphrase;
value.len = strlen(passphrase) + 1;
value.len = (unsigned int) strlen(passphrase) + 1;
r = chash_set(passphrase_hash, &key, &value, NULL);
if (r < 0) {
@ -3034,7 +3034,7 @@ static char * get_passphrase(struct mailprivacy * privacy,
return NULL;
key.data = buf;
key.len = strlen(buf) + 1;
key.len = (unsigned int) strlen(buf) + 1;
r = chash_get(passphrase_hash, &key, &value);
if (r < 0)

View File

@ -1320,9 +1320,9 @@ static void set_file(chash * hash, char * email, char * filename)
strip_string(buf);
key.data = buf;
key.len = strlen(buf);
key.len = (unsigned int) strlen(buf);
data.data = filename;
data.len = strlen(filename) + 1;
data.len = (unsigned int) strlen(filename) + 1;
chash_set(hash, &key, &data, NULL);
}
@ -1342,7 +1342,7 @@ static char * get_file(chash * hash, char * email)
strip_string(buf);
key.data = buf;
key.len = strlen(buf);
key.len = (unsigned int) strlen(buf);
r = chash_get(hash, &key, &data);
if (r < 0)
return NULL;
@ -1873,9 +1873,9 @@ int mailprivacy_smime_set_encryption_id(struct mailprivacy * privacy,
}
key.data = buf;
key.len = strlen(buf) + 1;
key.len = (unsigned int) strlen(buf) + 1;
value.data = passphrase;
value.len = strlen(passphrase) + 1;
value.len = (unsigned int) strlen(passphrase) + 1;
r = chash_set(passphrase_hash, &key, &value, NULL);
if (r < 0) {
@ -1904,7 +1904,7 @@ static char * get_passphrase(struct mailprivacy * privacy,
return NULL;
key.data = buf;
key.len = strlen(buf) + 1;
key.len = (unsigned int) strlen(buf) + 1;
r = chash_get(passphrase_hash, &key, &value);
if (r < 0)

View File

@ -1530,7 +1530,7 @@ int mailprivacy_spawn_and_wait(char * command, char * passphrase,
close(passphrase_input[0]);
if ((passphrase != NULL) && (strlen(passphrase) > 0)) {
r = write(passphrase_input[1], passphrase, strlen(passphrase));
r = (int) write(passphrase_input[1], passphrase, strlen(passphrase));
if (r != (int) strlen(passphrase)) {
close(passphrase_input[1]);
return ERROR_PASSPHRASE_FILE;
@ -1538,7 +1538,7 @@ int mailprivacy_spawn_and_wait(char * command, char * passphrase,
}
else {
/* dummy password */
r = write(passphrase_input[1], "*dummy*", 7);
r = (int) write(passphrase_input[1], "*dummy*", 7);
if (r != 7) {
close(passphrase_input[1]);
return ERROR_PASSPHRASE_FILE;

View File

@ -76,6 +76,7 @@ static time_t basic_format_parse(const char * str)
int apply_offset;
struct tm ts;
int local_time;
time_t result;
len = strlen(str);
current_index = 0;
@ -180,15 +181,15 @@ static time_t basic_format_parse(const char * str)
ts.tm_year = year - 1900;
if (local_time) {
value = mktime(&ts);
result = mktime(&ts);
}
else {
value = mail_mkgmtime(&ts);
result = mail_mkgmtime(&ts);
if (apply_offset)
value -= offset;
result -= offset;
}
return value;
return result;
}
/*
@ -216,6 +217,7 @@ static time_t extended_format_parse(const char * str)
int apply_offset;
struct tm ts;
int local_time;
time_t result;
len = strlen(str);
current_index = 0;
@ -359,15 +361,15 @@ static time_t extended_format_parse(const char * str)
ts.tm_year = year - 1900;
if (local_time) {
value = mktime(&ts);
result = mktime(&ts);
}
else {
value = mail_mkgmtime(&ts);
result = mail_mkgmtime(&ts);
if (apply_offset)
value -= offset;
result -= offset;
}
return value;
return result;
}
time_t newsfeed_iso8601_date_parse(const char * str)

View File

@ -188,7 +188,7 @@ int mailimap_fetch_envelope(mailimap * session,
}
int mailimap_append_simple(mailimap * session, const char * mailbox,
const char * content, uint32_t size)
const char * content, size_t size)
{
return mailimap_append(session, mailbox, NULL, NULL, content, size);
}

View File

@ -54,7 +54,7 @@ int mailimap_fetch_envelope(mailimap * session,
clist ** result);
int mailimap_append_simple(mailimap * session, const char * mailbox,
const char * content, uint32_t size);
const char * content, size_t size);
int mailimap_login_simple(mailimap * session,
const char * userid, const char * password);

View File

@ -56,7 +56,7 @@ int mailimap_token_case_insensitive_parse(mailstream * fd,
size_t * indx,
const char * token)
{
int len;
size_t len;
size_t cur_token;
int r;
@ -87,7 +87,7 @@ static int is_space_or_tab(char ch)
int mailimap_char_parse(mailstream * fd, MMAPString * buffer,
size_t * indx, char token)
{
int cur_token;
size_t cur_token;
cur_token = * indx;
@ -201,7 +201,7 @@ int mailimap_status_att_get_token_value(mailstream * fd, MMAPString * buffer,
}
const char * mailimap_status_att_get_token_str(size_t indx)
const char * mailimap_status_att_get_token_str(int indx)
{
return mailimap_get_token_str(indx, status_att_tab);
}
@ -228,7 +228,7 @@ int mailimap_month_get_token_value(mailstream * fd, MMAPString * buffer,
}
const char * mailimap_month_get_token_str(size_t indx)
const char * mailimap_month_get_token_str(int indx)
{
return mailimap_get_token_str(indx, month_tab);
}
@ -253,7 +253,7 @@ int mailimap_flag_get_token_value(mailstream * fd, MMAPString * buffer,
}
const char * mailimap_flag_get_token_str(size_t indx)
const char * mailimap_flag_get_token_str(int indx)
{
return mailimap_get_token_str(indx, mailimap_flag_tab);
}

View File

@ -61,18 +61,18 @@ int mailimap_token_case_insensitive_parse(mailstream * fd,
int mailimap_status_att_get_token_value(mailstream * fd, MMAPString * buffer,
size_t * indx);
const char * mailimap_status_att_get_token_str(size_t indx);
const char * mailimap_status_att_get_token_str(int indx);
int mailimap_month_get_token_value(mailstream * fd, MMAPString * buffer,
size_t * indx);
const char * mailimap_month_get_token_str(size_t indx);
const char * mailimap_month_get_token_str(int indx);
int mailimap_flag_get_token_value(mailstream * fd, MMAPString * buffer,
size_t * indx);
const char * mailimap_flag_get_token_str(size_t indx);
const char * mailimap_flag_get_token_str(int indx);
int mailimap_encoding_get_token_value(mailstream * fd, MMAPString * buffer,
size_t * indx);

View File

@ -134,9 +134,9 @@ int mailimap_oauth2_authenticate_send(mailimap * session,
char * ptr;
char * full_auth_string;
char * full_auth_string_b64;
int auth_user_len;
int access_token_len;
int full_auth_string_len;
size_t auth_user_len;
size_t access_token_len;
size_t full_auth_string_len;
int res;
full_auth_string = NULL;
@ -159,7 +159,7 @@ int mailimap_oauth2_authenticate_send(mailimap * session,
ptr = memcpy(ptr + access_token_len, "\1\1\0", 3);
/* Convert to base64 */
full_auth_string_b64 = encode_base64(full_auth_string, full_auth_string_len);
full_auth_string_b64 = encode_base64(full_auth_string, (int) full_auth_string_len);
if (full_auth_string_b64 == NULL) {
res = MAILIMAP_ERROR_MEMORY;
goto free;

View File

@ -182,7 +182,7 @@ static int mailimap_astring_literalplus_send(mailstream * fd, const char * astri
int literalplus_enabled);
static int
mailimap_literalplus_count_send(mailstream * fd, uint32_t count);
mailimap_literalplus_count_send(mailstream * fd, size_t count);
@ -417,7 +417,7 @@ static int is_atom(const char * str)
static int mailimap_literalplus_send(mailstream * fd, const char * literal)
{
size_t len;
uint32_t literal_len;
size_t literal_len;
int r;
len = strlen(literal);
@ -1544,7 +1544,7 @@ mailimap_literal_send(mailstream * fd, const char * literal,
progress_function * progr_fun)
{
size_t len;
uint32_t literal_len;
size_t literal_len;
int r;
len = strlen(literal);
@ -1564,7 +1564,7 @@ mailimap_literal_send(mailstream * fd, const char * literal,
"{" number "}" CRLF
*/
static int literal_count_send(mailstream * fd, uint32_t count, int literalplus_enabled)
static int literal_count_send(mailstream * fd, size_t count, int literalplus_enabled)
{
int r;
@ -1572,7 +1572,7 @@ static int literal_count_send(mailstream * fd, uint32_t count, int literalplus_e
if (r != MAILIMAP_NO_ERROR)
return r;
r = mailimap_number_send(fd, count);
r = mailimap_number_send(fd, (uint32_t) count);
if (r != MAILIMAP_NO_ERROR)
return r;
@ -1594,13 +1594,13 @@ static int literal_count_send(mailstream * fd, uint32_t count, int literalplus_e
}
int
mailimap_literal_count_send(mailstream * fd, uint32_t count)
mailimap_literal_count_send(mailstream * fd, size_t count)
{
return literal_count_send(fd, count, 0);
}
static int
mailimap_literalplus_count_send(mailstream * fd, uint32_t count)
mailimap_literalplus_count_send(mailstream * fd, size_t count)
{
return literal_count_send(fd, count, 1);
}
@ -1610,7 +1610,7 @@ mailimap_literalplus_count_send(mailstream * fd, uint32_t count)
*/
int
mailimap_literal_data_send(mailstream * fd, const char * literal, uint32_t len,
mailimap_literal_data_send(mailstream * fd, const char * literal, size_t len,
size_t progr_rate,
progress_function * progr_fun)
{
@ -1618,7 +1618,7 @@ mailimap_literal_data_send(mailstream * fd, const char * literal, uint32_t len,
}
int
mailimap_literal_data_send_with_context(mailstream * fd, const char * literal, uint32_t len,
mailimap_literal_data_send_with_context(mailstream * fd, const char * literal, size_t len,
mailprogress_function * progr_fun,
void * context)
{

View File

@ -165,15 +165,15 @@ mailimap_literal_send(mailstream * fd, const char * literal,
progress_function * progr_fun);
int
mailimap_literal_count_send(mailstream * fd, uint32_t count);
mailimap_literal_count_send(mailstream * fd, size_t count);
int
mailimap_literal_data_send(mailstream * fd, const char * literal, uint32_t len,
mailimap_literal_data_send(mailstream * fd, const char * literal, size_t len,
size_t progr_rate,
progress_function * progr_fun);
int
mailimap_literal_data_send_with_context(mailstream * fd, const char * literal, uint32_t len,
mailimap_literal_data_send_with_context(mailstream * fd, const char * literal, size_t len,
mailprogress_function * progr_fun,
void * context);

View File

@ -252,7 +252,7 @@ int mailimap_uidplus_append(mailimap * session, const char * mailbox,
LIBETPAN_EXPORT
int mailimap_uidplus_append_simple(mailimap * session, const char * mailbox,
const char * content, uint32_t size,
const char * content, size_t size,
uint32_t * uidvalidity_result,
uint32_t * uid_result)
{

View File

@ -70,7 +70,7 @@ int mailimap_uidplus_append(mailimap * session, const char * mailbox,
LIBETPAN_EXPORT
int mailimap_uidplus_append_simple(mailimap * session, const char * mailbox,
const char * content, uint32_t size,
const char * content, size_t size,
uint32_t * uidvalidity_result,
uint32_t * uid_result);

View File

@ -1306,7 +1306,7 @@ struct mailimf_date_time * mailimf_get_date(time_t t)
if (localtime_r(&t, &lt) == NULL)
return NULL;
off = (mail_mkgmtime(&lt) - mail_mkgmtime(&gmt)) * 100 / (60 * 60);
off = (int) ((mail_mkgmtime(&lt) - mail_mkgmtime(&gmt)) * 100 / (60 * 60));
date_time = mailimf_date_time_new(lt.tm_mday, lt.tm_mon + 1, lt.tm_year + 1900,
lt.tm_hour, lt.tm_min, lt.tm_sec,

View File

@ -42,7 +42,7 @@ static int do_write(void * data, const char * str, size_t length)
f = data;
return fwrite(str, 1, length, f);
return (int) fwrite(str, 1, length, f);
}
LIBETPAN_EXPORT

View File

@ -45,7 +45,7 @@ static int do_write(void * data, const char * str, size_t length)
if (mmap_string_append_len(f, str, length) == NULL)
return 0;
else
return length;
return (int) length;
}
int mailimf_string_write_mem(MMAPString * f, int * col,

View File

@ -280,7 +280,7 @@ static void maildir_flush(struct maildir * md, int new_msg)
chashdatum key;
key.data = msg->msg_uid;
key.len = strlen(msg->msg_uid);
key.len = (unsigned int) strlen(msg->msg_uid);
chash_delete(md->mdir_msg_hash, &key, NULL);
carray_delete(md->mdir_msg_list, i);
@ -315,7 +315,7 @@ static int add_message(struct maildir * md,
}
key.data = msg->msg_uid;
key.len = strlen(msg->msg_uid);
key.len = (unsigned int) strlen(msg->msg_uid);
value.data = msg;
value.len = 0;
@ -654,7 +654,7 @@ char * maildir_message_get(struct maildir * md, const char * uid)
int r;
key.data = (void *) uid;
key.len = strlen(uid);
key.len = (unsigned int) strlen(uid);
r = chash_get(md->mdir_msg_hash, &key, &value);
if (r < 0)
return NULL;
@ -686,7 +686,7 @@ int maildir_message_remove(struct maildir * md, const char * uid)
int res;
key.data = (void *) uid;
key.len = strlen(uid);
key.len = (unsigned int) strlen(uid);
r = chash_get(md->mdir_msg_hash, &key, &value);
if (r < 0) {
res = MAILDIR_ERROR_NOT_FOUND;
@ -730,7 +730,7 @@ int maildir_message_change_flags(struct maildir * md,
char * dup_filename;
key.data = (void *) uid;
key.len = strlen(uid);
key.len = (unsigned int) strlen(uid);
r = chash_get(md->mdir_msg_hash, &key, &value);
if (r < 0) {
res = MAILDIR_ERROR_NOT_FOUND;

View File

@ -1165,10 +1165,10 @@ static int mailmbox_expunge_to_file_no_lock(char * dest_filename, int dest_fd,
{
int r;
int res;
unsigned long i;