mirror of
https://github.com/yuanyuanxiang/SimpleRemoter.git
synced 2026-01-21 23:13:08 +08:00
fix: Use self-defined struct to replace char buffer
This commit is contained in:
@@ -1128,4 +1128,24 @@ public:
|
||||
#define MYMSG MSG64
|
||||
#endif
|
||||
|
||||
typedef struct CharMsg {
|
||||
char data[256];
|
||||
bool needFree;
|
||||
CharMsg(const char* msg, bool free = true) {
|
||||
memset(data, 0, sizeof(data));
|
||||
strcpy_s(data, msg);
|
||||
needFree = free;
|
||||
}
|
||||
CharMsg(int len, bool free = true) {
|
||||
memset(data, 0, sizeof(data));
|
||||
needFree = free;
|
||||
}
|
||||
char& operator[](int index) {
|
||||
return data[index];
|
||||
}
|
||||
operator const char* () const {
|
||||
return data;
|
||||
}
|
||||
}CharMsg;
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user