refactor(argparse): 将null替换为nullptr以提高C++兼容性

- 在argparse库中将所有null指针常量替换为nullptr
- 更新头文件和源文件中的指针初始化和比较操作
- 修改测试文件中的相关断言检查
- 更新AST定义文件中的注释说明
This commit is contained in:
zzy
2026-04-05 20:18:09 +08:00
parent 27d86d5685
commit 4144f7841c
76 changed files with 1430 additions and 998 deletions

View File

@@ -384,7 +384,7 @@ typedef struct _IMAGE_SECTION_HEADER {
// 导入表相关
typedef struct _IMAGE_IMPORT_DESCRIPTOR {
union {
DWORD Characteristics; // 0 for terminating null import descriptor
DWORD Characteristics; // 0 for terminating nullptr import descriptor
DWORD OriginalFirstThunk; // RVA to original unbound IAT
// (PIMAGE_THUNK_DATA)
} DUMMYUNIONNAME;
@@ -680,7 +680,7 @@ typedef IMAGE_SYMBOL UNALIGNED *PIMAGE_SYMBOL;
// 符号存储类
#define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE) - 1
#define IMAGE_SYM_CLASS_NULL 0x0000
#define IMAGE_SYM_CLASS_nullptr 0x0000
#define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
#define IMAGE_SYM_CLASS_EXTERNAL 0x0002
#define IMAGE_SYM_CLASS_STATIC 0x0003

View File

@@ -355,7 +355,7 @@ scc_pe_section_range scc_pe_reserve_section_header(scc_pe_builder_t *builder,
void scc_pe_write_section(scc_pe_builder_t *builder,
scc_pe_section_range *range, u8 *data,
usize data_size) {
if (range == null || data == null || data_size == 0) {
if (range == nullptr || data == nullptr || data_size == 0) {
return;
}
padding_util(builder, range->file_offset);

View File

@@ -156,11 +156,12 @@ scc_pe_buffer_t scc_pe_construct_idata(scc_pe_idata_builder_t *builder,
&scc_vec_at(lookup_table, 0), table_size);
}
// 添加NULL终止的目录项
IMAGE_IMPORT_DESCRIPTOR null_entry = image_import_descriptor_init(0, 0, 0);
// 添加nullptr终止的目录项
IMAGE_IMPORT_DESCRIPTOR nullptr_entry =
image_import_descriptor_init(0, 0, 0);
scc_memcpy(&scc_vec_at(builder->buffer,
import_file_count * sizeof(IMAGE_IMPORT_DESCRIPTOR)),
&null_entry, sizeof(IMAGE_IMPORT_DESCRIPTOR));
&nullptr_entry, sizeof(IMAGE_IMPORT_DESCRIPTOR));
// 填充Hint/Name表
scc_memcpy(&scc_vec_at(builder->buffer, hnt_offset),