Skip to content

[FIX] Change inet_ntop to inet_ntoa for Windows XP compatibility - #1165

Merged
canihavesomecoffee merged 2 commits into
CCExtractor:masterfrom
jshin313:xp
Dec 30, 2019
Merged

[FIX] Change inet_ntop to inet_ntoa for Windows XP compatibility#1165
canihavesomecoffee merged 2 commits into
CCExtractor:masterfrom
jshin313:xp

Conversation

@jshin313

@jshin313 jshin313 commented Dec 30, 2019

Copy link
Copy Markdown
Contributor

In raising this pull request, I confirm the following (please check boxes):

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.
  • I have mentioned this change in the changelog.

My familiarity with the project is as follows (check one):

  • I have never used CCExtractor.
  • I have used CCExtractor just a couple of times.
  • I absolutely love CCExtractor, but have not contributed previously.
  • I am an active contributor to CCExtractor.

#1116
The change allows the command-line version of ccextractor to be built for Windows XP and run on it as well. The following occurs without the changes because inet_ntop() is not supported on Windows XP.
image

CCX was built on a Windows 10 machine using Visual Studio 2017 targeted for Windows XP and then run on a Windows XP VM. Visual Studio 2019 doesn't support targeting for Windows XP.

@ccextractor-bot

Copy link
Copy Markdown
Collaborator

CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results:

Report Name Tests Passed
Broken 12/13
DVB 3/7
DVR-MS 2/2
General 27/27
Hauppage 3/3
MP4 3/3
NoCC 10/10
Teletext 14/21
WTV 13/13
XDS 34/34
CEA-708 14/14
DVD 3/3
Options 86/86

It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you).

Your PR breaks these cases:


Check the result page for more info.

@canihavesomecoffee
canihavesomecoffee merged commit 0954b47 into CCExtractor:master Dec 30, 2019
@jshin313
jshin313 deleted the xp branch December 31, 2019 02:56
Comment thread src/lib_ccx/networking.c

int i;
char ip[50] = "";
char ip[15];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say we are one short here (3*4 for digits + 3 for dots + final zero)
Also it would be good to have that as a constant rather than appear twice as a magic number

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@canihavesomecoffee canihavesomecoffee Dec 31, 2019

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to create a PR for this today/tomorrow, yes, please :)

@jshin313 jshin313 Jan 1, 2020

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I use the INET_ADDRSTRLEN constant? The <netinet/in.h> POSIX®header file says the constant is 16 bytes. But the Windows version is 22 bytes

// Maximum length of address literals (potentially including a port number)
// generated by any address-to-string conversion routine.  This length can
// be used when declaring buffers used with getnameinfo, WSAAddressToString,
// inet_ntoa, etc.  We just provide one define, rather than one per api,
// to avoid confusion.
//
// The totals are derived from the following data:
//  15: IPv4 address
//  45: IPv6 address including embedded IPv4 address
//  11: Scope Id
//   2: Brackets around IPv6 address when port is present
//   6: Port (including colon)
//   1: Terminating null byte
//
#define INET_ADDRSTRLEN  22

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a good idea to me to use a built-in constant :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is a portable built-in constant it's definitely best to use it.
If there isn't one define your own, but really there's nothing wrong with being generous - a few bytes wasted is much much better than an unexpected buffer overrun. Just add a comment next to the definition so the reader doesn't have to figure out where a magic number comes from.

@jshin313
jshin313 restored the xp branch January 1, 2020 01:42
@jshin313
jshin313 deleted the xp branch January 1, 2020 01:43
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