Jean-Marc Lasgouttes wrote:

>Ben, it seems to me that you sent a patch, but I lost it. Could you
>re-send?
>
Here it is.

I'd appreciate it if people on strange platforms could test it out and 
report any problems to me, thanks. I think this one should resolve the 
compile problems we had on Solaris and compaq cxx, and satisfy the 
regulations of the style police...

Ben.


--- lyx-devel-orig/src/support/ChangeLog        Thu Dec  6 12:28:42 2001
+++ lyx-devel/src/support/ChangeLog     Wed Dec 12 09:53:19 2001
@@ -1,3 +1,7 @@
+2001-12-12  Ben Stanley  <[EMAIL PROTECTED]>
+
+       * lyxsum.C: portability fix for mmap patch
+
 2001-12-05  Lars Gullik Bjønnes  <[EMAIL PROTECTED]>
 
        * filetools.C:
--- lyx-devel-orig/src/support/lyxsum.C Thu Dec  6 12:28:42 2001
+++ lyx-devel/src/support/lyxsum.C      Wed Dec 12 09:52:15 2001
@@ -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 @@
        
        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;
        }

Reply via email to