Skip to content
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

Windows: json-c 0.17 compatibility with ssize_t type definition #1002

Merged

Conversation

micahsnyder
Copy link
Contributor

json-c 0.17 defines the ssize_t type using a typedef on Windows. We have been setting ssize_t for Windows to a different type using a #define instead of a typedef.

We should have been using a typedef since it is a type. However, we must also match the exact type they're setting it to or else the compiler will baulk because the types are different.

Note: in C11, it's fine to use typedef the same type more than once, so long as you're defining it the same every time.

@micahsnyder micahsnyder force-pushed the CLAM-2422-json-c-0.17-compatibility branch 3 times, most recently from c02404f to 28f71b9 Compare August 24, 2023 21:33
json-c 0.17 defines the ssize_t type using a typedef on Windows.
We have been setting ssize_t for Windows to a different type using
a #define instead of a typedef.

We should have been using a typedef since it is a type.
However, we must also match the exact type they're setting it to or else
the compiler will baulk because the types are different.

Note: in C11, it's fine to use typedef the same type more than once, so
long as you're defining it the same every time.
@micahsnyder micahsnyder force-pushed the CLAM-2422-json-c-0.17-compatibility branch from 28f71b9 to 10903af Compare August 24, 2023 22:18
@micahsnyder
Copy link
Contributor Author

Verbally approved by a teammate that trusts me too much.

Also, I'm happy with the test results.

@micahsnyder micahsnyder merged commit 95df41b into Cisco-Talos:main Aug 25, 2023
22 of 23 checks passed
@micahsnyder micahsnyder deleted the CLAM-2422-json-c-0.17-compatibility branch August 25, 2023 15:56
@micahsnyder micahsnyder added the 🍒cherry-pick-candidate A PR that should be backported once approved. label Oct 19, 2023
@micahsnyder
Copy link
Contributor Author

Probably should have backported this for 1.1 and 1.0. I'll throw together the PR's real quick. Hopefully no conflict.

I'm unsure if the same issue exists with 0.103 with the Visual Studio build. It ... probably does. I'll investigate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒cherry-pick-candidate A PR that should be backported once approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant