This is an automated email from the ASF dual-hosted git repository.
mseidel pushed a commit to branch AOO42X
in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/AOO42X by this push:
new 9957b46 Fixed typos, removed whitespace
9957b46 is described below
commit 9957b4659c1f3bb02a3c57d9c90a49fb5b54042a
Author: mseidel <[email protected]>
AuthorDate: Sun Nov 17 15:49:15 2019 +0100
Fixed typos, removed whitespace
(cherry picked from commit 0cf988a7abfdbda8c5326a450fef021af93ab2bd)
---
.../checkrunningofficelanguagepack.cxx | 26 ++---
.../languagepacks/lngpckinsthelper.cxx | 128 ++++++++++-----------
.../customactions/languagepacks/respintest.cxx | 47 ++++----
3 files changed, 100 insertions(+), 101 deletions(-)
diff --git
a/main/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx
b/main/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx
index 81e5464..eeceec3 100644
---
a/main/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx
+++
b/main/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx
@@ -1,5 +1,5 @@
/**************************************************************
- *
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -7,16 +7,16 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
+ *
*************************************************************/
@@ -81,14 +81,14 @@ static std::_tstring GetMsiProperty( MSIHANDLE handle,
const std::_tstring& sPro
LPTSTR buffer = reinterpret_cast<LPTSTR>(_alloca(nBytes));
ZeroMemory( buffer, nBytes );
MsiGetProperty(handle, sProperty.c_str(), buffer, &nChars);
- result = buffer;
+ result = buffer;
}
return result;
}
-
+
static inline bool IsSetMsiProperty(MSIHANDLE handle, const std::_tstring&
sProperty)
-{
+{
std::_tstring value = GetMsiProperty(handle, sProperty);
return (value.length() > 0);
}
@@ -116,7 +116,7 @@ static BOOL MoveFileEx9x( LPCSTR lpExistingFileNameA,
LPCSTR lpNewFileNameA, DWO
// Path names in WININIT.INI must be in short path name form
- if (
+ if (
GetShortPathNameA( lpExistingFileNameA,
szExistingFileNameA, MAX_PATH ) &&
(!lpNewFileNameA || GetShortPathNameA( lpNewFileNameA,
szNewFileNameA, MAX_PATH ))
)
@@ -124,7 +124,7 @@ static BOOL MoveFileEx9x( LPCSTR lpExistingFileNameA,
LPCSTR lpNewFileNameA, DWO
CHAR szBuffer[32767]; // The buffer size must
not exceed 32K
DWORD dwBufLen = GetPrivateProfileSectionA(
RENAME_SECTION, szBuffer, elementsof(szBuffer), WININIT_FILENAME );
- CHAR szRename[MAX_PATH]; // This is enough for
at most to times 67 chracters
+ CHAR szRename[MAX_PATH]; // This is enough for
at most to times 67 characters
strcpy( szRename, szNewFileNameA );
strcat( szRename, "=" );
strcat( szRename, szExistingFileNameA );
@@ -200,10 +200,10 @@ extern "C" UINT __stdcall IsOfficeRunning( MSIHANDLE
handle )
} while ( fSuccess && fRenameSucceeded );
if ( !fRenameSucceeded )
- {
+ {
MsiSetProperty(handle, TEXT("OFFICERUNS"), TEXT("1"));
- SetMsiErrorCode( MSI_ERROR_OFFICE_IS_RUNNING );
- }
+ SetMsiErrorCode( MSI_ERROR_OFFICE_IS_RUNNING );
+ }
FindClose( hFind );
}
@@ -211,5 +211,3 @@ extern "C" UINT __stdcall IsOfficeRunning( MSIHANDLE handle
)
return ERROR_SUCCESS;
}
-
-
diff --git
a/main/setup_native/source/win32/customactions/languagepacks/lngpckinsthelper.cxx
b/main/setup_native/source/win32/customactions/languagepacks/lngpckinsthelper.cxx
index 01bb595..7b5fa9e 100644
---
a/main/setup_native/source/win32/customactions/languagepacks/lngpckinsthelper.cxx
+++
b/main/setup_native/source/win32/customactions/languagepacks/lngpckinsthelper.cxx
@@ -1,5 +1,5 @@
/**************************************************************
- *
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -7,20 +7,20 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
+ *
*************************************************************/
-
+
#ifdef _MSC_VER
#pragma warning(push, 1) /* disable warnings within system headers */
#endif
@@ -39,130 +39,130 @@
class RegistryKeyGuard
{
-public:
+public:
RegistryKeyGuard(HKEY hkey = 0) :
hkey_(hkey)
{
}
-
+
~RegistryKeyGuard()
{
if (hkey_)
RegCloseKey(hkey_);
- }
+ }
private:
HKEY hkey_;
private:
RegistryKeyGuard(const RegistryKeyGuard&);
- RegistryKeyGuard& operator=(const RegistryKeyGuard&);
+ RegistryKeyGuard& operator=(const RegistryKeyGuard&);
};
typedef std::vector<TCHAR> CharacterBuffer_t;
/* throws std::runtime_error when the value "Path" could
- not be found or contains an empty string or is not of
- type REG_SZ. All such conditions are invalid for a
+ not be found or contains an empty string or is not of
+ type REG_SZ. All such conditions are invalid for a
properly installed product. */
-std::string FindProductInstallationPath(HKEY hkey)
-{
+std::string FindProductInstallationPath(HKEY hkey)
+{
DWORD nSubKeys;
DWORD lLongestSubKey;
-
- if (RegQueryInfoKey(hkey, NULL, NULL, NULL, &nSubKeys, &lLongestSubKey,
NULL, NULL, NULL, NULL, NULL, NULL) !=
+
+ if (RegQueryInfoKey(hkey, NULL, NULL, NULL, &nSubKeys, &lLongestSubKey,
NULL, NULL, NULL, NULL, NULL, NULL) !=
ERROR_SUCCESS)
throw std::runtime_error("Cannot query info for registery key");
-
+
CharacterBuffer_t buff(lLongestSubKey + 1);
-
+
for (DWORD i = 0; i < nSubKeys; i++)
{
buff[0] = 0;
LONG ret = RegEnumKey(hkey, i, &buff[0], buff.size());
-
+
if ((ret != ERROR_SUCCESS) && (ret != ERROR_MORE_DATA))
throw std::runtime_error("Error enumerating registry key");
-
+
HKEY hSubKey;
- if (RegOpenKey(hkey, &buff[0], &hSubKey) != ERROR_SUCCESS)
- continue;
-
+ if (RegOpenKey(hkey, &buff[0], &hSubKey) != ERROR_SUCCESS)
+ continue;
+
RegistryKeyGuard guard(hSubKey);
-
+
DWORD type;
TCHAR pbuff[MAX_PATH];
DWORD size = sizeof(pbuff);
if ((RegQueryValueEx(
hSubKey, TEXT("Path"), NULL, &type,
reinterpret_cast<LPBYTE>(pbuff), &size) != ERROR_SUCCESS) ||
- (type != REG_SZ))
+ (type != REG_SZ))
continue;
-
- std::string path(pbuff);
+
+ std::string path(pbuff);
std::string::size_type idx = path.rfind("program\\soffice.exe");
- if (idx != std::string::npos)
- return path.substr(0, idx);
- } // for
-
- throw std::runtime_error("No valid product path found");
+ if (idx != std::string::npos)
+ return path.substr(0, idx);
+ } // for
+
+ throw std::runtime_error("No valid product path found");
}
UINT GetInstallProperty(MSIHANDLE handle, LPCTSTR name, CharacterBuffer_t*
buffer)
-{
+{
DWORD size = buffer->size();
UINT ret = MsiGetProperty(handle, name, &(*buffer)[0], &size);
-
+
if (ret == ERROR_MORE_DATA)
{
buffer->resize(size + 1);
size = buffer->size();
ret = MsiGetProperty(handle, name, &(*buffer)[0], &size);
- }
+ }
return ret;
}
-/*
+/*
Try to find the installation path to an already installed product.
The installation path will be written in the Windows registry
- during the installation. There may exist different products in
+ during the installation. There may exist different products in
parallel e.g. StarOffice, StarSuite, OpenOffice.org, Apache OpenOffice.
- It will be searched in this order for an installed product. If a
product
+ It will be searched in this order for an installed product. If a product
will be found the path to the product will be set in the property
"INSTALLLOCATION" else nothing will be done.
*/
extern "C" UINT __stdcall SetProductInstallationPath(MSIHANDLE handle)
{
//MessageBox(NULL, TEXT("SetProductInstallationPath"), TEXT("Language Pack
Installation Helper"), MB_OK | MB_ICONINFORMATION);
-
+
try
- {
- CharacterBuffer_t regKeyProdPath(MAX_PATH);
-
+ {
+ CharacterBuffer_t regKeyProdPath(MAX_PATH);
+
GetInstallProperty(handle, TEXT("REGKEYPRODPATH"), ®KeyProdPath);
-
+
HKEY hKey;
if ((RegOpenKey(HKEY_CURRENT_USER, ®KeyProdPath[0], &hKey) ==
ERROR_SUCCESS) ||
(RegOpenKey(HKEY_LOCAL_MACHINE, ®KeyProdPath[0], &hKey) ==
ERROR_SUCCESS))
- {
+ {
RegistryKeyGuard guard(hKey);
- std::string path = FindProductInstallationPath(hKey);
- MsiSetProperty(handle, TEXT("INSTALLLOCATION"), path.c_str());
- }
+ std::string path = FindProductInstallationPath(hKey);
+ MsiSetProperty(handle, TEXT("INSTALLLOCATION"), path.c_str());
+ }
}
catch(std::runtime_error& ex)
{
ex = ex; // no warnings
- }
- return ERROR_SUCCESS;
+ }
+ return ERROR_SUCCESS;
}
void MakeCfgimportCommandLine(CharacterBuffer_t* productPath)
-{
+{
char* p = &(*productPath)[0] + lstrlen(&(*productPath)[0]) - 1;
- if (*p != '\\')
- lstrcat(&(*productPath)[0], "\\program\\configimport.exe --spool");
+ if (*p != '\\')
+ lstrcat(&(*productPath)[0], "\\program\\configimport.exe --spool");
else
- lstrcat(&(*productPath)[0], "program\\configimport.exe --spool");
+ lstrcat(&(*productPath)[0], "program\\configimport.exe --spool");
}
/*
@@ -171,18 +171,18 @@ void MakeCfgimportCommandLine(CharacterBuffer_t*
productPath)
extern "C" UINT __stdcall RegisterLanguagePack(MSIHANDLE handle)
{
//MessageBox(NULL, TEXT("RegisterLanguagePack"), TEXT("Language Pack
Installation Helper"), MB_OK | MB_ICONINFORMATION);
-
- CharacterBuffer_t productPath(MAX_PATH);
- GetInstallProperty(handle, TEXT("INSTALLLOCATION"), &productPath);
- MakeCfgimportCommandLine(&productPath);
-
- STARTUPINFO si;
+
+ CharacterBuffer_t productPath(MAX_PATH);
+ GetInstallProperty(handle, TEXT("INSTALLLOCATION"), &productPath);
+ MakeCfgimportCommandLine(&productPath);
+
+ STARTUPINFO si;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
-
+
PROCESS_INFORMATION pi;
ZeroMemory(&pi, sizeof(pi));
-
+
if (CreateProcess(
NULL, &productPath[0], NULL, NULL,
FALSE, CREATE_NO_WINDOW | NORMAL_PRIORITY_CLASS, NULL,
@@ -191,10 +191,10 @@ extern "C" UINT __stdcall RegisterLanguagePack(MSIHANDLE
handle)
// Wait until child process exits.
WaitForSingleObject(pi.hProcess, INFINITE);
- // Close process and thread handles.
+ // Close process and thread handles.
CloseHandle(pi.hProcess);
- CloseHandle(pi.hThread);
- }
- return ERROR_SUCCESS;
+ CloseHandle(pi.hThread);
+ }
+ return ERROR_SUCCESS;
}
diff --git
a/main/setup_native/source/win32/customactions/languagepacks/respintest.cxx
b/main/setup_native/source/win32/customactions/languagepacks/respintest.cxx
index 35e1021..a40b2cb 100644
--- a/main/setup_native/source/win32/customactions/languagepacks/respintest.cxx
+++ b/main/setup_native/source/win32/customactions/languagepacks/respintest.cxx
@@ -1,5 +1,5 @@
/**************************************************************
- *
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -7,16 +7,16 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
+ *
*************************************************************/
@@ -47,7 +47,7 @@
using namespace std;
-namespace
+namespace
{
string GetMsiProperty(MSIHANDLE handle, const string& sProperty)
{
@@ -80,7 +80,7 @@ namespace
{
MsiSetProperty(handle, sProperty.c_str(), TEXT("1"));
}
-} // namespace
+} // namespace
extern "C" UINT __stdcall GetUserInstallMode(MSIHANDLE handle)
{
@@ -98,16 +98,16 @@ extern "C" UINT __stdcall GetUserInstallMode(MSIHANDLE
handle)
// 1. Searching for "ProductCode" in setup.ini
string sSetupiniPath = sOfficeInstallPath + TEXT("program\\setup.ini");
-
+
TCHAR szValue[32767];
- GetPrivateProfileString(
- TEXT("Bootstrap"),
+ GetPrivateProfileString(
+ TEXT("Bootstrap"),
TEXT("ProductCode"),
TEXT("INVALIDDIRECTORY"),
szValue,
elementsof(szValue),
- sSetupiniPath.c_str()
+ sSetupiniPath.c_str()
);
if ( !_tcsicmp( szValue, TEXT("INVALIDDIRECTORY") ) )
@@ -123,13 +123,13 @@ extern "C" UINT __stdcall GetUserInstallMode(MSIHANDLE
handle)
szValue[0] = '\0';
- GetPrivateProfileString(
- TEXT("Bootstrap"),
+ GetPrivateProfileString(
+ TEXT("Bootstrap"),
TEXT("buildid"),
TEXT("ISWRONGPRODUCT"),
szValue,
elementsof(szValue),
- sSetupiniPath.c_str()
+ sSetupiniPath.c_str()
);
if ( !_tcsicmp( szValue, TEXT("ISWRONGPRODUCT") ) )
@@ -150,7 +150,7 @@ extern "C" UINT __stdcall GetUserInstallMode(MSIHANDLE
handle)
SetMsiProperty( handle, TEXT("ISWRONGPRODUCT"), TEXT("YES") );
// MessageBox(NULL, "ISWRONGPRODUCT 2 set after searching
PRODUCTMAJOR", "DEBUG", MB_OK);
SetMsiErrorCode( MSI_ERROR_ISWRONGPRODUCT );
- return ERROR_SUCCESS;
+ return ERROR_SUCCESS;
}
// 3. Only for patch: Comparing "PRODUCTMINOR from property table and
"ProductMinor" from InfoFile
@@ -164,15 +164,15 @@ extern "C" UINT __stdcall GetUserInstallMode(MSIHANDLE
handle)
szValue[0] = '\0';
- GetPrivateProfileString(
- TEXT("Bootstrap"),
+ GetPrivateProfileString(
+ TEXT("Bootstrap"),
TEXT("ProductBuildid"),
TEXT("8918"),
szValue,
elementsof(szValue),
- sSetupiniPath.c_str()
+ sSetupiniPath.c_str()
);
-
+
int InstalledProductMinor = atoi(szValue);
if ( InstalledProductMinor >= PatchProductMinor )
@@ -180,7 +180,7 @@ extern "C" UINT __stdcall GetUserInstallMode(MSIHANDLE
handle)
SetMsiProperty( handle, TEXT("PATCHISOLDER"), TEXT("YES") );
// MessageBox(NULL, "PATCHISOLDER set", "DEBUG", MB_OK);
SetMsiErrorCode( MSI_ERROR_PATCHISOLDER );
- return ERROR_SUCCESS;
+ return ERROR_SUCCESS;
}
}
@@ -188,13 +188,13 @@ extern "C" UINT __stdcall GetUserInstallMode(MSIHANDLE
handle)
szValue[0] = '\0';
- GetPrivateProfileString(
- TEXT("Bootstrap"),
+ GetPrivateProfileString(
+ TEXT("Bootstrap"),
TEXT("ALLUSERS"),
TEXT(""),
szValue,
elementsof(szValue),
- sSetupiniPath.c_str()
+ sSetupiniPath.c_str()
);
if ( szValue[0] )
@@ -202,6 +202,7 @@ extern "C" UINT __stdcall GetUserInstallMode(MSIHANDLE
handle)
SetMsiProperty( handle, TEXT("ALLUSERS"), szValue );
// MessageBox(NULL, "ALLUSERS set", "DEBUG", MB_OK);
}
-
+
return ERROR_SUCCESS;
}
+