From 41772b4a0c7e59c934b8ace24e022631f8f867d0 Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Sat, 10 Oct 2026 22:15:49 +0800 Subject: [PATCH] =?UTF-8?q?refactor(narrow):=20=E6=92=A4=E9=94=80=20File.w?= =?UTF-8?q?rite=20=E5=AE=9E=E5=8F=82=E5=A4=9A=E4=BD=99=E7=9A=84=20ULONG(..?= =?UTF-8?q?.)=20=E6=98=BE=E5=BC=8F=E7=AA=84=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit File.write 形参已改为 sizet,调用点不再需要显式 ULONG 包裹(覆盖 WriteCallSidecar/_phase2_write_cmd/write_ir_to_file/WriteStackMap/TranslateFileGetTrans) --- App/lib/Phase/BuildPipeline.vp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/App/lib/Phase/BuildPipeline.vp b/App/lib/Phase/BuildPipeline.vp index 069abf8..77a90eb 100644 --- a/App/lib/Phase/BuildPipeline.vp +++ b/App/lib/Phase/BuildPipeline.vp @@ -131,7 +131,7 @@ def WriteCallSidecar(temp_dir: str, sha1: str, text: str) -> int: VLogger.error(f"--traceback: failed to write .vpcall (cannot open {vpath}), aborting compilation", "TRACEBACK") stdlib.free(vpath) return 1 - vf.write(text, ULONG(string.strlen(text))) + vf.write(text, string.strlen(text)) vf.close() return _tb_register_vpcall(vpath) @@ -199,7 +199,7 @@ def TranslateFileGetTrans(mb: memhub.MemBuddy*, file_path: str, sha1_val: str, c if pyi_path is not None: pf: fileio.File* = fileio.File(pyi_path, fileio.MODE.W) if not pf.closed: - pf.write(pyi_buf, ULONG(pyi_pos)) + pf.write(pyi_buf, pyi_pos) pf.close() stdlib.free(pyi_path) stdlib.free(pyi_buf) @@ -349,7 +349,7 @@ def write_ir_to_file(ir_buf: bytes, ir_len: sizet, output_dir: str, module_name: f: fileio.File* = fileio.File(path, fileio.MODE.W) if f.closed: return 1 - written: int64 = f.write(ir_buf, ULONG(ir_len)) + written: int64 = f.write(ir_buf, ir_len) f.close() if written < 0: return 1 return 0 @@ -553,9 +553,9 @@ def _phase2_write_cmd(cmd: str) -> None: _phase2_bat_init = 1 hdr1: str = "@echo off\r\n" hdr2: str = "rem TransPyV --phase2command generated commands\r\n" - f.write(hdr1, ULONG(string.strlen(hdr1))) - f.write(hdr2, ULONG(string.strlen(hdr2))) - f.write(cmd, ULONG(string.strlen(cmd))) + f.write(hdr1, string.strlen(hdr1)) + f.write(hdr2, string.strlen(hdr2)) + f.write(cmd, string.strlen(cmd)) f.write("\r\n", 2) f.close() @@ -2358,7 +2358,7 @@ def WriteStackMap(mb: memhub.MemBuddy*, exe_path: str) -> int: if mf.closed: VLogger.error(f"--traceback: failed to write sidecar file (cannot open {map_path}), aborting compilation", "TRACEBACK") return 1 - mf.write(out, ULONG(total)) + mf.write(out, total) mf.close() VLogger.success(f"--traceback: wrote address-to-source-line sidecar {map_path} ({uniq} records, {total} bytes)", "TRACEBACK") return 0