Skip to content

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

Merged
val-ms merged 1 commit intoCisco-Talos:mainfrom
val-ms:CLAM-2422-json-c-0.17-compatibility
Aug 25, 2023
Merged

Windows: json-c 0.17 compatibility with ssize_t type definition#1002
val-ms merged 1 commit intoCisco-Talos:mainfrom
val-ms:CLAM-2422-json-c-0.17-compatibility

Conversation

@val-ms
Copy link
Contributor

@val-ms val-ms commented Aug 18, 2023

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.

@val-ms val-ms 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.
@val-ms val-ms force-pushed the CLAM-2422-json-c-0.17-compatibility branch from 28f71b9 to 10903af Compare August 24, 2023 22:18
@val-ms
Copy link
Contributor Author

val-ms commented Aug 25, 2023

Verbally approved by a teammate that trusts me too much.

Also, I'm happy with the test results.

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

val-ms commented Oct 19, 2023

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