Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
ngtcp2
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kashyap Thimmaraju
ngtcp2
Commits
6b2a29a6
Unverified
Commit
6b2a29a6
authored
4 years ago
by
Tatsuhiro Tsujikawa
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #259 from jblazquez/master
Fix Windows build
parents
6508b36f
33be56e3
Branches
Branches containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/ngtcp2_conv.c
+8
-8
8 additions, 8 deletions
lib/ngtcp2_conv.c
lib/ngtcp2_conv.h
+11
-4
11 additions, 4 deletions
lib/ngtcp2_conv.h
with
19 additions
and
12 deletions
lib/ngtcp2_conv.c
+
8
−
8
View file @
6b2a29a6
...
...
@@ -45,19 +45,19 @@ uint64_t ngtcp2_get_uint48(const uint8_t *p) {
uint32_t
ngtcp2_get_uint32
(
const
uint8_t
*
p
)
{
uint32_t
n
;
memcpy
(
&
n
,
p
,
4
);
return
ntohl
(
n
);
return
ngtcp2_
ntohl
(
n
);
}
uint32_t
ngtcp2_get_uint24
(
const
uint8_t
*
p
)
{
uint32_t
n
=
0
;
memcpy
(((
uint8_t
*
)
&
n
)
+
1
,
p
,
3
);
return
ntohl
(
n
);
return
ngtcp2_
ntohl
(
n
);
}
uint16_t
ngtcp2_get_uint16
(
const
uint8_t
*
p
)
{
uint16_t
n
;
memcpy
(
&
n
,
p
,
2
);
return
ntohs
(
n
);
return
ngtcp2_
ntohs
(
n
);
}
uint64_t
ngtcp2_get_varint
(
size_t
*
plen
,
const
uint8_t
*
p
)
{
...
...
@@ -76,11 +76,11 @@ uint64_t ngtcp2_get_varint(size_t *plen, const uint8_t *p) {
case
2
:
memcpy
(
&
n
,
p
,
2
);
n
.
b
[
0
]
&=
0x3f
;
return
ntohs
(
n
.
n16
);
return
ngtcp2_
ntohs
(
n
.
n16
);
case
4
:
memcpy
(
&
n
,
p
,
4
);
n
.
b
[
0
]
&=
0x3f
;
return
ntohl
(
n
.
n32
);
return
ngtcp2_
ntohl
(
n
.
n32
);
case
8
:
memcpy
(
&
n
,
p
,
8
);
n
.
b
[
0
]
&=
0x3f
;
...
...
@@ -116,17 +116,17 @@ uint8_t *ngtcp2_put_uint48be(uint8_t *p, uint64_t n) {
}
uint8_t
*
ngtcp2_put_uint32be
(
uint8_t
*
p
,
uint32_t
n
)
{
n
=
htonl
(
n
);
n
=
ngtcp2_
htonl
(
n
);
return
ngtcp2_cpymem
(
p
,
(
const
uint8_t
*
)
&
n
,
sizeof
(
n
));
}
uint8_t
*
ngtcp2_put_uint24be
(
uint8_t
*
p
,
uint32_t
n
)
{
n
=
htonl
(
n
);
n
=
ngtcp2_
htonl
(
n
);
return
ngtcp2_cpymem
(
p
,
((
const
uint8_t
*
)
&
n
)
+
1
,
3
);
}
uint8_t
*
ngtcp2_put_uint16be
(
uint8_t
*
p
,
uint16_t
n
)
{
n
=
htons
(
n
);
n
=
ngtcp2_
htons
(
n
);
return
ngtcp2_cpymem
(
p
,
(
const
uint8_t
*
)
&
n
,
sizeof
(
n
));
}
...
...
This diff is collapsed.
Click to expand it.
lib/ngtcp2_conv.h
+
11
−
4
View file @
6b2a29a6
...
...
@@ -82,7 +82,7 @@
# define STIN static inline
# endif
STIN
uint32_t
htonl
(
uint32_t
hostlong
)
{
STIN
uint32_t
ngtcp2_
htonl
(
uint32_t
hostlong
)
{
uint32_t
res
;
unsigned
char
*
p
=
(
unsigned
char
*
)
&
res
;
*
p
++
=
hostlong
>>
24
;
...
...
@@ -92,7 +92,7 @@ STIN uint32_t htonl(uint32_t hostlong) {
return
res
;
}
STIN
uint16_t
htons
(
uint16_t
hostshort
)
{
STIN
uint16_t
ngtcp2_
htons
(
uint16_t
hostshort
)
{
uint16_t
res
;
unsigned
char
*
p
=
(
unsigned
char
*
)
&
res
;
*
p
++
=
hostshort
>>
8
;
...
...
@@ -100,7 +100,7 @@ STIN uint16_t htons(uint16_t hostshort) {
return
res
;
}
STIN
uint32_t
ntohl
(
uint32_t
netlong
)
{
STIN
uint32_t
ngtcp2_
ntohl
(
uint32_t
netlong
)
{
uint32_t
res
;
unsigned
char
*
p
=
(
unsigned
char
*
)
&
netlong
;
res
=
*
p
++
<<
24
;
...
...
@@ -110,7 +110,7 @@ STIN uint32_t ntohl(uint32_t netlong) {
return
res
;
}
STIN
uint16_t
ntohs
(
uint16_t
netshort
)
{
STIN
uint16_t
ngtcp2_
ntohs
(
uint16_t
netshort
)
{
uint16_t
res
;
unsigned
char
*
p
=
(
unsigned
char
*
)
&
netshort
;
res
=
*
p
++
<<
8
;
...
...
@@ -118,6 +118,13 @@ STIN uint16_t ntohs(uint16_t netshort) {
return
res
;
}
#else
/* WIN32 */
#define ngtcp2_htonl htonl
#define ngtcp2_htons htons
#define ngtcp2_ntohl ntohl
#define ngtcp2_ntohs ntohs
#endif
/* WIN32 */
/*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment