[m-rev.] trivial diff: fix compilation problem with Visual C

Julien Fischer juliensf at csse.unimelb.edu.au
Mon Sep 5 01:34:59 AEST 2011


Branches: main, 11.07

Fix a compilation problem with Visual C.

library/io.m:
 	Provide a replacement for ssize_t when using Visual C, since
 	it doesn't provide ssize_t.  (This is specific to Visual C,
 	MinGW and Cygwin do provide it.)

Julien.

Index: library/io.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.464
diff -u -r1.464 io.m
--- library/io.m	16 Jun 2011 06:22:22 -0000	1.464
+++ library/io.m	4 Sep 2011 15:28:52 -0000
@@ -5674,6 +5674,12 @@
    #include <sys/wait.h>     /* for WIFEXITED, WEXITSTATUS, etc. */
  #endif

+#if defined(MR_MSVC)
+    typedef SSIZE_T ML_ssize_t;
+#else
+    typedef ssize_t ML_ssize_t;
+#endif
+
  extern MercuryFile mercury_stdin;
  extern MercuryFile mercury_stdout;
  extern MercuryFile mercury_stderr;
@@ -7516,8 +7523,8 @@
          }
      } else {
          /* This requires multiple pushback in the underlying C library. */
-        char    buf[5];
-        ssize_t len;
+        char        buf[5];
+        ML_ssize_t  len;
          len = MR_utf8_encode(buf, Character);
          for (; len > 0; len--) {
              if (MR_UNGETCH(*mf, buf[len - 1]) == EOF) {

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list