Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
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
Иван Мажукин
mpd
Commits
55488831
Commit
55488831
authored
Jul 21, 2015
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net/StaticSocketAddress: use SocketAddress::size_type
parent
49aaf98a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
+10
-6
StaticSocketAddress.cxx
src/net/StaticSocketAddress.cxx
+1
-1
StaticSocketAddress.hxx
src/net/StaticSocketAddress.hxx
+9
-5
No files found.
src/net/StaticSocketAddress.cxx
View file @
55488831
...
...
@@ -44,7 +44,7 @@
StaticSocketAddress
&
StaticSocketAddress
::
operator
=
(
SocketAddress
other
)
{
size
=
std
::
min
(
size_t
(
other
.
GetSize
()
),
GetCapacity
());
size
=
std
::
min
(
other
.
GetSize
(
),
GetCapacity
());
memcpy
(
&
address
,
other
.
GetAddress
(),
size
);
return
*
this
;
}
...
...
src/net/StaticSocketAddress.hxx
View file @
55488831
...
...
@@ -46,7 +46,11 @@
* An OO wrapper for struct sockaddr_storage.
*/
class
StaticSocketAddress
{
size_t
size
;
public
:
typedef
SocketAddress
::
size_type
size_type
;
private
:
size_type
size
;
struct
sockaddr_storage
address
;
public
:
...
...
@@ -74,17 +78,17 @@ public:
return
reinterpret_cast
<
const
struct
sockaddr
*>
(
&
address
);
}
constexpr
size_t
GetCapacity
()
const
{
constexpr
size_t
ype
GetCapacity
()
const
{
return
sizeof
(
address
);
}
size_t
GetSize
()
const
{
size_t
ype
GetSize
()
const
{
return
size
;
}
void
SetSize
(
size_t
_size
)
{
void
SetSize
(
size_t
ype
_size
)
{
assert
(
_size
>
0
);
assert
(
_size
<=
sizeof
(
address
));
assert
(
size_t
(
_size
)
<=
sizeof
(
address
));
size
=
_size
;
}
...
...
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