diff --git a/libfprint/drivers/aes1660.c b/libfprint/drivers/aes1660.c index c43ae51..bebbf5a 100644 --- a/libfprint/drivers/aes1660.c +++ b/libfprint/drivers/aes1660.c @@ -50,9 +50,9 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data) fpi_imgdev_set_user_data(dev, aesdev); aesdev->buffer = g_malloc0(AES1660_FRAME_SIZE + AESX660_HEADER_SIZE); aesdev->init_seqs[0] = aes1660_init_1; - aesdev->init_seqs_len[0] = array_n_elements(aes1660_init_1); + aesdev->init_seqs_len[0] = G_N_ELEMENTS(aes1660_init_1); aesdev->init_seqs[1] = aes1660_init_2; - aesdev->init_seqs_len[1] = array_n_elements(aes1660_init_2); + aesdev->init_seqs_len[1] = G_N_ELEMENTS(aes1660_init_2); aesdev->start_imaging_cmd = (unsigned char *)aes1660_start_imaging_cmd; aesdev->start_imaging_cmd_len = sizeof(aes1660_start_imaging_cmd); aesdev->assembling_ctx = &assembling_ctx; diff --git a/libfprint/drivers/aes2660.c b/libfprint/drivers/aes2660.c index d4b453a..9964683 100644 --- a/libfprint/drivers/aes2660.c +++ b/libfprint/drivers/aes2660.c @@ -51,9 +51,9 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data) aesdev->buffer = g_malloc0(AES2660_FRAME_SIZE + AESX660_HEADER_SIZE); /* No scaling for AES2660 */ aesdev->init_seqs[0] = aes2660_init_1; - aesdev->init_seqs_len[0] = array_n_elements(aes2660_init_1); + aesdev->init_seqs_len[0] = G_N_ELEMENTS(aes2660_init_1); aesdev->init_seqs[1] = aes2660_init_2; - aesdev->init_seqs_len[1] = array_n_elements(aes2660_init_2); + aesdev->init_seqs_len[1] = G_N_ELEMENTS(aes2660_init_2); aesdev->start_imaging_cmd = (unsigned char *)aes2660_start_imaging_cmd; aesdev->start_imaging_cmd_len = sizeof(aes2660_start_imaging_cmd); aesdev->assembling_ctx = &assembling_ctx; diff --git a/libfprint/drivers/elan.h b/libfprint/drivers/elan.h index 1b47dbc..c929287 100644 --- a/libfprint/drivers/elan.h +++ b/libfprint/drivers/elan.h @@ -61,7 +61,7 @@ static const struct elan_cmd get_sensor_dim_cmds[] = { }; static const size_t get_sensor_dim_cmds_len = -array_n_elements(get_sensor_dim_cmds); +G_N_ELEMENTS(get_sensor_dim_cmds); static const struct elan_cmd init_start_cmds[] = { { @@ -76,7 +76,7 @@ static const struct elan_cmd init_start_cmds[] = { }, }; -static const size_t init_start_cmds_len = array_n_elements(init_start_cmds); +static const size_t init_start_cmds_len = G_N_ELEMENTS(init_start_cmds); static const struct elan_cmd read_cmds[] = { /* raw frame sizes are calculated from image dimesions reported by the @@ -88,7 +88,7 @@ static const struct elan_cmd read_cmds[] = { }, }; -const size_t read_cmds_len = array_n_elements(read_cmds); +const size_t read_cmds_len = G_N_ELEMENTS(read_cmds); /* issued after data reads during init and calibration */ static const struct elan_cmd init_end_cmds[] = { @@ -99,7 +99,7 @@ static const struct elan_cmd init_end_cmds[] = { }, }; -static const size_t init_end_cmds_len = array_n_elements(init_end_cmds); +static const size_t init_end_cmds_len = G_N_ELEMENTS(init_end_cmds); /* same command 2 times * original driver may observe return value to determine how many times it @@ -118,7 +118,7 @@ static const struct elan_cmd calibrate_start_cmds[] = { }; static const size_t calibrate_start_cmds_len = -array_n_elements(calibrate_start_cmds); +G_N_ELEMENTS(calibrate_start_cmds); /* issued after data reads during init and calibration */ static const struct elan_cmd calibrate_end_cmds[] = { @@ -130,7 +130,7 @@ static const struct elan_cmd calibrate_end_cmds[] = { }; static const size_t calibrate_end_cmds_len = -array_n_elements(calibrate_end_cmds); +G_N_ELEMENTS(calibrate_end_cmds); static const struct elan_cmd capture_start_cmds[] = { /* led on */ @@ -141,7 +141,7 @@ static const struct elan_cmd capture_start_cmds[] = { }, }; -static size_t capture_start_cmds_len = array_n_elements(capture_start_cmds); +static size_t capture_start_cmds_len = G_N_ELEMENTS(capture_start_cmds); static const struct elan_cmd capture_wait_finger_cmds[] = { /* wait for finger @@ -154,7 +154,7 @@ static const struct elan_cmd capture_wait_finger_cmds[] = { }; static size_t capture_wait_finger_cmds_len = -array_n_elements(capture_wait_finger_cmds); +G_N_ELEMENTS(capture_wait_finger_cmds); static const struct elan_cmd deactivate_cmds[] = { /* led off */ @@ -165,7 +165,7 @@ static const struct elan_cmd deactivate_cmds[] = { }, }; -static const size_t deactivate_cmds_len = array_n_elements(deactivate_cmds); +static const size_t deactivate_cmds_len = G_N_ELEMENTS(deactivate_cmds); static void elan_cmd_cb(struct libusb_transfer *transfer); static void elan_cmd_read(struct fpi_ssm *ssm); diff --git a/libfprint/drivers/upektc.c b/libfprint/drivers/upektc.c index 6097c26..ffa31f3 100644 --- a/libfprint/drivers/upektc.c +++ b/libfprint/drivers/upektc.c @@ -447,14 +447,14 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data) upekdev->ep_in = UPEKTC_EP_IN; upekdev->ep_out = UPEKTC_EP_OUT; upekdev->setup_commands = upektc_setup_commands; - upekdev->setup_commands_len = array_n_elements(upektc_setup_commands); + upekdev->setup_commands_len = G_N_ELEMENTS(upektc_setup_commands); upekdev->sum_threshold = UPEKTC_SUM_THRESHOLD; break; case UPEKTC_3001: upekdev->ep_in = UPEKET_EP_IN; upekdev->ep_out = UPEKET_EP_OUT; upekdev->setup_commands = upeket_setup_commands; - upekdev->setup_commands_len = array_n_elements(upeket_setup_commands); + upekdev->setup_commands_len = G_N_ELEMENTS(upeket_setup_commands); upekdev->sum_threshold = UPEKET_SUM_THRESHOLD; break; default: diff --git a/libfprint/drivers/uru4000.c b/libfprint/drivers/uru4000.c index 6ed311d..080edf7 100644 --- a/libfprint/drivers/uru4000.c +++ b/libfprint/drivers/uru4000.c @@ -664,7 +664,7 @@ static int calc_dev2(struct uru4k_image *img) uint8_t *b[2] = { NULL, NULL }; int res = 0, mean = 0, i, r, j, idx; - for (i = r = idx = 0; i < array_n_elements(img->block_info) && idx < 2; i++) { + for (i = r = idx = 0; i < G_N_ELEMENTS(img->block_info) && idx < 2; i++) { if (img->block_info[i].flags & BLOCKF_NOT_PRESENT) continue; for (j = 0; j < img->block_info[i].num_lines && idx < 2; j++) @@ -747,7 +747,7 @@ static void imaging_run_state(struct fpi_ssm *ssm) key ^= urudev->img_enc_seed; fp_dbg("encryption id %02x -> key %08x", img->key_number, key); - while (urudev->img_block < array_n_elements(img->block_info) && + while (urudev->img_block < G_N_ELEMENTS(img->block_info) && urudev->img_lines_done < img->num_lines) { flags = img->block_info[urudev->img_block].flags; num_lines = img->block_info[urudev->img_block].num_lines; @@ -785,7 +785,7 @@ static void imaging_run_state(struct fpi_ssm *ssm) fpimg = fpi_img_new_for_imgdev(dev); to = r = 0; - for (i = 0; i < array_n_elements(img->block_info) && r < img->num_lines; i++) { + for (i = 0; i < G_N_ELEMENTS(img->block_info) && r < img->num_lines; i++) { flags = img->block_info[i].flags; num_lines = img->block_info[i].num_lines; if (num_lines == 0) diff --git a/libfprint/drivers/vfs5011.c b/libfprint/drivers/vfs5011.c index 14799a9..0c50d99 100644 --- a/libfprint/drivers/vfs5011.c +++ b/libfprint/drivers/vfs5011.c @@ -679,7 +679,7 @@ static void activate_loop(struct fpi_ssm *ssm) switch (fpi_ssm_get_cur_state(ssm)) { case DEV_ACTIVATE_REQUEST_FPRINT: data->init_sequence.stepcount = - array_n_elements(vfs5011_initiate_capture); + G_N_ELEMENTS(vfs5011_initiate_capture); data->init_sequence.actions = vfs5011_initiate_capture; data->init_sequence.device = dev; if (data->init_sequence.receive_buf == NULL) @@ -721,7 +721,7 @@ static void activate_loop(struct fpi_ssm *ssm) case DEV_ACTIVATE_PREPARE_NEXT_CAPTURE: data->init_sequence.stepcount = - array_n_elements(vfs5011_initiate_capture); + G_N_ELEMENTS(vfs5011_initiate_capture); data->init_sequence.actions = vfs5011_initiate_capture; data->init_sequence.device = dev; if (data->init_sequence.receive_buf == NULL) @@ -774,7 +774,7 @@ static void open_loop(struct fpi_ssm *ssm) switch (fpi_ssm_get_cur_state(ssm)) { case DEV_OPEN_START: data->init_sequence.stepcount = - array_n_elements(vfs5011_initialization); + G_N_ELEMENTS(vfs5011_initialization); data->init_sequence.actions = vfs5011_initialization; data->init_sequence.device = dev; data->init_sequence.receive_buf = diff --git a/libfprint/drivers_api.h b/libfprint/drivers_api.h index b13aa67..b491a05 100644 --- a/libfprint/drivers_api.h +++ b/libfprint/drivers_api.h @@ -37,8 +37,6 @@ #include "assembling.h" #include "drivers/driver_ids.h" -#define array_n_elements(array) G_N_ELEMENTS(array) - #define fp_dbg g_debug #define fp_info g_debug #define fp_warn g_warning