Lines Matching refs:output
128 static int alloc_output_file ( size_t max_len, struct output_file *output ) { in alloc_output_file() argument
129 output->len = 0; in alloc_output_file()
130 output->max_len = ( max_len ); in alloc_output_file()
131 output->buf = malloc ( max_len ); in alloc_output_file()
132 if ( ! output->buf ) { in alloc_output_file()
137 memset ( output->buf, 0xff, sizeof ( output->buf ) ); in alloc_output_file()
142 struct output_file *output, in process_zinfo_copy() argument
153 output->len = align ( output->len, copy->align ); in process_zinfo_copy()
154 if ( ( output->len + len ) > output->max_len ) { in process_zinfo_copy()
161 offset, ( offset + len ), output->len, in process_zinfo_copy()
162 ( output->len + len ) ); in process_zinfo_copy()
165 memcpy ( ( output->buf + output->len ), in process_zinfo_copy()
167 output->len += len; in process_zinfo_copy()
172 struct output_file *output, in process_zinfo_pack() argument
184 output->len = align ( output->len, pack->align ); in process_zinfo_pack()
185 if ( output->len > output->max_len ) { in process_zinfo_pack()
191 ( output->buf + output->len ), in process_zinfo_pack()
199 offset, ( offset + len ), output->len, in process_zinfo_pack()
200 ( size_t )( output->len + packed_len ) ); in process_zinfo_pack()
203 output->len += packed_len; in process_zinfo_pack()
204 if ( output->len > output->max_len ) { in process_zinfo_pack()
213 struct output_file *output, in process_zinfo_add() argument
223 if ( ( offset + datasize ) > output->len ) { in process_zinfo_add()
229 target = ( output->buf + offset ); in process_zinfo_add()
230 size = ( align ( output->len, add->divisor ) / add->divisor ); in process_zinfo_add()
286 output->len, add->divisor, val ); in process_zinfo_add()
293 struct output_file *output, in process_zinfo_addb() argument
295 return process_zinfo_add ( input, output, &zinfo->add, 1 ); in process_zinfo_addb()
299 struct output_file *output, in process_zinfo_addw() argument
301 return process_zinfo_add ( input, output, &zinfo->add, 2 ); in process_zinfo_addw()
305 struct output_file *output, in process_zinfo_addl() argument
307 return process_zinfo_add ( input, output, &zinfo->add, 4 ); in process_zinfo_addl()
313 struct output_file *output,
326 struct output_file *output, in process_zinfo() argument
338 return processor->process ( input, output, zinfo ); in process_zinfo()
345 static int write_output_file ( struct output_file *output ) { in write_output_file() argument
346 if ( fwrite ( output->buf, 1, output->len, stdout ) != output->len ) { in write_output_file()
348 output->len, strerror ( errno ) ); in write_output_file()
356 struct output_file output; in main() local
370 if ( alloc_output_file ( ( input.len * 4 ), &output ) < 0 ) in main()
374 if ( process_zinfo ( &input, &output, in main()
379 if ( write_output_file ( &output ) < 0 ) in main()