linux编译不过修改

This commit is contained in:
zhaolei 2026-05-17 11:32:22 +08:00
parent ce681f8da6
commit e3fe5d8af9

View File

@ -113,12 +113,10 @@ bool MappingMem(HANDLE *hHandle,LPSTR *hMem,int len,const char* name)
0, // low offset: beginning
0); // default: map entire file
#else
HANDLE hMapFile = open(slf1.toStdString().c_str(),O_RDONLY));
if((hMapFile < 0)
{
return false;
}
*hMem = (LPSTR)mmap(0,0,PROT_READ,MAP_SHARED,hMapFile,0));
int hMapFile = open(slf1.toStdString().c_str(), O_RDONLY);
if (hMapFile<0)
return FALSE;
*hMem = (LPSTR )mmap(0, 0,PROT_READ,MAP_SHARED,hMapFile,0);
#endif
if (*hMem == NULL) return FALSE;
return TRUE;
@ -130,7 +128,7 @@ void CloseView(HANDLE hMapObject,LPVOID lpvMem)
if(lpvMem)UnmapViewOfFile(lpvMem);
if(hMapObject)CloseHandle(hMapObject);
#else
if(lpvMem)munmap(m_rbuf, m_mapsize);
if(lpvMem)munmap(lpvMem,0);
if(hMapObject)close(hMapObject);
return;
#endif