LiamBindle / MQTT-C

A portable MQTT C client for embedded systems and PCs alike.
https://liambindle.ca/MQTT-C
MIT License
774 stars 275 forks source link

Fixed Wall compiler warnings #47

Closed daanpape closed 5 years ago

daanpape commented 5 years ago

While compiling MQTT-C in an application on OpenWRT linux the compiler stopped me with two warnings in the source code. The first warning was that the function mqtt_fixed_header_rule_violation in mqtt.c was not declared. As this function is only used as a helper in the parser below I declared this function static.

In the file mqtt_pal.c a pointer was declared const twice which also rised a compiler warning.

As I'm compiling with Wall this prevented me from compiling MQTT-C, this pull request fixes the problem.

LiamBindle commented 5 years ago

Thanks for the PR! Those changes sound good. The only one I'm going to take a closer look at is the double const declaration. The intention is that both the pointer and it's contents are const. I can't remember the proper way to do that right now, but if you do feel free to add that. I guess the most important thing is that the data is const which it is in our change, but I'm going to check if there's a way to make the pointer const too (my C is a bit rusty right now). I'll probably get to this this weekend.

Thanks again for the PR! :smile: