Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
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
cpp-libs
Actor Framework
Commits
8df860e8
Commit
8df860e8
authored
Sep 20, 2019
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix conversion warnings
parent
54c7c6e2
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
58 additions
and
58 deletions
+58
-58
libcaf_core/caf/byte_address.hpp
libcaf_core/caf/byte_address.hpp
+10
-9
libcaf_core/caf/data_processor.hpp
libcaf_core/caf/data_processor.hpp
+2
-2
libcaf_core/caf/detail/parser/add_ascii.hpp
libcaf_core/caf/detail/parser/add_ascii.hpp
+3
-4
libcaf_core/caf/detail/parser/sub_ascii.hpp
libcaf_core/caf/detail/parser/sub_ascii.hpp
+3
-5
libcaf_core/caf/ipv6_subnet.hpp
libcaf_core/caf/ipv6_subnet.hpp
+2
-2
libcaf_core/caf/scheduler/profiled_coordinator.hpp
libcaf_core/caf/scheduler/profiled_coordinator.hpp
+5
-4
libcaf_core/caf/stream_serializer.hpp
libcaf_core/caf/stream_serializer.hpp
+2
-2
libcaf_core/caf/streambuf.hpp
libcaf_core/caf/streambuf.hpp
+4
-4
libcaf_core/caf/typed_behavior.hpp
libcaf_core/caf/typed_behavior.hpp
+7
-6
libcaf_core/src/ipv6_subnet.cpp
libcaf_core/src/ipv6_subnet.cpp
+4
-4
libcaf_core/src/logger.cpp
libcaf_core/src/logger.cpp
+3
-3
libcaf_core/src/scheduled_actor.cpp
libcaf_core/src/scheduled_actor.cpp
+2
-2
libcaf_core/test/composition.cpp
libcaf_core/test/composition.cpp
+1
-1
libcaf_io/src/basp_broker.cpp
libcaf_io/src/basp_broker.cpp
+1
-1
libcaf_io/src/event_handler.cpp
libcaf_io/src/event_handler.cpp
+7
-7
libcaf_io/src/instance.cpp
libcaf_io/src/instance.cpp
+1
-1
libcaf_io/src/stream.cpp
libcaf_io/src/stream.cpp
+1
-1
No files found.
libcaf_core/caf/byte_address.hpp
View file @
8df860e8
...
...
@@ -18,6 +18,7 @@
#pragma once
#include <algorithm>
#include <cstdint>
#include <cstring>
...
...
@@ -81,44 +82,44 @@ public:
// -- bitwise member operators -----------------------------------------------
/// Bitwise ANDs `*this` and `other`.
Derived
&
operator
&=
(
const
Derived
&
other
)
{
Derived
&
operator
&=
(
const
Derived
&
other
)
noexcept
{
auto
&
buf
=
dref
().
bytes
();
for
(
size_t
index
=
0
;
index
<
Derived
::
num_bytes
;
++
index
)
buf
[
index
]
&=
other
[
index
]
;
buf
[
index
]
=
static_cast
<
uint8_t
>
(
buf
[
index
]
&
other
[
index
])
;
return
dref
();
}
/// Bitwise ORs `*this` and `other`.
Derived
&
operator
|=
(
const
Derived
&
other
)
{
Derived
&
operator
|=
(
const
Derived
&
other
)
noexcept
{
auto
&
buf
=
dref
().
bytes
();
for
(
size_t
index
=
0
;
index
<
Derived
::
num_bytes
;
++
index
)
buf
[
index
]
|=
other
[
index
]
;
buf
[
index
]
=
static_cast
<
uint8_t
>
(
buf
[
index
]
|
other
[
index
])
;
return
dref
();
}
/// Bitwise XORs `*this` and `other`.
Derived
&
operator
^=
(
const
Derived
&
other
)
{
Derived
&
operator
^=
(
const
Derived
&
other
)
noexcept
{
auto
&
buf
=
dref
().
bytes
();
for
(
size_t
index
=
0
;
index
<
Derived
::
num_bytes
;
++
index
)
buf
[
index
]
^=
other
[
index
]
;
buf
[
index
]
=
static_cast
<
uint8_t
>
(
buf
[
index
]
^
other
[
index
])
;
return
dref
();
}
// -- bitwise free operators -------------------------------------------------
friend
Derived
operator
&
(
const
Derived
&
x
,
const
Derived
&
y
)
{
friend
Derived
operator
&
(
const
Derived
&
x
,
const
Derived
&
y
)
noexcept
{
Derived
result
{
x
};
result
&=
y
;
return
result
;
}
friend
Derived
operator
|
(
const
Derived
&
x
,
const
Derived
&
y
)
{
friend
Derived
operator
|
(
const
Derived
&
x
,
const
Derived
&
y
)
noexcept
{
Derived
result
{
x
};
result
|=
y
;
return
result
;
}
friend
Derived
operator
^
(
const
Derived
&
x
,
const
Derived
&
y
)
{
friend
Derived
operator
^
(
const
Derived
&
x
,
const
Derived
&
y
)
noexcept
{
Derived
result
{
x
};
result
^=
y
;
return
result
;
...
...
libcaf_core/caf/data_processor.hpp
View file @
8df860e8
...
...
@@ -238,7 +238,7 @@ public:
size_t
cpt
=
0
;
for
(
auto
v
:
rhs
)
{
for
(
int
k
=
0
;
k
<
8
;
++
k
)
{
lhs
[
cpt
]
=
(
(
v
&
(
1
<<
k
))
!=
0
)
;
lhs
[
cpt
]
=
(
v
&
(
1
<<
k
))
!=
0
;
if
(
++
cpt
>=
len
)
return
;
}
...
...
@@ -249,7 +249,7 @@ public:
lhs
.
resize
((
rhs
.
size
()
-
1
)
/
8
+
1
,
0
);
for
(
bool
b
:
rhs
)
{
if
(
b
)
lhs
[
k
/
8
]
|=
(
1
<<
(
k
%
8
));
lhs
[
k
/
8
]
=
static_cast
<
uint8_t
>
(
lhs
[
k
/
8
]
|
(
1
<<
(
k
%
8
)
));
++
k
;
}
}
...
...
libcaf_core/caf/detail/parser/add_ascii.hpp
View file @
8df860e8
...
...
@@ -36,12 +36,12 @@ bool add_ascii(T& x, char c, enable_if_tt<std::is_integral<T>, int> u = 0) {
CAF_IGNORE_UNUSED
(
u
);
if
(
x
>
(
std
::
numeric_limits
<
T
>::
max
()
/
Base
))
return
false
;
x
*=
Base
;
x
=
static_cast
<
T
>
(
x
*
Base
)
;
ascii_to_int
<
Base
,
T
>
f
;
auto
y
=
f
(
c
);
if
(
x
>
(
std
::
numeric_limits
<
T
>::
max
()
-
y
))
return
false
;
x
+=
y
;
x
=
static_cast
<
T
>
(
x
+
y
)
;
return
true
;
}
...
...
@@ -50,11 +50,10 @@ bool add_ascii(T& x, char c,
enable_if_tt
<
std
::
is_floating_point
<
T
>
,
int
>
u
=
0
)
{
CAF_IGNORE_UNUSED
(
u
);
ascii_to_int
<
Base
,
T
>
f
;
x
=
(
x
*
Base
)
+
f
(
c
);
x
=
static_cast
<
T
>
((
x
*
Base
)
+
f
(
c
)
);
return
true
;
}
}
// namespace parser
}
// namespace detail
}
// namespace caf
libcaf_core/caf/detail/parser/sub_ascii.hpp
View file @
8df860e8
...
...
@@ -36,12 +36,12 @@ bool sub_ascii(T& x, char c, enable_if_tt<std::is_integral<T>, int> u = 0) {
CAF_IGNORE_UNUSED
(
u
);
if
(
x
<
(
std
::
numeric_limits
<
T
>::
min
()
/
Base
))
return
false
;
x
*=
Base
;
x
=
static_cast
<
T
>
(
x
*
Base
)
;
ascii_to_int
<
Base
,
T
>
f
;
auto
y
=
f
(
c
);
if
(
x
<
(
std
::
numeric_limits
<
T
>::
min
()
+
y
))
return
false
;
x
-=
y
;
x
=
static_cast
<
T
>
(
x
-
y
)
;
return
true
;
}
...
...
@@ -50,12 +50,10 @@ bool sub_ascii(T& x, char c,
enable_if_tt
<
std
::
is_floating_point
<
T
>
,
int
>
u
=
0
)
{
CAF_IGNORE_UNUSED
(
u
);
ascii_to_int
<
Base
,
T
>
f
;
x
=
(
x
*
Base
)
-
f
(
c
);
x
=
static_cast
<
T
>
((
x
*
Base
)
-
f
(
c
)
);
return
true
;
}
}
// namespace parser
}
// namespace detail
}
// namespace caf
libcaf_core/caf/ipv6_subnet.hpp
View file @
8df860e8
...
...
@@ -33,8 +33,8 @@ public:
// -- constants --------------------------------------------------------------
/// Stores the offset of an embedded IPv4 subnet in bits.
static
constexpr
uint8
_t
v4_offset
=
static_cast
<
uint8_t
>
(
ipv6_address
::
num_bytes
-
ipv4_address
::
num_bytes
)
*
8
;
static
constexpr
size
_t
v4_offset
=
(
ipv6_address
::
num_bytes
-
ipv4_address
::
num_bytes
)
*
8
;
// -- constructors, destructors, and assignment operators --------------------
...
...
libcaf_core/caf/scheduler/profiled_coordinator.hpp
View file @
8df860e8
...
...
@@ -29,13 +29,14 @@
#include <sys/resource.h>
#endif
#include <cmath>
#include <mutex>
#include <chrono>
#include <vector>
#include <cmath>
#include <cstdint>
#include <fstream>
#include <iomanip>
#include <mutex>
#include <unordered_map>
#include <vector>
#include "caf/actor_system_config.hpp"
#include "caf/defaults.hpp"
...
...
@@ -262,7 +263,7 @@ public:
}
template
<
class
Time
,
class
Label
>
void
record
(
Time
t
,
Label
label
,
size
_t
rec_id
,
const
measurement
&
m
)
{
void
record
(
Time
t
,
Label
label
,
uint64
_t
rec_id
,
const
measurement
&
m
)
{
using
std
::
setw
;
file_
<<
setw
(
21
)
<<
t
.
time_since_epoch
().
count
()
<<
setw
(
10
)
<<
label
...
...
libcaf_core/caf/stream_serializer.hpp
View file @
8df860e8
...
...
@@ -114,10 +114,10 @@ protected:
uint8_t
buf
[
16
];
auto
i
=
buf
;
while
(
x
>
0x7f
)
{
*
i
++
=
(
static_cast
<
uint8_t
>
(
x
)
&
0x7f
)
|
0x80
;
*
i
++
=
static_cast
<
uint8_t
>
((
x
&
0x7f
)
|
0x80
)
;
x
>>=
7
;
}
*
i
++
=
static_cast
<
uint8_t
>
(
x
)
&
0x7f
;
*
i
++
=
static_cast
<
uint8_t
>
(
x
&
0x7f
)
;
auto
res
=
streambuf_
.
sputn
(
reinterpret_cast
<
char_type
*>
(
buf
),
static_cast
<
std
::
streamsize
>
(
i
-
buf
));
if
(
res
!=
(
i
-
buf
))
...
...
libcaf_core/caf/streambuf.hpp
View file @
8df860e8
...
...
@@ -79,7 +79,7 @@ protected:
pos_type
default_seekoff
(
off_type
off
,
std
::
ios_base
::
seekdir
dir
,
std
::
ios_base
::
openmode
which
)
{
auto
new_off
=
pos_type
(
off_type
(
-
1
))
;
auto
new_off
=
off_type
{
-
1
}
;
auto
get
=
(
which
&
std
::
ios_base
::
in
)
==
std
::
ios_base
::
in
;
auto
put
=
(
which
&
std
::
ios_base
::
out
)
==
std
::
ios_base
::
out
;
if
(
!
(
get
||
put
))
...
...
@@ -220,7 +220,7 @@ protected:
auto
available
=
this
->
epptr
()
-
this
->
pptr
();
auto
actual
=
std
::
min
(
n
,
static_cast
<
std
::
streamsize
>
(
available
));
std
::
memcpy
(
this
->
pptr
(),
s
,
static_cast
<
size_t
>
(
actual
*
sizeof
(
char_type
)
));
static_cast
<
size_t
>
(
actual
)
*
sizeof
(
char_type
));
this
->
safe_pbump
(
actual
);
return
actual
;
}
...
...
@@ -231,7 +231,7 @@ protected:
auto
available
=
this
->
egptr
()
-
this
->
gptr
();
auto
actual
=
std
::
min
(
n
,
static_cast
<
std
::
streamsize
>
(
available
));
std
::
memcpy
(
s
,
this
->
gptr
(),
static_cast
<
size_t
>
(
actual
*
sizeof
(
char_type
)
));
static_cast
<
size_t
>
(
actual
)
*
sizeof
(
char_type
));
this
->
safe_gbump
(
actual
);
return
actual
;
}
...
...
@@ -349,7 +349,7 @@ protected:
auto
available
=
this
->
egptr
()
-
this
->
gptr
();
auto
actual
=
std
::
min
(
n
,
static_cast
<
std
::
streamsize
>
(
available
));
std
::
memcpy
(
s
,
this
->
gptr
(),
static_cast
<
size_t
>
(
actual
*
sizeof
(
char_type
)
));
static_cast
<
size_t
>
(
actual
)
*
sizeof
(
char_type
));
this
->
safe_gbump
(
actual
);
return
actual
;
}
...
...
libcaf_core/caf/typed_behavior.hpp
View file @
8df860e8
...
...
@@ -179,8 +179,9 @@ public:
using
other_signatures
=
detail
::
type_list
<
Ts
...
>
;
using
m
=
interface_mismatch_t
<
other_signatures
,
signatures
>
;
// trigger static assert on mismatch
detail
::
static_error_printer
<
sizeof
...(
Ts
),
m
::
value
,
typename
m
::
xs
,
typename
m
::
ys
>
guard
;
detail
::
static_error_printer
<
static_cast
<
int
>
(
sizeof
...(
Ts
)),
m
::
value
,
typename
m
::
xs
,
typename
m
::
ys
>
guard
;
CAF_IGNORE_UNUSED
(
guard
);
}
...
...
@@ -200,7 +201,7 @@ public:
// -- modifiers --------------------------------------------------------------
/// Exchanges the contents of this and other.
inline
void
swap
(
typed_behavior
&
other
)
{
void
swap
(
typed_behavior
&
other
)
{
bhvr_
.
swap
(
other
.
bhvr_
);
}
...
...
@@ -242,8 +243,9 @@ private:
using
found_signatures
=
detail
::
type_list
<
deduce_mpi_t
<
Ts
>
...
>
;
using
m
=
interface_mismatch_t
<
found_signatures
,
signatures
>
;
// trigger static assert on mismatch
detail
::
static_error_printer
<
sizeof
...(
Ts
),
m
::
value
,
typename
m
::
xs
,
typename
m
::
ys
>
guard
;
detail
::
static_error_printer
<
static_cast
<
int
>
(
sizeof
...(
Ts
)),
m
::
value
,
typename
m
::
xs
,
typename
m
::
ys
>
guard
;
CAF_IGNORE_UNUSED
(
guard
);
// final (type-erasure) step
intrusive_ptr
<
detail
::
behavior_impl
>
ptr
=
std
::
move
(
bp
);
...
...
@@ -260,4 +262,3 @@ template <class... Sigs>
struct
is_typed_behavior
<
typed_behavior
<
Sigs
...
>>
:
std
::
true_type
{
};
}
// namespace caf
libcaf_core/src/ipv6_subnet.cpp
View file @
8df860e8
...
...
@@ -29,14 +29,14 @@ ipv6_subnet::ipv6_subnet() : prefix_length_(0) {
}
ipv6_subnet
::
ipv6_subnet
(
ipv4_subnet
subnet
)
:
address_
(
ipv6_address
{
subnet
.
network_address
()})
,
prefix_length_
(
v4_offset
+
subnet
.
prefix_length
()){
:
address_
(
ipv6_address
{
subnet
.
network_address
()})
{
prefix_length_
=
static_cast
<
uint8_t
>
(
v4_offset
+
subnet
.
prefix_length
());
detail
::
mask_bits
(
address_
.
bytes
(),
prefix_length_
);
}
ipv6_subnet
::
ipv6_subnet
(
ipv4_address
network_address
,
uint8_t
prefix_length
)
:
address_
(
network_address
)
,
prefix_length_
(
prefix_length
+
v4_offset
)
{
:
address_
(
network_address
)
{
prefix_length_
=
static_cast
<
uint8_t
>
(
prefix_length
+
v4_offset
);
detail
::
mask_bits
(
address_
.
bytes
(),
prefix_length_
);
}
...
...
libcaf_core/src/logger.cpp
View file @
8df860e8
...
...
@@ -386,9 +386,9 @@ void logger::init(actor_system_config& cfg) {
file_verbosity
=
get_or
(
cfg
,
"logger.file-verbosity"
,
file_verbosity
);
console_verbosity
=
get_or
(
cfg
,
"logger.console-verbosity"
,
console_verbosity
);
cfg_
.
file_verbosity
=
to_level_int
(
file_verbosity
);
cfg_
.
console_verbosity
=
to_level_int
(
console_verbosity
);
cfg_
.
verbosity
=
std
::
max
(
cfg_
.
file_verbosity
,
cfg_
.
console_verbosity
);
cfg_
.
file_verbosity
=
to_level_int
(
file_verbosity
)
&
0xFu
;
cfg_
.
console_verbosity
=
to_level_int
(
console_verbosity
)
&
0xFu
;
cfg_
.
verbosity
=
std
::
max
(
cfg_
.
file_verbosity
,
cfg_
.
console_verbosity
)
&
0xFu
;
// Parse the format string.
file_format_
=
parse_format
(
get_or
(
cfg
,
"logger.file-format"
,
lg
::
file_format
));
...
...
libcaf_core/src/scheduled_actor.cpp
View file @
8df860e8
...
...
@@ -975,8 +975,8 @@ uint64_t scheduled_actor::set_timeout(atom_value type,
stream_slot
scheduled_actor
::
next_slot
()
{
stream_slot
result
=
1
;
auto
nslot
=
[](
const
stream_manager_map
&
x
)
->
stream_slot
{
return
x
.
rbegin
()
->
first
+
1
;
auto
nslot
=
[](
const
stream_manager_map
&
x
)
{
return
static_cast
<
stream_slot
>
(
x
.
rbegin
()
->
first
+
1
)
;
};
if
(
!
stream_managers_
.
empty
())
result
=
std
::
max
(
nslot
(
stream_managers_
),
result
);
...
...
libcaf_core/test/composition.cpp
View file @
8df860e8
...
...
@@ -83,7 +83,7 @@ CAF_TEST(depth3) {
CAF_TEST
(
depth2_type_mismatch
)
{
auto
stage1
=
sys
.
spawn
(
multiplier
,
4
);
auto
stage2
=
sys
.
spawn
(
float_adder
,
10
);
auto
stage2
=
sys
.
spawn
(
float_adder
,
10
.
f
);
auto
testee
=
stage2
*
stage1
;
self
->
send
(
testee
,
1
);
expect
((
int
),
from
(
self
).
to
(
stage1
).
with
(
1
));
...
...
libcaf_io/src/basp_broker.cpp
View file @
8df860e8
...
...
@@ -556,7 +556,7 @@ bool basp_broker_state::deliver_pending(execution_unit* ctx,
ep
.
hdr
,
payload
,
false
,
ep
,
none
))
return
false
;
i
=
ep
.
pending
.
erase
(
i
);
ep
.
seq_incoming
+=
1
;
++
ep
.
seq_incoming
;
}
// Set a timeout if there are still pending messages.
if
(
!
ep
.
pending
.
empty
()
&&
!
ep
.
did_set_timeout
)
...
...
libcaf_io/src/event_handler.cpp
View file @
8df860e8
...
...
@@ -23,9 +23,9 @@
#include "caf/io/network/default_multiplexer.hpp"
#ifdef CAF_WINDOWS
#
include <winsock2.h>
#include <winsock2.h>
#else
#
include <sys/socket.h>
#include <sys/socket.h>
#endif
namespace
caf
{
...
...
@@ -33,11 +33,11 @@ namespace io {
namespace
network
{
event_handler
::
event_handler
(
default_multiplexer
&
dm
,
native_socket
sockfd
)
:
fd_
(
sockfd
),
state_
{
true
,
false
,
false
,
false
,
to_integer
(
receive_policy_flag
::
at_least
)
},
eventbf_
(
0
),
backend_
(
dm
)
{
:
fd_
(
sockfd
),
state_
{
true
,
false
,
false
,
false
,
to_integer
(
receive_policy_flag
::
at_least
)
&
0x2u
},
eventbf_
(
0
),
backend_
(
dm
)
{
set_fd_flags
();
}
...
...
libcaf_io/src/instance.cpp
View file @
8df860e8
...
...
@@ -174,7 +174,7 @@ bool instance::handle(execution_unit* ctx, new_datagram_msg& dm,
return
true
;
}
// This is the expected message.
ep
.
seq_incoming
+=
1
;
++
ep
.
seq_incoming
;
// TODO: add optional reliability here
if
(
!
is_handshake
(
ep
.
hdr
)
&&
!
is_heartbeat
(
ep
.
hdr
)
&&
ep
.
hdr
.
dest_node
!=
this_node_
)
{
...
...
libcaf_io/src/stream.cpp
View file @
8df860e8
...
...
@@ -55,7 +55,7 @@ void stream::activate(stream_manager* mgr) {
}
void
stream
::
configure_read
(
receive_policy
::
config
config
)
{
state_
.
rd_flag
=
to_integer
(
config
.
first
);
state_
.
rd_flag
=
to_integer
(
config
.
first
)
&
0x2
;
max_
=
config
.
second
;
}
...
...
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