summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/kit/file.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/source/kit/file.c b/source/kit/file.c
index b2167c7..cb64fe5 100644
--- a/source/kit/file.c
+++ b/source/kit/file.c
@@ -442,8 +442,7 @@ kit_path_list_t kit_folder_enum(kit_str_t path,
printf(" ENUM %s \n", data.cFileName);
fflush(stdout);
- i64 size = 0;
- while (size < MAX_PATH && data.cFileName[size] != '\0') size++;
+ i64 size = (i64) strlen(data.cFileName);
printf(" size %d \n", (int) size);
DA_INIT(result.files.values[n], size, alloc);
if (result.files.values[n].size != size) {
@@ -452,8 +451,7 @@ kit_path_list_t kit_folder_enum(kit_str_t path,
break;
}
- for (i64 i = 0; i < size; i++)
- result.files.values[n].values[i] = data.cFileName[i];
+ memcpy(result.files.values[n].values, data.cFileName, size);
} while (FindNextFileA(find, &data) != 0);
FindClose(find);