mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-30 10:26:58 +01:00
On win32 too, return null when dict not found.
This commit is contained in:
parent
9acbe29bf5
commit
7c50cacc18
1 changed files with 18 additions and 17 deletions
|
@ -466,29 +466,30 @@ openMappedFile( MPFORMAL const wchar_t* name, HANDLE* mappedFileP,
|
||||||
OPEN_EXISTING,
|
OPEN_EXISTING,
|
||||||
FILE_FLAG_RANDOM_ACCESS,
|
FILE_FLAG_RANDOM_ACCESS,
|
||||||
NULL );
|
NULL );
|
||||||
XP_ASSERT( hFile != INVALID_HANDLE_VALUE );
|
if ( hFile != INVALID_HANDLE_VALUE ) {
|
||||||
|
|
||||||
DWORD size = GetFileSize( hFile, NULL );
|
DWORD size = GetFileSize( hFile, NULL );
|
||||||
XP_LOGF( "file size: %d", size );
|
XP_LOGF( "file size: %d", size );
|
||||||
|
|
||||||
ptr = XP_MALLOC( mpool, size );
|
ptr = XP_MALLOC( mpool, size );
|
||||||
if ( ptr != NULL ) {
|
if ( ptr != NULL ) {
|
||||||
DWORD nRead;
|
DWORD nRead;
|
||||||
if ( ReadFile( hFile, ptr, size, &nRead, NULL ) ) {
|
if ( ReadFile( hFile, ptr, size, &nRead, NULL ) ) {
|
||||||
XP_ASSERT( nRead == size );
|
XP_ASSERT( nRead == size );
|
||||||
} else {
|
} else {
|
||||||
XP_FREE( mpool, ptr );
|
XP_FREE( mpool, ptr );
|
||||||
ptr = NULL;
|
ptr = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
CloseHandle( hFile );
|
CloseHandle( hFile );
|
||||||
|
|
||||||
*hFileP = NULL; /* nothing to close later */
|
*hFileP = NULL; /* nothing to close later */
|
||||||
if ( sizep != NULL ) {
|
if ( sizep != NULL ) {
|
||||||
*sizep = GetFileSize( hFile, NULL );
|
*sizep = GetFileSize( hFile, NULL );
|
||||||
|
}
|
||||||
|
*mappedFileP = (HANDLE)ptr;
|
||||||
}
|
}
|
||||||
*mappedFileP = (HANDLE)ptr;
|
|
||||||
#endif
|
#endif
|
||||||
return ptr;
|
return ptr;
|
||||||
} /* openMappedFile */
|
} /* openMappedFile */
|
||||||
|
|
Loading…
Reference in a new issue