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
3456b1e5
Commit
3456b1e5
authored
Feb 09, 2021
by
Max Kellermann
Committed by
Max Kellermann
Feb 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use std::size_t
parent
fe6abe17
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
27 deletions
+27
-27
SocketDescriptor.cxx
src/net/SocketDescriptor.cxx
+7
-7
SocketDescriptor.hxx
src/net/SocketDescriptor.hxx
+7
-7
UTF8.cxx
src/util/UTF8.cxx
+9
-9
UTF8.hxx
src/util/UTF8.hxx
+4
-4
No files found.
src/net/SocketDescriptor.cxx
View file @
3456b1e5
...
@@ -225,9 +225,9 @@ SocketDescriptor::GetError() noexcept
...
@@ -225,9 +225,9 @@ SocketDescriptor::GetError() noexcept
:
errno
;
:
errno
;
}
}
size_t
s
td
::
s
ize_t
SocketDescriptor
::
GetOption
(
int
level
,
int
name
,
SocketDescriptor
::
GetOption
(
int
level
,
int
name
,
void
*
value
,
size_t
size
)
const
noexcept
void
*
value
,
s
td
::
s
ize_t
size
)
const
noexcept
{
{
assert
(
IsDefined
());
assert
(
IsDefined
());
...
@@ -264,7 +264,7 @@ SocketDescriptor::SetNonBlocking() noexcept
...
@@ -264,7 +264,7 @@ SocketDescriptor::SetNonBlocking() noexcept
bool
bool
SocketDescriptor
::
SetOption
(
int
level
,
int
name
,
SocketDescriptor
::
SetOption
(
int
level
,
int
name
,
const
void
*
value
,
size_t
size
)
noexcept
const
void
*
value
,
s
td
::
s
ize_t
size
)
noexcept
{
{
assert
(
IsDefined
());
assert
(
IsDefined
());
...
@@ -431,7 +431,7 @@ SocketDescriptor::GetPeerAddress() const noexcept
...
@@ -431,7 +431,7 @@ SocketDescriptor::GetPeerAddress() const noexcept
}
}
ssize_t
ssize_t
SocketDescriptor
::
Read
(
void
*
buffer
,
size_t
length
)
noexcept
SocketDescriptor
::
Read
(
void
*
buffer
,
s
td
::
s
ize_t
length
)
noexcept
{
{
int
flags
=
0
;
int
flags
=
0
;
#ifndef _WIN32
#ifndef _WIN32
...
@@ -442,7 +442,7 @@ SocketDescriptor::Read(void *buffer, size_t length) noexcept
...
@@ -442,7 +442,7 @@ SocketDescriptor::Read(void *buffer, size_t length) noexcept
}
}
ssize_t
ssize_t
SocketDescriptor
::
Write
(
const
void
*
buffer
,
size_t
length
)
noexcept
SocketDescriptor
::
Write
(
const
void
*
buffer
,
s
td
::
s
ize_t
length
)
noexcept
{
{
int
flags
=
0
;
int
flags
=
0
;
#ifdef __linux__
#ifdef __linux__
...
@@ -495,7 +495,7 @@ SocketDescriptor::WaitWritable(int timeout_ms) const noexcept
...
@@ -495,7 +495,7 @@ SocketDescriptor::WaitWritable(int timeout_ms) const noexcept
#endif
#endif
ssize_t
ssize_t
SocketDescriptor
::
Read
(
void
*
buffer
,
size_t
length
,
SocketDescriptor
::
Read
(
void
*
buffer
,
s
td
::
s
ize_t
length
,
StaticSocketAddress
&
address
)
noexcept
StaticSocketAddress
&
address
)
noexcept
{
{
int
flags
=
0
;
int
flags
=
0
;
...
@@ -513,7 +513,7 @@ SocketDescriptor::Read(void *buffer, size_t length,
...
@@ -513,7 +513,7 @@ SocketDescriptor::Read(void *buffer, size_t length,
}
}
ssize_t
ssize_t
SocketDescriptor
::
Write
(
const
void
*
buffer
,
size_t
length
,
SocketDescriptor
::
Write
(
const
void
*
buffer
,
s
td
::
s
ize_t
length
,
SocketAddress
address
)
noexcept
SocketAddress
address
)
noexcept
{
{
int
flags
=
0
;
int
flags
=
0
;
...
...
src/net/SocketDescriptor.hxx
View file @
3456b1e5
...
@@ -159,8 +159,8 @@ public:
...
@@ -159,8 +159,8 @@ public:
/**
/**
* @return the value size or 0 on error
* @return the value size or 0 on error
*/
*/
size_t
GetOption
(
int
level
,
int
name
,
s
td
::
s
ize_t
GetOption
(
int
level
,
int
name
,
void
*
value
,
size_t
size
)
const
noexcept
;
void
*
value
,
std
::
size_t
size
)
const
noexcept
;
#ifdef HAVE_STRUCT_UCRED
#ifdef HAVE_STRUCT_UCRED
/**
/**
...
@@ -172,7 +172,7 @@ public:
...
@@ -172,7 +172,7 @@ public:
#endif
#endif
bool
SetOption
(
int
level
,
int
name
,
bool
SetOption
(
int
level
,
int
name
,
const
void
*
value
,
size_t
size
)
noexcept
;
const
void
*
value
,
s
td
::
s
ize_t
size
)
noexcept
;
bool
SetBoolOption
(
int
level
,
int
name
,
bool
_value
)
noexcept
{
bool
SetBoolOption
(
int
level
,
int
name
,
bool
_value
)
noexcept
{
const
int
value
=
_value
;
const
int
value
=
_value
;
...
@@ -232,8 +232,8 @@ public:
...
@@ -232,8 +232,8 @@ public:
[[
gnu
::
pure
]]
[[
gnu
::
pure
]]
StaticSocketAddress
GetPeerAddress
()
const
noexcept
;
StaticSocketAddress
GetPeerAddress
()
const
noexcept
;
ssize_t
Read
(
void
*
buffer
,
size_t
length
)
noexcept
;
ssize_t
Read
(
void
*
buffer
,
s
td
::
s
ize_t
length
)
noexcept
;
ssize_t
Write
(
const
void
*
buffer
,
size_t
length
)
noexcept
;
ssize_t
Write
(
const
void
*
buffer
,
s
td
::
s
ize_t
length
)
noexcept
;
#ifdef _WIN32
#ifdef _WIN32
int
WaitReadable
(
int
timeout_ms
)
const
noexcept
;
int
WaitReadable
(
int
timeout_ms
)
const
noexcept
;
...
@@ -247,13 +247,13 @@ public:
...
@@ -247,13 +247,13 @@ public:
/**
/**
* Receive a datagram and return the source address.
* Receive a datagram and return the source address.
*/
*/
ssize_t
Read
(
void
*
buffer
,
size_t
length
,
ssize_t
Read
(
void
*
buffer
,
s
td
::
s
ize_t
length
,
StaticSocketAddress
&
address
)
noexcept
;
StaticSocketAddress
&
address
)
noexcept
;
/**
/**
* Send a datagram to the specified address.
* Send a datagram to the specified address.
*/
*/
ssize_t
Write
(
const
void
*
buffer
,
size_t
length
,
ssize_t
Write
(
const
void
*
buffer
,
s
td
::
s
ize_t
length
,
SocketAddress
address
)
noexcept
;
SocketAddress
address
)
noexcept
;
#ifndef _WIN32
#ifndef _WIN32
...
...
src/util/UTF8.cxx
View file @
3456b1e5
...
@@ -167,7 +167,7 @@ ValidateUTF8(const char *p) noexcept
...
@@ -167,7 +167,7 @@ ValidateUTF8(const char *p) noexcept
return
true
;
return
true
;
}
}
size_t
s
td
::
s
ize_t
SequenceLengthUTF8
(
char
ch
)
noexcept
SequenceLengthUTF8
(
char
ch
)
noexcept
{
{
if
(
IsASCII
(
ch
))
if
(
IsASCII
(
ch
))
...
@@ -194,7 +194,7 @@ SequenceLengthUTF8(char ch) noexcept
...
@@ -194,7 +194,7 @@ SequenceLengthUTF8(char ch) noexcept
}
}
template
<
size_t
L
>
template
<
s
td
::
s
ize_t
L
>
struct
CheckSequenceUTF8
{
struct
CheckSequenceUTF8
{
gcc_pure
gcc_pure
bool
operator
()(
const
char
*
p
)
const
noexcept
{
bool
operator
()(
const
char
*
p
)
const
noexcept
{
...
@@ -209,9 +209,9 @@ struct CheckSequenceUTF8<0U> {
...
@@ -209,9 +209,9 @@ struct CheckSequenceUTF8<0U> {
}
}
};
};
template
<
size_t
L
>
template
<
s
td
::
s
ize_t
L
>
gcc_pure
gcc_pure
static
size_t
static
s
td
::
s
ize_t
InnerSequenceLengthUTF8
(
const
char
*
p
)
noexcept
InnerSequenceLengthUTF8
(
const
char
*
p
)
noexcept
{
{
return
CheckSequenceUTF8
<
L
>
()(
p
)
return
CheckSequenceUTF8
<
L
>
()(
p
)
...
@@ -219,7 +219,7 @@ InnerSequenceLengthUTF8(const char *p) noexcept
...
@@ -219,7 +219,7 @@ InnerSequenceLengthUTF8(const char *p) noexcept
:
0U
;
:
0U
;
}
}
size_t
s
td
::
s
ize_t
SequenceLengthUTF8
(
const
char
*
p
)
noexcept
SequenceLengthUTF8
(
const
char
*
p
)
noexcept
{
{
const
uint8_t
ch
=
*
p
++
;
const
uint8_t
ch
=
*
p
++
;
...
@@ -258,14 +258,14 @@ FindNonASCIIOrZero(const char *p) noexcept
...
@@ -258,14 +258,14 @@ FindNonASCIIOrZero(const char *p) noexcept
const
char
*
const
char
*
Latin1ToUTF8
(
const
char
*
gcc_restrict
src
,
char
*
gcc_restrict
buffer
,
Latin1ToUTF8
(
const
char
*
gcc_restrict
src
,
char
*
gcc_restrict
buffer
,
size_t
buffer_size
)
noexcept
s
td
::
s
ize_t
buffer_size
)
noexcept
{
{
const
char
*
p
=
FindNonASCIIOrZero
(
src
);
const
char
*
p
=
FindNonASCIIOrZero
(
src
);
if
(
*
p
==
0
)
if
(
*
p
==
0
)
/* everything is plain ASCII, we don't need to convert anything */
/* everything is plain ASCII, we don't need to convert anything */
return
src
;
return
src
;
if
((
size_t
)(
p
-
src
)
>=
buffer_size
)
if
((
s
td
::
s
ize_t
)(
p
-
src
)
>=
buffer_size
)
/* buffer too small */
/* buffer too small */
return
nullptr
;
return
nullptr
;
...
@@ -332,14 +332,14 @@ UnicodeToUTF8(unsigned ch, char *q) noexcept
...
@@ -332,14 +332,14 @@ UnicodeToUTF8(unsigned ch, char *q) noexcept
return
q
;
return
q
;
}
}
size_t
s
td
::
s
ize_t
LengthUTF8
(
const
char
*
p
)
noexcept
LengthUTF8
(
const
char
*
p
)
noexcept
{
{
/* this is a very naive implementation: it does not do any
/* this is a very naive implementation: it does not do any
verification, it just counts the bytes that are not a UTF-8
verification, it just counts the bytes that are not a UTF-8
continuation */
continuation */
size_t
n
=
0
;
s
td
::
s
ize_t
n
=
0
;
for
(;
*
p
!=
0
;
++
p
)
for
(;
*
p
!=
0
;
++
p
)
if
(
!
IsContinuation
(
*
p
))
if
(
!
IsContinuation
(
*
p
))
++
n
;
++
n
;
...
...
src/util/UTF8.hxx
View file @
3456b1e5
...
@@ -47,7 +47,7 @@ ValidateUTF8(const char *p) noexcept;
...
@@ -47,7 +47,7 @@ ValidateUTF8(const char *p) noexcept;
* character, or 0 if the character is not a valid start byte
* character, or 0 if the character is not a valid start byte
*/
*/
gcc_const
gcc_const
size_t
s
td
::
s
ize_t
SequenceLengthUTF8
(
char
ch
)
noexcept
;
SequenceLengthUTF8
(
char
ch
)
noexcept
;
/**
/**
...
@@ -55,7 +55,7 @@ SequenceLengthUTF8(char ch) noexcept;
...
@@ -55,7 +55,7 @@ SequenceLengthUTF8(char ch) noexcept;
* if the sequence is malformed
* if the sequence is malformed
*/
*/
gcc_pure
gcc_pure
size_t
s
td
::
s
ize_t
SequenceLengthUTF8
(
const
char
*
p
)
noexcept
;
SequenceLengthUTF8
(
const
char
*
p
)
noexcept
;
/**
/**
...
@@ -67,7 +67,7 @@ SequenceLengthUTF8(const char *p) noexcept;
...
@@ -67,7 +67,7 @@ SequenceLengthUTF8(const char *p) noexcept;
*/
*/
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
const
char
*
const
char
*
Latin1ToUTF8
(
const
char
*
src
,
char
*
buffer
,
size_t
buffer_size
)
noexcept
;
Latin1ToUTF8
(
const
char
*
src
,
char
*
buffer
,
s
td
::
s
ize_t
buffer_size
)
noexcept
;
/**
/**
* Convert the specified Unicode character to UTF-8 and write it to
* Convert the specified Unicode character to UTF-8 and write it to
...
@@ -84,7 +84,7 @@ UnicodeToUTF8(unsigned ch, char *buffer) noexcept;
...
@@ -84,7 +84,7 @@ UnicodeToUTF8(unsigned ch, char *buffer) noexcept;
* from strlen(), which counts the number of bytes.
* from strlen(), which counts the number of bytes.
*/
*/
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
size_t
s
td
::
s
ize_t
LengthUTF8
(
const
char
*
p
)
noexcept
;
LengthUTF8
(
const
char
*
p
)
noexcept
;
#endif
#endif
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