compareUdpRow() was already performing the byte-swaps but compareIpAddrRow() and compareIpForwardRow() need them too.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- The byte order was fixed in compareUdpRow() for bug 52224: https://bugs.winehq.org/show_bug.cgi?id=52224
There is no specific test for this but adding traces showed that the other two comparison functions were also operating on the wrong byte order. --- dlls/inetmib1/main.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/dlls/inetmib1/main.c b/dlls/inetmib1/main.c index d19648ff792..d5bcc45a1e9 100644 --- a/dlls/inetmib1/main.c +++ b/dlls/inetmib1/main.c @@ -773,9 +773,11 @@ static void oidToIpAddrRow(AsnObjectIdentifier *oid, void *dst) static int __cdecl compareIpAddrRow(const void *a, const void *b) { const MIB_IPADDRROW *rowA = a, *rowB = b; + ULONG addrA = ntohl( rowA->dwAddr ); + ULONG addrB = ntohl( rowB->dwAddr );
- return rowA->dwAddr < rowB->dwAddr ? -1 : /* avoids overflows */ - rowA->dwAddr > rowB->dwAddr ? 1 : + return addrA < addrB ? -1 : /* avoids overflows */ + addrA > addrB ? 1 : 0; }
@@ -868,9 +870,11 @@ static void oidToIpForwardRow(AsnObjectIdentifier *oid, void *dst) static int __cdecl compareIpForwardRow(const void *a, const void *b) { const MIB_IPFORWARDROW *rowA = a, *rowB = b; + ULONG addrA = ntohl( rowA->dwForwardDest ); + ULONG addrB = ntohl( rowB->dwForwardDest );
- return rowA->dwForwardDest < rowB->dwForwardDest ? -1 : /* avoids overflows */ - rowA->dwForwardDest > rowB->dwForwardDest ? 1 : + return addrA < addrB ? -1 : /* avoids overflows */ + addrA > addrB ? 1 : 0; }