fix: 修正SDL初始化条件判断和Windows平台编译兼容性

- 将SDL初始化条件从`< 0`改为`!= 0`以正确处理SDL_Init返回值
- 为Windows平台的#pragma comment添加_MSC_VER条件编译,提升跨编译器兼容性
- 统一网络函数参数声明中的指针星号位置,保持代码风格一致
This commit is contained in:
2026-02-09 20:16:52 +08:00
parent 17d7079c41
commit a0944f8e16
2 changed files with 8 additions and 6 deletions
+2
View File
@@ -18,7 +18,9 @@
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#ifdef _MSC_VER
#pragma comment(lib, "ws2_32.lib")
#endif
#else
#include <sys/socket.h>
#include <netinet/in.h>
+1 -1
View File
@@ -29,7 +29,7 @@
*/
int init_gui()
{
if (SDL_Init(SDL_INIT_VIDEO) < 0)
if (!SDL_Init(SDL_INIT_VIDEO))
{
printf("SDL初始化失败: %s\n", SDL_GetError());
return -1;