ref: 772afbe98c7e74be35e7e5318967ce594e4d93e8
parent: 9c99d0c8d3236b87bd292ac29d4d1b2d5f550bd5
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Wed Jan 6 23:44:13 EST 2016
format pointer subtraction results with %zd instead of %ld (for long -> intptr on amd64)
--- a/sys/src/9/ip/esp.c
+++ b/sys/src/9/ip/esp.c
@@ -511,7 +511,7 @@
payload = BLEN(bp) - vers.hdrlen - ecb->ahlen;
if(payload <= 0 || payload % 4 != 0 || payload % ecb->espblklen != 0) {
qunlock(c);
- netlog(f, Logesp, "esp: bad length %I -> %I!%lud payload=%d BLEN=%lud\n",
+ netlog(f, Logesp, "esp: bad length %I -> %I!%lud payload=%d BLEN=%zd\n",
vers.raddr, vers.laddr, vers.spi, payload, BLEN(bp));
freeb(bp);
return;
--- a/sys/src/9/pc/archmp.c
+++ b/sys/src/9/pc/archmp.c
@@ -310,7 +310,7 @@
*/
while(p < e) switch(*p){
default:
- print("pcmpinit: unknown PCMP type 0x%uX (e-p 0x%luX)\n",
+ print("pcmpinit: unknown PCMP type 0x%uX (e-p 0x%zuX)\n",
*p, e-p);
while(p < e){
print("%uX ", *p);
--- a/sys/src/9/pc/etherrt2860.c
+++ b/sys/src/9/pc/etherrt2860.c
@@ -2658,7 +2658,7 @@
p = pool->p + pool->i * TxwiDmaSz;
w = (Wifipkt*)(p + Txwisize);
if(ctlr->wifi->debug){
- print("transmit: %E->%E,%E nodeid=%x txq[%d]=%d size=%ld\n", w->a2, w->a1, w->a3, nodeid, qid, ctlr->tx[qid].i, BLEN(outb));
+ print("transmit: %E->%E,%E nodeid=%x txq[%d]=%d size=%zd\n", w->a2, w->a1, w->a3, nodeid, qid, ctlr->tx[qid].i, BLEN(outb));
}
tx->i = (tx->i + 1) % Ntx;
--- a/sys/src/9/port/devaoe.c
+++ b/sys/src/9/port/devaoe.c
@@ -2141,7 +2141,7 @@
case Crd:
case Crdext:
if(BLEN(b) - (Aoehsz + Aoeatasz) != n){
- eventlog("%æ: misread blen %ld expect %d\n",
+ eventlog("%æ: misread blen %zd expect %d\n",
d, BLEN(b), n);
goto bail;
}
@@ -2159,7 +2159,7 @@
break;
case Cid:
if(BLEN(b) - (Aoehsz + Aoeatasz) < 512){
- eventlog("%æ: runt identify blen %ld expect %d\n",
+ eventlog("%æ: runt identify blen %zd expect %d\n",
d, BLEN(b), 512 + Aoehsz + Aoeatasz);
goto bail;
}
--- a/sys/src/9/port/devtls.c
+++ b/sys/src/9/port/devtls.c
@@ -1115,7 +1115,7 @@
/* return at most what was asked for */
b = qgrab(&tr->processed, n);
-if(tr->debug) pprint("consumed processed %ld\n", BLEN(b));
+if(tr->debug) pprint("consumed processed %zd\n", BLEN(b));
if(tr->debug) pdump(BLEN(b), b->rp, "consumed:");
qunlock(&tr->in.io);
poperror();
@@ -1272,7 +1272,7 @@
nexterror();
}
qlock(&out->io);
-if(tr->debug)pprint("send %ld\n", BLEN(b));
+if(tr->debug)pprint("send %zd\n", BLEN(b));
if(tr->debug)pdump(BLEN(b), b->rp, "sent:");
--- a/sys/src/9/port/proc.c
+++ b/sys/src/9/port/proc.c
@@ -1362,7 +1362,7 @@
for(rq = &runq[Nrq-1]; rq >= runq; rq--){
if(rq->head == nil)
continue;
- print("rq%ld:", rq-runq);
+ print("rq%zd:", rq-runq);
for(p = rq->head; p != nil; p = p->rnext)
print(" %lud(%lud)", p->pid, m->ticks - p->readytime);
print("\n");
--- a/sys/src/cmd/9nfs/9p.c
+++ b/sys/src/cmd/9nfs/9p.c
@@ -130,7 +130,7 @@
*(f->owner) = 0;
f->owner = 0;
}
- chat("%ld...", f - s->fids);
+ chat("%zd...", f - s->fids);
f->tstale = nfstime + staletime;
return f;
}
@@ -153,7 +153,7 @@
void
putfid(Session *s, Fid *f)
{
- chat("putfid %ld...", f-s->fids);
+ chat("putfid %zd...", f-s->fids);
if(s == 0 || f == 0){
clog("putfid(0x%p, 0x%p) %s", s, f, (s ? s->service : "?"));
return;
--- a/sys/src/cmd/9nfs/nfs.c
+++ b/sys/src/cmd/9nfs/nfs.c
@@ -330,7 +330,7 @@
newxf->urfid = nfid;
nfid->owner = &newxf->urfid;
}else if(newxf->urfid){
- chat("old xfid %ld...", newxf->urfid-s->fids);
+ chat("old xfid %zd...", newxf->urfid-s->fids);
clunkfid(s, nfid);
}else{
newxf->urfid = nfid;
--- a/sys/src/cmd/9nfs/nfsmount.c
+++ b/sys/src/cmd/9nfs/nfsmount.c
@@ -159,7 +159,7 @@
xp->name = "/";
xf = xfid("none", xp, 1);
xf->urfid = f;
- clog("service=%s uid=%s fid=%ld\n",
+ clog("service=%s uid=%s fid=%zd\n",
s->service, xf->uid, xf->urfid - s->fids);
if(tail)
tail->next = s;
--- a/sys/src/cmd/9nfs/string.c
+++ b/sys/src/cmd/9nfs/string.c
@@ -57,7 +57,7 @@
for(bin = stab; bin < stab+STRHASH; bin++)
for(x=*bin; x; x=x->next)
- fprint(fd, "%ld %s\n", bin-stab, x->str);
+ fprint(fd, "%zd %s\n", bin-stab, x->str);
}
static long
--- a/sys/src/cmd/aux/astarld.c
+++ b/sys/src/cmd/aux/astarld.c
@@ -255,7 +255,7 @@
cpl->dlen = cpl->bytes[0];
if(cpl->dlen + 5 != up - cpl->bytes){
- fprint(2, "%d %ld\n", cpl->dlen + 5, up - cpl->bytes);
+ fprint(2, "%d %zd\n", cpl->dlen + 5, up - cpl->bytes);
return "bad data length";
}
--- a/sys/src/cmd/cfs/inode.c
+++ b/sys/src/cmd/cfs/inode.c
@@ -225,7 +225,7 @@
/*
* init inode and write to disk
*/
- DPRINT(2, "new file %llud.%ld ino %ld\n",
+ DPRINT(2, "new file %llud.%ld ino %zd\n",
qid.path, qid.vers, m - ic->map);
b = ialloc(ic, m - ic->map);
b->inode.inuse = m->inuse = 1;
--- a/sys/src/cmd/cifs/netbios.c
+++ b/sys/src/cmd/cifs/netbios.c
@@ -465,7 +465,7 @@
fprint(2, "\n");
for(; p < end; p++){
if((p - (uchar *)buf) % 16 == 0)
- fprint(2, "\n%06lx\t", p - (uchar *)buf);
+ fprint(2, "\n%06zx\t", p - (uchar *)buf);
if(isprint((char)*p))
fprint(2, "%c ", (char )*p);
else
--- a/sys/src/cmd/cwfs/juke.c
+++ b/sys/src/cmd/cwfs/juke.c
@@ -212,7 +212,7 @@
delay(100);
}
if(chatty)
- fprint(2, "\tload r%ld drive %Z\n", v-w->side, w->drive[drive]);
+ fprint(2, "\tload r%zd drive %Z\n", v-w->side, w->drive[drive]);
if(mmove(w, w->mt0, v->elem, w->dt0+drive, v->rot)) {
qunlock(w);
goto sbad;
@@ -398,7 +398,7 @@
goto loop;
}
if(chatty)
- fprint(2, "\tunload r%ld drive %Z\n",
+ fprint(2, "\tunload r%zd drive %Z\n",
v-w->side, w->drive[drive]);
if(mmove(w, w->mt0, w->dt0+drive, v->elem, v->rot)) {
qunlock(v);
@@ -1319,7 +1319,7 @@
if(v->status == Sstart && t > v->time) {
drive = v->drive;
if(chatty)
- fprint(2, "\ttime r%ld drive %Z\n",
+ fprint(2, "\ttime r%zd drive %Z\n",
v-w->side, w->drive[drive]);
mmove(w, w->mt0, w->dt0+drive, v->elem, v->rot);
v->status = Sunload;
--- a/sys/src/cmd/ip/httpd/sendfd.c
+++ b/sys/src/cmd/ip/httpd/sendfd.c
@@ -324,7 +324,7 @@
hprint(hout, "Server: Plan9\r\n");
hprint(hout, "Date: %D\r\n", time(nil));
hprint(hout, "Content-Type: text/html\r\n");
- hprint(hout, "Content-Length: %lud\r\n", s - c->xferbuf);
+ hprint(hout, "Content-Length: %zud\r\n", s - c->xferbuf);
if(c->head.closeit)
hprint(hout, "Connection: close\r\n");
else if(!http11(c))
--- a/sys/src/cmd/ip/ppp/mppc.c
+++ b/sys/src/cmd/ip/ppp/mppc.c
@@ -851,7 +851,7 @@
return;
}
p += 2;
-netlog("off = %ld ", p-s->his);
+netlog("off = %zd ", p-s->his);
iph = (Iphdr*)p;
len = nhgets(iph->length);
ipcheck(p, len);
--- a/sys/src/cmd/ip/ppp/ppp.c
+++ b/sys/src/cmd/ip/ppp/ppp.c
@@ -473,7 +473,7 @@
if(ppp->ctcp)
compress_error(ppp->ctcp);
ppp->in.discards++;
- netlog("ppp: discard len %ld/%ld cksum %ux (%ux %ux %ux %ux)\n",
+ netlog("ppp: discard len %zd/%zd cksum %ux (%ux %ux %ux %ux)\n",
BLEN(b), BLEN(buf), fcs, b->rptr[0],
b->rptr[1], b->rptr[2], b->rptr[3]);
}
@@ -506,7 +506,7 @@
b->rptr += 4;
}
- netlog("ppp: putframe 0x%ux %ld\n", proto, b->wptr-b->rptr);
+ netlog("ppp: putframe 0x%ux %zd\n", proto, BLEN(b));
/* add in the protocol and address, we'd better have left room */
from = b->rptr;
@@ -2272,7 +2272,7 @@
m = (Lcpmsg*)b->rptr;
len = 4;
if(BLEN(b) < 4 || BLEN(b) < (len = nhgets(m->len))){
- syslog(0, LOG, "short pap message (%ld < %d)", BLEN(b), len);
+ syslog(0, LOG, "short pap message (%zd < %d)", BLEN(b), len);
freeb(b);
return;
}
--- a/sys/src/cmd/ip/snoopy/hdlc.c
+++ b/sys/src/cmd/ip/snoopy/hdlc.c
@@ -155,7 +155,7 @@
/* accept if this is a good packet */
if(fcs != PPP_goodfcs)
- print("bad frame %ld %2.2ux %2.2ux!\n", to-pkt, pkt[0], pkt[1]);
+ print("bad frame %zd %2.2ux %2.2ux!\n", to-pkt, pkt[0], pkt[1]);
else
return to-pkt;
}
--- a/sys/src/cmd/ip/snoopy/ttls.c
+++ b/sys/src/cmd/ip/snoopy/ttls.c
@@ -76,7 +76,7 @@
m->p = seprint(m->p, m->e, " totallen=%1d", NetL(h->ln));
/* these are not in the header, just print them for our convenience */
- m->p = seprint(m->p, m->e, " dataln=%1ld", m->pe - m->ps);
+ m->p = seprint(m->p, m->e, " dataln=%1zd", m->pe - m->ps);
if ((h->flags & (FlagL|FlagS|FlagM)) == 0 && m->ps == m->pe)
m->p = seprint(m->p, m->e, " ack");
--- a/sys/src/cmd/jpg/ico.c
+++ b/sys/src/cmd/jpg/ico.c
@@ -304,7 +304,7 @@
xor += 4*ncolor;
end = xor + icon->h*4*((icon->bits*icon->w+31)/32);
if(end < buf || end > buf+icon->len){
- werrstr("bad icon length %lux != %lux", end - buf, icon->len);
+ werrstr("bad icon length %zux != %lux", end - buf, icon->len);
return -1;
}
--- a/sys/src/cmd/ndb/convM2DNS.c
+++ b/sys/src/cmd/ndb/convM2DNS.c
@@ -486,7 +486,7 @@
if (type == Tcname && sp->p - data == 2 && len == 0)
return rp;
if (len > sp->p - data){
- dnslog("bad %s RR len (%d bytes nominal, %lud actual): %R",
+ dnslog("bad %s RR len (%d bytes nominal, %zud actual): %R",
rrname(type, ptype, sizeof ptype), len,
sp->p - data, rp);
rrfree(rp);
--- a/sys/src/cmd/nusb/disk/disk.c
+++ b/sys/src/cmd/nusb/disk/disk.c
@@ -156,7 +156,7 @@
fmtstrinit(&fmt);
fmtprint(&fmt, "dev %s\n", dev->dir);
- fmtprint(&fmt, "lun %ld\n", lun - &ums->lun[0]);
+ fmtprint(&fmt, "lun %zd\n", lun - &ums->lun[0]);
if(lun->flags & Finqok)
fmtprint(&fmt, "inquiry %s\n", lun->inq);
if(lun->blocks > 0)
--- a/sys/src/cmd/plot/plot.c
+++ b/sys/src/cmd/plot/plot.c
@@ -564,7 +564,7 @@
case TEXT: strarg(); text(argstr); pplots=0; break;
case VEC: numargs(2); vec(x[0], x[1]); break;
default:
- sysfatal("%s:%d: plot: missing case %ld\n", fsp->name, fsp->lineno, pplots-plots);
+ sysfatal("%s:%d: plot: missing case %zd\n", fsp->name, fsp->lineno, pplots-plots);
}
}
return 1;
--- a/sys/src/cmd/ssh/msg.c
+++ b/sys/src/cmd/ssh/msg.c
@@ -102,7 +102,7 @@
void
unrecvmsg(Conn *c, Msg *m)
{
- debug(DBG_PROTO, "unreceived %s len %ld\n", msgnames[m->type], m->ep - m->rp);
+ debug(DBG_PROTO, "unreceived %s len %zd\n", msgnames[m->type], m->ep - m->rp);
free(c->unget);
c->unget = m;
}
@@ -171,7 +171,7 @@
Msg *m;
while((m = recvmsg0(c)) != nil){
- debug(DBG_PROTO, "received %s len %ld\n", msgnames[m->type], m->ep - m->rp);
+ debug(DBG_PROTO, "received %s len %zd\n", msgnames[m->type], m->ep - m->rp);
if(m->type != SSH_MSG_DEBUG && m->type != SSH_MSG_IGNORE)
break;
if(m->type == SSH_MSG_DEBUG)
--- a/sys/src/cmd/tcs/tcs.c
+++ b/sys/src/cmd/tcs/tcs.c
@@ -378,7 +378,7 @@
c = table[*p];
if(c < 0){
if(squawk)
- EPR "%s: bad char 0x%x near byte %ld in %s\n", argv0, *p, ninput+(p-e), file);
+ EPR "%s: bad char 0x%x near byte %zd in %s\n", argv0, *p, ninput+(p-e), file);
nerrors++;
if(clean)
continue;
--- a/sys/src/cmd/telco/telco.c
+++ b/sys/src/cmd/telco/telco.c
@@ -1418,7 +1418,7 @@
close(fd);
/* open connection through the file system interface */
- sprint(file, "/net/telco/%ld/data", d - dev);
+ sprint(file, "/net/telco/%zd/data", d - dev);
fd = open(file, ORDWR);
if(fd < 0){
syslog(0, LOGFILE, "can't open %s: %r", file);
--- a/sys/src/cmd/upas/bayes/dfa.c
+++ b/sys/src/cmd/upas/bayes/dfa.c
@@ -688,13 +688,13 @@
nc = 0;
for(i=0; i<p->ninst; i++)
nc += p->inst[i].nc;
- Bprint(b, "%d %d %ld %ld %ld %ld\n", p->ninst, nc,
+ Bprint(b, "%d %d %zd %zd %zd %zd\n", p->ninst, nc,
p->start[0]-p->inst, p->start[1]-p->inst,
p->start[2]-p->inst, p->start[3]-p->inst);
for(i=0; i<p->ninst; i++){
Bprint(b, "%d %d %d", p->inst[i].isfinal, p->inst[i].isloop, p->inst[i].nc);
for(j=0; j<p->inst[i].nc; j++)
- Bprint(b, " %d %ld", p->inst[i].c[j].start, p->inst[i].c[j].next-p->inst);
+ Bprint(b, " %d %zd", p->inst[i].c[j].start, p->inst[i].c[j].next-p->inst);
Bprint(b, "\n");
}
}
--- a/sys/src/cmd/upas/bayes/msgtok.c
+++ b/sys/src/cmd/upas/bayes/msgtok.c
@@ -117,7 +117,7 @@
n = m[2];
if(n <= 0){
fprint(2, "«%s» %.2ux", p, p[0]);
- sysfatal("no regexps matched at %ld", off + (p-msg));
+ sysfatal("no regexps matched at %zd", off + (p-msg));
}
if(m[0] >= m[1] && m[0] >= m[2]){
--- a/sys/src/cmd/upas/fs/mbox.c
+++ b/sys/src/cmd/upas/fs/mbox.c
@@ -1382,7 +1382,7 @@
else
date = "";
- sprint(lenstr, "%ld", m->end-m->start);
+ sprint(lenstr, "%zd", m->end-m->start);
if(biffing && !delete)
print("[ %s / %s / %s ]\n", from, subject, lenstr);
--- a/sys/src/cmd/venti/srv/buildindex.c
+++ b/sys/src/cmd/venti/srv/buildindex.c
@@ -736,7 +736,7 @@
zerorange(part, bucket2offset(is, lastb+1), bucket2offset(is, is->stop - is->start));
if(n != mb->nwentry)
- fprint(2, "sortminibuffer bug: n=%ud nwentry=%ud have=%ld\n", n, mb->nwentry, (ep-buf)/IEntrySize);
+ fprint(2, "sortminibuffer bug: n=%ud nwentry=%ud have=%zd\n", n, mb->nwentry, (ep-buf)/IEntrySize);
free(buckdata);
}
--- a/sys/src/cmd/venti/srv/fixarenas.c
+++ b/sys/src/cmd/venti/srv/fixarenas.c
@@ -1628,7 +1628,7 @@
}
if(ci >= eci || cit < ecit){
print("ran out of space editing existing directory; rewriting\n");
- print("# eci %ld ci %ld ecit %ld cit %ld\n", eci-bci, ci-bci, ecit-bcit, cit-bcit);
+ print("# eci %zd ci %zd ecit %zd cit %zd\n", eci-bci, ci-bci, ecit-bcit, cit-bcit);
assert(smart); /* can't happen second time thru */
smart = 0;
goto Again;
--- a/sys/src/cmd/venti/srv/unwhack.c
+++ b/sys/src/cmd/venti/srv/unwhack.c
@@ -156,7 +156,8 @@
off++;
if(off > d - dst){
- snprint(uw->err, WhackErrLen, "offset out of range: off=%d d=%ld len=%d nbits=%d", off, d - dst, len, uwnbits);
+ snprint(uw->err, WhackErrLen, "offset out of range: off=%d d=%zd len=%d nbits=%d",
+ off, d - dst, len, uwnbits);
return -1;
}
if(d + len > dmax){
--- a/sys/src/cmd/webfs/fs.c
+++ b/sys/src/cmd/webfs/fs.c
@@ -84,7 +84,7 @@
static Client client[64];
static int nclient;
-#define CLIENTID(c) (((Client*)(c)) - client)
+#define CLIENTID(c) ((int)(((Client*)(c)) - client))
Client*
newclient(void)
@@ -222,7 +222,7 @@
d->length = strlen(((Key*)aux)->val);
break;
case Qclient:
- snprint(buf, sizeof(buf), "%ld", CLIENTID(aux));
+ snprint(buf, sizeof(buf), "%d", CLIENTID(aux));
d->name = estrdup(buf);
break;
case Qctl:
@@ -530,7 +530,7 @@
respond(r, nil);
return;
case Qctl:
- snprint(buf, sizeof(buf), "%ld\n", CLIENTID(f->client));
+ snprint(buf, sizeof(buf), "%d\n", CLIENTID(f->client));
goto String;
case Qheader:
snprint(buf, sizeof(buf), "%s", f->key->val);
--- a/sys/src/libaml/aml.c
+++ b/sys/src/libaml/aml.c
@@ -833,9 +833,9 @@
r = p;
e = r->ref;
if(c == 'A')
- return fmtprint(f, "Arg%ld=%V", r->ptr - e->arg, *r->ptr);
+ return fmtprint(f, "Arg%zd=%V", r->ptr - e->arg, *r->ptr);
if(c == 'L')
- return fmtprint(f, "Local%ld=%V", r->ptr - e->loc, *r->ptr);
+ return fmtprint(f, "Local%zd=%V", r->ptr - e->loc, *r->ptr);
case 'n':
return fmtprint(f, "%s", (char*)p);
case 's':
@@ -901,7 +901,7 @@
print("\n*** dumpregs: PC=%p FP=%p\n", PC, FP);
e = nil;
for(f = FP; f >= FB; f--){
- print("%.8p.%.2lx: %-8s %N\t", f->start, f-FB, f->phase, f->dot);
+ print("%.8p.%.2zx: %-8s %N\t", f->start, f-FB, f->phase, f->dot);
if(f->op)
print("%s", f->op->name);
print("(");
@@ -950,7 +950,7 @@
if((++loop & 127) == 0)
gc();
if(amldebug)
- print("\n%.8p.%.2lx %-8s\t%N\t", PC, FP - FB, FP->phase, FP->dot);
+ print("\n%.8p.%.2zx %-8s\t%N\t", PC, FP - FB, FP->phase, FP->dot);
r = nil;
c = *FP->phase++;
switch(c){
--- a/sys/src/libflate/deflate.c
+++ b/sys/src/libflate/deflate.c
@@ -478,7 +478,7 @@
lzput(lz, lz->eof && !lz->avail, 1);
if(lz->debug){
- fprint(2, "block: bytes=%lud entries=%ld extra bits=%d\n\tuncompressed=%lud fixed=%lud dynamic=%lud huffman=%lud\n",
+ fprint(2, "block: bytes=%lud entries=%zd extra bits=%d\n\tuncompressed=%lud fixed=%lud dynamic=%lud huffman=%lud\n",
nunc, lzb->eparse - lzb->parse, lzb->excost, (nunc + 4) * 8, nfix, ndyn, nhuff);
fprint(2, "\tnlit=%lud matches=%lud eof=%d\n", nlits, nmatches, lz->eof && !lz->avail);
}