Check return value of fwrite() calls.

This is to satisfy GCC 4.3.2 (on Ubuntu 8.10), which requires it.
This commit is contained in:
Rich Scott 2008-12-01 16:53:34 -07:00
parent a3c8a0460d
commit f13bf44e87

View File

@ -215,21 +215,21 @@ get(object o, unsigned offsetInWords)
void void
write1(Context* c, uint8_t v) write1(Context* c, uint8_t v)
{ {
fwrite(&v, 1, 1, c->out); size_t n UNUSED = fwrite(&v, 1, 1, c->out);
} }
void void
write4(Context* c, uint32_t v) write4(Context* c, uint32_t v)
{ {
uint8_t b[] = { v >> 24, (v >> 16) & 0xFF, (v >> 8) & 0xFF, v & 0xFF }; uint8_t b[] = { v >> 24, (v >> 16) & 0xFF, (v >> 8) & 0xFF, v & 0xFF };
fwrite(b, 4, 1, c->out); size_t n UNUSED = fwrite(b, 4, 1, c->out);
} }
void void
writeString(Context* c, int8_t* p, unsigned size) writeString(Context* c, int8_t* p, unsigned size)
{ {
write4(c, size); write4(c, size);
fwrite(p, size, 1, c->out); size_t n UNUSED = fwrite(p, size, 1, c->out);
} }
unsigned unsigned