Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
433990d6
Commit
433990d6
authored
Feb 09, 2020
by
Alex Henrie
Committed by
Alexandre Julliard
Feb 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iphlpapi/tests: Build rotating buffers into ntoa and ntoa6.
Signed-off-by:
Alex Henrie
<
alexhenrie24@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
71affb28
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
25 deletions
+17
-25
iphlpapi.c
dlls/iphlpapi/tests/iphlpapi.c
+17
-25
No files found.
dlls/iphlpapi/tests/iphlpapi.c
View file @
433990d6
...
...
@@ -169,28 +169,25 @@ static void freeIPHlpApi(void)
/* replacement for inet_ntoa */
static
const
char
*
ntoa
(
DWORD
ip
)
{
static
char
buffer
[
40
];
static
char
buffers
[
4
][
16
];
static
int
i
=
-
1
;
ip
=
htonl
(
ip
);
sprintf
(
buffer
,
"%u.%u.%u.%u"
,
(
ip
>>
24
)
&
0xff
,
(
ip
>>
16
)
&
0xff
,
(
ip
>>
8
)
&
0xff
,
ip
&
0xff
);
return
buffer
;
i
=
(
i
+
1
)
%
ARRAY_SIZE
(
buffers
);
sprintf
(
buffers
[
i
],
"%u.%u.%u.%u"
,
(
ip
>>
24
)
&
0xff
,
(
ip
>>
16
)
&
0xff
,
(
ip
>>
8
)
&
0xff
,
ip
&
0xff
);
return
buffers
[
i
];
}
static
const
char
*
ntoa6
(
IN6_ADDR
*
ip
)
{
static
char
buffer
[
40
];
char
*
buf
=
buffer
;
static
char
buffer
s
[
4
]
[
40
];
static
int
i
=
-
1
;
unsigned
short
*
p
=
ip
->
u
.
Word
;
unsigned
int
i
=
0
;
while
(
i
<
8
)
{
if
(
i
>
0
)
*
buf
++
=
':'
;
buf
+=
sprintf
(
buf
,
"%x"
,
htons
(
p
[
i
])
);
i
++
;
}
return
buffer
;
i
=
(
i
+
1
)
%
ARRAY_SIZE
(
buffers
);
sprintf
(
buffers
[
i
],
"%x:%x:%x:%x:%x:%x:%x:%x"
,
htons
(
p
[
0
]),
htons
(
p
[
1
]),
htons
(
p
[
2
]),
htons
(
p
[
3
]),
htons
(
p
[
4
]),
htons
(
p
[
5
]),
htons
(
p
[
6
]),
htons
(
p
[
7
])
);
return
buffers
[
i
];
}
/*
...
...
@@ -382,8 +379,6 @@ static void testGetIpForwardTable(void)
trace
(
"IP forward table: %u entries
\n
"
,
buf
->
dwNumEntries
);
for
(
i
=
0
;
i
<
buf
->
dwNumEntries
;
i
++
)
{
char
buffer
[
100
];
if
(
!
U1
(
buf
->
table
[
i
]).
dwForwardDest
)
/* Default route */
{
todo_wine
...
...
@@ -403,9 +398,8 @@ todo_wine
* value so it is not worth testing in this case. */
}
sprintf
(
buffer
,
"dest %s"
,
ntoa
(
buf
->
table
[
i
].
dwForwardDest
));
sprintf
(
buffer
+
strlen
(
buffer
),
" mask %s"
,
ntoa
(
buf
->
table
[
i
].
dwForwardMask
));
trace
(
"%u: %s gw %s if %u type %u proto %u
\n
"
,
i
,
buffer
,
trace
(
"%u: dest %s mask %s gw %s if %u type %u proto %u
\n
"
,
i
,
ntoa
(
buf
->
table
[
i
].
dwForwardDest
),
ntoa
(
buf
->
table
[
i
].
dwForwardMask
),
ntoa
(
buf
->
table
[
i
].
dwForwardNextHop
),
buf
->
table
[
i
].
dwForwardIfIndex
,
U1
(
buf
->
table
[
i
]).
dwForwardType
,
U1
(
buf
->
table
[
i
]).
dwForwardProto
);
}
...
...
@@ -890,12 +884,10 @@ static void testGetTcpTable(void)
trace
(
"TCP table: %u entries
\n
"
,
buf
->
dwNumEntries
);
for
(
i
=
0
;
i
<
buf
->
dwNumEntries
;
i
++
)
{
char
buffer
[
40
];
sprintf
(
buffer
,
"local %s:%u"
,
ntoa
(
buf
->
table
[
i
].
dwLocalAddr
),
ntohs
(
buf
->
table
[
i
].
dwLocalPort
)
);
trace
(
"%u: %s remote %s:%u state %u
\n
"
,
i
,
buffer
,
ntoa
(
buf
->
table
[
i
].
dwRemoteAddr
),
ntohs
(
buf
->
table
[
i
].
dwRemotePort
),
U
(
buf
->
table
[
i
]).
dwState
);
trace
(
"%u: local %s:%u remote %s:%u state %u
\n
"
,
i
,
ntoa
(
buf
->
table
[
i
].
dwLocalAddr
),
ntohs
(
buf
->
table
[
i
].
dwLocalPort
),
ntoa
(
buf
->
table
[
i
].
dwRemoteAddr
),
ntohs
(
buf
->
table
[
i
].
dwRemotePort
),
U
(
buf
->
table
[
i
]).
dwState
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment