Skip to content

Fix incompatible pointer type in Windows code (nacl_host_dir.c)#29

Open
illwieckz wants to merge 1 commit into
masterfrom
illwieckz/incompatible-pointers
Open

Fix incompatible pointer type in Windows code (nacl_host_dir.c)#29
illwieckz wants to merge 1 commit into
masterfrom
illwieckz/incompatible-pointers

Conversation

@illwieckz

@illwieckz illwieckz commented Jun 26, 2026

Copy link
Copy Markdown
Member

Fixes:

src/shared/platform/win/nacl_host_dir.c:43:30: error: passing argument 1 of 'FindFirstFileA' from incompatible pointer type [-Wincompatible-pointer-types]
   43 |   d->handle = FindFirstFile(d->pattern, &d->find_data);
      |                             ~^~~~~~~~~
      |                              |
      |                              wchar_t * {aka short unsigned int *}

src/shared/platform/win/nacl_host_dir.c:220:34: error: passing argument 2 of 'FindNextFileA' from incompatible pointer type [-Wincompatible-pointer-types]
  220 |     if (!FindNextFile(d->handle, &d->find_data)) {
      |                                  ^~~~~~~~~~~~~
      |                                  |
      |                                  WIN32_FIND_DATAW *

I reproduced it with MinGW from Debian 13.2 Trixie.
I didn't reproduced it with MinGW from Ubuntu 24.04.4 Noble.

I noticed it while working on implementing the NaCl loader build in Dæmon's external deps:

Fixes:

src/shared/platform/win/nacl_host_dir.c:43:30: error: passing argument 1 of 'FindFirstFileA' from incompatible pointer type [-Wincompatible-pointer-types]
   43 |   d->handle = FindFirstFile(d->pattern, &d->find_data);
      |                             ~^~~~~~~~~
      |                              |
      |                              wchar_t * {aka short unsigned int *}

src/shared/platform/win/nacl_host_dir.c:220:34: error: passing argument 2 of 'FindNextFileA' from incompatible pointer type [-Wincompatible-pointer-types]
  220 |     if (!FindNextFile(d->handle, &d->find_data)) {
      |                                  ^~~~~~~~~~~~~
      |                                  |
      |                                  WIN32_FIND_DATAW *
@illwieckz illwieckz changed the title nacl_host_dir: fix incompatible pointer type win/nacl_host_dir: fix incompatible pointer type Jun 26, 2026
@illwieckz illwieckz mentioned this pull request Jun 26, 2026
@illwieckz illwieckz changed the title win/nacl_host_dir: fix incompatible pointer type Fix incompatible pointer type in Windows code Jun 26, 2026
@illwieckz illwieckz force-pushed the illwieckz/incompatible-pointers branch from 28fc8b3 to 241d782 Compare June 26, 2026 10:07
@slipher

slipher commented Jun 26, 2026

Copy link
Copy Markdown
Member

Probably a UNICODE define is missing in your build system port. Anyway using the macros or the UNICODE define is stupid; better to use the explicit W or A prefix, so LGTM.

@illwieckz illwieckz changed the title Fix incompatible pointer type in Windows code Fix incompatible pointer type in Windows code (nacl_host_dir.c) Jun 27, 2026
@illwieckz illwieckz force-pushed the illwieckz/incompatible-pointers branch from 241d782 to e9f8d4d Compare June 27, 2026 00:13
@illwieckz

Copy link
Copy Markdown
Member Author

Thanks (the recent push is just me editing the commit message, no change to the patch).

I caught some more:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants