Skip to content

Commit 3263a71

Browse files
committed
modify:build warn
1 parent 8436aad commit 3263a71

5 files changed

Lines changed: 20 additions & 10 deletions

File tree

XEngine_Source/StorageModule_Session/Session_Stroage/Session_DLStroage.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ bool CSession_DLStroage::Session_DLStroage_Insert(LPCXSTR lpszClientAddr, LPCXST
150150
Session_dwErrorCode = ERROR_STORAGE_MODULE_SESSION_OPENFILE;
151151
return false;
152152
}
153-
int nRet = _xtfstat(_xtfileno(st_Client.pSt_File), &st_FStat);
153+
int nRet = _fstat(_fileno(st_Client.pSt_File), &st_FStat);
154154
if (-1 == nRet)
155155
{
156-
xtfclose(st_Client.pSt_File);
156+
fclose(st_Client.pSt_File);
157157
st_Client.pSt_File = NULL;
158158
Session_IsErrorOccur = true;
159159
Session_dwErrorCode = ERROR_STORAGE_MODULE_SESSION_OPENFILE;

XEngine_Source/StorageModule_Session/Session_Stroage/Session_UPStroage.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,11 @@ bool CSession_UPStroage::Session_UPStroage_Insert(LPCXSTR lpszClientAddr, LPCXST
191191
return false;
192192
}
193193

194-
int nFileHandle = _open(lpszFileDir, _O_CREAT | _O_WRONLY | _O_TRUNC, _S_IREAD | _S_IWRITE);
194+
#ifdef _MSC_BUILD
195+
int nFileHandle = _xtopen(lpszFileDir, _O_WRONLY | _O_CREAT | _O_TRUNC, _S_IREAD | _S_IWRITE);
196+
#else
197+
int nFileHandle = _xtopen(lpszFileDir, _O_CREAT | _O_WRONLY | _O_TRUNC, _S_IREAD | _S_IWRITE);
198+
#endif
195199
if (nFileHandle < 0)
196200
{
197201
Session_IsErrorOccur = true;

XEngine_Source/StorageModule_Session/pch.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@
1212
#include "framework.h"
1313
#include <tchar.h>
1414
#include <io.h>
15+
#include <fcntl.h>
1516
#else
1617
#include <unistd.h>
18+
#include <sys/types.h>
19+
#include <sys/stat.h>
1720
#endif
1821
#endif //PCH_H
1922
#include <stdio.h>

XEngine_Source/XEngine_StorageApp/StorageApp_Hdr.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
#include <windows.h>
1717
#include <tchar.h>
1818
#include <io.h>
19+
#include <fcntl.h>
1920
#include <minidumpapiset.h>
2021
#else
22+
#include <fcntl.h>
2123
#include <unistd.h>
2224
#include <sys/wait.h>
2325
#endif

XEngine_Source/XEngine_StorageApp/StorageApp_UPLoader.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
#include "StorageApp_Hdr.h"
2-
#include <fcntl.h>
3-
#include <unistd.h>
4-
#include <sys/stat.h>
5-
#include <stdio.h>
2+
63

74
XHTHREAD XCALLBACK XEngine_UPLoader_HTTPThread(XPVOID lParam)
85
{
@@ -196,7 +193,11 @@ bool XEngine_Task_HttpUPLoader(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, in
196193
return true;
197194
}
198195
//文件是否可写
199-
int nFileFD = open(tszFileDir, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
196+
#ifdef _MSC_BUILD
197+
int nFileFD = _xtopen(tszFileDir, _O_WRONLY | _O_CREAT | _O_TRUNC, _S_IREAD | _S_IWRITE);
198+
#else
199+
int nFileFD = _xtopen(tszFileDir, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
200+
#endif
200201
if (nFileFD < 0)
201202
{
202203
st_HDRParam.bIsClose = true;
@@ -206,10 +207,10 @@ bool XEngine_Task_HttpUPLoader(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, in
206207
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("上传客户端:%s,准备上传文件:%s 失败,创建文件失败"), lpszClientAddr, tszFileDir);
207208
return true;
208209
}
209-
FILE* pSt_File = fdopen(nFileFD, "wb");
210+
FILE* pSt_File = _fdopen(nFileFD, "wb");
210211
if (NULL == pSt_File)
211212
{
212-
close(nFileFD);
213+
_close(nFileFD);
213214
st_HDRParam.bIsClose = true;
214215
st_HDRParam.nHttpCode = 403;
215216
HttpProtocol_Server_SendMsgEx(xhUPHttp, tszSDBuffer, &nSDLen, &st_HDRParam);

0 commit comments

Comments
 (0)