mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2025-11-15 07:38:12 +00:00
cleanup: Use non-const pointers for non constant cases
We had various cases in which we were using const pointers for non constant data, and in fact we were allocating and free'ing them. So let's handle all these case properly, so that we won't have newer GLib complaining at us!
This commit is contained in:
@@ -50,9 +50,9 @@ elanmoc_compose_cmd (
|
|||||||
const struct elanmoc_cmd *cmd_info
|
const struct elanmoc_cmd *cmd_info
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
g_autofree char *cmd_buf = NULL;
|
g_autofree uint8_t *cmd_buf = NULL;
|
||||||
|
|
||||||
cmd_buf = g_malloc0 (cmd_info->cmd_len);
|
cmd_buf = g_new0 (uint8_t, cmd_info->cmd_len);
|
||||||
if(cmd_info->cmd_len < ELAN_MAX_HDR_LEN)
|
if(cmd_info->cmd_len < ELAN_MAX_HDR_LEN)
|
||||||
memcpy (cmd_buf, &cmd_info->cmd_header, cmd_info->cmd_len);
|
memcpy (cmd_buf, &cmd_info->cmd_header, cmd_info->cmd_len);
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -126,12 +126,12 @@ fp_cmd_bcc (uint8_t *data, uint16_t len)
|
|||||||
static uint8_t *
|
static uint8_t *
|
||||||
focaltech_moc_compose_cmd (uint8_t cmd, const uint8_t *data, uint16_t len)
|
focaltech_moc_compose_cmd (uint8_t cmd, const uint8_t *data, uint16_t len)
|
||||||
{
|
{
|
||||||
g_autofree char *cmd_buf = NULL;
|
g_autofree uint8_t *cmd_buf = NULL;
|
||||||
FpCmd *fp_cmd = NULL;
|
FpCmd *fp_cmd = NULL;
|
||||||
uint8_t *bcc = NULL;
|
uint8_t *bcc = NULL;
|
||||||
uint16_t header_len = len + sizeof (*bcc);
|
uint16_t header_len = len + sizeof (*bcc);
|
||||||
|
|
||||||
cmd_buf = g_malloc0 (sizeof (FpCmd) + header_len);
|
cmd_buf = g_new0 (uint8_t, sizeof (FpCmd) + header_len);
|
||||||
|
|
||||||
fp_cmd = (FpCmd *) cmd_buf;
|
fp_cmd = (FpCmd *) cmd_buf;
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ typedef struct
|
|||||||
FpDeviceType type;
|
FpDeviceType type;
|
||||||
|
|
||||||
GUsbDevice *usb_device;
|
GUsbDevice *usb_device;
|
||||||
const gchar *virtual_env;
|
gchar *virtual_env;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
gchar *spidev_path;
|
gchar *spidev_path;
|
||||||
|
|||||||
@@ -73,7 +73,7 @@
|
|||||||
struct _FpiSsm
|
struct _FpiSsm
|
||||||
{
|
{
|
||||||
FpDevice *dev;
|
FpDevice *dev;
|
||||||
const char *name;
|
char *name;
|
||||||
FpiSsm *parentsm;
|
FpiSsm *parentsm;
|
||||||
gpointer ssm_data;
|
gpointer ssm_data;
|
||||||
GDestroyNotify ssm_data_destroy;
|
GDestroyNotify ssm_data_destroy;
|
||||||
|
|||||||
Reference in New Issue
Block a user