Skip to content

Commit 9ce5c7b

Browse files
LatosProjectclaude
andcommitted
fix: 修复 C 代码中错误使用 C++ 头文件和更新协议版本
- 将 server.c 中的 #include <cstring> 改为 #include <string.h> - 添加 MSG_ERR_PROTOCOL_VERSION 消息定义 - 将 PROTOCOL_VERSION 从 0 更新为 2 - 调整代码格式(空格对齐) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 1b279f3 commit 9ce5c7b

3 files changed

Lines changed: 12 additions & 11 deletions

File tree

‎include/i18n.h‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
* 语言枚举
4040
*/
4141
typedef enum {
42-
LANG_EN, /* English */
43-
LANG_ZH, /* 中文 */
42+
LANG_EN, /* English */
43+
LANG_ZH, /* 中文 */
4444
} language_t;
4545

4646
/**
@@ -74,6 +74,7 @@ typedef enum {
7474
MSG_ERR_FORK,
7575
MSG_ERR_OPEN_PTY,
7676
MSG_ERR_EXEC,
77+
MSG_ERR_PROTOCOL_VERSION,
7778

7879
/* 会话管理 */
7980
MSG_SESSION_FORMAT,
@@ -90,7 +91,7 @@ typedef enum {
9091
MSG_WINDOW_NEW,
9192
MSG_WINDOW_ATTACHED,
9293

93-
MSG_COUNT /* 消息总数 */
94+
MSG_COUNT /* 消息总数 */
9495
} message_id_t;
9596

9697
/**

‎include/muxkit-protocol.h‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#pragma once
4141
#include <stddef.h>
4242

43-
#define PROTOCOL_VERSION 0
43+
#define PROTOCOL_VERSION 2
4444

4545
/**
4646
* 消息类型枚举
@@ -52,7 +52,7 @@ enum msgtype {
5252
MSG_IDENTIFY_FLAGS = 100,
5353
MSG_IDENTIFY_TERM,
5454
MSG_IDENTIFY_TTYNAME,
55-
MSG_IDENTIFY_OLDCWD, /* unused */
55+
MSG_IDENTIFY_OLDCWD, /* unused */
5656
MSG_IDENTIFY_STDIN,
5757
MSG_IDENTIFY_ENVIRON,
5858
MSG_IDENTIFY_DONE,
@@ -76,9 +76,9 @@ enum msgtype {
7676
MSG_RESIZE,
7777
MSG_SHELL,
7878
MSG_SHUTDOWN,
79-
MSG_OLDSTDERR, /* unused */
80-
MSG_OLDSTDIN, /* unused */
81-
MSG_OLDSTDOUT, /* unused */
79+
MSG_OLDSTDERR, /* unused */
80+
MSG_OLDSTDIN, /* unused */
81+
MSG_OLDSTDOUT, /* unused */
8282
MSG_SUSPEND,
8383
MSG_UNLOCK,
8484
MSG_WAKEUP,
@@ -102,6 +102,6 @@ enum msgtype {
102102
* 消息头结构
103103
*/
104104
struct msg_header {
105-
enum msgtype type; /* 消息类型 */
106-
size_t len; /* 负载长度 */
105+
enum msgtype type; /* 消息类型 */
106+
size_t len; /* 负载长度 */
107107
};

‎src/server/server.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
* SOFTWARE.
4242
*/
4343

44-
#include <cstring>
4544
#define _XOPEN_SOURCE 700
45+
#include <string.h>
4646
#include "i18n.h"
4747
#include "list.h"
4848
#include "log.h"

0 commit comments

Comments
 (0)