set qid.vers (Erik Quanstrom)

This commit is contained in:
rsc 2005-12-29 21:41:54 +00:00
parent adeb5ac9eb
commit 3d484b0d1a
7 changed files with 21 additions and 17 deletions

View file

@ -40,7 +40,7 @@ fmtfdinit(Fmt *f, int fd, char *buf, int size)
f->to = buf;
f->stop = buf + size;
f->flush = __fmtFdFlush;
f->farg = (void*)fd;
f->farg = (void*)(uintptr_t)fd;
f->nfmt = 0;
return 0;
}

View file

@ -27,7 +27,7 @@ __fmtFdFlush(Fmt *f)
int n;
n = (char*)f->to - (char*)f->start;
if(n && write((int)f->farg, f->start, n) != n)
if(n && write((uintptr)f->farg, f->start, n) != n)
return 0;
f->to = f->start;
return 1;

View file

@ -36,7 +36,7 @@ runeFmtStrFlush(Fmt *f)
if(f->start == nil)
return 0;
n = (int)f->farg;
n = (uintptr)f->farg;
n *= 2;
s = (Rune*)f->start;
f->start = realloc(s, sizeof(Rune)*n);
@ -47,7 +47,7 @@ runeFmtStrFlush(Fmt *f)
free(s);
return 0;
}
f->farg = (void*)n;
f->farg = (void*)(uintptr)n;
f->to = (Rune*)f->start + ((Rune*)f->to - s);
f->stop = (Rune*)f->start + n - 1;
return 1;
@ -67,7 +67,7 @@ runefmtstrinit(Fmt *f)
f->to = f->start;
f->stop = (Rune*)f->start + n - 1;
f->flush = runeFmtStrFlush;
f->farg = (void*)n;
f->farg = (void*)(uintptr)n;
f->nfmt = 0;
return 0;
}

View file

@ -30,7 +30,7 @@ sprint(char *buf, char *fmt, ...)
* we must be sure not to overflow a 32-bit pointer.
*/
if(buf+len < buf)
len = -(uint)buf-1;
len = -(uintptr)buf-1;
va_start(args, fmt);
n = vsnprint(buf, len, fmt, args);

View file

@ -36,7 +36,7 @@ fmtStrFlush(Fmt *f)
if(f->start == nil)
return 0;
n = (int)f->farg;
n = (uintptr)f->farg;
n *= 2;
s = (char*)f->start;
f->start = realloc(s, n);
@ -47,7 +47,7 @@ fmtStrFlush(Fmt *f)
free(s);
return 0;
}
f->farg = (void*)n;
f->farg = (void*)(uintptr)n;
f->to = (char*)f->start + ((char*)f->to - s);
f->stop = (char*)f->start + n - 1;
return 1;
@ -67,7 +67,7 @@ fmtstrinit(Fmt *f)
f->to = f->start;
f->stop = (char*)f->start + n - 1;
f->flush = fmtStrFlush;
f->farg = (void*)n;
f->farg = (void*)(uintptr)n;
f->nfmt = 0;
return 0;
}