diff --git a/src/mail.cc b/src/mail.cc index 1f331a20..6786f9f4 100644 --- a/src/mail.cc +++ b/src/mail.cc @@ -48,6 +48,7 @@ #include #include #include +#include #include #include @@ -122,7 +123,7 @@ namespace { hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; - snprintf(portbuf, 8, "%lu", get()); + snprintf(portbuf, 8, "%" SCNu16, get()); if(int res = getaddrinfo(get().c_str(), portbuf, &hints, &ai)) throw std::runtime_error(std::string("IMAP getaddrinfo: ") + gai_strerror(res)); @@ -551,7 +552,7 @@ std::unique_ptr parse_mail_args(mail_type type, const char *arg) tmp = (char*)strstr(arg, "-r "); if (tmp) { tmp += 3; - sscanf(tmp, "%u", &mail->retries); + sscanf(tmp, "%" SCNu16, &mail->retries); } else { mail->retries = 5; // 5 retries after failure } @@ -567,7 +568,7 @@ std::unique_ptr parse_mail_args(mail_type type, const char *arg) tmp = (char*)strstr(arg, "-p "); if (tmp) { tmp += 3; - sscanf(tmp, "%lu", &get(*mail)); + sscanf(tmp, "%" SCNu16, &get(*mail)); } else { if (type == POP3_TYPE) { get(*mail) = 110; // default pop3 port