Nmap Development mailing list archives
[Patch] nsock issues in MSVC
From: Gisle Vanem <gvanem () broadpark no>
Date: Thu, 02 May 2013 10:03:25 +0200
As hinted in a previous message, here are 2 more fixes to C99 (?) issues with MSVC v16. E.g. nsock_iod.c compiled as pure C (not C++) fails on lines like:
for (i = 0; i < 3 && nsi->events_pending > 0; i++) { for (current = evlist_ar[i]; current != NULL; current = next) { next = GH_LIST_ELEM_NEXT(current); msevent *nse = (msevent *)GH_LIST_ELEM_DATA(current);You cannot have declarations after code in MSVC. Hence here are 2 patches for that case:
--- SVN-Latest\nsock\src\nsock_iod.c Thu Apr 25 10:06:26 2013 +++ nsock\src\nsock_iod.c Tue Apr 30 16:31:58 2013 @@ -205,8 +205,9 @@ for (i = 0; i < 3 && nsi->events_pending > 0; i++) { for (current = evlist_ar[i]; current != NULL; current = next) { + msevent *nse; next = GH_LIST_ELEM_NEXT(current); - msevent *nse = (msevent *)GH_LIST_ELEM_DATA(current); + nse = (msevent *)GH_LIST_ELEM_DATA(current); /* we're done with this list of events for the current IOD */ if (nse->iod != nsi) --- SVN-Latest\nsock\src\nsock_pcap.c Thu Apr 25 10:06:26 2013 +++ nsock\src\nsock_pcap.c Tue Apr 30 16:32:53 2013 @@ -103,6 +103,7 @@ va_list ap; int failed, datalink; char *e; + int to_ms; gettimeofday(&nsock_tod, NULL); @@ -112,13 +113,13 @@ /* MacOsX reports error if to_ms is too big (like INT_MAX) with error * FAILED. Reported error: BIOCSRTIMEOUT: Invalid argument * INT_MAX/6 (=357913941) seems to be working... */ - int to_ms = 357913941; + to_ms = 357913941; #else - int to_ms = 200; + to_ms = 200; #endif /* PCAP_BSD_SELECT_HACK */ #else - int to_ms = 1; + to_ms = 1; #endif if (mp) --------------------------- --gv _______________________________________________ Sent through the dev mailing list http://nmap.org/mailman/listinfo/dev Archived at http://seclists.org/nmap-dev/
Current thread:
- [Patch] nsock issues in MSVC Gisle Vanem (May 02)
- Re: [Patch] nsock issues in MSVC Henri Doreau (May 02)