@@ -342,8 +342,8 @@ x_msg_va(const unsigned int flags, const char *format, va_list arglist)
struct timeval tv;
gettimeofday(&tv, NULL);
- fprintf(fp, "%lld.%06ld %x %s%s%s%s",
- (long long)tv.tv_sec,
+ fprintf(fp, "%"PRIi64".%06ld %x %s%s%s%s",
+ (int64_t)tv.tv_sec,
(long)tv.tv_usec,
flags,
prefix,
@@ -1041,9 +1041,9 @@ se_wait_fast(struct event_set *es, const struct timeval *tv, struct event_set_re
struct timeval tv_tmp = *tv;
int stat;
- dmsg(D_EVENT_WAIT, "SE_WAIT_FAST maxfd=%d tv=%lld/%ld",
+ dmsg(D_EVENT_WAIT, "SE_WAIT_FAST maxfd=%d tv=%"PRIi64"/%ld",
ses->maxfd,
- (long long)tv_tmp.tv_sec,
+ (int64_t)tv_tmp.tv_sec,
(long)tv_tmp.tv_usec);
stat = select(ses->maxfd + 1, &ses->readfds, &ses->writefds, NULL, &tv_tmp);
@@ -1065,8 +1065,8 @@ se_wait_scalable(struct event_set *es, const struct timeval *tv, struct event_se
fd_set write = ses->writefds;
int stat;
- dmsg(D_EVENT_WAIT, "SE_WAIT_SCALEABLE maxfd=%d tv=%lld/%ld",
- ses->maxfd, (long long)tv_tmp.tv_sec, (long)tv_tmp.tv_usec);
+ dmsg(D_EVENT_WAIT, "SE_WAIT_SCALEABLE maxfd=%d tv=%"PRIi64"/%ld",
+ ses->maxfd, (int64_t)tv_tmp.tv_sec, (long)tv_tmp.tv_usec);
stat = select(ses->maxfd + 1, &read, &write, NULL, &tv_tmp);
@@ -610,7 +610,7 @@ check_coarse_timers_dowork(struct context *c)
process_coarse_timers(c);
c->c2.coarse_timer_wakeup = now + c->c2.timeval.tv_sec;
- dmsg(D_INTERVAL, "TIMER: coarse timer wakeup %lld seconds", (long long)c->c2.timeval.tv_sec);
+ dmsg(D_INTERVAL, "TIMER: coarse timer wakeup %"PRIi64" seconds", (int64_t)c->c2.timeval.tv_sec);
/* Is the coarse timeout NOT the earliest one? */
if (c->c2.timeval.tv_sec > save.tv_sec)
@@ -556,7 +556,7 @@ void
setenv_long_long(struct env_set *es, const char *name, long long value)
{
char buf[64];
- openvpn_snprintf(buf, sizeof(buf), "%lld", value);
+ openvpn_snprintf(buf, sizeof(buf), "%"PRIi64, (int64_t)value);
setenv_str(es, name, buf);
}
@@ -2383,13 +2383,13 @@ multi_process_post(struct multi_context *m, struct multi_instance *mi, const uns
multi_set_pending(m, ANY_OUT(&mi->context) ? mi : NULL);
#ifdef MULTI_DEBUG_EVENT_LOOP
- printf("POST %s[%d] to=%d lo=%d/%d w=%lld/%ld\n",
+ printf("POST %s[%d] to=%d lo=%d/%d w=%"PRIi64"/%ld\n",
id(mi),
(int) (mi == m->pending),
mi ? mi->context.c2.to_tun.len : -1,
mi ? mi->context.c2.to_link.len : -1,
(mi && mi->context.c2.fragment) ? mi->context.c2.fragment->outgoing.len : -1,
- (long long)mi->context.c2.timeval.tv_sec,
+ (int64_t)mi->context.c2.timeval.tv_sec,
(long)mi->context.c2.timeval.tv_usec);
#endif
}
@@ -88,8 +88,8 @@ const char *
tv_string(const struct timeval *tv, struct gc_arena *gc)
{
struct buffer out = alloc_buf_gc(64, gc);
- buf_printf(&out, "[%lld/%ld]",
- (long long)tv->tv_sec,
+ buf_printf(&out, "[%"PRIi64"/%ld]",
+ (int64_t)tv->tv_sec,
(long)tv->tv_usec);
return BSTR(&out);
}
@@ -198,9 +198,9 @@ time_test(void)
t = time(NULL);
gettimeofday(&tv, NULL);
#if 1
- msg(M_INFO, "t=%lld s=%lld us=%ld",
- (long long)t,
- (long long)tv.tv_sec,
+ msg(M_INFO, "t=%"PRIi64" s=%"PRIi64" us=%ld",
+ (int64_t)t,
+ (int64_t)tv.tv_sec,
(long)tv.tv_usec);
#endif
}
@@ -606,14 +606,14 @@ packet_id_debug_print(int msglevel,
}
buf_printf(&out, "%c", c);
}
- buf_printf(&out, "] %lld:" packet_id_format, (long long)p->time, (packet_id_print_type)p->id);
+ buf_printf(&out, "] %"PRIi64":" packet_id_format, (int64_t)p->time, (packet_id_print_type)p->id);
if (pin)
{
- buf_printf(&out, " %lld:" packet_id_format, (long long)pin->time, (packet_id_print_type)pin->id);
+ buf_printf(&out, " %"PRIi64":" packet_id_format, (int64_t)pin->time, (packet_id_print_type)pin->id);
}
- buf_printf(&out, " t=%lld[%d]",
- (long long)prev_now,
+ buf_printf(&out, " t=%"PRIi64"[%d]",
+ (int64_t)prev_now,
(int)(prev_now - tv.tv_sec));
buf_printf(&out, " r=[%d,%d,%d,%d,%d]",
@@ -666,8 +666,8 @@ packet_id_interactive_test(void)
{
packet_id_reap_test(&pid.rec);
test = packet_id_test(&pid.rec, &pin);
- printf("packet_id_test (%lld, " packet_id_format ") returned %d\n",
- (long long)pin.time,
+ printf("packet_id_test (%"PRIi64", " packet_id_format ") returned %d\n",
+ (int64_t)pin.time,
(packet_id_print_type)pin.id,
test);
if (test)
@@ -679,8 +679,8 @@ packet_id_interactive_test(void)
{
long_form = (count < 20);
packet_id_alloc_outgoing(&pid.send, &pin, long_form);
- printf("(%lld(" packet_id_format "), %d)\n",
- (long long)pin.time,
+ printf("(%"PRIi64"(" packet_id_format "), %d)\n",
+ (int64_t)pin.time,
(packet_id_print_type)pin.id,
long_form);
if (pid.send.id == 10)
@@ -786,14 +786,14 @@ reliable_debug_print(const struct reliable *rel, char *desc)
printf("********* struct reliable %s\n", desc);
printf(" initial_timeout=%d\n", (int)rel->initial_timeout);
printf(" packet_id=" packet_id_format "\n", rel->packet_id);
- printf(" now=%lld\n", (long long)now);
+ printf(" now=%"PRIi64"\n", (int64_t)now);
for (i = 0; i < rel->size; ++i)
{
const struct reliable_entry *e = &rel->array[i];
if (e->active)
{
printf(" %d: packet_id=" packet_id_format " len=%d", i, e->packet_id, e->buf.len);
- printf(" next_try=%lld", (long long)e->next_try);
+ printf(" next_try=%"PRIi64, (int64_t)e->next_try);
printf("\n");
}
}
@@ -1969,12 +1969,12 @@ add_route_ipv6(struct route_ipv6 *r6, const struct tuntap *tt, unsigned int flag
struct buffer out = alloc_buf_gc(64, &gc);
if (r6->adapter_index) /* vpn server special route */
{
- buf_printf(&out, "interface=%d", r6->adapter_index );
+ buf_printf(&out, "interface=%u", (unsigned int)r6->adapter_index );
gateway_needed = true;
}
else
{
- buf_printf(&out, "interface=%d", tt->adapter_index );
+ buf_printf(&out, "interface=%u", (unsigned int)tt->adapter_index );
}
device = buf_bptr(&out);
@@ -2416,12 +2416,12 @@ delete_route_ipv6(const struct route_ipv6 *r6, const struct tuntap *tt, unsigned
struct buffer out = alloc_buf_gc(64, &gc);
if (r6->adapter_index) /* vpn server special route */
{
- buf_printf(&out, "interface=%d", r6->adapter_index );
+ buf_printf(&out, "interface=%u", (unsigned int)r6->adapter_index );
gateway_needed = true;
}
else
{
- buf_printf(&out, "interface=%d", tt->adapter_index );
+ buf_printf(&out, "interface=%u", (unsigned int)tt->adapter_index );
}
device = buf_bptr(&out);
@@ -2843,7 +2843,7 @@ get_default_gateway_ipv6(struct route_ipv6_gateway_info *rgi6,
}
msg( D_ROUTE, "GDG6: II=%d DP=%s/%d NH=%s",
- BestRoute.InterfaceIndex,
+ (int)BestRoute.InterfaceIndex,
print_in6_addr( BestRoute.DestinationPrefix.Prefix.Ipv6.sin6_addr, 0, &gc),
BestRoute.DestinationPrefix.PrefixLength,
print_in6_addr( BestRoute.NextHop.Ipv6.sin6_addr, 0, &gc) );
@@ -3003,7 +3003,7 @@ do_route_service(const bool add, const route_message_t *rt, const size_t size, H
if (ack.error_number != NO_ERROR)
{
- msg(M_WARN, "ROUTE: route %s failed using service: %s [status=%u if_index=%lu]",
+ msg(M_WARN, "ROUTE: route %s failed using service: %s [status=%u if_index=%d]",
(add ? "addition" : "deletion"), strerror_win32(ack.error_number, &gc),
ack.error_number, rt->iface.index);
goto out;
@@ -76,8 +76,8 @@ shaper_soonest_event(struct timeval *tv, int delay)
}
}
#ifdef SHAPER_DEBUG
- dmsg(D_SHAPER_DEBUG, "SHAPER shaper_soonest_event sec=%lld usec=%ld ret=%d",
- (long long)tv->tv_sec, (long)tv->tv_usec, (int)ret);
+ dmsg(D_SHAPER_DEBUG, "SHAPER shaper_soonest_event sec=%"PRIi64" usec=%ld ret=%d",
+ (int64_t)tv->tv_sec, (long)tv->tv_usec, (int)ret);
#endif
return ret;
}
@@ -147,10 +147,10 @@ shaper_wrote_bytes(struct shaper *s, int nbytes)
tv_add(&s->wakeup, &tv);
#ifdef SHAPER_DEBUG
- dmsg(D_SHAPER_DEBUG, "SHAPER shaper_wrote_bytes bytes=%d delay=%ld sec=%lld usec=%ld",
+ dmsg(D_SHAPER_DEBUG, "SHAPER shaper_wrote_bytes bytes=%d delay=%ld sec=%"PRIi64" usec=%ld",
nbytes,
(long)tv.tv_usec,
- (long long)s->wakeup.tv_sec,
+ (int64_t)s->wakeup.tv_sec,
(long)s->wakeup.tv_usec);
#endif
}
@@ -1122,7 +1122,7 @@ socket_do_accept(socket_descriptor_t sd,
if (!socket_defined(new_sd))
{
- msg(D_LINK_ERRORS | M_ERRNO, "TCP: accept(%d) failed", sd);
+ msg(D_LINK_ERRORS | M_ERRNO, "TCP: accept(%d) failed", (int)sd);
}
/* only valid if we have remote_len_af!=0 */
else if (remote_len_af && remote_len != remote_len_af)
@@ -1875,12 +1875,12 @@ phase2_inetd(struct link_socket *sock, const struct frame *frame,
sock->info.lsa->actual.dest.addr.sa.sa_family = local_addr.addr.sa.sa_family;
dmsg(D_SOCKET_DEBUG, "inetd(%s): using sa_family=%d from getsockname(%d)",
proto2ascii(sock->info.proto, sock->info.af, false),
- local_addr.addr.sa.sa_family, sock->sd);
+ local_addr.addr.sa.sa_family, (int)sock->sd);
}
else
{
msg(M_WARN, "inetd(%s): getsockname(%d) failed, using AF_INET",
- proto2ascii(sock->info.proto, sock->info.af, false), sock->sd);
+ proto2ascii(sock->info.proto, sock->info.af, false), (int)sock->sd);
}
}
#else /* ifdef HAVE_GETSOCKNAME */
@@ -1448,8 +1448,8 @@ bio_debug_data(const char *mode, BIO *bio, const uint8_t *buf, int len, const ch
if (len > 0)
{
open_biofp();
- fprintf(biofp, "BIO_%s %s time=%lld bio=" ptr_format " len=%d data=%s\n",
- mode, desc, (long long)time(NULL), (ptr_type)bio, len, format_hex(buf, len, 0, &gc));
+ fprintf(biofp, "BIO_%s %s time=%"PRIi64" bio=" ptr_format " len=%d data=%s\n",
+ mode, desc, (int64_t)time(NULL), (ptr_type)bio, len, format_hex(buf, len, 0, &gc));
fflush(biofp);
}
gc_free(&gc);
@@ -1459,8 +1459,8 @@ static void
bio_debug_oc(const char *mode, BIO *bio)
{
open_biofp();
- fprintf(biofp, "BIO %s time=%lld bio=" ptr_format "\n",
- mode, (long long)time(NULL), (ptr_type)bio);
+ fprintf(biofp, "BIO %s time=%"PRIi64" bio=" ptr_format "\n",
+ mode, (int64_t)time(NULL), (ptr_type)bio);
fflush(biofp);
}
@@ -124,7 +124,7 @@ do_address_service(const bool add, const short family, const struct tuntap *tt)
if (ack.error_number != NO_ERROR)
{
- msg(M_WARN, "TUN: %s address failed using service: %s [status=%u if_index=%lu]",
+ msg(M_WARN, "TUN: %s address failed using service: %s [status=%u if_index=%d]",
(add ? "adding" : "deleting"), strerror_win32(ack.error_number, &gc),
ack.error_number, addr.iface.index);
goto out;
@@ -3790,7 +3790,7 @@ get_panel_reg(struct gc_arena *gc)
if (status != ERROR_SUCCESS || name_type != REG_SZ)
{
- dmsg(D_REGISTRY, "Error opening registry key: %s\\%s\\%s",
+ dmsg(D_REGISTRY, "Error opening registry key: %s\\%s\\%ls",
NETWORK_CONNECTIONS_KEY, connection_string, name_string);
}
else