From: <ust...@us...> - 2008-07-25 09:50:57
|
Revision: 2818 http://clucene.svn.sourceforge.net/clucene/?rev=2818&view=rev Author: ustramooner Date: 2008-07-25 09:50:55 +0000 (Fri, 25 Jul 2008) Log Message: ----------- fixed mmap errors on windows Modified Paths: -------------- branches/lucene2_3_2/src/core/CLucene/store/MMapInput.cpp Modified: branches/lucene2_3_2/src/core/CLucene/store/MMapInput.cpp =================================================================== --- branches/lucene2_3_2/src/core/CLucene/store/MMapInput.cpp 2008-07-25 09:50:22 UTC (rev 2817) +++ branches/lucene2_3_2/src/core/CLucene/store/MMapInput.cpp 2008-07-25 09:50:55 UTC (rev 2818) @@ -136,24 +136,16 @@ return; //SUCCESS! } } + + //failure: + int errnum = GetLastError(); + CloseHandle(internal->mmaphandle); - char* lpMsgBuf=0; - _cl_dword_t dw = GetLastError(); + char* lpMsgBuf=strerror(errnum); + char* errstr = _CL_NEWARRAY(char, strlen(lpMsgBuf)+80); + sprintf(errstr, "MMapIndexInput::MMapIndexInput failed with error %d: %s", errnum, lpMsgBuf); - FormatMessageA( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM, - NULL, - dw, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - lpMsgBuf, - 0, NULL ); - - char* errstr = _CL_NEWARRAY(char, strlen(lpMsgBuf)+40); - sprintf(errstr, "MMapIndexInput::MMapIndexInput failed with error %d: %s", dw, lpMsgBuf); - LocalFree(lpMsgBuf); - _CLTHROWA_DEL(CL_ERR_IO,errstr); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |