Fix invalid cast of TF sizetf callback.

(cherry picked from commit 6415d84ed5)
This commit is contained in:
Martin Whitaker 2018-10-06 22:56:04 +01:00
parent 4cb9ae0aa2
commit ac2f5f0740
2 changed files with 30 additions and 2 deletions

View File

@ -44,6 +44,7 @@ typedef struct t_pli_data {
static PLI_INT32 compiletf(ICARUS_VPI_CONST PLI_BYTE8 *);
static PLI_INT32 calltf(ICARUS_VPI_CONST PLI_BYTE8 *);
static PLI_INT32 sizetf(ICARUS_VPI_CONST PLI_BYTE8 *);
static PLI_INT32 callback(p_cb_data);
/*
@ -150,7 +151,7 @@ void veriusertfs_register_table(p_tfcell vtable)
tf_data.tfname = tf->tfname;
tf_data.compiletf = compiletf;
tf_data.calltf = calltf;
tf_data.sizetf = (PLI_INT32 (*)(ICARUS_VPI_CONST PLI_BYTE8 *))tf->sizetf;
tf_data.sizetf = sizetf;
tf_data.user_data = (char *)data;
if (pli_trace) {
@ -283,6 +284,32 @@ static PLI_INT32 calltf(ICARUS_VPI_CONST PLI_BYTE8*data)
return rc;
}
/*
* This function is the wrapper for the veriusertfs sizetf routine.
*/
static PLI_INT32 sizetf(ICARUS_VPI_CONST PLI_BYTE8*data)
{
int rc = 32;
p_pli_data pli;
p_tfcell tf;
/* cast back from opaque */
pli = (p_pli_data)data;
tf = pli->tf;
/* execute sizetf */
if (tf->sizetf) {
if (pli_trace) {
fprintf(pli_trace, "Call %s->sizetf(%d, %d)\n",
tf->tfname, tf->data, reason_sizetf);
}
rc = tf->sizetf(tf->data, reason_sizetf);
}
return rc;
}
/*
* This function is the wrapper for all the misctf callbacks
*/

View File

@ -1,7 +1,7 @@
#ifndef VERIUSER_H
#define VERIUSER_H
/*
* Copyright (c) 2002-2014 Stephen Williams (steve@icarus.com)
* Copyright (c) 2002-2018 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -159,6 +159,7 @@ extern void veriusertfs_register_table(p_tfcell vtable);
/* callback reasons */
#define reason_checktf 1
#define reason_sizetf 2
#define reason_calltf 3
#define reason_paramvc 7
#define reason_synch 8