From 2d0beab92afeb28a98553466a8b2e936096768b1 Mon Sep 17 00:00:00 2001 From: Janos SUTO Date: Wed, 17 Oct 2018 07:26:07 +0000 Subject: [PATCH] Fixed signed vs. unsigned comparisons Signed-off-by: Janos SUTO --- src/defs.h | 10 +++++----- src/extract.c | 5 +++-- src/misc.c | 3 ++- src/parser.c | 4 ++-- src/parser.h | 2 +- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/defs.h b/src/defs.h index c2cbd1e1..34d9ef03 100644 --- a/src/defs.h +++ b/src/defs.h @@ -174,8 +174,8 @@ struct parser_state { int content_type_is_set; int pushed_pointer; int saved_size; - int writebufpos; - int abufpos; + unsigned int writebufpos; + unsigned int abufpos; char attachedfile[RND_STR_LEN+SMALLBUFSIZE]; char message_id[SMALLBUFSIZE]; char message_id_hash[2*DIGEST_LENGTH+1]; @@ -205,9 +205,9 @@ struct parser_state { char b_from[SMALLBUFSIZE], b_from_domain[SMALLBUFSIZE], b_to[MAXBUFSIZE], b_to_domain[SMALLBUFSIZE], b_subject[MAXBUFSIZE], b_body[BIGBUFSIZE]; char b_journal_to[MAXBUFSIZE]; - int bodylen; - int tolen; - int todomainlen; + unsigned int bodylen; + unsigned int tolen; + unsigned int todomainlen; int journaltolen; int retention; diff --git a/src/extract.c b/src/extract.c index 1d26565c..8be05033 100644 --- a/src/extract.c +++ b/src/extract.c @@ -41,7 +41,7 @@ int remove_xml(char *src, char *dest, int destlen, int *html){ #ifdef HAVE_ZIP int extract_opendocument(struct session_data *sdata, struct parser_state *state, char *filename, char *prefix){ int errorp, i=0, len=0, html=0; - int len2; + unsigned int len2; char buf[4*MAXBUFSIZE], puf[4*MAXBUFSIZE]; struct zip *z; struct zip_stat sb; @@ -206,7 +206,8 @@ void kill_helper(){ void extract_attachment_content(struct session_data *sdata, struct parser_state *state, char *filename, char *type, int *rec, struct config *cfg){ - int link[2], n; + int link[2]; + ssize_t n; pid_t pid; char outbuf[MAXBUFSIZE]; diff --git a/src/misc.c b/src/misc.c index 9ce05bb2..103c75cb 100644 --- a/src/misc.c +++ b/src/misc.c @@ -101,7 +101,8 @@ int countCharacterInBuffer(char *p, char c){ void replaceCharacterInBuffer(char *p, char from, char to){ - int i, k=0; + size_t i; + int k=0; for(i=0; imessage_state == MSG_BODY && len >= cfg->min_word_len && state->bodylen < BIGBUFSIZE-len-1){ + else if(state->message_state == MSG_BODY && len >= (unsigned int)(cfg->min_word_len) && state->bodylen < BIGBUFSIZE-len-1){ // 99% of email addresses are longer than 8 characters if(len >= MIN_EMAIL_ADDRESS_LEN && does_it_seem_like_an_email_address(puf)){ fix_email_address_for_sphinx(puf); diff --git a/src/parser.h b/src/parser.h index a8b4d184..3d43cd2e 100644 --- a/src/parser.h +++ b/src/parser.h @@ -11,7 +11,7 @@ struct parser_state parse_message(struct session_data *sdata, int take_into_pieces, struct data *data, struct config *cfg); void post_parse(struct session_data *sdata, struct parser_state *state, struct config *cfg); -int parse_line(char *buf, struct parser_state *state, struct session_data *sdata, int take_into_pieces, char *writebuffer, int writebuffersize, char *abuffer, int abuffersize, struct data *data, struct config *cfg); +int parse_line(char *buf, struct parser_state *state, struct session_data *sdata, int take_into_pieces, char *writebuffer, unsigned int writebuffersize, char *abuffer, unsigned int abuffersize, struct data *data, struct config *cfg); void init_state(struct parser_state *state); time_t parse_date_header(char *s);