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

Runtime Error in MQTTPacket_formatPayload Due to char Type Not Defaulting to Unsigned in MSVC 193833134 (Visual Studio 2022) #1565

Open
liuyuanlins opened this issue Jan 17, 2025 · 0 comments

Comments

@liuyuanlins
Copy link

liuyuanlins commented Jan 17, 2025

Issue Description:

Compilation Environment: Visual Studio 2022
Compiler Version: MSVC 193833134

In the file paho.mqtt.c\src\MQTTPacket.c, the function:

int MQTTPacket_formatPayload(int buflen, char* buf, int payloadlen, char* payload)

at line 863:

if (isprint(payload[i]))

the isprint causes an error during debugging with the isprint function. This is because the compiler does not default the char type to unsigned, as shown in the attached image.

Image
convert isclype.cpp Line: 36 Expression:c>=-1&&c<= 255

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

No branches or pull requests

1 participant