summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2023-09-15 22:14:23 +0200
committerMitya Selivanov <automainint@guattari.tech>2023-09-15 22:14:23 +0200
commitcdc5ceea3634fd6bdd55156ef0523d927624eb4c (patch)
tree220d84239c1d9a63c2e26dd226400dc73f9d9b88
parent94c01870418373c93744b73d29ebc74986cedd5c (diff)
downloadkit-cdc5ceea3634fd6bdd55156ef0523d927624eb4c.zip
win32: file mapping fix
-rw-r--r--source/kit/file.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/kit/file.c b/source/kit/file.c
index 7b80e67..4d6b979 100644
--- a/source/kit/file.c
+++ b/source/kit/file.c
@@ -517,6 +517,10 @@ void kit_path_list_destroy(kit_path_list_t list) {
}
kit_mapped_file_t kit_file_map(kit_str_t path, i64 size, i32 mode) {
+#if defined(_WIN32) && !defined(__CYGWIN__)
+# define PATH_MAX MAX_PATH
+#endif
+
assert(size > 0);
assert(path.size > 0);
assert(path.size <= PATH_MAX);
@@ -600,6 +604,8 @@ kit_mapped_file_t kit_file_map(kit_str_t path, i64 size, i32 mode) {
mf.bytes = p;
mf._file = file;
mf._map = map;
+
+# undef PATH_MAX
#else
char buf[PATH_MAX + 1];
memcpy(buf, path.values, path.size);