mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-13 22:23:45 +00:00
Fix some signed/unsigned implicit conversions.
Fix some trivial cases where the signedness of the constant value does not match the signedness of type the code expects to see. GCC can be asked to warn about those by passing Wsign-covnersion flag. Issue #4354
This commit is contained in:
parent
f2dab083f6
commit
d610f9f4f1
@ -23,7 +23,7 @@ namespace Abi {
|
||||
* change the stack pointer, we need no further stack adjustment.
|
||||
*/
|
||||
inline Genode::addr_t stack_align(Genode::addr_t addr) {
|
||||
return (addr & ~0xf); }
|
||||
return (addr & ~0xfUL); }
|
||||
|
||||
/**
|
||||
* Do ABI specific initialization to a freshly created stack
|
||||
|
@ -22,7 +22,7 @@ namespace Abi {
|
||||
* On ARM we align the stack top to 16-byte.
|
||||
*/
|
||||
inline Genode::addr_t stack_align(Genode::addr_t addr) {
|
||||
return (addr & ~0xf); }
|
||||
return (addr & ~0xfUL); }
|
||||
|
||||
/**
|
||||
* Do ABI specific initialization to a freshly created stack
|
||||
|
@ -33,7 +33,7 @@ namespace Genode {
|
||||
struct Rpc_request
|
||||
{
|
||||
Reply_capability caller { };
|
||||
unsigned long badge = ~0;
|
||||
unsigned long badge = ~0UL;
|
||||
|
||||
Rpc_request() { }
|
||||
|
||||
|
@ -146,7 +146,7 @@ static inline void out_float(T value, unsigned base, unsigned length, OUT_CHAR_F
|
||||
volatile_value = (T)(volatile_value - (T)integer);
|
||||
volatile_value = (T)(volatile_value * (T)base);
|
||||
|
||||
integer = (int64_t)volatile_value;
|
||||
integer = (uint64_t)volatile_value;
|
||||
out_char(ascii((int)integer));
|
||||
|
||||
length--;
|
||||
|
@ -99,7 +99,7 @@ Allocator_avl_base::Alloc_md_result Allocator_avl_base::_alloc_block_metadata()
|
||||
{
|
||||
return _md_alloc.try_alloc(sizeof(Block)).convert<Alloc_md_result>(
|
||||
[&] (void *ptr) {
|
||||
return construct_at<Block>(ptr, 0, 0, 0); },
|
||||
return construct_at<Block>(ptr, 0U, 0U, 0); },
|
||||
[&] (Alloc_error error) {
|
||||
return error; });
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ Heap::_allocate_dataspace(size_t size, bool enforce_separate_metadata)
|
||||
/* add new local address range to our local allocator */
|
||||
_alloc->add_range((addr_t)attach_guard.ptr, size).with_result(
|
||||
[&] (Range_allocator::Range_ok) {
|
||||
metadata = _alloc->alloc_aligned(sizeof(Heap::Dataspace), log2(16)); },
|
||||
metadata = _alloc->alloc_aligned(sizeof(Heap::Dataspace), log2(16U)); },
|
||||
[&] (Alloc_error error) {
|
||||
metadata = error; });
|
||||
}
|
||||
@ -153,7 +153,7 @@ Heap::_allocate_dataspace(size_t size, bool enforce_separate_metadata)
|
||||
|
||||
Allocator::Alloc_result Heap::_try_local_alloc(size_t size)
|
||||
{
|
||||
return _alloc->alloc_aligned(size, log2(16)).convert<Alloc_result>(
|
||||
return _alloc->alloc_aligned(size, log2(16U)).convert<Alloc_result>(
|
||||
|
||||
[&] (void *ptr) {
|
||||
_quota_used += size;
|
||||
|
@ -167,7 +167,7 @@ namespace Sandbox {
|
||||
*/
|
||||
inline Prio_levels prio_levels_from_xml(Xml_node const &config)
|
||||
{
|
||||
long const prio_levels = config.attribute_value("prio_levels", 0UL);
|
||||
long const prio_levels = config.attribute_value("prio_levels", 0L);
|
||||
|
||||
if (prio_levels && ((prio_levels >= (long)sizeof(prio_levels)*8) ||
|
||||
(prio_levels != (1L << log2(prio_levels))))) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user