From 5b77d39672aca33416be95c685295e49ecb9f457 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Tue, 5 Apr 2022 17:30:16 +0900 Subject: Fix API break. * src/posix-fd-t.inc.h (assuan_fd_from_posix_fd): Revert. * src/w32-fd-t.inc.h (assuan_fd_from_posix_fd): Revert. * src/system-w32.c (assuan_fd_from_posix_fd): Revert. -- Note that assuan_fd_from_posix_fd is exposed inline function. Fixes-commit: 28a40a298661877e1bbeb3eb9ac58a85bdd85b02 Signed-off-by: NIIBE Yutaka --- src/posix-fd-t.inc.h | 5 +++++ src/system-w32.c | 10 ---------- src/w32-fd-t.inc.h | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/posix-fd-t.inc.h b/src/posix-fd-t.inc.h index b9d8dd2..832c4fa 100644 --- a/src/posix-fd-t.inc.h +++ b/src/posix-fd-t.inc.h @@ -24,5 +24,10 @@ typedef int assuan_fd_t; #define ASSUAN_INVALID_FD (-1) #define ASSUAN_INVALID_PID ((pid_t) -1) +static GPG_ERR_INLINE assuan_fd_t +assuan_fd_from_posix_fd (int fd) +{ + return fd; +} ##EOF## diff --git a/src/system-w32.c b/src/system-w32.c index 08b93e2..c49d485 100644 --- a/src/system-w32.c +++ b/src/system-w32.c @@ -403,16 +403,6 @@ build_w32_commandline (assuan_context_t ctx, const char * const *argv, } -static assuan_fd_t -assuan_fd_from_posix_fd (int fd) -{ - if (fd < 0) - return ASSUAN_INVALID_FD; - else - return (assuan_fd_t) _get_osfhandle (fd); -} - - int __assuan_spawn (assuan_context_t ctx, pid_t *r_pid, const char *name, const char **argv, diff --git a/src/w32-fd-t.inc.h b/src/w32-fd-t.inc.h index 4e3e66b..bc3df28 100644 --- a/src/w32-fd-t.inc.h +++ b/src/w32-fd-t.inc.h @@ -28,5 +28,20 @@ typedef void *assuan_fd_t; #define ASSUAN_INVALID_FD ((void*)(-1)) #define ASSUAN_INVALID_PID ((pid_t) -1) +#if GPGRT_HAVE_PRAGMA_GCC_PUSH +# pragma GCC push_options +# pragma GCC diagnostic ignored "-Wbad-function-cast" +#endif +static GPG_ERR_INLINE assuan_fd_t +assuan_fd_from_posix_fd (int fd) +{ + if (fd < 0) + return ASSUAN_INVALID_FD; + else + return (assuan_fd_t) _get_osfhandle (fd); +} +#if GPGRT_HAVE_PRAGMA_GCC_PUSH +# pragma GCC pop_options +#endif ##EOF## -- cgit v1.2.1