mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 02:14:50 +00:00
lyxsum/mmap compatibility patch
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3251 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
bdfd6bb075
commit
b8ec942f92
@ -1,3 +1,7 @@
|
||||
2001-12-12 Ben Stanley <bds02@uow.edu.au>
|
||||
|
||||
* lyxsum.C: portability fix for mmap patch
|
||||
|
||||
2001-12-05 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
||||
* filetools.C:
|
||||
|
@ -23,6 +23,10 @@
|
||||
#warning lyx::sum() using mmap (lightning fast)
|
||||
#endif
|
||||
|
||||
// Make sure we get modern version of mmap and friends with void*,
|
||||
// not `compatibility' version with caddr_t.
|
||||
#define _POSIX_C_SOURCE 199506L
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
@ -40,7 +44,8 @@ unsigned long lyx::sum(string const & file)
|
||||
|
||||
void * mm = mmap(0, info.st_size, PROT_READ,
|
||||
MAP_PRIVATE, fd, 0);
|
||||
if (mm == MAP_FAILED) {
|
||||
// Some platforms have the wrong type for MAP_FAILED (compaq cxx).
|
||||
if (mm == reinterpret_cast<void*>(MAP_FAILED)) {
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user