linux编译不过修改
This commit is contained in:
parent
ce681f8da6
commit
e3fe5d8af9
|
|
@ -113,12 +113,10 @@ bool MappingMem(HANDLE *hHandle,LPSTR *hMem,int len,const char* name)
|
||||||
0, // low offset: beginning
|
0, // low offset: beginning
|
||||||
0); // default: map entire file
|
0); // default: map entire file
|
||||||
#else
|
#else
|
||||||
HANDLE hMapFile = open(slf1.toStdString().c_str(),O_RDONLY));
|
int hMapFile = open(slf1.toStdString().c_str(), O_RDONLY);
|
||||||
if((hMapFile < 0)
|
if (hMapFile<0)
|
||||||
{
|
return FALSE;
|
||||||
return false;
|
*hMem = (LPSTR )mmap(0, 0,PROT_READ,MAP_SHARED,hMapFile,0);
|
||||||
}
|
|
||||||
*hMem = (LPSTR)mmap(0,0,PROT_READ,MAP_SHARED,hMapFile,0));
|
|
||||||
#endif
|
#endif
|
||||||
if (*hMem == NULL) return FALSE;
|
if (*hMem == NULL) return FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
@ -130,7 +128,7 @@ void CloseView(HANDLE hMapObject,LPVOID lpvMem)
|
||||||
if(lpvMem)UnmapViewOfFile(lpvMem);
|
if(lpvMem)UnmapViewOfFile(lpvMem);
|
||||||
if(hMapObject)CloseHandle(hMapObject);
|
if(hMapObject)CloseHandle(hMapObject);
|
||||||
#else
|
#else
|
||||||
if(lpvMem)munmap(m_rbuf, m_mapsize);
|
if(lpvMem)munmap(lpvMem,0);
|
||||||
if(hMapObject)close(hMapObject);
|
if(hMapObject)close(hMapObject);
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user