Skip to content

Fix ESP8266NetBIOS to compile with lwip V2 #3823

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

Merged
merged 5 commits into from
Nov 17, 2017
Merged

Fix ESP8266NetBIOS to compile with lwip V2 #3823

merged 5 commits into from
Nov 17, 2017

Conversation

luc-github
Copy link
Contributor

No description provided.

@luc-github luc-github changed the title Fix to compile with lwip V2 Fix ESP8266NetBIOS to compile with lwip V2 Nov 12, 2017
@devyte
Copy link
Collaborator

devyte commented Nov 17, 2017

@d-a-v this looks correct to me, but could you please give it a look?

@d-a-v
Copy link
Collaborator

d-a-v commented Nov 17, 2017

It WorksForMe in both version.

I have a proposal:
<ip_addr.h> defines ip_addr in v1.4 and ip_addr_t in both lwip.
so why not use it.

--- a/libraries/ESP8266NetBIOS/ESP8266NetBIOS.h
+++ b/libraries/ESP8266NetBIOS/ESP8266NetBIOS.h
@@ -3,7 +3,8 @@
 #define __ESPNBNS_h__
 
 extern "C" {
-#include "lwip/init.h" // LWIP_VERSION_
+#include <lwip/init.h> // LWIP_VERSION_
+#include <lwip/ip_addr.h>
 }
 #include <ESP8266WiFi.h>
 
@@ -18,12 +19,6 @@ extern "C" {
 
 struct udp_pcb;
 struct pbuf;
-#if LWIP_VERSION_MAJOR == 1 
-struct ip_addr;
-#else
-struct ip4_addr;
-typedef ip4_addr_t ip_addr_t;
-#endif
 
 class ESP8266NetBIOS
 {

And since the .cpp is also updated, for the WallWextra guys, I propose this too:

--- a/libraries/ESP8266NetBIOS/ESP8266NetBIOS.cpp
+++ b/libraries/ESP8266NetBIOS/ESP8266NetBIOS.cpp
@@ -146,7 +146,7 @@ bool ESP8266NetBIOS::begin(const char *name)
     }
 
     // presuneme jmeno zarizeni se soucasnou upravou na UPPER case
-    for (int i = 0; i < n; ++i) {
+    for (size_t i = 0; i < n; ++i) {
         _name[i] = toupper(name[i]);
     }
     _name[n] = '\0';
@@ -180,6 +180,9 @@ void ESP8266NetBIOS::_recv(udp_pcb *upcb, pbuf *pb, ip_addr_t *addr, uint16_t po
 void ESP8266NetBIOS::_recv(udp_pcb *upcb, pbuf *pb, const ip_addr_t *addr, uint16_t port)
 #endif
 {
+    (void)upcb;
+    (void)addr;
+    (void)port;
     while(pb != NULL) {
         uint8_t * data = (uint8_t*)((pb)->payload);
         size_t len = pb->len;

@Pablo2048
Copy link

ok, so I can translate all comments to english :-) ...

@devyte
Copy link
Collaborator

devyte commented Nov 17, 2017

@luc-github can you please update the PR with the suggestions?

@devyte devyte merged commit bec6a4d into esp8266:master Nov 17, 2017
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

Successfully merging this pull request may close these issues.

4 participants