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:
Huihuang Shi
2018-11-05 10:40:50 +08:00
committed by lijinxia
parent ad1e2ab678
commit a2516ecc85
3 changed files with 24 additions and 25 deletions

View File

@@ -13,14 +13,24 @@
/* Command for the emit function: fill output with first character. */
#define PRINT_CMD_FILL 0x00000001U
/** Structure used to call back emit lived in print_param */
struct snprint_param {
/** The destination buffer. */
char *dst;
/** The size of the destination buffer. */
uint32_t sz;
/** Counter for written chars. */
uint32_t wrtn;
};
/* Structure used to parse parameters and variables to subroutines. */
struct print_param {
/* A pointer to the function that is used to emit characters. */
void (*emit)(size_t, const char *, uint32_t, void *);
/* An opaque pointer that is passed as third argument to the emit
void (*emit)(size_t, const char *, uint32_t, struct snprint_param *);
/* An opaque pointer that is passed as forth argument to the emit
* function.
*/
void *data;
struct snprint_param *data;
/* Contains variables which are recalculated for each argument. */
struct {
/* A bitfield with the parsed format flags. */