[Libreoffice-commits] core.git: Branch 'feature/mar-updater' - 12 commits - desktop/source onlineupdate/Executable_mar.mk onlineupdate/Executable_updater.mk onlineupdate/source

Markus Mohrhard markus.mohrhard at googlemail.com
Sat Nov 26 22:39:47 UTC 2016


 desktop/source/app/updater.cxx                        |   16 ++++++++-
 onlineupdate/Executable_mar.mk                        |    4 --
 onlineupdate/Executable_updater.mk                    |    5 +--
 onlineupdate/source/libmar/verify/cryptox.c           |    5 +++
 onlineupdate/source/update/updater/progressui_win.cxx |    4 +-
 onlineupdate/source/update/updater/updater.cxx        |   30 ++++++++++--------
 6 files changed, 41 insertions(+), 23 deletions(-)

New commits:
commit 6c0ad32216c7c41d3da28d347e3c790247428242
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Nov 26 23:31:16 2016 +0100

    include nss also on windows for the updater executable
    
    Change-Id: I998355e0c4fb97a5b513be0072bced2a611c9928

diff --git a/onlineupdate/Executable_updater.mk b/onlineupdate/Executable_updater.mk
index a2342581..e5c1611 100644
--- a/onlineupdate/Executable_updater.mk
+++ b/onlineupdate/Executable_updater.mk
@@ -43,13 +43,14 @@ endif
 
 $(eval $(call gb_Executable_use_externals,updater,\
 	bzip2 \
+	nss3 \
 	$(if $(filter LINUX,$(OS)), \
-		gtk \
-		nss3 )\
+		gtk )\
 ))
 
 $(eval $(call gb_Executable_add_defs,updater,\
 	-DVERIFY_MAR_SIGNATURE \
+	-DNSS3 \
 ))
 
 $(eval $(call gb_Executable_add_exception_objects,updater,\
commit 3721d309d97e047a1498c8395052bf897e87752c
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Nov 26 23:30:25 2016 +0100

    more XP_WIN to _WIN32
    
    Change-Id: If2dd733f44675e1f4305afff84a1b16f8c8ff1c5

diff --git a/onlineupdate/source/update/updater/updater.cxx b/onlineupdate/source/update/updater/updater.cxx
index 1315b7c..5c8578c 100644
--- a/onlineupdate/source/update/updater/updater.cxx
+++ b/onlineupdate/source/update/updater/updater.cxx
@@ -1630,7 +1630,7 @@ PatchFile::Execute()
     // Go ahead and do a bit of cleanup now to minimize runtime overhead.
     // Make sure mPatchStream gets unlocked on Windows; the system will do that,
     // but not until some indeterminate future time, and we want determinism.
-#ifdef XP_WIN
+#ifdef _WIN32
     UnlockFile((HANDLE)_get_osfhandle(fileno(mPatchStream)), (DWORD)0, (DWORD)0, (DWORD)-1, (DWORD)-1);
 #endif
     // Set mPatchStream to nullptr to make AutoFile close the file,
@@ -3344,7 +3344,7 @@ int NS_main(int argc, NS_tchar **argv)
                 NS_tmkdir(gDeleteDirPath, 0755);
             }
         }
-#endif /* XP_WIN */
+#endif /* _WIN32 */
 
         // Run update process on a background thread. ShowProgressUI may return
         // before QuitProgressUI has been called, so wait for UpdateThreadFunc to
@@ -3360,7 +3360,7 @@ int NS_main(int argc, NS_tchar **argv)
         }
         t.join();
 
-#ifdef XP_WIN
+#ifdef _WIN32
         if (argc > callbackIndex && !sReplaceRequest) {
             if (callbackFile != INVALID_HANDLE_VALUE) {
                 CloseHandle(callbackFile);
@@ -3447,7 +3447,7 @@ int NS_main(int argc, NS_tchar **argv)
     LogFinish();
 
     int retVal = LaunchCallbackAndPostProcessApps(argc, argv, callbackIndex
-#ifdef XP_WIN
+#ifdef _WIN32
             , elevatedLockFilePath
             , updateLockFileHandle
 #elif XP_MACOSX
commit d1431ec89ce824b2c408f5f636b5748cfdf571ee
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Nov 26 23:29:40 2016 +0100

    add missing windows error codes
    
    Error codes taken for now from the mozilla code.
    
    Change-Id: Ib5b8ce4effb62ff0149a70a293ef6d19a0af4bb7

diff --git a/onlineupdate/source/update/updater/updater.cxx b/onlineupdate/source/update/updater/updater.cxx
index 0b2d047..1315b7c 100644
--- a/onlineupdate/source/update/updater/updater.cxx
+++ b/onlineupdate/source/update/updater/updater.cxx
@@ -65,6 +65,12 @@
 #include <winhelper/windowsStart.hxx>
 #include "uachelper.h"
 #include "pathhash.h"
+
+// TODO:moggi taken from the mozilla code -- find a better solution
+#define INVALID_APPLYTO_DIR_ERROR 74
+#define REMOVE_FILE_SPEC_ERROR 71
+#define INVALID_APPLYTO_DIR_STAGED_ERROR 72
+
 #endif
 
 
commit 8bc6f620ff843070e70bfc7da49c776d38839859
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Nov 26 23:19:12 2016 +0100

    always build with NSS and therefore verify signatures
    
    Change-Id: I7b697b95e620ce915d762ce5d09af33a9e812107

diff --git a/onlineupdate/Executable_mar.mk b/onlineupdate/Executable_mar.mk
index e6f18ef..3410ae2 100644
--- a/onlineupdate/Executable_mar.mk
+++ b/onlineupdate/Executable_mar.mk
@@ -32,13 +32,9 @@ $(eval $(call gb_Executable_add_libs,mar,\
 ))
 endif
 
-ifeq ($(filter WNT MACOSX,$(OS)),)
-$(eval $(call gb_Executable_use_externals,mar,nss3))
-
 $(eval $(call gb_Executable_add_defs,mar,\
 	-DMAR_NSS \
 ))
-endif
 
 $(eval $(call gb_Executable_add_defs,mar,\
 	-DAPP_VERSION=\"$(LIBO_VERSION_MAJOR).$(LIBO_VERSION_MINOR).$(LIBO_VERSION_MICRO).$(LIBO_VERSION_PATCH)\" \
commit 9adca375d2f4115a2fa0b57bd4e62288aeb6955f
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Nov 26 23:18:47 2016 +0100

    remove header includes
    
    Change-Id: I72c4b65b733875c8bc18a7e6718e1470bcaf611d

diff --git a/onlineupdate/source/update/updater/updater.cxx b/onlineupdate/source/update/updater/updater.cxx
index 22eae3f..0b2d047 100644
--- a/onlineupdate/source/update/updater/updater.cxx
+++ b/onlineupdate/source/update/updater/updater.cxx
@@ -1825,10 +1825,6 @@ PatchIfFile::Finish(int status)
 //-----------------------------------------------------------------------------
 
 #ifdef _WIN32
-#include "nsWindowsRestart.cpp"
-#include "nsWindowsHelpers.h"
-#include "uachelper.h"
-#include "pathhash.h"
 
 /**
  * Launch the post update application (helper.exe). It takes in the path of the
commit 360ba2c32208ce7ea9ef84450ab194026b818a7f
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Nov 26 23:18:21 2016 +0100

    workaround for compile error
    
    Change-Id: I23c0e39cf74424febc78a5e0785fa2a889d9cd56

diff --git a/onlineupdate/source/update/updater/updater.cxx b/onlineupdate/source/update/updater/updater.cxx
index 1a75b1d..22eae3f 100644
--- a/onlineupdate/source/update/updater/updater.cxx
+++ b/onlineupdate/source/update/updater/updater.cxx
@@ -1488,7 +1488,8 @@ PatchFile::Prepare()
     // when we're done creating it and when we go to apply it.
     if (!LockFile((HANDLE)_get_osfhandle(fileno(mPatchStream)), (DWORD)0, (DWORD)0, (DWORD)-1, (DWORD)-1)) {
         LOG(("Couldn't lock patch file: %d", GetLastError()));
-        return LOCK_ERROR_PATCH_FILE;
+        // TODO: moggi: fix the build problem with LOCK_ERROR_PATCH_FILE
+        return WRITE_ERROR; //return LOCK_ERROR_PATCH_FILE;
     }
     char sourcefile[MAXPATHLEN];
     if (!WideCharToMultiByte(CP_UTF8, 0, mPatchFile, -1, sourcefile, MAXPATHLEN,
commit 1489c4e9aca2569ddc0356c43f8a49daf1a5866b
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Nov 26 23:17:15 2016 +0100

    fix warnings in windows only code
    
    Change-Id: I33079d9f895e4c596a7804ec1bf6b3acde891ae7

diff --git a/onlineupdate/source/update/updater/updater.cxx b/onlineupdate/source/update/updater/updater.cxx
index ebcd98a..1a75b1d 100644
--- a/onlineupdate/source/update/updater/updater.cxx
+++ b/onlineupdate/source/update/updater/updater.cxx
@@ -1376,7 +1376,7 @@ PatchFile::~PatchFile()
     // this call is here in case Execute errors out.
 #ifdef _WIN32
     if (mPatchStream) {
-        UnlockFile((HANDLE)_get_osfhandle(fileno(mPatchStream)), 0, 0, -1, -1);
+        UnlockFile((HANDLE)_get_osfhandle(fileno(mPatchStream)), (DWORD)0, (DWORD)0, (DWORD)-1, (DWORD)-1);
     }
 #endif
 
@@ -1486,7 +1486,7 @@ PatchFile::Prepare()
 #ifdef _WIN32
     // Lock the patch file, so it can't be messed with between
     // when we're done creating it and when we go to apply it.
-    if (!LockFile((HANDLE)_get_osfhandle(fileno(mPatchStream)), 0, 0, -1, -1)) {
+    if (!LockFile((HANDLE)_get_osfhandle(fileno(mPatchStream)), (DWORD)0, (DWORD)0, (DWORD)-1, (DWORD)-1)) {
         LOG(("Couldn't lock patch file: %d", GetLastError()));
         return LOCK_ERROR_PATCH_FILE;
     }
@@ -1624,7 +1624,7 @@ PatchFile::Execute()
     // Make sure mPatchStream gets unlocked on Windows; the system will do that,
     // but not until some indeterminate future time, and we want determinism.
 #ifdef XP_WIN
-    UnlockFile((HANDLE)_get_osfhandle(fileno(mPatchStream)), 0, 0, -1, -1);
+    UnlockFile((HANDLE)_get_osfhandle(fileno(mPatchStream)), (DWORD)0, (DWORD)0, (DWORD)-1, (DWORD)-1);
 #endif
     // Set mPatchStream to nullptr to make AutoFile close the file,
     // so it can be deleted on Windows.
commit 2b9d1ad0e460dffc03f80fc254a639a7623d0333
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Nov 26 23:15:28 2016 +0100

    disable warning 4204
    
    nonstandard extension used
    
    Change-Id: I7d24417dfb14fa659e50c36889bedee406ce9401

diff --git a/onlineupdate/source/libmar/verify/cryptox.c b/onlineupdate/source/libmar/verify/cryptox.c
index 0e17f77..f71c4cef 100644
--- a/onlineupdate/source/libmar/verify/cryptox.c
+++ b/onlineupdate/source/libmar/verify/cryptox.c
@@ -13,6 +13,9 @@
 
 #if defined(MAR_NSS)
 
+#pragma warning(push)
+#pragma warning(disable: 4204)
+
 /**
  * Loads the public key for the specified cert name from the NSS store.
  *
@@ -267,6 +270,8 @@ CryptoAPI_VerifyUpdate(HCRYPTHASH* hash, BYTE *buf, DWORD len)
   return result ? CryptoX_Success : CryptoX_Error;
 }
 
+#pragma warning(pop)
+
 #endif
 
 
commit 7f1e2aa5fd579def661dc3286e7673ed12e0bae0
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Sep 17 11:53:00 2016 +0200

    explicitly include header file for unique_ptr
    
    Change-Id: I060c7554a0b293977c3e4363f246b31bb35b9055

diff --git a/onlineupdate/source/update/updater/updater.cxx b/onlineupdate/source/update/updater/updater.cxx
index 7e3ee08..ebcd98a 100644
--- a/onlineupdate/source/update/updater/updater.cxx
+++ b/onlineupdate/source/update/updater/updater.cxx
@@ -52,6 +52,7 @@
 #include <limits.h>
 #include <errno.h>
 #include <algorithm>
+#include <memory>
 
 #include <config_version.h>
 
commit a163844c06a03dad6e870cf708674966f1aa01bb
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Sep 17 11:35:22 2016 +0200

    fix unused parameter warnings
    
    Change-Id: I959129f9cf2ea0534cadf89948f9d1f09a7e2540

diff --git a/desktop/source/app/updater.cxx b/desktop/source/app/updater.cxx
index de688e1..bccf677 100644
--- a/desktop/source/app/updater.cxx
+++ b/desktop/source/app/updater.cxx
@@ -437,7 +437,7 @@ std::string download_content(const OString& rURL, bool bFile)
     return response_body;
 }
 
-OUString generateHash(const OUString& rURL)
+OUString generateHash(const OUString& /*rURL*/)
 {
     return OUString();
 }
diff --git a/onlineupdate/source/update/updater/progressui_win.cxx b/onlineupdate/source/update/updater/progressui_win.cxx
index efb4fb9..a285550 100644
--- a/onlineupdate/source/update/updater/progressui_win.cxx
+++ b/onlineupdate/source/update/updater/progressui_win.cxx
@@ -182,7 +182,7 @@ InitDialog(HWND hDlg)
 
 // Message handler for update dialog.
 static LRESULT CALLBACK
-DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
+DialogProc(HWND hDlg, UINT message, WPARAM /*wParam*/, LPARAM /*lParam*/)
 {
   switch (message)
   {
@@ -205,7 +205,7 @@ DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 }
 
 int
-InitProgressUI(int *argc, WCHAR ***argv)
+InitProgressUI(int* /*argc*/, WCHAR*** /*argv*/)
 {
   return 0;
 }
diff --git a/onlineupdate/source/update/updater/updater.cxx b/onlineupdate/source/update/updater/updater.cxx
index 2d20698..7e3ee08 100644
--- a/onlineupdate/source/update/updater/updater.cxx
+++ b/onlineupdate/source/update/updater/updater.cxx
@@ -2293,7 +2293,7 @@ ProcessReplaceRequest()
 
 #ifdef _WIN32
 static void
-WaitForServiceFinishThread(void *param)
+WaitForServiceFinishThread(void* /*param*/)
 {
     // We wait at most 10 minutes, we already waited 5 seconds previously
     // before deciding to show this UI.
commit 0cba275d26de001700e02efc93246fbe4fda8d7b
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Sep 17 11:33:23 2016 +0200

    the header file is also needed on windows
    
    Change-Id: I9d13753dd067f5370035233cb5cb7815b01f28d1

diff --git a/desktop/source/app/updater.cxx b/desktop/source/app/updater.cxx
index 6b4b930..de688e1 100644
--- a/desktop/source/app/updater.cxx
+++ b/desktop/source/app/updater.cxx
@@ -12,10 +12,10 @@
 #if UNX
 #include <unistd.h>
 #include <errno.h>
-#include <fstream>
 
 #endif
 
+#include <fstream>
 #include <config_folders.h>
 #include <rtl/bootstrap.hxx>
 
commit 6e0db65079a9b5a49a790ce47ab8ae1d877456e9
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Aug 22 18:45:21 2016 +0200

    fix windows build
    
    Change-Id: I260e2a6266d8bac2ad10b85d67721222049fce47

diff --git a/desktop/source/app/updater.cxx b/desktop/source/app/updater.cxx
index 92dfe83..6b4b930 100644
--- a/desktop/source/app/updater.cxx
+++ b/desktop/source/app/updater.cxx
@@ -9,10 +9,13 @@
 
 #include "updater.hxx"
 
+#if UNX
 #include <unistd.h>
 #include <errno.h>
 #include <fstream>
 
+#endif
+
 #include <config_folders.h>
 #include <rtl/bootstrap.hxx>
 
@@ -37,7 +40,13 @@ class error_updater : public std::exception
 
 static const char kUserAgent[] = "UpdateChecker/1.0 (Linux)";
 
+#if UNX
 const char* pUpdaterName = "updater";
+#elif WNT
+const char* pUpdaterName = "updater.exe";
+#else
+#error "Need implementation"
+#endif
 
 const char* pSofficeExeName = "soffice";
 
@@ -170,10 +179,13 @@ void Update()
 
     char** pArgs = createCommandLine();
 
+#if UNX
     if (execv(aPath.getStr(), pArgs))
     {
         printf("execv failed with error %d %s\n",errno,strerror(errno));
     }
+#endif
+
     for (size_t i = 0; i < 8; ++i)
     {
         delete[] pArgs[i];


More information about the Libreoffice-commits mailing list