Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
f11c071d
Commit
f11c071d
authored
Feb 12, 2007
by
Damien Fouilleul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- win32 replacements for inet_pton/inet_ntop
parent
8b8ea5e9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
8 deletions
+23
-8
modules/access_output/udp.c
modules/access_output/udp.c
+11
-7
modules/services_discovery/sap.c
modules/services_discovery/sap.c
+12
-1
No files found.
modules/access_output/udp.c
View file @
f11c071d
...
@@ -648,30 +648,34 @@ static const char *MakeRandMulticast (int family, char *buf, size_t buflen)
...
@@ -648,30 +648,34 @@ static const char *MakeRandMulticast (int family, char *buf, size_t buflen)
#ifdef AF_INET6
#ifdef AF_INET6
case
AF_INET6
:
case
AF_INET6
:
{
{
struct
in6_addr
addr
;
struct
sockaddr_in6
addr
;
memset
(
&
addr
,
0
,
sizeof
(
addr
));
memcpy
(
&
addr
,
"
\xff\x38\x00\x00
"
"
\x00\x00\x00\x00
"
memcpy
(
&
addr
,
"
\xff\x38\x00\x00
"
"
\x00\x00\x00\x00
"
"
\x00\x00\x00\x00
"
,
12
);
"
\x00\x00\x00\x00
"
,
12
);
rand
|=
0x80000000
;
rand
|=
0x80000000
;
memcpy
(
addr
.
s6_addr
+
12
,
&
(
uint32_t
){
htonl
(
rand
)
},
4
);
memcpy
(
addr
.
s
in6_addr
.
s
6_addr
+
12
,
&
(
uint32_t
){
htonl
(
rand
)
},
4
);
#if defined(WIN32) || defined(UNDER_CE)
#if defined(WIN32) || defined(UNDER_CE)
if
(
0
==
WSAAddressToStringA
((
LPSOCKADDR
)
&
addr
,
sizeof
(
struct
in6_addr
),
NULL
,
buf
,
&
buflen
)
)
addr
.
sin6_family
=
AF_INET6
;
if
(
0
==
WSAAddressToStringA
((
LPSOCKADDR
)
&
addr
,
sizeof
(
struct
sockaddr_in6
),
NULL
,
buf
,
&
buflen
)
)
{
{
buf
[
buflen
]
=
'\0'
;
buf
[
buflen
]
=
'\0'
;
return
buf
;
return
buf
;
}
}
return
NULL
;
return
NULL
;
#else
#else
return
inet_ntop
(
family
,
&
addr
,
buf
,
buflen
);
return
inet_ntop
(
family
,
&
(
addr
.
sin_addr
)
,
buf
,
buflen
);
#endif
#endif
}
}
#endif
#endif
case
AF_INET
:
case
AF_INET
:
{
{
struct
in_addr
addr
;
struct
sockaddr_in
addr
;
addr
.
s_addr
=
htonl
((
rand
&
0xffffff
)
|
0xe8000000
);
memset
(
&
addr
,
0
,
sizeof
(
addr
));
addr
.
sin_addr
.
s_addr
=
htonl
((
rand
&
0xffffff
)
|
0xe8000000
);
#if defined(WIN32) || defined(UNDER_CE)
#if defined(WIN32) || defined(UNDER_CE)
if
(
0
==
WSAAddressToStringA
((
LPSOCKADDR
)
&
addr
,
sizeof
(
struct
in_addr
),
NULL
,
buf
,
&
buflen
)
)
addr
.
sin_family
=
AF_INET
;
if
(
0
==
WSAAddressToStringA
((
LPSOCKADDR
)
&
addr
,
sizeof
(
struct
sockaddr_in
),
NULL
,
buf
,
&
buflen
)
)
{
{
buf
[
buflen
]
=
'\0'
;
buf
[
buflen
]
=
'\0'
;
return
buf
;
return
buf
;
...
...
modules/services_discovery/sap.c
View file @
f11c071d
...
@@ -949,10 +949,15 @@ static int ParseSDPConnection (const char *str, struct sockaddr_storage *addr,
...
@@ -949,10 +949,15 @@ static int ParseSDPConnection (const char *str, struct sockaddr_storage *addr,
# endif
# endif
*
addrlen
=
sizeof
(
struct
sockaddr_in6
);
*
addrlen
=
sizeof
(
struct
sockaddr_in6
);
#if defined(WIN32) || defined(UNDER_CE)
if
(
WSAStringToAddressA
(
host
,
AF_INET6
,
NULL
,
(
LPSOCKADDR
)
addr
,
addrlen
)
)
return
-
1
;
#else
if
(
inet_pton
(
AF_INET6
,
host
,
if
(
inet_pton
(
AF_INET6
,
host
,
&
((
struct
sockaddr_in6
*
)
addr
)
->
sin6_addr
)
<=
0
)
&
((
struct
sockaddr_in6
*
)
addr
)
->
sin6_addr
)
<=
0
)
return
-
1
;
return
-
1
;
#endif
*
number
=
(
res
>=
3
)
?
n1
:
1
;
*
number
=
(
res
>=
3
)
?
n1
:
1
;
break
;
break
;
#endif
#endif
...
@@ -964,9 +969,15 @@ static int ParseSDPConnection (const char *str, struct sockaddr_storage *addr,
...
@@ -964,9 +969,15 @@ static int ParseSDPConnection (const char *str, struct sockaddr_storage *addr,
# endif
# endif
*
addrlen
=
sizeof
(
struct
sockaddr_in
);
*
addrlen
=
sizeof
(
struct
sockaddr_in
);
#if defined(WIN32) || defined(UNDER_CE)
if
(
WSAStringToAddressA
(
host
,
AF_INET
,
NULL
,
(
LPSOCKADDR
)
addr
,
addrlen
)
)
return
-
1
;
#else
if
(
inet_pton
(
AF_INET
,
host
,
if
(
inet_pton
(
AF_INET
,
host
,
&
((
struct
sockaddr_in
*
)
addr
)
->
sin_addr
)
<=
0
)
&
((
struct
sockaddr_in
*
)
addr
)
->
sin_addr
)
<=
0
)
return
-
1
;
return
-
1
;
#endif
*
number
=
(
res
>=
4
)
?
n2
:
1
;
*
number
=
(
res
>=
4
)
?
n2
:
1
;
break
;
break
;
...
...
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