解决一个擦除的bug

This commit is contained in:
2026-07-21 20:18:28 +08:00
parent f50b9c9e66
commit 66a1e8fd6a
25 changed files with 2005 additions and 61 deletions

31
dump_all_corruptions.py Normal file
View File

@@ -0,0 +1,31 @@
import sys, os
sys.stdout.reconfigure(encoding='utf-8', errors='replace')
rep = chr(0xfffd)
base = 'D:\\Code\\DTU 程序\\STM32F4-Base\\'
files = [
'Drivers\\BSP\\CH395F\\ch395f.c',
'Drivers\\BSP\\CH395F\\ch395f_test.c',
'Drivers\\BSP\\NET\\net_select.c',
'Drivers\\BSP\\GD5F2GQ5UE\\gd5f2gq5ue.c',
'Drivers\\BSP\\SD2506\\sd2506.c',
'Drivers\\BSP\\TPAFE5160\\tpafe5160.c',
]
for fname in files:
path = base + fname
with open(path, 'rb') as f:
raw = f.read()
text = raw.decode('utf-8', errors='replace')
lines = text.split(chr(10))
count = text.count(rep)
if count == 0:
continue
print('\\n=== {} ({} remaining) ==='.format(fname, count))
for i, line in enumerate(lines, 1):
if rep in line:
idx = line.index(rep)
left = line[max(0,idx-30):idx]
right = line[idx+2:idx+30]
ctx = left + '[?]' + right
print('L{}: |{}|'.format(i, ctx))