dde_linux: avoid implicit conversions

Issue #23
This commit is contained in:
Norman Feske 2021-12-03 14:49:55 +01:00
parent 1aa4f29300
commit 5bd8fa9678
7 changed files with 13 additions and 14 deletions

View File

@ -35,7 +35,7 @@ struct page *lx_emul_associated_page(void const *virt, unsigned long size);
*
* If no page struct exists for the virtual address, it is created.
*/
struct page *lx_emul_virt_to_pages(void const *virt, unsigned num);
struct page *lx_emul_virt_to_pages(void const *virt, unsigned long num);
/**

View File

@ -34,7 +34,7 @@ void lx_emul_task_create(struct task_struct * task,
void lx_emul_task_unblock(struct task_struct * task);
void lx_emul_task_priority(struct task_struct * task, unsigned long prio);
void lx_emul_task_priority(struct task_struct * task, int prio);
void lx_emul_task_schedule(int block);

View File

@ -41,9 +41,9 @@ class Lx_kit::Console
static inline char _ascii(int digit, int uppercase = 0)
{
if (digit > 9)
return digit + (uppercase ? 'A' : 'a') - 10;
return (char)(digit + (uppercase ? 'A' : 'a') - 10);
return digit + '0';
return (char)(digit + '0');
}
/**
@ -74,7 +74,7 @@ class Lx_kit::Console
/* fill buffer starting with the least significant digits */
else
for (; value > 0; value /= base)
buf[i++] = _ascii(value % base);
buf[i++] = _ascii((value % base) & 0xff);
/* add sign to buffer for negative values */
if (neg)
@ -108,8 +108,8 @@ class Lx_kit::Console
}
/* fill buffer starting with the least significant digits */
for (; value > 0; value /= base, pad--)
buf[i++] = _ascii(value % base);
for (; value > 0; value /= (T)base, pad--)
buf[i++] = _ascii((value % base) & 0xff);
/* add padding zeros */
for (; pad-- > 0; )

View File

@ -43,8 +43,7 @@ extern "C" void lx_emul_task_unblock(struct task_struct * t)
}
extern "C" void lx_emul_task_priority(struct task_struct * t,
unsigned long prio)
extern "C" void lx_emul_task_priority(struct task_struct * t, int prio)
{
Lx_kit::env().scheduler.task((void*)t).priority(prio);
}

View File

@ -16,7 +16,7 @@
#include <lx_emul/page_virt.h>
struct page *lx_emul_virt_to_pages(void const *virt, unsigned count)
struct page *lx_emul_virt_to_pages(void const *virt, unsigned long count)
{
/* sanitize argument */
void * const page_aligned_virt = (void *)((uintptr_t)virt & PAGE_MASK);
@ -24,7 +24,7 @@ struct page *lx_emul_virt_to_pages(void const *virt, unsigned count)
struct page *page = lx_emul_associated_page(page_aligned_virt, 1);
if (!page) {
unsigned i;
unsigned long i;
struct page * p = kzalloc(sizeof(struct page)*count, 0);
page = p;
for (i = 0; i < count; i++, p++) {

View File

@ -275,7 +275,7 @@ void Lx_kit::Console::vprintf(const char *format, va_list list)
case Format_command::CHAR:
_out_char(va_arg(list, int));
_out_char((char)(va_arg(list, int)));
break;
case Format_command::STRING:

View File

@ -95,7 +95,7 @@ void * Lx_kit::Mem_allocator::alloc(size_t size, size_t align)
if (!size)
return nullptr;
return _mem.alloc_aligned(size, log2(align)).convert<void *>(
return _mem.alloc_aligned(size, (unsigned)log2(align)).convert<void *>(
[&] (void *ptr) {
memset(ptr, 0, size);
@ -124,7 +124,7 @@ void * Lx_kit::Mem_allocator::alloc(size_t size, size_t align)
_mem.add_range((addr_t)ds.local_addr<void>(), ds.size() - 1);
/* re-try allocation */
return _mem.alloc_aligned(size, log2(align)).convert<void *>(
return _mem.alloc_aligned(size, (unsigned)log2(align)).convert<void *>(
[&] (void *ptr) {
memset(ptr, 0, size);