~ chicken-core (chicken-5) 19f49f048305fc639a0c2b7db0e442195e0ad78e


commit 19f49f048305fc639a0c2b7db0e442195e0ad78e
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Mon Jun 2 16:19:55 2025 +0200
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Mon Jun 2 16:19:55 2025 +0200

    typo fixes in posixwin.scm, use correct _wdirent stuff in file.scm

diff --git a/file.scm b/file.scm
index e46925f5..9911e78a 100644
--- a/file.scm
+++ b/file.scm
@@ -53,12 +53,13 @@
 #endif
 
 #if defined(_WIN32) && !defined(__CYGWIN__)
+# include <direct.h>
 # define C_test_access(fn, m) C_fix(_waccess(C_utf16(fn, 0), C_unfix(m)))
 
 static C_word C_rename(C_word old, C_word new) {
-  C_char *s = C_utf16(old, 0), *s2 = C_utf16(new, 1);
+  wchar_t *s = C_utf16(old, 0), *s2 = C_utf16(new, 1);
   _wremove(s2);
-  return(C_fix(_wrename(s, s2));
+  return(C_fix(_wrename(s, s2)));
 }
 
 # define C_remove(str)       C_fix(_wremove(C_utf16(str, 0)))
@@ -80,14 +81,14 @@ static C_word C_rename(C_word old, C_word new) {
 # define C_opendir(s,h)      C_set_block_item(h, 0, (C_word) _wopendir(C_utf16(s, 0)))
 
 static C_word C_foundfile(C_word e,C_word b,C_word l) {
-   C_char *s = C_utf8(((struct dirent *) C_block_item(e, 0))->d_name);
+   C_char *s = C_utf8(((struct _wdirent  *)C_block_item(e, 0))->d_name);
    C_strlcpy(C_c_string(b), s, C_unfix(l));
    return(C_fix(strlen(s)));
 }
 
 #else
 # define C_opendir(s,h)      C_set_block_item(h, 0, (C_word) opendir(C_c_string(s)))
-# define C_foundfile(e,b,l)  (C_strlcpy(C_c_string(b), ((struct dirent *) C_block_item(e, 0))->d_name, C_unfix(l)), C_fix(strlen(((struct dirent *) C_block_item(e, 0))->d_name)))
+# define C_foundfile(e,b,l)  (C_strlcpy(C_c_string(b), ((struct _wdirent *)C_block_item(e, 0))->d_name, C_unfix(l)), C_fix(strlen(((struct dirent *) C_block_item(e, 0))->d_name)))
 #endif
 
 #define C_readdir(h,e)      C_set_block_item(e, 0, (C_word) readdir((DIR *)C_block_item(h, 0)))
diff --git a/posixwin.scm b/posixwin.scm
index 90f4b209..c4373e62 100644
--- a/posixwin.scm
+++ b/posixwin.scm
@@ -735,7 +735,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
 
 (define c-string->allocated-pointer
   (foreign-lambda* c-pointer ((scheme-object o))
-     "int len = C_header_size(o) * sizeof(wchar_t)); \n"
+     "int len = C_header_size(o) * sizeof(wchar_t); \n"
      "char *ptr = C_malloc(len); \n"
      "if (ptr != NULL) {\n"
      "  wchar_t *u = C_utf16(o, 0); \n"
Trap