Skip to content

Commit

Permalink
Merge pull request #1178 from slyshykO/fix-copypaste-issue
Browse files Browse the repository at this point in the history
Removed redundant array
  • Loading branch information
Nightwalker-87 authored Aug 14, 2021
2 parents a6d19d7 + 03153d0 commit b433200
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/stlink-lib/chipid.c
Original file line number Diff line number Diff line change
Expand Up @@ -1130,28 +1130,26 @@ void init_chipids(char *dir_to_scan) {
void init_chipids(char *dir_to_scan) {
HANDLE hFind = INVALID_HANDLE_VALUE;
WIN32_FIND_DATAA ffd;
char file_pattern[MAX_PATH] = {0};
char filepath[MAX_PATH] = {0};
StringCchCopyA(file_pattern, STLINK_ARRAY_SIZE(file_pattern), dir_to_scan);
StringCchCopyA(filepath, STLINK_ARRAY_SIZE(filepath), dir_to_scan);

if (FAILED(StringCchCatA(file_pattern, STLINK_ARRAY_SIZE(file_pattern), "\\*.chip"))) {
if (FAILED(StringCchCatA(filepath, STLINK_ARRAY_SIZE(filepath), "\\*.chip"))) {
ELOG("Path to chips's dir too long.\n");
return;
}

;
hFind = FindFirstFileA(file_pattern, &ffd);
hFind = FindFirstFileA(filepath, &ffd);

if (INVALID_HANDLE_VALUE == hFind) {
ELOG("Can't find any chip description file in %s.\n", file_pattern);
ELOG("Can't find any chip description file in %s.\n", filepath);
return;
}

do {
memset(filepath, 0, STLINK_ARRAY_SIZE(filepath));
StringCchCopyA(filepath, STLINK_ARRAY_SIZE(filepath), dir_to_scan);
StringCchCatA(filepath, STLINK_ARRAY_SIZE(file_pattern), "\\");
StringCchCatA(filepath, STLINK_ARRAY_SIZE(file_pattern), ffd.cFileName);
StringCchCatA(filepath, STLINK_ARRAY_SIZE(filepath), "\\");
StringCchCatA(filepath, STLINK_ARRAY_SIZE(filepath), ffd.cFileName);
process_chipfile(filepath);
} while (FindNextFileA(hFind, &ffd) != 0);

Expand Down

0 comments on commit b433200

Please sign in to comment.