refactor(argparse): 将null替换为nullptr以提高C++兼容性
- 在argparse库中将所有null指针常量替换为nullptr - 更新头文件和源文件中的指针初始化和比较操作 - 修改测试文件中的相关断言检查 - 更新AST定义文件中的注释说明
This commit is contained in:
@@ -34,12 +34,12 @@ static inline u8 *sccf_sect_header_table(u8 *base) {
|
||||
* @brief 获取指定索引的节头指针
|
||||
* @param base 文件缓冲区起始地址
|
||||
* @param idx 节索引 (0 <= idx < sect_header_num)
|
||||
* @return 指向该节头的指针, 若索引无效返回 null
|
||||
* @return 指向该节头的指针, 若索引无效返回 nullptr
|
||||
*/
|
||||
static inline sccf_sect_header_t *sccf_sect_header(u8 *base, usize idx) {
|
||||
sccf_header_t *hdr = (sccf_header_t *)base;
|
||||
if (idx >= (usize)hdr->sect_header_num)
|
||||
return null;
|
||||
return nullptr;
|
||||
u8 *table = sccf_sect_header_table(base);
|
||||
return (sccf_sect_header_t *)(table + idx * sizeof(sccf_sect_header_t));
|
||||
}
|
||||
@@ -76,11 +76,11 @@ static inline usize sccf_sect_data_offset(u8 *base, usize idx) {
|
||||
* @brief 获取指定索引的节数据起始地址
|
||||
* @param base 文件缓冲区起始地址
|
||||
* @param idx 节索引
|
||||
* @return 数据起始地址, 若索引无效返回 null
|
||||
* @return 数据起始地址, 若索引无效返回 nullptr
|
||||
*/
|
||||
static inline u8 *sccf_sect_data(u8 *base, usize idx) {
|
||||
usize off = sccf_sect_data_offset(base, idx);
|
||||
return (off == 0) ? null : base + off;
|
||||
return (off == 0) ? nullptr : base + off;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
Reference in New Issue
Block a user