From f4969c2f804d04c44bbcff1c35f0b57749571db9 Mon Sep 17 00:00:00 2001 From: Bruno Lopes Date: Tue, 31 Mar 2026 22:16:25 -0300 Subject: [PATCH] plug-ins: Use fopen_s on Windows to fix CRT_INSECURE_DEPRECATE warns --- plug-ins/file-bmp/generate-huffman.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/plug-ins/file-bmp/generate-huffman.c b/plug-ins/file-bmp/generate-huffman.c index 5fbeae5cb2..b6ccfebecf 100644 --- a/plug-ins/file-bmp/generate-huffman.c +++ b/plug-ins/file-bmp/generate-huffman.c @@ -64,10 +64,22 @@ main (int argc, char *argv[]) { file = stdout; } - else if (! (file = fopen (argv[1], "w"))) + else { - perror (argv[1]); - return 1; +#ifndef _UCRT + if (! (file = fopen (argv[1], "w"))) + { + perror (argv[1]); + return 1; + } +#else + if (fopen_s (&file, argv[1], "w") != 0) + { + file = NULL; + perror (argv[1]); + return 1; + } +#endif } } else