From d741ceda2bd53d15d48fc1b9c4d836a9016194a7 Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Mon, 8 Jun 2020 17:19:07 -0600 Subject: * Remove some compilation warnings given by clang7. --- alpine/alpine.c | 4 +--- alpine/imap.c | 2 +- alpine/imap.h | 2 +- alpine/xoauth2conf.c | 2 +- alpine/xoauth2conf.h | 2 +- imap/src/c-client/auth_bea.c | 12 ++++++------ imap/src/c-client/mail.h | 7 +++---- pico/browse.c | 2 +- pico/line.c | 2 +- pith/filter.c | 14 +++++++------- pith/ical.c | 2 +- pith/pine.hlp | 2 +- pith/send.c | 2 +- pith/smime.c | 8 ++++---- 14 files changed, 30 insertions(+), 33 deletions(-) diff --git a/alpine/alpine.c b/alpine/alpine.c index d6e5e44e..8155f54a 100644 --- a/alpine/alpine.c +++ b/alpine/alpine.c @@ -715,9 +715,7 @@ main(int argc, char **argv) } if(max_v > 0 && max_v < (long) pith_ssl_encryption_version("tls1")){ - snprintf(tmp_20k_buf, SIZEOF_20KBUF, - _("Security alert: SSL maximum encryption version was set to SSLv3."), - ps_global->VAR_ENCRYPTION_RANGE); + strncpy(tmp_20k_buf, _("Security alert: SSL maximum encryption version was set to SSLv3."), SIZEOF_20KBUF); tmp_20k_buf[SIZEOF_20KBUF-1] = '\0'; init_error(ps_global, SM_ORDER | SM_DING, 3, 5, tmp_20k_buf); } diff --git a/alpine/imap.c b/alpine/imap.c index 556ad401..f86587e6 100644 --- a/alpine/imap.c +++ b/alpine/imap.c @@ -200,7 +200,7 @@ typedef struct auth_code_s { } AUTH_CODE_S; char * -oauth2_get_access_code(char *url, char *method, OAUTH2_S *oauth2, int *tryanother) +oauth2_get_access_code(unsigned char *url, char *method, OAUTH2_S *oauth2, int *tryanother) { char tmp[MAILTMPLEN]; char *code; diff --git a/alpine/imap.h b/alpine/imap.h index 3af88253..c4195fba 100644 --- a/alpine/imap.h +++ b/alpine/imap.h @@ -31,7 +31,7 @@ char *pine_newsrcquery(MAILSTREAM *, char *, char *); int url_local_certdetails(char *); void pine_sslfailure(char *, char *, unsigned long); void mm_expunged_current(long unsigned int); -char *oauth2_get_access_code(char *, char *, OAUTH2_S *, int *); +char *oauth2_get_access_code(unsigned char *, char *, OAUTH2_S *, int *); #ifdef LOCAL_PASSWD_CACHE int get_passfile_passwd(char *, char **, char *, STRLIST_S *, int); diff --git a/alpine/xoauth2conf.c b/alpine/xoauth2conf.c index 2e7ce49a..97900d25 100644 --- a/alpine/xoauth2conf.c +++ b/alpine/xoauth2conf.c @@ -63,7 +63,7 @@ xoauth_config_line(char *server, char *id, char *secret) * else return default values. */ void -oauth2_get_client_info(char *name, char **id, char **secret) +oauth2_get_client_info(unsigned char *name, char **id, char **secret) { int i; char **lval, *name_lval, *idp, *secretp; diff --git a/alpine/xoauth2conf.h b/alpine/xoauth2conf.h index 25eec591..c1de4139 100644 --- a/alpine/xoauth2conf.h +++ b/alpine/xoauth2conf.h @@ -21,7 +21,7 @@ /* exported prototypes */ void alpine_xoauth2_configuration(struct pine *, int); void xoauth_parse_client_info(char *, char **, char **, char **); -void oauth2_get_client_info(char *, char **, char **); +void oauth2_get_client_info(unsigned char *, char **, char **); char *xoauth_config_line(char *, char *, char *); #endif /* XOAUTH2_CONFIG */ diff --git a/imap/src/c-client/auth_bea.c b/imap/src/c-client/auth_bea.c index 6b78fe64..6079fb7b 100644 --- a/imap/src/c-client/auth_bea.c +++ b/imap/src/c-client/auth_bea.c @@ -48,19 +48,19 @@ char *oauth2_generate_state(void) rv[0] = '\0'; for(i = 0; i < 4; i++) - sprintf(rv + strlen(rv), "%x", random() % 256); + sprintf(rv + strlen(rv), "%x", (unsigned int) (random() % 256)); sprintf(rv + strlen(rv), "%c", '-'); for(i = 0; i < 2; i++) - sprintf(rv + strlen(rv), "%x", random() % 256); + sprintf(rv + strlen(rv), "%x", (unsigned int) (random() % 256)); sprintf(rv + strlen(rv), "%c", '-'); for(i = 0; i < 2; i++) - sprintf(rv + strlen(rv), "%x", random() % 256); + sprintf(rv + strlen(rv), "%x", (unsigned int) (random() % 256)); sprintf(rv + strlen(rv), "%c", '-'); for(i = 0; i < 2; i++) - sprintf(rv + strlen(rv), "%x", random() % 256); + sprintf(rv + strlen(rv), "%x", (unsigned int) (random() % 256)); sprintf(rv + strlen(rv), "%c", '-'); for(i = 0; i < 6; i++) - sprintf(rv + strlen(rv), "%x", random() % 256); + sprintf(rv + strlen(rv), "%x", (unsigned int) (random() % 256)); rv[36] = '\0'; return cpystr(rv); } @@ -287,7 +287,7 @@ mm_login_oauth2_c_client_method (NETMBX *mb, char *user, char *method, params[i].name = params[i].value = NULL; if(strcmp(RefreshMethod.name, "GET") == 0){ - char *url = http_get_param_url(RefreshMethod.urlserver, params); + unsigned char *url = http_get_param_url(RefreshMethod.urlserver, params); oauth2getaccesscode_t ogac = (oauth2getaccesscode_t) mail_parameters (NIL, GET_OA2CLIENTGETACCESSCODE, NIL); diff --git a/imap/src/c-client/mail.h b/imap/src/c-client/mail.h index d7c52dd8..39c7e4f8 100644 --- a/imap/src/c-client/mail.h +++ b/imap/src/c-client/mail.h @@ -1941,7 +1941,7 @@ typedef struct OA2_param_s { typedef struct OA2_serverparam_s { char *name; /* method name: GET or POST */ - char *urlserver; + unsigned char *urlserver; OA2_type params[OAUTH2_PARAM_NUMBER]; } OAUTH2_SERVER_METHOD_S; @@ -1955,6 +1955,5 @@ typedef struct oauth2_s { unsigned long expiration; } OAUTH2_S; -typedef char *(*oauth2getaccesscode_t) (char *, char *, OAUTH2_S *, int *); -typedef void (*oauth2clientinfo_t)(char *name, char **id, char **secret); - +typedef char *(*oauth2getaccesscode_t) (unsigned char *, char *, OAUTH2_S *, int *); +typedef void (*oauth2clientinfo_t)(unsigned char *name, char **id, char **secret); diff --git a/pico/browse.c b/pico/browse.c index b6d5c473..ca0f4657 100644 --- a/pico/browse.c +++ b/pico/browse.c @@ -1118,7 +1118,7 @@ FileBrowse(char *dir, size_t dirlen, char *fn, size_t fnlen, if((status = fexist(child, "w", (off_t *)NULL)) == FIOSUC){ snprintf(tmp, sizeof(tmp), _("%s \"%.*s\" already exists!"), - NLINE - 20, add_file > 0 ? "File" : "Directory", child); + add_file > 0 ? "File" : "Directory", NLINE - 20, child); emlwrite(tmp, NULL); break; } diff --git a/pico/line.c b/pico/line.c index bb51963e..109f52d9 100644 --- a/pico/line.c +++ b/pico/line.c @@ -621,7 +621,7 @@ lisblank(LINE *line) for(; n < llength(line); n++) if(!ucs4_isspace(lgetc(line, n).c) || lgetc(line, n).c >= 0xff - || (unsigned char) lgetc(line,n).c != NBSPC) + || (unsigned char) lgetc(line,n).c != (unsigned char) NBSPC) return(FALSE); return(TRUE); diff --git a/pith/filter.c b/pith/filter.c index 1e2db4d1..0c2f5256 100644 --- a/pith/filter.c +++ b/pith/filter.c @@ -3228,7 +3228,7 @@ int html_code(HANDLER_S *, int, int); int html_ins(HANDLER_S *, int, int); int html_del(HANDLER_S *, int, int); int html_abbr(HANDLER_S *, int, int); -char *cid_tempfile_name(unsigned char *, long, int *); +char *cid_tempfile_name(char *, long, int *); /* * Protos for RSS 2.0 Tag handlers @@ -9057,7 +9057,7 @@ gf_html2plain_rss_free_items(RSS_ITEM_S **itemp) } char * -cid_tempfile_name(unsigned char *line, long n, int *is_cidp) +cid_tempfile_name(char *line, long n, int *is_cidp) { int f2 = 0; int i, found; @@ -9086,7 +9086,7 @@ cid_tempfile_name(unsigned char *line, long n, int *is_cidp) /* find the tmpdir where all these files will be saved to */ if(t == NULL){ for(i = 0; ps_global->atmts[i].tmpdir == NULL && ps_global->atmts[i].description != NULL; i++); - t = ps_global->atmts[i].description ? ps_global->atmts[i].tmpdir : NULL; + t = ps_global->atmts[i].description ? ps_global->atmts[i].tmpdir : NULL; } /* now we need to look for s in the list of attachments */ @@ -9156,7 +9156,7 @@ gf_html_cid2file(FILTER_S *f, int cmd) if (f->f2 == 1 && (c == 'i' || c == 'I')) f->f2 = 2; else if (f->f2 == 2 && (c == 'm' || c == 'M')) f->f2 = 3; else if (f->f2 == 3 && (c == 'g' || c == 'G')) f->f2 = 4; - else if (f->f2 == 4 && HTML_ISSPACE(c)){ f->f2 = 0; state = 1; } + else if (f->f2 == 4 && ASCII_ISSPACE(c)){ f->f2 = 0; state = 1; } else f->f2 = 0; } } @@ -9165,11 +9165,11 @@ gf_html_cid2file(FILTER_S *f, int cmd) else if (f->f2 == 1 && (c == 'r' || c == 'R')) f->f2 = 2; else if (f->f2 == 2 && (c == 'c' || c == 'C')) f->f2 = 3; else if (f->f2 == 3 && c == '='){ GF_PUTC(f->next, c); state = 2; } - else if (f->f2 == 3 && !HTML_ISSPACE(c)) f->f2 = 0; + else if (f->f2 == 3 && !ASCII_ISSPACE(c)) f->f2 = 0; else f->f2 = 0; } else if (state == 2){ /* collect all data */ - if(HTML_ISSPACE(c) || c == '>'){ + if(ASCII_ISSPACE(c) || c == '>'){ long n; int is_cid; if(f->n > 0){ @@ -9191,7 +9191,7 @@ gf_html_cid2file(FILTER_S *f, int cmd) else f->n = 0; GF_PUTC(f->next, '\"'); GF_PUTC(f->next, c); - state = HTML_ISSPACE(c) ? 1 : 0; + state = ASCII_ISSPACE(c) ? 1 : 0; RESET_FILTER(f); } else COLLECT(f, c); /* collect this data */ diff --git a/pith/ical.c b/pith/ical.c index 5079ceb9..2d61c00e 100644 --- a/pith/ical.c +++ b/pith/ical.c @@ -243,7 +243,7 @@ ical_decode(char *text, unsigned short encoding) t = rfc822_qprint ((unsigned char *) text,strlen(text),&callen); if(t != NULL){ tlen = strlen(text) + 1; - strncpy(text, t, tlen); + strncpy(text, (char *) t, tlen); text[tlen - 1] = '\0'; fs_give((void **) &t); } diff --git a/pith/pine.hlp b/pith/pine.hlp index d7af4f7f..08ef532d 100644 --- a/pith/pine.hlp +++ b/pith/pine.hlp @@ -140,7 +140,7 @@ with help text for the config screen and the composer that didn't have any reasonable place to be called from. Dummy change to get revision in pine.hlp ============= h_revision ================= -Alpine Commit 435 2020-06-08 02:41:56 +Alpine Commit 436 2020-06-08 17:19:02 ============= h_news ================= diff --git a/pith/send.c b/pith/send.c index 39295a9e..80db83f8 100644 --- a/pith/send.c +++ b/pith/send.c @@ -4297,7 +4297,7 @@ pine_rfc822_output_body(struct mail_bodystruct *body, soutr_t f, void *s) #ifdef SMIME if(ps_global->smime && ps_global->smime->do_sign && strlen(tmp) < sizeof(tmp)-2) - strncat(tmp, "\015\012", sizeof(tmp) - strlen(tmp)); + strncat(tmp, "\015\012", sizeof(tmp) - strlen(tmp) - 1); #endif if(lmc.so && !lmc.all_written){ so_puts(lmc.so, t); diff --git a/pith/smime.c b/pith/smime.c index 499264de..ccaf1066 100644 --- a/pith/smime.c +++ b/pith/smime.c @@ -478,7 +478,7 @@ smime_expunge_cert(WhichCerts ctype) if(SMHOLDERTYPE(ctype) == Directory){ build_path(buf, path, cl->next->name, sizeof(buf)); if(ctype == Private && strlen(buf) + strlen(EXTCERT(Private)) < sizeof(buf)){ - strncat(buf, EXTCERT(Private), sizeof(buf) - strlen(buf)); + strncat(buf, EXTCERT(Private), sizeof(buf) - strlen(buf)-1); buf[sizeof(buf)-1] = '\0'; } @@ -867,7 +867,7 @@ import_certificate(WhichCerts ctype, PERSONAL_CERT *p_cert, char *fname) if(SMHOLDERTYPE(ctype) == Directory){ build_path(buf, PATHCERTDIR(ctype), filename, sizeof(buf)); if(strcmp(buf + strlen(buf) - 4, EXTCERT(ctype)) != 0 && strlen(buf) + 4 < sizeof(buf)){ - strncat(buf, EXTCERT(ctype), sizeof(buf) - strlen(buf)); + strncat(buf, EXTCERT(ctype), sizeof(buf) - strlen(buf) -1); buf[sizeof(buf)-1] = '\0'; } rc = our_copy(buf, full_filename); @@ -892,7 +892,7 @@ import_certificate(WhichCerts ctype, PERSONAL_CERT *p_cert, char *fname) if(SMHOLDERTYPE(ctype) == Directory){ build_path(buf, PATHCERTDIR(ctype), filename, sizeof(buf)); if(strcmp(buf + strlen(buf) - 4, ".crt") != 0 && strlen(buf) + 4 < sizeof(buf)){ - strncat(buf, EXTCERT(ctype), sizeof(buf) - strlen(buf)); + strncat(buf, EXTCERT(ctype), sizeof(buf) - strlen(buf) - 1); buf[sizeof(buf)-1] = '\0'; } @@ -1345,7 +1345,7 @@ get_personal_certs(char *path) pc = (PERSONAL_CERT *) fs_get(sizeof(*pc)); pc->cert = cert; pc->name = cpystr(buf2); - strncat(buf2, EXTCERT(Public), sizeof(buf2) - strlen(buf2)); + strncat(buf2, EXTCERT(Public), sizeof(buf2) - strlen(buf2) - 1); pc->cname = cpystr(buf2); /* Try to load the key with an empty password */ -- cgit v1.2.3-54-g00ecf