-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix UWP build #611
fix UWP build #611
Conversation
BY_HANDLE_FILE_INFORMATION is not defined when WINSTORECOMPAT is not set (in mingw-w64 and never in MSVC). follow up to 7dfcd73
With plain mingw build, I get:
Maybe enclose the info1|2 stuff in braces to avoid that? |
Also, there seems to be an I suggest something like the following, on top of your patch. (formatting excluded deliberately.) diff --git a/src/share/grabbag/file.c b/src/share/grabbag/file.c
index 652ef70..d20f9b8 100644
--- a/src/share/grabbag/file.c
+++ b/src/share/grabbag/file.c
@@ -143,6 +143,8 @@ FLAC__bool grabbag__file_are_same(const char *f1, const char *f2)
h2 = CreateFile_utf8(f2, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if(h1 == INVALID_HANDLE_VALUE || h2 == INVALID_HANDLE_VALUE)
ok = 0;
+ else
+ {
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
BY_HANDLE_FILE_INFORMATION info1, info2;
ok &= GetFileInformationByHandle(h1, &info1);
@@ -159,7 +161,9 @@ FLAC__bool grabbag__file_are_same(const char *f1, const char *f2)
GetFileInformationByHandleEx(h2, FileIdInfo, &id_info2, sizeof (id_info2)) &&
id_info1.VolumeSerialNumber == id_info2.VolumeSerialNumber &&
memcmp(&id_info1.FileId, &id_info2.FileId, sizeof(id_info1.FileId)) == 0;
+
#endif // !WINAPI_PARTITION_DESKTOP
+ }
if(h1 != INVALID_HANDLE_VALUE)
CloseHandle(h1);
if(h2 != INVALID_HANDLE_VALUE) |
Sure it's possible, but it's just a warning. Any modern C compiler (including that one) understands this. I can completely refactor the code to support C89 or K&R C, but is that really supposed to be supported when targeting Windows ? I can understand it may be needed for some embedded platform, but I doubt it on Windows. Is there a minimum requirement for the C standard supported ? There doesn't seem to be any set in the autoconf or CMake files. The configure.ac says this:
|
What makes you think that ? The documentation doesn't say that:
And this code executes just fine and return FALSE on both case:
Also this is out of the scope of what this MR is fixing. |
Closing this as it's an issue in |
BTW this line in a public header says it assumes that C99 headers are present: Line 36 in 6571cbb
It would be a good idea to set that minimum in the CMake and autotools projects. |
Here is some discussion about supporting C89 with some C99 headers: #483 I'd like to keep the assumptions about C standard version as compatible as possible (within reason) as libFLAC is used in quite a few embedded applications as well. In that case, that means C89, with the exception of some headers. stdint.h and stdbool.h shouldn't be too hard to "emulate". FWIW I also think it is good practice (or at least part of the coding style) to not mix declarations and code. |
If you want to make sure this compatibility doesn't break, you should enforce it in CMake with |
BY_HANDLE_FILE_INFORMATION
is not defined whenWINSTORECOMPAT
is not defined (in mingw-w64 and never in MSVC).follow up to 7dfcd73