Skip to content

Commit

Permalink
Reduced variable scope.
Browse files Browse the repository at this point in the history
  • Loading branch information
hipersayanX committed Jun 1, 2023
1 parent 108be1f commit e0535ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ akvcam_driver_rw_mode_strings_ct akvcam_driver_rw_mode_strs(void);
int akvcam_driver_init(const char *name, const char *description)
{
akvcam_settings_t settings;
akvcam_matrix_t available_formats;

akpr_function();

Expand All @@ -91,6 +90,8 @@ int akvcam_driver_init(const char *name, const char *description)
settings = akvcam_settings_new();

if (akvcam_settings_load(settings, akvcam_settings_file())) {
akvcam_matrix_t available_formats;

akvcam_driver_global->default_frame =
akvcam_driver_load_default_frame(settings);
available_formats = akvcam_driver_read_formats(settings);
Expand Down Expand Up @@ -483,7 +484,6 @@ akvcam_formats_list_t akvcam_driver_read_device_formats(akvcam_settings_t settin
void akvcam_driver_connect_devices(akvcam_settings_t settings,
akvcam_devices_list_t devices)
{
akvcam_string_list_t connections;
akvcam_devices_list_t connected_outputs;
akvcam_list_element_t it = NULL;
akvcam_device_t device;
Expand All @@ -499,6 +499,7 @@ void akvcam_driver_connect_devices(akvcam_settings_t settings,
n_connections = akvcam_settings_begin_array(settings, "connections");

for (i = 0; i < n_connections; i++) {
akvcam_string_list_t connections;
size_t n_nodes;

akvcam_settings_set_array_index(settings, i);
Expand Down
3 changes: 2 additions & 1 deletion src/file_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,15 @@ bool akvcam_file_seek(akvcam_file_t self, ssize_t offset, AKVCAM_FILE_SEEK pos)
size_t akvcam_file_read(akvcam_file_t self, void *data, size_t size)
{
loff_t offset;
ssize_t bytes_read;
char read_block[AKVCAM_READ_BLOCK];

if (!self->is_open || size < 1)
return 0;

while (self->file_bytes_read < self->size
&& akvcam_rbuffer_data_size(self->buffer) < size) {
ssize_t bytes_read;

offset = (loff_t) self->file_bytes_read;
bytes_read = kernel_read(self->filp,
read_block,
Expand Down

0 comments on commit e0535ff

Please sign in to comment.