[m-rev.] diff: fix an XXX with trace count files on Windows

Julien Fischer jfischer at opturion.com
Sun Oct 22 20:57:12 AEDT 2023


Fix an XXX with trace count files on Windows.

runtime/mercury_trace_base.c:
     Handle the case where the trace count file name contains non-ASCII
     characters on Windows.

Julien.

diff --git a/runtime/mercury_trace_base.c b/runtime/mercury_trace_base.c
index 18839be..1302765 100644
--- a/runtime/mercury_trace_base.c
+++ b/runtime/mercury_trace_base.c
@@ -329,8 +329,11 @@ MR_trace_record_label_exec_counts(void *dummy)
          }
      }

-    // XXX WINDOWS: probably wants to be _wfopen on Windows.
-    fp = fopen(name, "w");
+    #if defined(MR_WIN32) && !defined(MR_CYGWIN)
+        fp = _wfopen(MR_utf8_to_wide(name), L"w");
+    #else
+        fp = fopen(name, "w");
+    #endif
      if (fp != NULL) {
          unsigned    num_written;



More information about the reviews mailing list