[PATCH 0/1] MR1652: winspool: Define copy_file() only if CUPS is available.
Avoid unused function warnings. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/1652
From: Zebediah Figura <zfigura(a)codeweavers.com> Avoid unused function warnings. --- dlls/winspool.drv/cups.c | 46 ++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/dlls/winspool.drv/cups.c b/dlls/winspool.drv/cups.c index 6d2d9fa1c8e..ccb64325e7b 100644 --- a/dlls/winspool.drv/cups.c +++ b/dlls/winspool.drv/cups.c @@ -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 ) { -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/1652
This merge request was approved by Huw Davies. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/1652
This merge request was approved by Piotr Caban. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/1652
participants (4)
-
Huw Davies (@huw) -
Piotr Caban (@piotr) -
Zebediah Figura -
Zebediah Figura (@zfigura)