diff options
-rw-r--r-- | Changes | 2 | ||||
-rw-r--r-- | lzf.c | 14 |
2 files changed, 16 insertions, 0 deletions
@@ -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 @@ -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); |