Fix the build on 64-bit platforms.

This commit is contained in:
Marcel Moolenaar 2004-09-06 00:07:58 +00:00
parent 0fe38d47b7
commit 1814213e06
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=134833
10 changed files with 37 additions and 31 deletions

View File

@ -443,11 +443,11 @@ auth_ReadHeader(struct authinfo *authp, struct mbuf *bp)
if (len >= ntohs(authp->in.hdr.length))
return bp;
authp->in.hdr.length = htons(0);
log_Printf(LogWARN, "auth_ReadHeader: Short packet (%u > %u) !\n",
log_Printf(LogWARN, "auth_ReadHeader: Short packet (%u > %zu) !\n",
ntohs(authp->in.hdr.length), len);
} else {
authp->in.hdr.length = htons(0);
log_Printf(LogWARN, "auth_ReadHeader: Short packet header (%u > %u) !\n",
log_Printf(LogWARN, "auth_ReadHeader: Short packet header (%u > %zu) !\n",
(int)(sizeof authp->in.hdr), len);
}
@ -459,12 +459,12 @@ struct mbuf *
auth_ReadName(struct authinfo *authp, struct mbuf *bp, size_t len)
{
if (len > sizeof authp->in.name - 1)
log_Printf(LogWARN, "auth_ReadName: Name too long (%u) !\n", len);
log_Printf(LogWARN, "auth_ReadName: Name too long (%zu) !\n", len);
else {
size_t mlen = m_length(bp);
if (len > mlen)
log_Printf(LogWARN, "auth_ReadName: Short packet (%u > %u) !\n",
log_Printf(LogWARN, "auth_ReadName: Short packet (%zu > %zu) !\n",
len, mlen);
else {
bp = mbuf_Read(bp, (u_char *)authp->in.name, len);

View File

@ -1425,7 +1425,7 @@ bundle_ReceiveDatalink(struct bundle *bundle, int s)
if (got == -1)
log_Printf(LogERROR, "Failed recvmsg: %s\n", strerror(errno));
else
log_Printf(LogERROR, "Failed recvmsg: Got %d, not %u\n",
log_Printf(LogERROR, "Failed recvmsg: Got %zd, not %u\n",
got, (unsigned)iov[0].iov_len);
while (niov--)
free(iov[niov].iov_base);
@ -1478,7 +1478,7 @@ bundle_ReceiveDatalink(struct bundle *bundle, int s)
if (got == -1)
log_Printf(LogERROR, "Failed write: %s\n", strerror(errno));
else
log_Printf(LogERROR, "Failed write: Got %d, not %d\n", got,
log_Printf(LogERROR, "Failed write: Got %zd, not %d\n", got,
(int)(sizeof pid));
while (nfd--)
close(fd[nfd]);
@ -1491,7 +1491,7 @@ bundle_ReceiveDatalink(struct bundle *bundle, int s)
if (got == -1)
log_Printf(LogERROR, "Failed write: %s\n", strerror(errno));
else
log_Printf(LogERROR, "Failed write: Got %d, not %d\n", got, expect);
log_Printf(LogERROR, "Failed write: Got %zd, not %d\n", got, expect);
while (nfd--)
close(fd[nfd]);
while (niov--)
@ -1612,7 +1612,7 @@ bundle_SendDatalink(struct datalink *dl, int s, struct sockaddr_un *sun)
log_Printf(LogERROR, "Failed sendmsg: %s: %s\n",
sun->sun_path, strerror(errno));
else if (got != (ssize_t)iov[0].iov_len)
log_Printf(LogERROR, "%s: Failed initial sendmsg: Only sent %d of %u\n",
log_Printf(LogERROR, "%s: Failed initial sendmsg: Only sent %zd of %u\n",
sun->sun_path, got, (unsigned)iov[0].iov_len);
else {
/* We must get the ACK before closing the descriptor ! */
@ -1630,14 +1630,14 @@ bundle_SendDatalink(struct datalink *dl, int s, struct sockaddr_un *sun)
log_Printf(LogERROR, "%s: Failed writev: %s\n",
sun->sun_path, strerror(errno));
else
log_Printf(LogERROR, "%s: Failed writev: Wrote %d of %d\n",
log_Printf(LogERROR, "%s: Failed writev: Wrote %zd of %d\n",
sun->sun_path, got, expect);
}
} else if (got == -1)
log_Printf(LogERROR, "%s: Failed socketpair read: %s\n",
sun->sun_path, strerror(errno));
else
log_Printf(LogERROR, "%s: Failed socketpair read: Got %d of %d\n",
log_Printf(LogERROR, "%s: Failed socketpair read: Got %zd of %d\n",
sun->sun_path, got, (int)(sizeof newpid));
}

View File

@ -637,7 +637,7 @@ cbcp_Input(struct bundle *bundle __unused, struct link *l, struct mbuf *bp)
}
head = (struct cbcp_header *)MBUF_CTOP(bp);
if (ntohs(head->length) != len) {
log_Printf(LogWARN, "Corrupt CBCP packet (code %d, length %u not %u)"
log_Printf(LogWARN, "Corrupt CBCP packet (code %d, length %u not %zu)"
" - ignored\n", head->code, ntohs(head->length), len);
m_freem(bp);
return NULL;
@ -729,7 +729,7 @@ cbcp_Input(struct bundle *bundle __unused, struct link *l, struct mbuf *bp)
break;
default:
log_Printf(LogWARN, "Unrecognised CBCP packet (code %d, length %d)\n",
log_Printf(LogWARN, "Unrecognised CBCP packet (code %d, length %zd)\n",
head->code, len);
break;
}

View File

@ -519,7 +519,7 @@ ether_Create(struct physical *p)
* magically exist as a way of hooking stuff onto an ethernet device
*/
path = (char *)alloca(ifacelen + 2);
sprintf(path, "%.*s:", ifacelen, iface);
sprintf(path, "%.*s:", (int)ifacelen, iface);
if (NgSendMsg(dev->cs, path, NGM_GENERIC_COOKIE, NGM_LISTHOOKS,
NULL, 0) < 0) {
log_Printf(LogWARN, "%s Cannot send a netgraph message: %s\n",

View File

@ -1055,7 +1055,7 @@ fsm_Input(struct fsm *fp, struct mbuf *bp)
bp = mbuf_Read(bp, &lh, sizeof lh);
if (ntohs(lh.length) > len) {
log_Printf(LogWARN, "%s: Oops: Got %u bytes but %d byte payload "
log_Printf(LogWARN, "%s: Oops: Got %zu bytes but %d byte payload "
"- dropped\n", fp->link->name, len, (int)ntohs(lh.length));
m_freem(bp);
return;

View File

@ -908,7 +908,7 @@ ip_Input(struct bundle *bundle, struct link *l, struct mbuf *bp, u_int32_t af)
nb = m_length(bp);
if (nb > sizeof tun.data) {
log_Printf(LogWARN, "ip_Input: %s: Packet too large (got %d, max %d)\n",
log_Printf(LogWARN, "ip_Input: %s: Packet too large (got %zd, max %d)\n",
l->name, nb, (int)(sizeof tun.data));
m_freem(bp);
return 0;
@ -937,10 +937,11 @@ ip_Input(struct bundle *bundle, struct link *l, struct mbuf *bp, u_int32_t af)
nw = write(bundle->dev.fd, data, nb);
if (nw != (ssize_t)nb) {
if (nw == -1)
log_Printf(LogERROR, "ip_Input: %s: wrote %d, got %s\n",
log_Printf(LogERROR, "ip_Input: %s: wrote %zd, got %s\n",
l->name, nb, strerror(errno));
else
log_Printf(LogERROR, "ip_Input: %s: wrote %d, got %d\n", l->name, nb, nw);
log_Printf(LogERROR, "ip_Input: %s: wrote %zd, got %zd\n", l->name, nb,
nw);
}
return nb;

View File

@ -456,7 +456,8 @@ LcpSendConfigReq(struct fsm *fp)
if (sz > sizeof o->data - 1) {
sz = sizeof o->data - 1;
log_Printf(LogWARN, "Truncating E164 data to %u octets (oops!)\n", sz);
log_Printf(LogWARN, "Truncating E164 data to %zu octets (oops!)\n",
sz);
}
*o->data = CALLBACK_E164;
memcpy(o->data + 1, lcp->want_callback.msg, sz);
@ -1068,17 +1069,20 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, u_char *end, int mode_type,
log_Printf(LogLCP, "%s Auth\n", request);
break;
case CALLBACK_DIALSTRING:
log_Printf(LogLCP, "%s Dialstring %.*s\n", request, sz,
log_Printf(LogLCP, "%s Dialstring %.*s\n", request, (int)sz,
opt->data + 1);
break;
case CALLBACK_LOCATION:
log_Printf(LogLCP, "%s Location %.*s\n", request, sz, opt->data + 1);
log_Printf(LogLCP, "%s Location %.*s\n", request, (int)sz,
opt->data + 1);
break;
case CALLBACK_E164:
log_Printf(LogLCP, "%s E.164 (%.*s)\n", request, sz, opt->data + 1);
log_Printf(LogLCP, "%s E.164 (%.*s)\n", request, (int)sz,
opt->data + 1);
break;
case CALLBACK_NAME:
log_Printf(LogLCP, "%s Name %.*s\n", request, sz, opt->data + 1);
log_Printf(LogLCP, "%s Name %.*s\n", request, (int)sz,
opt->data + 1);
break;
case CALLBACK_CBCP:
log_Printf(LogLCP, "%s CBCP\n", request);
@ -1104,7 +1108,7 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, u_char *end, int mode_type,
lcp->his_callback.opmask = CALLBACK_BIT(op);
if (sz > sizeof lcp->his_callback.msg - 1) {
sz = sizeof lcp->his_callback.msg - 1;
log_Printf(LogWARN, "Truncating option arg to %u octets\n", sz);
log_Printf(LogWARN, "Truncating option arg to %zu octets\n", sz);
}
memcpy(lcp->his_callback.msg, opt->data + 1, sz);
lcp->his_callback.msg[sz] = '\0';

View File

@ -118,7 +118,7 @@ lqr_RecvEcho(struct fsm *fp, struct mbuf *bp)
log_Printf(LogWARN, "lqr_RecvEcho: Got sig 0x%08lx, not 0x%08lx !\n",
(u_long)lqr.signature, (u_long)SIGNATURE);
} else
log_Printf(LogWARN, "lqr_RecvEcho: Got packet size %d, expecting %ld !\n",
log_Printf(LogWARN, "lqr_RecvEcho: Got packet size %zd, expecting %ld !\n",
m_length(bp), (long)sizeof(struct echolqr));
return bp;
}

View File

@ -574,7 +574,7 @@ mp_Assemble(struct mp *mp, struct mbuf *m, struct physical *p)
if (q) {
q = m_pullup(q);
log_Printf(LogDEBUG, "MP: Reassembled frags %lu-%lu, length %d\n",
log_Printf(LogDEBUG, "MP: Reassembled frags %lu-%lu, length %zd\n",
(u_long)first, (u_long)h.seq, m_length(q));
link_PullPacket(&mp->link, MBUF_CTOP(q), q->m_len, mp->bundle);
m_freem(q);
@ -650,7 +650,7 @@ mp_Output(struct mp *mp, struct bundle *bundle, struct link *l,
m = m_prepend(m, prepend, 4, 0);
}
if (log_IsKept(LogDEBUG))
log_Printf(LogDEBUG, "MP[frag %d]: Send %d bytes on link `%s'\n",
log_Printf(LogDEBUG, "MP[frag %d]: Send %zd bytes on link `%s'\n",
mp->out.seq, m_length(m), l->name);
mp->out.seq = inc_seq(mp->peer_is12bit, mp->out.seq);
@ -907,7 +907,8 @@ mp_Enddisc(u_char c, const char *address, size_t len)
break;
case ENDDISC_LOCAL:
snprintf(result, sizeof result, "Local Addr: %.*s", len, address);
snprintf(result, sizeof result, "Local Addr: %.*s", (int)len,
address);
break;
case ENDDISC_IP:
@ -915,7 +916,7 @@ mp_Enddisc(u_char c, const char *address, size_t len)
snprintf(result, sizeof result, "IP %s",
inet_ntoa(*(const struct in_addr *)address));
else
sprintf(result, "IP[%d] ???", len);
sprintf(result, "IP[%zd] ???", len);
break;
case ENDDISC_MAC:
@ -924,7 +925,7 @@ mp_Enddisc(u_char c, const char *address, size_t len)
snprintf(result, sizeof result, "MAC %02x:%02x:%02x:%02x:%02x:%02x",
m[0], m[1], m[2], m[3], m[4], m[5]);
} else
sprintf(result, "MAC[%d] ???", len);
sprintf(result, "MAC[%zd] ???", len);
break;
case ENDDISC_MAGIC:
@ -937,7 +938,7 @@ mp_Enddisc(u_char c, const char *address, size_t len)
break;
case ENDDISC_PSN:
snprintf(result, sizeof result, "PSN: %.*s", len, address);
snprintf(result, sizeof result, "PSN: %.*s", (int)len, address);
break;
default:

View File

@ -428,7 +428,7 @@ physical_DescriptorWrite(struct fdescriptor *d, struct bundle *bundle __unused,
if (errno == EAGAIN)
result = 1;
else if (errno != ENOBUFS) {
log_Printf(LogPHASE, "%s: write (fd %d, len %d): %s\n", p->link.name,
log_Printf(LogPHASE, "%s: write (fd %d, len %zd): %s\n", p->link.name,
p->fd, p->out->m_len, strerror(errno));
datalink_Down(p->dl, CLOSE_NORMAL);
}