From 71e601f11fc39b6dd3d6086a030e7eafeb20ce4d Mon Sep 17 00:00:00 2001 From: kichik Date: Sat, 19 Aug 2006 12:47:17 +0000 Subject: [PATCH] fixed bug #1536377 - incorrect timestamps on big-endian platforms instead of messing with structs, use simple arithmetic ops to split the time to low & high words git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4738 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/script.cpp | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/Source/script.cpp b/Source/script.cpp index baacbd1c..48b060dc 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -4744,18 +4744,9 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) struct stat st; if (!stat(line.gettoken_str(1), &st)) { - union - { - struct - { - long l; - long h; - } words; - long long ll; - }; - ll = (st.st_mtime * 10000000LL) + 116444736000000000LL; - high = words.h; - low = words.l; + unsigned long long ll = (st.st_mtime * 10000000LL) + 116444736000000000LL; + high = (DWORD) (ll >> 32); + low = (DWORD) ll; } else { @@ -6076,22 +6067,13 @@ int CEXEBuild::add_file(const string& dir, const string& file, int attrib, const struct stat st; if (!fstat(fd, &st)) { - union - { - struct - { - long l; - long h; - } words; - long long ll; - }; - ll = (st.st_mtime * 10000000LL) + 116444736000000000LL; + unsigned long long ll = (st.st_mtime * 10000000LL) + 116444736000000000LL; // FAT write time has a resolution of 2 seconds ll -= ll % 20000000; - ent.offsets[3] = words.l; - ent.offsets[4] = words.h; + ent.offsets[3] = (int) ll; + ent.offsets[4] = (int) (ll >> 32); } #endif else