Skip to content

Commit

Permalink
* Style nits
Browse files Browse the repository at this point in the history
* task_database - db_crc allocated variable does not need to be of size PATH_MAX_LENGTH size
  • Loading branch information
LibretroAdmin committed Feb 9, 2025
1 parent db99fe0 commit f71181d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion audio/drivers/alsathread.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ static ssize_t alsa_thread_write(void *data, const void *buf, size_t len)
}
else
{
while (written < len && !alsa->info.thread_dead)
while (written < (ssize_t)len && !alsa->info.thread_dead)
{
size_t avail;
slock_lock(alsa->info.fifo_lock);
Expand Down
14 changes: 7 additions & 7 deletions tasks/task_database.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ static int task_database_gdi_get_serial(const char *name, char *s, size_t len)
{
char track_path[PATH_MAX_LENGTH];

track_path[0] = '\0';
track_path[0] = '\0';

if (gdi_find_track(name, true,
track_path, sizeof(track_path)) < 0)
Expand Down Expand Up @@ -703,19 +703,19 @@ static int database_info_list_iterate_end_no_match(
if (archive_list && archive_list->size > 0)
{
unsigned i;
size_t path_len = strlen(path);
size_t _len = strlen(path);

for (i = 0; i < archive_list->size; i++)
{
if (path_len + strlen(archive_list->elems[i].data)
if (_len + strlen(archive_list->elems[i].data)
+ 1 < PATH_MAX_LENGTH)
{
char new_path[PATH_MAX_LENGTH];
strlcpy(new_path, path, sizeof(new_path));
new_path[path_len] = '#';
strlcpy(new_path + path_len + 1,
new_path[_len] = '#';
strlcpy(new_path + _len + 1,
archive_list->elems[i].data,
sizeof(new_path) - path_len);
sizeof(new_path) - _len);
string_list_append(db->list, new_path,
archive_list->elems[i].attr);
}
Expand Down Expand Up @@ -773,7 +773,7 @@ static int database_info_list_iterate_found_match(
* We should use less fullsize paths in the future so that we don't
* need to have all these big char arrays here */
size_t str_len = PATH_MAX_LENGTH * sizeof(char);
char* db_crc = (char*)malloc(str_len);
char* db_crc = (char*)malloc(256 * sizeof(char));
char* db_playlist_path = (char*)malloc(str_len);
char* entry_path_str = (char*)malloc(str_len);
char *hash = NULL;
Expand Down

0 comments on commit f71181d

Please sign in to comment.