tools: Use flush_output_buffer() in a few more places.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2022-01-19 10:55:08 +01:00
parent 318822d258
commit 49326cb258
2 changed files with 3 additions and 16 deletions

View File

@ -276,7 +276,6 @@ void add_output_to_resources( const char *type, const char *name )
void flush_output_resources( const char *name )
{
int fd;
unsigned int i;
/* all output must have been saved with add_output_to_resources() first */
@ -294,19 +293,13 @@ void flush_output_resources( const char *name )
put_dword( 0 ); /* Version */
put_dword( 0 ); /* Characteristics */
fd = open( name, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666 );
if (fd == -1) error( "Error creating %s\n", name );
if (write( fd, output_buffer, output_buffer_pos ) != output_buffer_pos)
error( "Error writing to %s\n", name );
for (i = 0; i < nb_resources; i++)
{
if (write( fd, resources[i].data, resources[i].size ) != resources[i].size)
error( "Error writing to %s\n", name );
put_data( resources[i].data, resources[i].size );
free( resources[i].data );
}
close( fd );
flush_output_buffer( name );
nb_resources = 0;
free( output_buffer );
}
/* pointer-sized word */

View File

@ -623,7 +623,6 @@ void output_res_o_file( DLLSPEC *spec )
{
unsigned int i;
char *res_file = NULL;
int fd;
struct strarray args;
if (!spec->nb_resources) fatal_error( "--resources mode needs at least one resource file as input\n" );
@ -673,12 +672,7 @@ void output_res_o_file( DLLSPEC *spec )
}
res_file = get_temp_file_name( output_file_name, ".res" );
if ((fd = open( res_file, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0600 )) == -1)
fatal_error( "Cannot create %s\n", res_file );
if (write( fd, output_buffer, output_buffer_pos ) != output_buffer_pos)
fatal_error( "Error writing to %s\n", res_file );
close( fd );
free( output_buffer );
flush_output_buffer( res_file );
args = find_tool( "windres", NULL );
strarray_add( &args, "-i" );