mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-01-05 23:57:10 +00:00
fix "Casting operation to a pointer"
The print_param struct's member emit who is used for callback, the forth parameter of it is used for transmit the private data of the "print_param". The type translation between "void *" and private date broke the violations. Use the same type to fix it out. Tracked-On: #861 Signed-off-by: Huihuang Shi <huihuang.shi@intel.com> Acked-by: Xu Anthony <anthony.xu@intel.com>
This commit is contained in:
@@ -6,12 +6,13 @@
|
||||
|
||||
#include <hypervisor.h>
|
||||
|
||||
static void charout(size_t cmd, const char *s_arg, uint32_t sz_arg, void *hnd)
|
||||
static void
|
||||
charout(size_t cmd, const char *s_arg, uint32_t sz_arg, struct snprint_param *param)
|
||||
{
|
||||
const char *s = s_arg;
|
||||
uint32_t sz = sz_arg;
|
||||
/* pointer to an integer to store the number of characters */
|
||||
size_t *nchars = (size_t *)hnd;
|
||||
size_t nchars = param->wrtn;
|
||||
/* working pointer */
|
||||
const char *p = s;
|
||||
size_t len;
|
||||
@@ -23,30 +24,29 @@ static void charout(size_t cmd, const char *s_arg, uint32_t sz_arg, void *hnd)
|
||||
s += len;
|
||||
}
|
||||
|
||||
*nchars += (s - p);
|
||||
nchars += (s - p);
|
||||
} else {
|
||||
/* fill mode */
|
||||
*nchars += sz;
|
||||
nchars += sz;
|
||||
while (sz != 0U) {
|
||||
console_putc(s);
|
||||
sz--;
|
||||
}
|
||||
}
|
||||
|
||||
param->wrtn = nchars;
|
||||
}
|
||||
|
||||
void vprintf(const char *fmt, va_list args)
|
||||
{
|
||||
/* struct to store all necessary parameters */
|
||||
struct print_param param;
|
||||
|
||||
/* argument fo charout() */
|
||||
size_t nchars = 0;
|
||||
struct snprint_param snparam;
|
||||
|
||||
/* initialize parameters */
|
||||
(void)memset(&snparam, 0U, sizeof(snparam));
|
||||
(void)memset(¶m, 0U, sizeof(param));
|
||||
param.emit = charout;
|
||||
param.data = &nchars;
|
||||
param.data = &snparam;
|
||||
|
||||
/* execute the printf() */
|
||||
do_print(fmt, ¶m, args);
|
||||
|
||||
Reference in New Issue
Block a user