hirotakaster / CoAP-simple-library

Other
111 stars 48 forks source link

esp32.ino example does not compile (v1.3.13) #9

Closed sauvant closed 3 years ago

sauvant commented 5 years ago

Compiling fails for me with: coap-simple.cpp: In member function bool Coap::loop()

coap-simple.cpp: 239:43: error: statement has no effect [-Werror=unused-value] packet.options[optionIndex] coap-simple.cpp: 267:55: warning: converting to non-pointer type 'char' from NULL [-Wconversion-null] urlname[packet.options[i].length] = NULL coap-simple.cpp: In member function uint16_t Coap::sendResponse(IPAddress, int, uint16_t)

coap-simple.cpp: 298:1: error: no return statement in function returning non-void [-Werror=return-type] coap-simple.cpp: In member function uint16_t Coap::sendResponse(IPAddress, int, uint16_t, char*)

coap-simple.cpp: 302:1: error: no return statement in function returning non-void [-Werror=return-type] coap-simple.cpp: In member function uint16_t Coap::sendResponse(IPAddress, int, uint16_t, char*, int)

coap-simple.cpp: 306:1: error: no return statement in function returning non-void [-Werror=return-type] cc1plus.exe*: some warnings being treated as errors Error compiling libraries

I am running Visual Studio 2017 with vMicro, compiling for an ESP32 Dev Module.

Is that a known issue?

Best regards and thanks for your great work! Keith

hirotakaster commented 5 years ago

Hi @sauvant ,

Sorry I do not compile with Visual Studio 2017, I check with Arduino IDE, VScode(PlatformIO). I think your compile error problem is maybe based on VS 2017(vMicro).

Thank you, Hirotaka

sauvant commented 5 years ago

Hi Hirotaka,

You are right: it compiles in the Aduino IDE. But that is due to the fact, that its compiler ignores some issues... In my opinion there are two things to change:

Line 239: packet.options[optionIndex] <- can be deleted? What is the purpose of this line?

Lines 297, 301, 305: this->sendResponse(...) -> return this->sendResponse(...)

This version compiles in VS as well. What do you think?

Best regards, Keith

hirotakaster commented 5 years ago

Hi @sauvant ,

packet.options[optionIndex] <- can be deleted? What is the purpose of this line? https://github.com/hirotakaster/CoAP-simple-library/blob/1bfe4c2808401c383ed3334d04b08793118e5213/coap-simple.cpp#L250

Yes, this line could delete.

this->sendResponse(...) -> return this->sendResponse(...)

oh, you are right! If you send me a pull-request for kind, I will merge this.

Thank you, Hirotaka

rauno56 commented 3 years ago

This was fixed in https://github.com/hirotakaster/CoAP-simple-library/commit/a976d69b381e781c503d925fa68b9f55183e1eb3 and can be closed.