[PATCH 2/2] plugin-factory: Fix pointer to integer cast warnings in MinGW

Biswapriyo Nath <[email protected]> Mon, 25 Oct 2021 19:17:50 +0530
Newsgroups gmane.comp.gnu.global.bugs
Message-ID <CALK-3m+W+79UF_0Z8nJ_zVpTkERtDtysKDywurS2835xPGZ+nQ@mail.gmail.com>
0002-plugin-factory-Fix-pointer-to-integer-cast-warnings-.patch (text/plain, 1.8 KB)
From c01296cedd4ef96f177f2978947e6418d8ab3193 Mon Sep 17 00:00:00 2001
From: Biswapriyo Nath <[email protected]>
Date: Mon, 25 Oct 2021 19:11:46 +0530
Subject: [PATCH 2/2] plugin-factory: Fix pointer to integer cast warnings in MinGW

long is 4 bytes in Win32 platform. Instead, use intptr_t to
cast HANDLE (i.e. void*) type to integer type.

Signed-off-by: Biswapriyo Nath <[email protected]>
---
 plugin-factory/exuberant-ctags.c | 4 ++--
 plugin-factory/pygments-parser.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/plugin-factory/exuberant-ctags.c b/plugin-factory/exuberant-ctags.c
index b3d233b..e84afd2 100644
--- a/plugin-factory/exuberant-ctags.c
+++ b/plugin-factory/exuberant-ctags.c
@@ -152,8 +152,8 @@ start_ctags(const struct parser_param *param)
 	CloseHandle(ipipe[1]);
 	CloseHandle(pi.hThread);
 	pid = pi.hProcess;
-	op = fdopen(_open_osfhandle((long)opipe[1], _O_WRONLY), "w");
-	ip = fdopen(_open_osfhandle((long)ipipe[0], _O_RDONLY), "r");
+	op = fdopen(_open_osfhandle((intptr_t)opipe[1], _O_WRONLY), "w");
+	ip = fdopen(_open_osfhandle((intptr_t)ipipe[0], _O_RDONLY), "r");
 	if (ip == NULL || op == NULL)
 		param->die("fdopen failed.");
 
diff --git a/plugin-factory/pygments-parser.c b/plugin-factory/pygments-parser.c
index 4ba6506..5900ba8 100644
--- a/plugin-factory/pygments-parser.c
+++ b/plugin-factory/pygments-parser.c
@@ -131,8 +131,8 @@ start_process(const struct parser_param *param)
 	CloseHandle(ipipe[1]);
 	CloseHandle(pi.hThread);
 	pid = pi.hProcess;
-	op = fdopen(_open_osfhandle((long)opipe[1], _O_WRONLY), "w");
-	ip = fdopen(_open_osfhandle((long)ipipe[0], _O_RDONLY), "r");
+	op = fdopen(_open_osfhandle((intptr_t)opipe[1], _O_WRONLY), "w");
+	ip = fdopen(_open_osfhandle((intptr_t)ipipe[0], _O_RDONLY), "r");
 	if (ip == NULL || op == NULL)
 		param->die("fdopen failed.");
 
-- 
2.33.0