Fix fwrite/fread params
This commit is contained in:
parent
fd72f658c0
commit
bffdedddb4
@ -109,7 +109,7 @@ bool cpio::exists(const char *name) {
|
|||||||
return entries.count(name) != 0;
|
return entries.count(name) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define do_out(buf, len) pos += fwrite(buf, len, 1, out);
|
#define do_out(buf, len) pos += fwrite(buf, 1, len, out);
|
||||||
#define out_align() do_out(zeros, align_off(pos, 4))
|
#define out_align() do_out(zeros, align_off(pos, 4))
|
||||||
void cpio::dump(FILE *out) {
|
void cpio::dump(FILE *out) {
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
@ -142,7 +142,7 @@ void cpio::dump(FILE *out) {
|
|||||||
}
|
}
|
||||||
// Write trailer
|
// Write trailer
|
||||||
sprintf(header, "070701%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x",
|
sprintf(header, "070701%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x",
|
||||||
inode++, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 11, 0);
|
inode++, 0755, 0, 0, 1, 0, 0, 0, 0, 0, 0, 11, 0);
|
||||||
do_out(header, 110);
|
do_out(header, 110);
|
||||||
do_out("TRAILER!!!\0", 11);
|
do_out("TRAILER!!!\0", 11);
|
||||||
out_align();
|
out_align();
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
// #include <utils.h>
|
|
||||||
|
|
||||||
class stream;
|
class stream;
|
||||||
|
|
||||||
FILE *open_stream(stream *strm);
|
FILE *open_stream(stream *strm);
|
||||||
|
@ -51,11 +51,11 @@ int stream::close() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int filter_stream::read(void *buf, size_t len) {
|
int filter_stream::read(void *buf, size_t len) {
|
||||||
return fread(buf, len, 1, fp);
|
return fread(buf, 1, len, fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
int filter_stream::write(const void *buf, size_t len) {
|
int filter_stream::write(const void *buf, size_t len) {
|
||||||
return fwrite(buf, len, 1, fp);
|
return fwrite(buf, 1, len, fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
int filter_stream::close() {
|
int filter_stream::close() {
|
||||||
|
Loading…
Reference in New Issue
Block a user