refactor(narrow): 撤销 File.write 实参多余的 ULONG(...) 显式窄化

File.write 形参已改为 sizet,调用点不再需要显式 ULONG 包裹(覆盖 WriteCallSidecar/_phase2_write_cmd/write_ir_to_file/WriteStackMap/TranslateFileGetTrans)
This commit is contained in:
TermiNexus committed 2026-10-10 22:15:49 +08:00
1 parent 58951a29a8
commit 41772b4a0c
1 file changed
+7 -7
+7 -7
View File
@@ -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