← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/fix-archive-dateTime into lp:zorba/archive-module

 

Matthias Brantner has proposed merging lp:~zorba-coders/zorba/fix-archive-dateTime into lp:zorba/archive-module.

Requested reviews:
  Luis Rodriguez Gonzalez (kuraru)
  Chris Hillery (ceejatec)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/fix-archive-dateTime/+merge/118036

- don't require bz2 on windows
- create last-modified attributes adjusting to UTC timezone
-- 
https://code.launchpad.net/~zorba-coders/zorba/fix-archive-dateTime/+merge/118036
Your team Zorba Coders is subscribed to branch lp:zorba/archive-module.
=== modified file 'src/archive_module.xq'
--- src/archive_module.xq	2012-07-27 03:43:13 +0000
+++ src/archive_module.xq	2012-08-03 04:59:30 +0000
@@ -25,7 +25,7 @@
  : <p>The following archive formats and compression algorithms are supported:
  : <ul>
  :   <li>ZIP (with compression DEFLATE or STORE)</li>
- :   <li>TAR (with compression GZIP or BZIP2)</li>
+ :   <li>TAR (with compression GZIP)</li>
  : </ul>
  : </p>
  : 
@@ -218,6 +218,8 @@
  : Returns the entries identified by the given paths from the archive
  : as base64Binary.
  :
+ : @param $archive the archive to extract the entries from as xs:base64Binary
+ :
  : @param $entry-names a sequence of names for entries which should be extracted
  :
  : @return a sequence of xs:base64Binary itmes for the given sequence of names

=== modified file 'src/archive_module.xq.src/archive_module.cpp'
--- src/archive_module.xq.src/archive_module.cpp	2012-08-01 20:47:46 +0000
+++ src/archive_module.xq.src/archive_module.cpp	2012-08-03 04:59:30 +0000
@@ -110,15 +110,13 @@
   zorba::Item
   ArchiveModule::createDateTimeItem(time_t& aTime)
   {
-    long long lTimeShift = 0;
+    // create a datetime item with UTC as timezone
+    // this seems to be what mtime from libarchive returns
     struct ::tm gmtm;
 #ifdef WIN32
-    localtime_s(&gmtm, &aTime);
-    if (gmtm.tm_isdst != 0)
-      lTimeShift += 3600;
+    gmtime_s(&gmtm, &aTime);
 #else
-    localtime_r(&aTime, &gmtm);
-    lTimeShift = gmtm.tm_gmtoff;
+    gmtime_r(&aTime, &gmtm);
 #endif
 
     Item lModifiedItem = getItemFactory()->createDateTime(
@@ -128,7 +126,7 @@
         static_cast<short>(gmtm.tm_hour),
         static_cast<short>(gmtm.tm_min),
         gmtm.tm_sec,
-        static_cast<short>(lTimeShift/3600));
+        0);
     return lModifiedItem;
   }
 
@@ -309,14 +307,21 @@
     }
     if (theFormat == "TAR")
     {
-      if (theCompression != "GZIP" &&
-          theCompression != "BZIP2" &&
-          theCompression != "LZMA")
+      if (theCompression != "GZIP"
+#ifndef WIN32
+          && theCompression != "BZIP2"
+          && theCompression != "LZMA"
+#endif
+        )
       {
         std::ostringstream lMsg;
         lMsg
           << theCompression
-          << ": compression algorithm not supported for TAR format (required: gzip, bzip2, lzma)";
+          << ": compression algorithm not supported for TAR format (required: gzip"
+#ifndef WIN32
+          << ", bzip2, lzma"
+#endif
+          << ")";
         throwError("ARCH0002", lMsg.str().c_str());
       }
     }


Follow ups