refactor(tpv): rowptr[T] 迁移 + D 表定长缓冲改精确分配 + SHA1 前缀判定收敛(D1/D3/D4/D5/D6/D7/C10)
This commit is contained in:
1 parent
7471cc64f9
commit
82eea2719f
66 files changed
+2709
-2604
No files matched your search
@@ -17,7 +17,7 @@ import w32.fileio as fileio
|
||||
# ============================================================
|
||||
|
||||
# 全局 mbuddy 指针
|
||||
_mbuddy: memhub.MemBuddy | t.CPtr
|
||||
_mbuddy: rowptr[memhub.MemBuddy]
|
||||
|
||||
|
||||
# ============================================================
|
||||
@@ -33,7 +33,7 @@ def nibble_to_hex_char(n: int, uppercase: int) -> char:
|
||||
# ============================================================
|
||||
# bytes_to_hex - 字节序列转十六进制字符串
|
||||
# ============================================================
|
||||
def bytes_to_hex(pool: memhub.MemBuddy | t.CPtr,
|
||||
def bytes_to_hex(pool: rowptr[memhub.MemBuddy],
|
||||
digest: bytes,
|
||||
nbytes: sizet,
|
||||
uppercase: int,
|
||||
@@ -68,7 +68,7 @@ def bytes_to_hex(pool: memhub.MemBuddy | t.CPtr,
|
||||
# 使用 includes/hashlib 库的 sha1 类计算摘要,转为十六进制字符串。
|
||||
# 参考 Projectrans.py 的 compute_sha1(hashlib.sha1().hexdigest()[:16])。
|
||||
# ============================================================
|
||||
def compute_sha1(pool: memhub.MemBuddy | t.CPtr, content: str) -> str:
|
||||
def compute_sha1(pool: rowptr[memhub.MemBuddy], content: str) -> str:
|
||||
"""计算字符串的 SHA1,返回前 16 个十六进制字符(用于文件命名)"""
|
||||
if content is None or pool is None:
|
||||
return None
|
||||
|
||||
Reference in new issue
Block a user