新增代码规范检查钩子(规范V1.0 可机械校验项)并修复存量违规

新增 scripts/check_coding_standard.py + coding-standard 钩子(S1~S9:
头文件保护宏、文件头注释、宏大写、_t 后缀、switch default、
禁 strcpy/sprintf/goto/Tab、函数注释)
修复存量违规:NET_* 字节序宏大写化、net_fd_set 等类型加 _t 后缀、
net_inet_ntoa 的 sprintf 改 snprintf、补 4 处函数注释与 ui_task.c 文件头
docs/代码规范/pre-commit使用说明.md:新增 2.8 节,修正失效文档路径
This commit is contained in:
2026-09-01 15:41:25 +08:00
parent 07afb7b468
commit 2b66f96d01
12 changed files with 278 additions and 72 deletions
+7 -7
View File
@@ -24,7 +24,7 @@ extern "C" {
*/
typedef struct {
uint32_t fd_bits; /* 位掩码 */
} net_fd_set;
} net_fd_set_t;
/*
* 时间结构体
@@ -32,7 +32,7 @@ typedef struct {
typedef struct {
long tv_sec; /* 秒 */
long tv_usec; /* 微秒 */
} net_timeval;
} net_timeval_t;
/*
* poll 事件结构体
@@ -41,7 +41,7 @@ typedef struct {
int fd; /* socket 描述符 */
short events; /* 请求的事件 */
short revents; /* 实际发生的事件 */
} net_pollfd;
} net_pollfd_t;
/*
* poll 事件掩码
@@ -92,12 +92,12 @@ typedef struct {
* 函数说明:此函数会调用 net_poll() 轮询所有 Socket,
* 并检查哪些 Socket 有指定的事件发生。
*/
int net_select(int nfds, net_fd_set *readfds, net_fd_set *writefds,
net_fd_set *exceptfds, net_timeval *timeout);
int net_select(int nfds, net_fd_set_t *readfds, net_fd_set_t *writefds,
net_fd_set_t *exceptfds, net_timeval_t *timeout);
/*
* 函数功能:I/O 多路复用(poll 模式)
* 入口参数:fds - net_pollfd 数组
* 入口参数:fds - net_pollfd_t 数组
* nfds - 数组元素数量
* timeout - 超时时间(毫秒),-1 表示无限等待
* 返回值:就绪的 fd 数量,0=超时,-1=错误
@@ -105,7 +105,7 @@ int net_select(int nfds, net_fd_set *readfds, net_fd_set *writefds,
* 函数说明:与 select 类似,但使用 pollfd 结构体数组,
* 更灵活,支持更多事件类型。
*/
int net_poll_events(net_pollfd *fds, int nfds, int timeout);
int net_poll_events(net_pollfd_t *fds, int nfds, int timeout);
#ifdef __cplusplus
}