summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changes2
-rw-r--r--lzf.c14
2 files changed, 16 insertions, 0 deletions
diff --git a/Changes b/Changes
index ac650cd..8c9ed3e 100644
--- a/Changes
+++ b/Changes
@@ -2,6 +2,8 @@
- get rid of memcpy.
- tentatively use rep movsb on x86 and x86_64 (gcc only) for a
moderate speed improvement.
+ - applied patch by Kein-Hong Man to maske lzf.c compile under
+ the crippled mingw32 environment.
2.0 Fri Feb 16 23:11:18 CET 2007
- replaced lzf demo by industrial-strength lzf utility with behaviour
diff --git a/lzf.c b/lzf.c
index d4f4ef4..f10058e 100644
--- a/lzf.c
+++ b/lzf.c
@@ -323,6 +323,9 @@ open_out (const char *name)
m = 0;
fd = open (name, O_CREAT | O_WRONLY | O_TRUNC | m, 600);
+#if defined(__MINGW32__)
+ _setmode(fd, _O_BINARY);
+#endif
return fd;
}
@@ -376,8 +379,15 @@ run_file (const char *fname)
if (compose_name (fname, oname))
return -1;
+#if !defined(__MINGW32__)
rc = lstat (fname, &mystat);
+#else
+ rc = stat (fname, &mystat);
+#endif
fd = open (fname, O_RDONLY);
+#if defined(__MINGW32__)
+ _setmode(fd, _O_BINARY);
+#endif
if (rc || fd == -1)
{
fprintf (stderr, "%s: %s: ", imagename, fname);
@@ -423,7 +433,11 @@ run_file (const char *fname)
fname, nr_written == 0 ? 0 : 100.0 - nr_read / ((double) nr_written / 100.0), oname);
}
+#if !defined(__MINGW32__)
fchmod (fd2, mystat.st_mode);
+#else
+ chmod (oname, mystat.st_mode);
+#endif
close (fd);
close (fd2);