From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 1411242FD5 for ; Tue, 17 May 2022 15:07:02 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7AC4068B329; Tue, 17 May 2022 18:07:00 +0300 (EEST) Received: from msg-6.mailo.com (ip-16.mailobj.net [213.182.54.16]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 21D2868B23C for ; Tue, 17 May 2022 18:06:53 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1652800012; bh=VRUY2tWzwVJaQkgk98cDa2ofYLFP5czfj5qrkDhM63U=; h=X-EA-Auth:From:To:Date:Subject:MIME-Version:X-Mailer:Message-ID: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=fYUZ816gKtl+5dU9LjzT+XqA0/rBPBg3zgv9NxBMOSlLQUVpdFzdoLzL0wkBAo86o /cpA+eHK2d1oJJDTO3FjvgQp05bRt7u2B/78vzha94EqC9awhIhGQNabrqcUmv2vp5 5UWyK58bqEvD2qQJ2BYLW3yj9xVjp5APaCxhx0GQ= Received: by www-7.mailo.com with http webmail; Tue, 17 May 2022 17:06:52 +0200 (CEST) X-EA-Auth: 6XIQzJXJvABAq0hpJwdkJ9N3E5Ra8kGo08iOczbK5bRPq2JVj8/fD7kRmYp8QJalpNJa15BbgytIvCWB1Jp9GaDuezT18NMM From: nil-admirari@mailo.com To: ffmpeg-devel@ffmpeg.org Date: Tue, 17 May 2022 17:06:52 +0200 (CEST) X-Priority: 3 MIME-Version: 1.0 X-Mailer: COMS/EA21.01/r20220415 Message-ID: In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH v2 1/2] avutil/wchar_filename, file_open: Support long file names on Windows X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: > stat wasn't already defined as win32_stat. > win32_stat was already defined but not mapped. That's what my change > does. There are two defines in os_support.h: # ifdef stat # undef stat # endif # define stat _stati64 and DEF_FS_FUNCTION2(stat, _wstati64, _stati64, struct stat*) which defines win32_stat (not stat). This function takes struct stat*, which due to previous define expands into struct _stati64*. _stati64 and _wstati64 both take struct _stati64*, which is named identically to the first function. struct _stati64 expands into different structs depending on the value of _USE_32BIT_TIME_T, which your explicit structure definition does not capture, see: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/stat-functions?view=msvc-170. If someone defines_USE_32BIT_TIME_T, your code will fail to compile. C allows functions and structs to have identical names, preprocessor does not; therefore win32_stat must be used explicitly where stat is required as in file.c:160 struct stat st; // expands into struct _stati64 on Windows. # ifndef _WIN32 ret = stat(filename, &st); # else ret = win32_stat(filename, &st); # endif However, no everyone follows: img2dec.c:504 and ipfsgateway.c:104 use plain stat. if (stat(filename, &img_stat)) { stat_ret = stat(ipfs_full_data_folder, &st); In these files, on Windows, both the struct and the function call expand into _stati64, and this time the function call bypasses the UTF-8 to wchar conversion. Apparently yet another macro is necessary: #ifdef _WIN32 #define ff_stat win32_stat #else #define ff_stat stat #endif _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".