On 20.4.2013 11:23, Janne Hyvärinen wrote:
I have been doing some heavy testing with the new FLAC version, and I found that CreateFile function in grabbag had been left out of UTF-8 treatment at some point. This causes re-encoding an existing flac to the same name to break the file if it contains non-ascii characters. Attached patch fixes this.



And another patch. UTF-8 version of utime was completely broken and file timestamps were not preserved.

diff --git a/src/share/win_utf8_io/win_utf8_io.c 
b/src/share/win_utf8_io/win_utf8_io.c
index d7d1dbd..b10dbe3 100644
--- a/src/share/win_utf8_io/win_utf8_io.c
+++ b/src/share/win_utf8_io/win_utf8_io.c
@@ -214,22 +214,20 @@ int chmod_utf8(const char *filename, int pmode)
 int utime_utf8(const char *filename, struct utimbuf *times)
 {
        wchar_t *wname;
-       struct _utimbuf ut;
+       struct __utimbuf64 ut;
        int ret;
 
+       if (sizeof(*times) == sizeof(ut)) {
+               memcpy(&ut, times, sizeof(ut));
+       } else {
+               ut.actime = times->actime;
+               ut.modtime = times->modtime;
+       }
+
        if (!(wname = wchar_from_utf8(filename))) return -1;
-       ret = _wutime(wname, &ut);
+       ret = _wutime64(wname, &ut);
        free(wname);
 
-       if (ret != -1) {
-               if (sizeof(*times) == sizeof(ut)) {
-                       memcpy(times, &ut, sizeof(ut));
-               } else {
-                       times->actime = ut.actime;
-                       times->modtime = ut.modtime;
-               }
-       }
-
        return ret;
 }
 
_______________________________________________
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev

Reply via email to