void CL_ZipFileHeader::save(CL_IODevice &output)
{
	CL_String8 str_filename;
	CL_String8 str_comment;
	if (general_purpose_bit_flag & CL_ZIP_USE_UTF8)
	{
		str_filename = CL_StringHelp::text_to_utf8(filename);
		str_comment = CL_StringHelp::text_to_utf8(file_comment);
	}
	else
	{
		str_filename = CL_StringHelp::text_to_cp437(filename);
		str_comment = CL_StringHelp::text_to_cp437(file_comment);
	}

	file_name_length = str_filename.length();
	file_comment_length = str_comment.length();

	output.write_int32(signature);
	output.write_int16(version_made_by);
	output.write_int16(version_needed_to_extract);
	output.write_int16(general_purpose_bit_flag);
	output.write_int16(compression_method);
	output.write_int16(last_mod_file_time);
	output.write_int16(last_mod_file_date);
	output.write_uint32(crc32);
	output.write_int32(compressed_size);
	output.write_int32(uncompressed_size);
	output.write_int16(file_name_length);
	output.write_int16(extra_field_length);
	output.write_int16(file_comment_length);
	output.write_int16(disk_number_start);
	output.write_int16(internal_file_attributes);
	output.write_int32(external_file_attributes);
	output.write_int32(relative_offset_of_local_header);
	output.write(str_filename.data(), file_name_length);
	output.write(extra_field.get_data(), extra_field_length);
	output.write(file_comment.data(), file_comment_length);
}
Esempio n. 2
0
void CustomIOFunctions::write( png_structp png_ptr, png_bytep data, png_size_t length )
{
	CL_IODevice *iodev = (CL_IODevice*)png_get_io_ptr(png_ptr);
	iodev->write(data, length);
}