winspool: Define copy_file() only if CUPS is available.

Avoid unused function warnings.
This commit is contained in:
Zebediah Figura 2022-12-01 23:29:29 -06:00 committed by Alexandre Julliard
parent aac8ae7300
commit d69cdbf103

View file

@ -161,29 +161,6 @@ static NTSTATUS process_attach( void *args )
#endif /* SONAME_LIBCUPS */
}
static BOOL copy_file( const char *src, const char *dst )
{
int fds[2] = { -1, -1 }, num;
char buf[1024];
BOOL ret = FALSE;
fds[0] = open( src, O_RDONLY );
fds[1] = open( dst, O_CREAT | O_TRUNC | O_WRONLY, 0666 );
if (fds[0] == -1 || fds[1] == -1) goto fail;
while ((num = read( fds[0], buf, sizeof(buf) )) != 0)
{
if (num == -1) goto fail;
if (write( fds[1], buf, num ) != num) goto fail;
}
ret = TRUE;
fail:
if (fds[1] != -1) close( fds[1] );
if (fds[0] != -1) close( fds[0] );
return ret;
}
static char *get_unix_file_name( LPCWSTR path )
{
UNICODE_STRING nt_name;
@ -246,6 +223,29 @@ static BOOL cups_is_scanner( cups_dest_t *dest )
return cups_get_printer_type( dest ) & 0x2000000 /* CUPS_PRINTER_SCANNER */;
}
static BOOL copy_file( const char *src, const char *dst )
{
int fds[2] = { -1, -1 }, num;
char buf[1024];
BOOL ret = FALSE;
fds[0] = open( src, O_RDONLY );
fds[1] = open( dst, O_CREAT | O_TRUNC | O_WRONLY, 0666 );
if (fds[0] == -1 || fds[1] == -1) goto fail;
while ((num = read( fds[0], buf, sizeof(buf) )) != 0)
{
if (num == -1) goto fail;
if (write( fds[1], buf, num ) != num) goto fail;
}
ret = TRUE;
fail:
if (fds[1] != -1) close( fds[1] );
if (fds[0] != -1) close( fds[0] );
return ret;
}
static http_status_t cupsGetPPD3_wrapper( http_t *http, const char *name, time_t *modtime,
char *buffer, size_t bufsize )
{