-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 2015-02-15 um 15:50 schrieb Mark Jansen:
You can make this const (or even static const, not much difference though). Will do, I was just following the style of the RtlIpv4StringToAddressA test function. I recommend to change it to const there as well in a separate patch.
I recommend to add a few more tests: "1.1.1.1" - without a port "256.1.1.1:1" - out of range ip "-1.1.1.1:1" - negative ip "1.1.0.1" - There's a zero in it, should still be valid though. Hex and octal IPs There is already tests for that in the RtlIpv4StringToAddressA test, this testcase is for the port handling. My preference would be to run the full set of tests against both functions (as far as the functionality is there of course), since it's always possible that there is subtly different behavior.
Is there a reason why you didn't just put a IN_ADDR in the test structure? You'll probably need an extra curly brackets around each member of struct S_un_b and one for the union: {{1}, {1}, {1}, {1}} I did not do this because i followed the style of the RtlIpv4StringToAddressA function, and if i would have to guess the extra brackets are precisely the reason. The curly brackets are not really an issue. I suspect that the author of the previous test saw the compiler warning and did not know how to fix it, so he wrote a workaround.
(That said, I have not tried to change this myself. There may be unforseen problems.) If a direct initialization works the way I think it works sending a patch that changes the existing code would be appreciated. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJU4OpYAAoJEN0/YqbEcdMw0uoP/19T794mbuc4/xEKpLHQph97 qqz522GdH1ZqhKeo3krqO0bU3FB7Jy2XIHXcEv/lcj0ibuFADuRx+krhLmPj4Fq3 +6wQr0g6xyRL5BNMe4lwRwmZXs/tT7qiQR96L+fK5Rq5QClnjBUap9LoRgslTlA7 g8dd2bEum8lnyt6yEXkgb0pHKlEd5mQh+5tu42uB0iLSa7vyDFFK/XVxmu/Un8Jx fv8PUbDRoYeOp2Ukxozyrb1qs0Am+biD6zqY4Lji+zzlIXi9s9X/yDusxaGbz/LR JP0eWQYOj41jsFyRPrZRhq7UDJkkKuloaDrwFmallT6RlWQ+CnTkfhpeuR3p2ZUj An4vDqStaVJkGHGF8nMa223eLgb9/PMHPK9ohHETkFH2EzA75ohBIDAuyv2oq3tl 7TDjPLZZ/nRlROkygjRYXM8lsNOEVL3jkvmJnu1WdN0pTItclx8eMCk5TOiTe/ra 1n0dkhGnG9hAPSWSKuPzS8oGw09qk8Qqa9HNrfgR93G2UuIXWkzJJRhAkZK0bRXJ sCXux4p8QNC4QrzeyXza/ZEWfw6jFAVa5E1lCz372NEOMPhgTPeNWVns7xjitnuH rUTRf8WubUPiv/Z7lDo08/n5GW9MYrC4VFmJja/M3Np9dmJyltXu78SPJrE8DsDr FPXv42VRuCx0/VTCQVCk =ebeD -----END PGP SIGNATURE-----