From 88b81c04ed0467e53a14d45723df2e53375d005d Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Wed, 16 Sep 2026 18:16:37 +0800 Subject: [PATCH] =?UTF-8?q?fix(posix):=20DIR=20=E5=B7=B2=E6=98=AF=20t.CPtr?= =?UTF-8?q?(i8*)=EF=BC=8C=E5=8E=BB=E6=8E=89=E5=A4=9A=E4=BD=99=E7=9A=84=20|?= =?UTF-8?q?=20t.CPtr=20=E4=BB=A5=E5=85=8D=E5=A4=9A=E5=8F=A0=E4=B8=80?= =?UTF-8?q?=E5=B1=82=E6=8C=87=E9=92=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit opendir/readdir/closedir 三个形参与 os/_posix.listdir 的局部变量统一为 DIR(= i8*,即 C 的 DIR*):785e825 把 DIR 由 t.CVoid | t.CPtr 清成裸 t.CPtr 后,DIR | t.CPtr 合并成 i8**(双重指针),opendir 的 declare 变成 i8** 而 C 侧是 DIR* 不改动 win32file.vp 的 HANDLE | t.CPtr(PHANDLE=void**)、win32sync.vp 的 VOIDPTR | t.CPtr(PVOID*)、vqt6/_qtwidgets.vp 的 t.CPtr | t.CPtr(char**)——那些多叠一层是有意的 --- os/_posix.vp | 2 +- posix.vp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/os/_posix.vp b/os/_posix.vp index f5d9114..4702782 100644 --- a/os/_posix.vp +++ b/os/_posix.vp @@ -143,7 +143,7 @@ def listdir(path: str, out_names: str, max_count: ULONG) -> ULONG: 文件名通过 _mbuddy 分配内存。 max_count 为 out_names 数组最大容量。 返回实际列举的条目数。失败返回 0。""" - dirp: posix.DIR | t.CPtr = posix.opendir(path) + dirp: posix.DIR = posix.opendir(path) if dirp == None: return 0 diff --git a/posix.vp b/posix.vp index 12a5cda..1d6e544 100644 --- a/posix.vp +++ b/posix.vp @@ -183,9 +183,9 @@ extern def fstat(fd: INT, buf: Stat | t.CPtr) -> INT # ============================================================================= # Directory operations (6) # ============================================================================= -extern def opendir(name: t.CConst | str) -> DIR | t.CPtr -extern def readdir(dirp: DIR | t.CPtr) -> Dirent | t.CPtr -extern def closedir(dirp: DIR | t.CPtr) -> INT +extern def opendir(name: t.CConst | str) -> DIR +extern def readdir(dirp: DIR) -> Dirent | t.CPtr +extern def closedir(dirp: DIR) -> INT extern def mkdir(path: t.CConst | str, mode: mode_t) -> INT extern def rmdir(path: t.CConst | str) -> INT extern def getcwd(buf: CHARPTR, size: t.CSizeT) -> CHARPTR