Ejemplo n.º 1
0
void put_32_be(uint32_t value, FILE *outfile)
{
    unsigned char buf[4];
    write_32_be(value, buf);
    size_t bytes_written = fwrite(buf, 1, 4, outfile);
    CHECK_FILE(bytes_written != 4, outfile, "fwrite");
}
Ejemplo n.º 2
0
void put_32_le(uint32_t value, FILE *infile)
{
    unsigned char bufTemp[4], buf[4];
    write_32_be(value, bufTemp);
	for (int i = 0; i < 4; i++)
		buf[3-i] = bufTemp[i];
    size_t bytes_written = fwrite(buf, 1, 4, infile);
    CHECK_FILE(bytes_written != 4, infile, "fwrite");
}
Ejemplo n.º 3
0
void fix_file_sizes(FILE *outfile, const long offset, struct cpk_file *file, int i)
{
    long file_size_off = query_utf_offset(outfile, offset, file[i].index, "FileSize");
    long extract_size_off = query_utf_offset(outfile, offset, file[i].index, "ExtractSize");
    unsigned char size_buf[4];
    write_32_be(file[i].new_size, size_buf);
    replace_data(outfile, file_size_off, size_buf, 4);
    replace_data(outfile, extract_size_off, size_buf, 4);
    printf("%s changed in size by %ld bytes\n", file[i].filename, (long)(file[i].new_size-file[i].orig_size));
}