Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
7c9d058c
Commit
7c9d058c
authored
May 28, 2018
by
Simon Giesecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: Magic number "2" in ip_resolver.cpp
Solution: introduced constant
parent
16bb62e6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
ip_resolver.cpp
src/ip_resolver.cpp
+6
-3
No files found.
src/ip_resolver.cpp
View file @
7c9d058c
...
...
@@ -218,10 +218,13 @@ int zmq::ip_resolver_t::resolve (ip_addr_t *ip_addr_, const char *name_)
// Trim any square brackets surrounding the address. Used for
// IPv6 addresses to remove the confusion with the port
// delimiter. Should we validate that the brackets are present if
// delimiter.
// TODO Should we validate that the brackets are present if
// 'addr' contains ':' ?
if
(
addr
.
size
()
>=
2
&&
addr
[
0
]
==
'['
&&
addr
[
addr
.
size
()
-
1
]
==
']'
)
{
addr
=
addr
.
substr
(
1
,
addr
.
size
()
-
2
);
const
size_t
brackets_length
=
2
;
if
(
addr
.
size
()
>=
brackets_length
&&
addr
[
0
]
==
'['
&&
addr
[
addr
.
size
()
-
1
]
==
']'
)
{
addr
=
addr
.
substr
(
1
,
addr
.
size
()
-
brackets_length
);
}
// Look for an interface name / zone_id in the address
...
...
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