Kaydet (Commit) 827430c8 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Fold URE: Windows

...assuming the delayLoadHook in cli_ure/source/native/native_bootstrap.cxx is
no longer necessary and loading of cppuhelper from the program dir cannot fail
regardless in whatever scenario the cli_cppuhelper library itself is loaded.

Change-Id: I13f32b327bca4cce9780864f5e57cdad3860afe5
üst 1924d05e
......@@ -932,10 +932,6 @@ $(eval $(call gb_Helper_register_packages_for_install,ure,\
xml2 \
))
$(eval $(call gb_Helper_register_packages_for_install,ooo,\
xml2_win32 \
))
define gb_LinkTarget__use_libxml2
$(call gb_LinkTarget_use_package,$(1),xml2)
$(call gb_LinkTarget_set_include,$(1),\
......
......@@ -21,8 +21,7 @@ $(eval $(call gb_Jar_set_packageroot,java_uno,com))
$(eval $(call gb_Jar_add_manifest_classpath,java_uno,\
ridl.jar \
jurt.jar \
$(if $(filter MACOSX,$(OS)),../../Frameworks/, \
$(if $(filter WNT,$(OS)),../bin/,../)) \
$(if $(filter MACOSX,$(OS)),../../Frameworks/,../) \
))
$(eval $(call gb_Jar_add_sourcefiles,java_uno,\
......
......@@ -25,7 +25,6 @@
#pragma warning(push, 1)
#endif
#include <windows.h>
#include "uno/environment.hxx"
#ifdef _MSC_VER
#pragma warning(pop)
#endif
......@@ -37,271 +36,11 @@
#include "rtl/bootstrap.hxx"
#include "com/sun/star/uno/XComponentContext.hpp"
#include "cppuhelper/bootstrap.hxx"
#include <delayimp.h>
#include <stdio.h>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
namespace cli_ure {
WCHAR * resolveLink(WCHAR * path);
}
#define INSTALL_PATH L"Software\\LibreOffice\\UNO\\InstallPath"
#define URE_LINK L"\\ure-link"
#define URE_BIN L"\\bin"
#define UNO_PATH L"UNO_PATH"
namespace
{
/*
* Gets the installation path from the Windows Registry for the specified
* registry key.
*
* @param hroot open handle to predefined root registry key
* @param subKeyName name of the subkey to open
*
* @return the installation path or NULL, if no installation was found or
* if an error occurred
*/
WCHAR* getPathFromRegistryKey( HKEY hroot, LPCWSTR subKeyName )
{
HKEY hkey;
DWORD type;
TCHAR* data = NULL;
DWORD size;
/* open the specified registry key */
if ( RegOpenKeyEx( hroot, subKeyName, 0, KEY_READ, &hkey ) != ERROR_SUCCESS )
{
return NULL;
}
/* find the type and size of the default value */
if ( RegQueryValueEx( hkey, NULL, NULL, &type, NULL, &size) != ERROR_SUCCESS )
{
RegCloseKey( hkey );
return NULL;
}
/* get memory to hold the default value */
data = new WCHAR[size];
/* read the default value */
if ( RegQueryValueEx( hkey, NULL, NULL, &type, (LPBYTE) data, &size ) != ERROR_SUCCESS )
{
RegCloseKey( hkey );
delete[] data;
return NULL;
}
/* release registry key handle */
RegCloseKey( hkey );
return data;
}
/* If the path does not end with '\' the las segment will be removed.
path: C:\a\b
-> C:\a
@param io_path
in/out parameter. The string is not reallocated. Simply a '\0'
will be inserted to shorten the string.
*/
void oneDirUp(LPTSTR io_path)
{
WCHAR * pEnd = io_path + lstrlen(io_path) - 1;
while (pEnd > io_path //prevent crashing if provided string does not contain a backslash
&& *pEnd != L'\\')
pEnd --;
*pEnd = L'\0';
}
/* Returns the path to the program folder of the brand layer,
for example c:/LibreOffice 3/program
This path is either obtained from the environment variable UNO_PATH
or the registry item
"Software\\LibreOffice\\UNO\\InstallPath"
either in HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE
The return value must be freed with delete[]
*/
WCHAR * getInstallPath()
{
WCHAR * szInstallPath = NULL;
DWORD cChars = GetEnvironmentVariable(UNO_PATH, NULL, 0);
if (cChars > 0)
{
szInstallPath = new WCHAR[cChars];
cChars = GetEnvironmentVariable(UNO_PATH, szInstallPath, cChars);
//If PATH is not set then it is no error
if (cChars == 0)
{
delete[] szInstallPath;
return NULL;
}
}
if (! szInstallPath)
{
szInstallPath = getPathFromRegistryKey( HKEY_CURRENT_USER, INSTALL_PATH );
if ( szInstallPath == NULL )
{
/* read the key's default value from HKEY_LOCAL_MACHINE */
szInstallPath = getPathFromRegistryKey( HKEY_LOCAL_MACHINE, INSTALL_PATH );
}
}
return szInstallPath;
}
/* Returns the path to the URE/bin path, where cppuhelper lib resides.
The returned string must be freed with delete[]
*/
WCHAR* getUnoPath()
{
WCHAR * szLinkPath = NULL;
WCHAR * szUrePath = NULL;
WCHAR * szUreBin = NULL; //the return value
WCHAR * szInstallPath = getInstallPath();
if (szInstallPath)
{
oneDirUp(szInstallPath);
//build the path to the ure-link file
szUrePath = new WCHAR[MAX_PATH];
szUrePath[0] = L'\0';
lstrcat(szUrePath, szInstallPath);
lstrcat(szUrePath, URE_LINK);
//get the path to the actual Ure folder
if (cli_ure::resolveLink(szUrePath))
{
//build the path to the URE/bin directory
szUreBin = new WCHAR[lstrlen(szUrePath) + lstrlen(URE_BIN) + 1];
szUreBin[0] = L'\0';
lstrcat(szUreBin, szUrePath);
lstrcat(szUreBin, URE_BIN);
}
}
#if OSL_DEBUG_LEVEL >=2
if (szUreBin)
{
fwprintf(stdout,L"[cli_cppuhelper]: Path to URE libraries:\n %s \n", szUreBin);
}
else
{
fwprintf(stdout,L"[cli_cppuhelper]: Failed to determine location of URE.\n");
}
#endif
delete[] szInstallPath;
delete[] szLinkPath;
delete[] szUrePath;
return szUreBin;
}
/*We extend the path to contain the Ure/bin folder,
so that components can use osl_loadModule with arguments, such as
"reg3.dll". That is, the arguments are only the library names.
*/
void extendPath(LPCWSTR szUreBinPath)
{
if (!szUreBinPath)
return;
WCHAR * sEnvPath = NULL;
DWORD cChars = GetEnvironmentVariable(L"PATH", sEnvPath, 0);
if (cChars > 0)
{
sEnvPath = new WCHAR[cChars];
cChars = GetEnvironmentVariable(L"PATH", sEnvPath, cChars);
//If PATH is not set then it is no error
if (cChars == 0 && GetLastError() != ERROR_ENVVAR_NOT_FOUND)
{
delete[] sEnvPath;
return;
}
}
//prepare the new PATH. Add the Ure/bin directory at the front.
//note also adding ';'
WCHAR * sNewPath = new WCHAR[lstrlen(sEnvPath) + lstrlen(szUreBinPath) + 2];
sNewPath[0] = L'\0';
lstrcat(sNewPath, szUreBinPath);
if (lstrlen(sEnvPath))
{
lstrcat(sNewPath, L";");
lstrcat(sNewPath, sEnvPath);
}
SetEnvironmentVariable(L"PATH", sNewPath);
delete[] sEnvPath;
delete[] sNewPath;
}
HMODULE loadFromPath(LPCWSTR sLibName)
{
if (sLibName == NULL)
return NULL;
WCHAR * szUreBinPath = getUnoPath();
if (!szUreBinPath)
return NULL;
extendPath(szUreBinPath);
WCHAR* szFullPath = new WCHAR[lstrlen(sLibName) + lstrlen(szUreBinPath) + 2];
szFullPath[0] = L'\0';
lstrcat(szFullPath, szUreBinPath);
lstrcat(szFullPath, L"\\");
lstrcat(szFullPath, sLibName);
HMODULE handle = LoadLibraryEx(szFullPath, NULL,
LOAD_WITH_ALTERED_SEARCH_PATH);
delete[] szFullPath;
delete[] szUreBinPath;
return handle;
}
/*Hook for delayed loading of libraries which this library is linked with.
This is a failure hook. That is, it is only called when the loading of
a library failed. It will be called when loading of cppuhelper failed.
Because we extend the PATH to the URE/bin folder while this function is
executed (see extendPath), all other libraries are found.
*/
extern "C" FARPROC WINAPI delayLoadHook(
unsigned dliNotify,
PDelayLoadInfo pdli
)
{
if (dliNotify == dliFailLoadLib)
{
LPWSTR szLibName = NULL;
//Convert the ansi file name to wchar_t*
int size = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, pdli->szDll, -1, NULL, 0);
if (size > 0)
{
szLibName = new WCHAR[size];
if (! MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, pdli->szDll, -1, szLibName, size))
{
delete[] szLibName;
return 0;
}
}
HANDLE h = loadFromPath(szLibName);
delete[] szLibName;
return (FARPROC) h;
}
return 0;
}
}
ExternC
PfnDliHook __pfnDliFailureHook2 = delayLoadHook;
namespace uno
{
namespace util
......
......@@ -21,8 +21,6 @@
#if defined WNT
#include <cstddef>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
......@@ -43,167 +41,6 @@ SAL_DLLPUBLIC_EXPORT WCHAR * filename(WCHAR * path) {
}
}
WCHAR * buildPath(
WCHAR * path, WCHAR const * frontBegin, WCHAR const * frontEnd,
WCHAR const * backBegin, std::size_t backLength)
{
// Remove leading ".." segments in the second path together with matching
// segments in the first path that are neither empty nor "." nor ".." nor
// end in ":" (which is not foolprove, as it can erroneously erase the start
// of a UNC path, but only if the input is bad data):
while (backLength >= 2 && backBegin[0] == L'.' && backBegin[1] == L'.' &&
(backLength == 2 || backBegin[2] == L'\\'))
{
if (frontEnd - frontBegin < 2 || frontEnd[-1] != L'\\' ||
frontEnd[-2] == L'\\' || frontEnd[-2] == L':' ||
(frontEnd[-2] == L'.' &&
(frontEnd - frontBegin < 3 || frontEnd[-3] == L'\\' ||
(frontEnd[-3] == L'.' &&
(frontEnd - frontBegin < 4 || frontEnd[-4] == L'\\')))))
{
break;
}
WCHAR const * p = frontEnd - 1;
while (p != frontBegin && p[-1] != L'\\') {
--p;
}
if (p == frontBegin) {
break;
}
frontEnd = p;
if (backLength == 2) {
backBegin += 2;
backLength -= 2;
} else {
backBegin += 3;
backLength -= 3;
}
}
if (backLength <
static_cast< std::size_t >(MAX_PATH - (frontEnd - frontBegin)))
// hopefully std::size_t is large enough
{
WCHAR * p;
if (frontBegin == path) {
p = const_cast< WCHAR * >(frontEnd);
} else {
p = path;
while (frontBegin != frontEnd) {
*p++ = *frontBegin++;
}
}
for (; backLength > 0; --backLength) {
*p++ = *backBegin++;
}
*p = L'\0';
return p;
} else {
SetLastError(ERROR_FILENAME_EXCED_RANGE);
return NULL;
}
}
WCHAR * resolveLink(WCHAR * path) {
HANDLE h = CreateFileW(
path, FILE_READ_DATA, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
if (h == INVALID_HANDLE_VALUE) {
return NULL;
}
char p1[MAX_PATH];
DWORD n;
BOOL ok = ReadFile(h, p1, MAX_PATH, &n, NULL);
CloseHandle(h);
if (!ok) {
return NULL;
}
WCHAR p2[MAX_PATH];
std::size_t n2 = 0;
bool colon = false;
for (DWORD i = 0; i < n;) {
unsigned char c = static_cast< unsigned char >(p1[i++]);
switch (c) {
case '\0':
SetLastError(ERROR_BAD_PATHNAME);
return NULL;
case '\x0A':
case '\x0D':
if (n2 == MAX_PATH) {
SetLastError(ERROR_FILENAME_EXCED_RANGE);
return NULL;
}
p2[n2] = L'\0';
break;
case ':':
colon = true;
// fall through
default:
// Convert from UTF-8 to UTF-16:
if (c <= 0x7F) {
p2[n2++] = c;
} else if (c >= 0xC2 && c <= 0xDF && i < n &&
static_cast< unsigned char >(p1[i]) >= 0x80 &&
static_cast< unsigned char >(p1[i]) <= 0xBF)
{
p2[n2++] = ((c & 0x1F) << 6) |
(static_cast< unsigned char >(p1[i++]) & 0x3F);
} else if (n - i > 1 &&
((c == 0xE0 &&
static_cast< unsigned char >(p1[i]) >= 0xA0 &&
static_cast< unsigned char >(p1[i]) <= 0xBF) ||
((c >= 0xE1 && c <= 0xEC || c >= 0xEE && c <= 0xEF) &&
static_cast< unsigned char >(p1[i]) >= 0x80 &&
static_cast< unsigned char >(p1[i]) <= 0xBF) ||
(c == 0xED &&
static_cast< unsigned char >(p1[i]) >= 0x80 &&
static_cast< unsigned char >(p1[i]) <= 0x9F)) &&
static_cast< unsigned char >(p1[i + 1]) >= 0x80 &&
static_cast< unsigned char >(p1[i + 1]) <= 0xBF)
{
p2[n2++] = ((c & 0x0F) << 12) |
((static_cast< unsigned char >(p1[i]) & 0x3F) << 6) |
(static_cast< unsigned char >(p1[i + 1]) & 0x3F);
i += 2;
} else if (n - 2 > 1 &&
((c == 0xF0 &&
static_cast< unsigned char >(p1[i]) >= 0x90 &&
static_cast< unsigned char >(p1[i]) <= 0xBF) ||
(c >= 0xF1 && c <= 0xF3 &&
static_cast< unsigned char >(p1[i]) >= 0x80 &&
static_cast< unsigned char >(p1[i]) <= 0xBF) ||
(c == 0xF4 &&
static_cast< unsigned char >(p1[i]) >= 0x80 &&
static_cast< unsigned char >(p1[i]) <= 0x8F)) &&
static_cast< unsigned char >(p1[i + 1]) >= 0x80 &&
static_cast< unsigned char >(p1[i + 1]) <= 0xBF &&
static_cast< unsigned char >(p1[i + 2]) >= 0x80 &&
static_cast< unsigned char >(p1[i + 2]) <= 0xBF)
{
sal_Int32 u = ((c & 0x07) << 18) |
((static_cast< unsigned char >(p1[i]) & 0x3F) << 12) |
((static_cast< unsigned char >(p1[i + 1]) & 0x3F) << 6) |
(static_cast< unsigned char >(p1[i + 2]) & 0x3F);
i += 3;
p2[n2++] = static_cast< WCHAR >(((u - 0x10000) >> 10) | 0xD800);
p2[n2++] = static_cast< WCHAR >(
((u - 0x10000) & 0x3FF) | 0xDC00);
} else {
SetLastError(ERROR_BAD_PATHNAME);
return NULL;
}
break;
}
}
WCHAR * end;
if (colon || p2[0] == L'\\') {
// Interpret p2 as an absolute path:
end = path;
} else {
// Interpret p2 as a relative path:
end = filename(path);
}
return buildPath(path, path, end, p2, n2);
}
}
#endif
......
......@@ -3039,11 +3039,11 @@ elif test $_os = WINNT; then
LIBO_SHARE_PRESETS_FOLDER=presets
LIBO_SHARE_RESOURCE_FOLDER=program/resource
LIBO_SHARE_SHELL_FOLDER=program/shell
LIBO_URE_BIN_FOLDER=URE/bin
LIBO_URE_ETC_FOLDER=URE/bin
LIBO_URE_LIB_FOLDER=URE/bin
LIBO_URE_MISC_FOLDER=URE/misc
LIBO_URE_SHARE_JAVA_FOLDER=URE/java
LIBO_URE_BIN_FOLDER=program
LIBO_URE_ETC_FOLDER=program
LIBO_URE_LIB_FOLDER=program
LIBO_URE_MISC_FOLDER=program
LIBO_URE_SHARE_JAVA_FOLDER=program/classes
else
LIBO_BIN_FOLDER=program
LIBO_ETC_FOLDER=program
......
......@@ -23,7 +23,7 @@ $(eval $(call gb_Executable_use_system_win32_libs,soffice,\
$(eval $(call gb_Executable_use_static_libraries,soffice,\
ooopathutils \
winextendloaderenv \
winloader \
))
$(eval $(call gb_Executable_add_exception_objects,soffice,\
......
......@@ -36,11 +36,6 @@ endif
ifeq ($(OS),WNT)
$(eval $(call gb_Executable_use_static_libraries,soffice_bin,\
ooopathutils \
winextendloaderenv \
))
$(eval $(call gb_Executable_set_targettype_gui,soffice_bin,YES))
$(eval $(call gb_Executable_add_nativeres,soffice_bin,sofficebin/officeloader))
......
......@@ -13,7 +13,7 @@ $(eval $(call gb_Executable_set_targettype_gui,unopkg,YES))
$(eval $(call gb_Executable_use_static_libraries,unopkg,\
ooopathutils \
winextendloaderenv \
winloader \
))
$(eval $(call gb_Executable_add_exception_objects,unopkg,\
......
......@@ -69,7 +69,7 @@ $(eval $(call gb_Module_add_targets,desktop,\
endif
$(eval $(call gb_Module_add_targets,desktop,\
StaticLibrary_winextendloaderenv \
StaticLibrary_winloader \
StaticLibrary_winlauncher \
Executable_quickstart \
Executable_sbase \
......
......@@ -8,10 +8,10 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_StaticLibrary_StaticLibrary,winextendloaderenv))
$(eval $(call gb_StaticLibrary_StaticLibrary,winloader))
$(eval $(call gb_StaticLibrary_add_exception_objects,winextendloaderenv,\
desktop/win32/source/extendloaderenvironment \
$(eval $(call gb_StaticLibrary_add_exception_objects,winloader,\
desktop/win32/source/loader \
))
# vim:set noet sw=4 ts=4:
......@@ -38,7 +38,7 @@
#include <systools/win32/uwinapi.h>
#include <tools/pathutils.hxx>
#include "../extendloaderenvironment.hxx"
#include "../loader.hxx"
......@@ -48,7 +48,7 @@ static int GenericMain()
TCHAR szIniDirectory[MAX_PATH];
STARTUPINFO aStartupInfo;
desktop_win32::extendLoaderEnvironment(szTargetFileName, szIniDirectory);
desktop_win32::getPaths(szTargetFileName, szIniDirectory);
ZeroMemory( &aStartupInfo, sizeof(aStartupInfo) );
aStartupInfo.cb = sizeof(aStartupInfo);
......
......@@ -19,8 +19,6 @@
#include <sal/config.h>
#include <cstddef>
#define WIN32_LEAN_AND_MEAN
#if defined _MSC_VER
#pragma warning(push, 1)
......@@ -33,53 +31,19 @@
#include <tools/pathutils.hxx>
#include "extendloaderenvironment.hxx"
namespace {
void fail() {
LPWSTR buf = NULL;
FormatMessageW(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL,
GetLastError(), 0, reinterpret_cast< LPWSTR >(&buf), 0, NULL);
MessageBoxW(NULL, buf, NULL, MB_OK | MB_ICONERROR);
LocalFree(buf);
TerminateProcess(GetCurrentProcess(), 255);
}
bool contains(WCHAR const * paths, WCHAR const * path, WCHAR const * pathEnd) {
WCHAR const * q = path;
for (WCHAR const * p = paths;; ++p) {
WCHAR c = *p;
switch (c) {
case L'\0':
return q == pathEnd;
case L';':
if (q == pathEnd) {
return true;
}
q = path;
break;
default:
if (q != NULL) {
if (q != pathEnd && *q == c) {
++q;
} else {
q = NULL;
}
}
break;
}
}
}
}
#include "loader.hxx"
namespace desktop_win32 {
void extendLoaderEnvironment(WCHAR * binPath, WCHAR * iniDirectory) {
void getPaths(WCHAR * binPath, WCHAR * iniDirectory) {
if (!GetModuleFileNameW(NULL, iniDirectory, MAX_PATH)) {
fail();
LPWSTR buf = NULL;
FormatMessageW(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL,
GetLastError(), 0, reinterpret_cast< LPWSTR >(&buf), 0, NULL);
MessageBoxW(NULL, buf, NULL, MB_OK | MB_ICONERROR);
LocalFree(buf);
TerminateProcess(GetCurrentProcess(), 255);
}
WCHAR * iniDirEnd = tools::filename(iniDirectory);
WCHAR name[MAX_PATH + MY_LENGTH(L".bin")];
......@@ -101,40 +65,6 @@ void extendLoaderEnvironment(WCHAR * binPath, WCHAR * iniDirectory) {
nameEnd[-1] = 'n';
tools::buildPath(binPath, iniDirectory, iniDirEnd, name, nameEnd - name);
*iniDirEnd = L'\0';
std::size_t const maxEnv = 32767;
WCHAR pad[MAX_PATH + maxEnv];
// hopefully std::size_t is large enough to not overflow
WCHAR * pathEnd = tools::buildPath(
pad, iniDirectory, iniDirEnd, MY_STRING(L"..\\ure-link"));
if (pathEnd == NULL) {
fail();
}
pathEnd = tools::resolveLink(pad);
if (pathEnd == NULL) {
fail();
}
pathEnd = tools::buildPath(pad, pad, pathEnd, MY_STRING(L"\\bin"));
if (pathEnd == NULL) {
fail();
}
WCHAR env[maxEnv];
DWORD n = GetEnvironmentVariableW(L"PATH", env, maxEnv);
if ((n >= maxEnv || n == 0) && GetLastError() != ERROR_ENVVAR_NOT_FOUND) {
fail();
}
env[n] = L'\0';
if (!contains(env, pad, pathEnd)) {
WCHAR * p = pathEnd;
if (n != 0) {
*p++ = L';';
}
for (DWORD i = 0; i <= n; ++i) {
*p++ = env[i];
}
if (!SetEnvironmentVariableW(L"PATH", pad)) {
fail();
}
}
}
}
......
......@@ -17,8 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_DESKTOP_WIN32_SOURCE_EXTENDLOADERENVIRONMENT_HXX
#define INCLUDED_DESKTOP_WIN32_SOURCE_EXTENDLOADERENVIRONMENT_HXX
#ifndef INCLUDED_DESKTOP_WIN32_SOURCE_LOADER_HXX
#define INCLUDED_DESKTOP_WIN32_SOURCE_LOADER_HXX
#include <sal/config.h>
......@@ -68,8 +68,6 @@ inline WCHAR * commandLineAppendEncoded(WCHAR * buffer, WCHAR const * text) {
return buffer;
}
// Set the PATH environment variable in the current (loader) process, so that a
// following CreateProcess has the necessary environment:
// @param binPath
// Must point to an array of size at least MAX_PATH. Is filled with the null
// terminated full path to the "bin" file corresponding to the current
......@@ -78,7 +76,7 @@ inline WCHAR * commandLineAppendEncoded(WCHAR * buffer, WCHAR const * text) {
// Must point to an array of size at least MAX_PATH. Is filled with the null
// terminated full directory path (ending in "\") to the "ini" file
// corresponding to the current executable.
void extendLoaderEnvironment(WCHAR * binPath, WCHAR * iniDirectory);
void getPaths(WCHAR * binPath, WCHAR * iniDirectory);
}
......
......@@ -44,7 +44,7 @@
#include <sal/macros.h>
#include "../../../source/inc/exithelper.h"
#include "../extendloaderenvironment.hxx"
#include "../loader.hxx"
#include <config_version.h>
......@@ -177,7 +177,7 @@ int WINAPI _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int )
TCHAR szPerfTuneIniFile[MAX_PATH] = TEXT("");
STARTUPINFO aStartupInfo;
desktop_win32::extendLoaderEnvironment(szTargetFileName, szIniDirectory);
desktop_win32::getPaths(szTargetFileName, szIniDirectory);
ZeroMemory( &aStartupInfo, sizeof(aStartupInfo) );
aStartupInfo.cb = sizeof(aStartupInfo);
......
......@@ -79,16 +79,7 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) {
#endif
wchar_t path[MAX_PATH];
wchar_t * pathEnd = getBrandPath(path);
if (tools::buildPath(path, path, pathEnd, MY_STRING(L"..\\ure-link")) ==
NULL)
{
exit(EXIT_FAILURE);
}
pathEnd = tools::resolveLink(path);
if (pathEnd == NULL) {
exit(EXIT_FAILURE);
}
writePath(path, pathEnd, MY_STRING(L"\\bin"));
writePath(path, pathEnd, MY_STRING(L""));
#ifdef __MINGW32__
} else if (argc == 2 && strcmp(argv[1], "java") == 0) {
#else
......@@ -99,24 +90,15 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) {
}
wchar_t path[MAX_PATH];
wchar_t * pathEnd = getBrandPath(path);
writePath(path, pathEnd, MY_STRING(L""));
writePath(path, pathEnd, MY_STRING(L"classes\\ridl.jar"));
writeNull();
writePath(path, pathEnd, MY_STRING(L"classes\\unoil.jar"));
if (tools::buildPath(path, path, pathEnd, MY_STRING(L"..\\ure-link")) ==
NULL)
{
exit(EXIT_FAILURE);
}
pathEnd = tools::resolveLink(path);
if (pathEnd == NULL) {
exit(EXIT_FAILURE);
}
writePath(path, pathEnd, MY_STRING(L"classes\\jurt.jar"));
writeNull();
writePath(path, pathEnd, MY_STRING(L"\\java\\ridl.jar"));
writePath(path, pathEnd, MY_STRING(L"classes\\juh.jar"));
writeNull();
writePath(path, pathEnd, MY_STRING(L"\\java\\jurt.jar"));
writePath(path, pathEnd, MY_STRING(L"classes\\unoil.jar"));
writeNull();
writePath(path, pathEnd, MY_STRING(L"\\java\\juh.jar"));
writePath(path, pathEnd, MY_STRING(L""));
} else {
exit(EXIT_FAILURE);
}
......
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_ExternalPackage_ExternalPackage,xml2_win32,xml2))
$(eval $(call gb_ExternalPackage_use_external_project,xml2_win32,xml2))
# duplicate copy next to executables due to stupid Win32 DLL search order
# where a libxml2.dll in C:\Windows is loaded before one in URE lib dir
# see 5a5dab5167d136c315e81448ea8eca59e60067da
ifeq ($(OS),WNT)
ifeq ($(COM),GCC)
$(eval $(call gb_ExternalPackage_add_file,xml2_win32,$(LIBO_LIB_FOLDER)/libxml2.dll,.libs/libxml2.dll))
else # COM=MSC
$(eval $(call gb_ExternalPackage_add_file,xml2_win32,$(LIBO_LIB_FOLDER)/libxml2.dll,win32/bin.msvc/libxml2.dll))
endif
endif # OS=WNT
# vim: set noet sw=4 ts=4:
......@@ -11,7 +11,6 @@ $(eval $(call gb_Module_Module,libxml2))
$(eval $(call gb_Module_add_targets,libxml2,\
ExternalPackage_xml2 \
ExternalPackage_xml2_win32 \
ExternalProject_xml2 \
UnpackedTarball_xml2 \
))
......
......@@ -66,19 +66,6 @@ WCHAR * buildPath(
WCHAR * path, WCHAR const * frontBegin, WCHAR const * frontEnd,
WCHAR const * backBegin, std::size_t backLength);
/** Resolve a link file.
@param path
An input/output parameter taking the path; must point at a valid range of
memory of size at least MAX_PATH. On input, contains the null-terminated
full path of the link file. On output, contains the null-terminated full
path of the resolved link; if NULL is returned, the content is unspecified.
@return
A pointer to the terminating null character of path, or NULL if a failure
occurred.
*/
WCHAR * resolveLink(WCHAR * path);
}
#endif
......
......@@ -58,7 +58,7 @@ $(call gb_CustomTarget_get_workdir,instsetoo_native/setup)/$(call gb_Helper_get_
&& echo 'UNO_SHARED_PACKAGES_CACHE=$${$$ORIGIN/$(call gb_Helper_get_rcfile,louno):UNO_SHARED_PACKAGES_CACHE}' \
&& echo 'TMP_EXTENSIONS=$${$$ORIGIN/$(call gb_Helper_get_rcfile,louno):TMP_EXTENSIONS}' \
&& echo 'UNO_USER_PACKAGES_CACHE=$${$$ORIGIN/$(call gb_Helper_get_rcfile,louno):UNO_USER_PACKAGES_CACHE}' \
&& echo 'URE_BIN_DIR=$(if $(filter WNT,$(OS)),$${.link:$${BRAND_BASE_DIR}/ure-link}/bin,$${BRAND_BASE_DIR}/$(LIBO_URE_BIN_FOLDER))' \
&& echo 'URE_BIN_DIR=$${BRAND_BASE_DIR}/$(LIBO_URE_BIN_FOLDER)' \
&& echo 'URE_MORE_JAVA_CLASSPATH_URLS=$(if $(SYSTEM_HSQLDB),$(HSQLDB_JAR))' \
&& echo 'URE_OVERRIDE_JAVA_JFW_SHARED_DATA=$${BRAND_BASE_DIR}/$(LIBO_SHARE_FOLDER)/config/javasettings_$${_OS}_$${_ARCH}.xml' \
&& echo 'URE_OVERRIDE_JAVA_JFW_USER_DATA=$${$${BRAND_BASE_DIR}/$(LIBO_ETC_FOLDER)/$(call gb_Helper_get_rcfile,bootstrap):UserInstallation}/user/config/javasettings_$${_OS}_$${_ARCH}.xml' \
......@@ -120,10 +120,10 @@ $(call gb_CustomTarget_get_workdir,instsetoo_native/setup)/$(call gb_Helper_get_
( \
echo '[Bootstrap]' \
&& echo 'URE_INTERNAL_LIB_DIR=$${ORIGIN}$(if $(filter MACOSX,$(OS)),/../../../Frameworks)' \
&& echo 'URE_INTERNAL_JAVA_DIR=$(if $(filter MACOSX,$(OS)),$${ORIGIN}/../../java,$(if $(filter WNT,$(OS)),$${ORIGIN}/../java,$${ORIGIN}/classes))' \
&& echo 'URE_INTERNAL_JAVA_DIR=$(if $(filter MACOSX,$(OS)),$${ORIGIN}/../../java,$${ORIGIN}/classes)' \
&& echo 'URE_INTERNAL_JAVA_CLASSPATH=$${URE_MORE_JAVA_TYPES}' \
&& echo 'UNO_TYPES=$(if $(filter MACOSX,$(OS)),$${ORIGIN}/../share/misc/,$(if $(filter WNT,$(OS)),$${ORIGIN}/../misc/,$${ORIGIN}/))types.rdb $${URE_MORE_TYPES}' \
&& echo 'UNO_SERVICES=$(if $(filter MACOSX,$(OS)),$${ORIGIN}/../share/misc/,$(if $(filter WNT,$(OS)),$${ORIGIN}/../misc/,$${ORIGIN}/))services.rdb $${URE_MORE_SERVICES}' \
&& echo 'UNO_TYPES=$(if $(filter MACOSX,$(OS)),$${ORIGIN}/../share/misc/,$${ORIGIN}/)types.rdb $${URE_MORE_TYPES}' \
&& echo 'UNO_SERVICES=$(if $(filter MACOSX,$(OS)),$${ORIGIN}/../share/misc/,$${ORIGIN}/)services.rdb $${URE_MORE_SERVICES}' \
) > $@
.PHONY: $(call gb_CustomTarget_get_workdir,instsetoo_native/setup)/$(call gb_Helper_get_rcfile,version)
......
......@@ -19,8 +19,7 @@ $(eval $(call gb_Jar_set_packageroot,juh,com))
$(eval $(call gb_Jar_add_manifest_classpath,juh, \
jurt.jar \
ridl.jar \
$(if $(filter MACOSX,$(OS)),../../Frameworks/, \
$(if $(filter WNT,$(OS)),../bin/,../)) \
$(if $(filter MACOSX,$(OS)),../../Frameworks/,../) \
))
$(eval $(call gb_Jar_set_manifest,juh,$(SRCDIR)/javaunohelper/util/manifest))
......
......@@ -21,8 +21,7 @@ $(eval $(call gb_Jar_set_manifest,jurt,$(SRCDIR)/jurt/util/manifest))
$(eval $(call gb_Jar_add_manifest_classpath,jurt, \
ridl.jar \
unoloader.jar \
$(if $(filter MACOSX,$(OS)),../../Frameworks/, \
$(if $(filter WNT,$(OS)),../bin/,../)) \
$(if $(filter MACOSX,$(OS)),../../Frameworks/,../) \
))
$(eval $(call gb_Jar_add_sourcefiles,jurt,\
......
......@@ -27,7 +27,7 @@ $(call gb_CustomTarget_get_workdir,jvmfwk/jvmfwk3_ini)/$(call gb_Helper_get_rcfi
$(SRCDIR)/jvmfwk/CustomTarget_jvmfwk_jvmfwk3_ini.mk
$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),ECH,1)
( printf '[Bootstrap]\n' && \
printf 'UNO_JAVA_JFW_VENDOR_SETTINGS=$(if $(filter MACOSX,$(OS)),$${ORIGIN}/../share/misc/,$(if $(filter WNT,$(OS)),$${ORIGIN}/../misc/,$${ORIGIN}/))javavendors.xml\n' && \
printf 'UNO_JAVA_JFW_VENDOR_SETTINGS=$(if $(filter MACOSX,$(OS)),$${ORIGIN}/../share/misc/,$${ORIGIN}/)javavendors.xml\n' && \
printf 'UNO_JAVA_JFW_SHARED_DATA=$${URE_OVERRIDE_JAVA_JFW_SHARED_DATA}\n' && \
printf 'UNO_JAVA_JFW_USER_DATA=$${URE_OVERRIDE_JAVA_JFW_USER_DATA}\n' && \
printf 'UNO_JAVA_JFW_CLASSPATH_URLS=$${URE_MORE_JAVA_CLASSPATH_URLS}\n' \
......
......@@ -53,7 +53,6 @@ var oo_user_sdk_dir=WshSysEnv("APPDATA") + "\\" + oo_sdk_name;
var oo_user_sdk_env_script=oo_user_sdk_dir + "\\setsdkenv_windows.bat";
var office_home=getOfficeHome();
var oo_sdk_ure_home=office_home + "\\URE";
var oo_sdk_make_home=getMakeHome();
var oo_sdk_zip_home=getZipHome();
......@@ -854,10 +853,6 @@ function writeBatFile(fdir, file)
"REM Example: set OFFICE_HOME=C:\\Program Files\\LibreOffice 3\n" +
"set OFFICE_HOME=" + office_home +
"\n\n" +
"REM URE installation directory.\n" +
"REM Example: set OO_SDK_URE_HOME=C:\\Program Files\\LibreOffice 3\\URE\n" +
"set OO_SDK_URE_HOME=" + oo_sdk_ure_home +
"\n\n" +
"REM Directory of the make command.\n" +
"REM Example: set OO_SDK_MAKE_HOME=D:\\NextGenerationMake\\make\n" +
"set OO_SDK_MAKE_HOME=" + oo_sdk_make_home +
......@@ -904,12 +899,9 @@ function writeBatFile(fdir, file)
"\n" +
"REM Check installation path for the office.\n" +
"REM if not defined OFFICE_HOME (\n" +
"REM if not defined OO_SDK_URE_HOME (\n" +
"REM echo Error: either of the variables OFFICE_HOME and\n" +
"REM echo OO_SDK_URE_HOME is missing!\n" +
"REM echo Error: the variable OFFICE_HOME is missing!\n" +
"REM goto :error\n" +
"REM )\n" +
"REM )\n" +
"\n" +
"REM Check installation path for GNU make.\n" +
"if not defined OO_SDK_MAKE_HOME (\n" +
......@@ -953,15 +945,12 @@ function writeBatFile(fdir, file)
" set UNO_PATH=%OFFICE_PROGRAM_PATH%\n" +
" )\n" +
"\n" +
"REM if defined OO_SDK_URE_HOME (\n" +
"set OO_SDK_URE_BIN_DIR=%OO_SDK_URE_HOME%\\bin\n" +
"set OO_SDK_URE_LIB_DIR=%OO_SDK_URE_HOME%\\bin\n" +
"set OO_SDK_URE_JAVA_DIR=%OO_SDK_URE_HOME%\\java\n" +
"REM ) else (\n" +
"set OO_SDK_URE_BIN_DIR=%OFFICE_PROGRAM_PATH%\n" +
"set OO_SDK_URE_LIB_DIR=%OFFICE_PROGRAM_PATH%\n" +
"set OO_SDK_URE_JAVA_DIR=%OFFICE_PROGRAM_PATH%\\classes\n" +
"set OO_SDK_OFFICE_BIN_DIR=%OFFICE_PROGRAM_PATH%\n" +
"set OO_SDK_OFFICE_LIB_DIR=%OFFICE_PROGRAM_PATH%\n" +
"set OO_SDK_OFFICE_JAVA_DIR=%OFFICE_PROGRAM_PATH%\\classes\n" +
"REM )\n" +
"\n" +
"REM Set classpath\n" +
"set CLASSPATH=%OO_SDK_URE_JAVA_DIR%\\juh.jar;%OO_SDK_URE_JAVA_DIR%\\jurt.jar;%OO_SDK_URE_JAVA_DIR%\\ridl.jar;%OO_SDK_URE_JAVA_DIR%\\unoloader.jar;%OO_SDK_OFFICE_JAVA_DIR%\\unoil.jar\n" +
......@@ -1013,7 +1002,6 @@ function writeBatFile(fdir, file)
"echo *\n" +
"echo * SDK = %OO_SDK_HOME%\n" +
"echo * Office = %OFFICE_HOME%\n" +
"echo * URE = %OO_SDK_URE_HOME%\n" +
"echo * Make = %OO_SDK_MAKE_HOME%\n" +
"echo * Zip = %OO_SDK_ZIP_HOME%\n" +
"echo * cat = %OO_SDK_CAT_HOME%\n" +
......
......@@ -129,9 +129,7 @@ endif
LINK_JAVA_LIBS=/LIBPATH:"$(OO_SDK_JAVA_HOME)/lib"
ifneq "$(OO_SDK_URE_HOME)" ""
URE_MISC=$(OO_SDK_URE_HOME)\misc
endif
URE_MISC=${OFFICE_PROGRAM_PATH}
# use this for release version
#EXE_LINK_FLAGS=/MAP /OPT:NOREF /SUBSYSTEM:CONSOLE /BASE:0x1100000
......
......@@ -131,21 +131,6 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) {
if (pythonexeEnd == NULL) {
exit(EXIT_FAILURE);
}
wchar_t urepath[MAX_PATH];
if (tools::buildPath(urepath, path, pathEnd, MY_STRING(L"..\\ure-link"))
== NULL)
{
exit(EXIT_FAILURE);
}
wchar_t * urepathEnd = tools::resolveLink(urepath);
if (urepathEnd == NULL) {
exit(EXIT_FAILURE);
}
urepathEnd = tools::buildPath(
urepath, urepath, urepathEnd, MY_STRING(L"\\bin"));
if (urepathEnd == NULL) {
exit(EXIT_FAILURE);
}
std::size_t clSize = MY_LENGTH(L"\"") + 4 * (pythonexeEnd - pythonexe) +
MY_LENGTH(L"\"\0"); //TODO: overflow
// 4 * len: each char preceded by backslash, each trailing backslash
......@@ -192,12 +177,12 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) {
exit(EXIT_FAILURE);
}
}
std::size_t len = (urepathEnd - urepath) + MY_LENGTH(L";") +
(pathEnd - path) + (n == 0 ? 0 : MY_LENGTH(L";") + (n - 1)) + 1;
std::size_t len = (pathEnd - path) + (n == 0 ? 0 : MY_LENGTH(L";") +
(n - 1)) + 1;
//TODO: overflow
wchar_t * value = new wchar_t[len];
_snwprintf(
value, len, L"%s;%s%s%s", urepath, path, n == 0 ? L"" : L";", orig);
value, len, L"%s%s%s", path, n == 0 ? L"" : L";", orig);
if (!SetEnvironmentVariableW(L"PATH", value)) {
exit(EXIT_FAILURE);
}
......
......@@ -65,19 +65,10 @@
#ifdef MACOSX
#define GID_BRAND_DIR_ETC gid_Brand_Dir_Share
#define GID_DIR_PY gid_Brand_Dir_Share
#define GID_DIR_URE_BIN gid_Brand_Dir_Program
#define GID_DIR_URE_JAVA gid_Dir_Classes
#define GID_DIR_URE_LIB gid_Dir_Frameworks
#else
#define GID_BRAND_DIR_ETC gid_Brand_Dir_Program
#define GID_DIR_PY gid_Brand_Dir_Program
#if defined UNX
#define GID_DIR_URE_BIN gid_Brand_Dir_Program
#define GID_DIR_URE_JAVA gid_Dir_Classes
#else
#define GID_DIR_URE_BIN gid_Dir_Ure_Bin
#define GID_DIR_URE_JAVA gid_Dir_Ure_Java
#endif
#define GID_DIR_URE_LIB gid_Brand_Dir_Program
#endif
......@@ -246,7 +237,7 @@ End
File id \
TXT_FILE_BODY; \
Name = name; \
Dir = GID_DIR_URE_JAVA; \
Dir = gid_Dir_Classes; \
Styles = (PACKED); \
End
......@@ -463,9 +454,8 @@ End
#endif
#define SCP2_URE_DL_DIR GID_DIR_URE_LIB
#if defined WNT
#define SCP2_URE_DL_DIR gid_Dir_Ure_Bin
#define SCP2_URE_DL_NORMAL(n) n ".dll"
#define SCP2_URE_DL_BARE(n) n ".dll"
#define SCP2_URE_DL_VER(n, v) n v ".dll"
......@@ -474,7 +464,6 @@ End
#define SCP2_URE_DL_UNO_VER(n, v) n v ".dll"
#define SCP2_URE_DL_UNO_COMID_VER(n, v) n v STRING(COMID) ".dll"
#else
#define SCP2_URE_DL_DIR GID_DIR_URE_LIB
#define SCP2_URE_DL_NORMAL(n) "lib" n STRING(UNXSUFFIX)
#define SCP2_URE_DL_BARE(n) n STRING(UNXSUFFIX)
#define SCP2_URE_DL_VER(n, v) "lib" n STRING(UNXSUFFIX) "." v
......@@ -536,7 +525,7 @@ End
#define URE_EXECUTABLE(id,name) \
File id \
BIN_FILE_BODY; \
Dir = GID_DIR_URE_BIN; \
Dir = gid_Brand_Dir_Program; \
Name = name; \
Styles = (PACKED); \
End
......
......@@ -1126,11 +1126,7 @@ ProfileItem gid_Brand_Profileitem_Fundamental_Ure_Bin_Dir
ProfileID = gid_Brand_Profile_Fundamental_Ini;
Section = "Bootstrap";
Key = "URE_BIN_DIR";
#if defined WNT
Value = "${.link:${BRAND_BASE_DIR}/ure-link}/bin";
#else
Value = "${BRAND_BASE_DIR}/" LIBO_URE_BIN_FOLDER;
#endif
End
ProfileItem gid_Brand_Profileitem_Fundamental_Configuration_Layers
......
......@@ -20,32 +20,6 @@
#include "AutoInstall/ure"
#if !defined MACOSX
#if defined WNT
Directory gid_Dir_Common_Ure
ParentID = gid_Dir_Brand_Root;
HostName = "URE";
Styles = (UREDIRECTORY);
End
#endif
#if defined WNT
Directory gid_Dir_Ure_Bin
ParentID = gid_Dir_Common_Ure;
DosName = "bin";
End
#endif
#if defined WNT && defined ENABLE_JAVA
Directory gid_Dir_Ure_Java
ParentID = gid_Dir_Common_Ure;
DosName = "java";
End
#endif
#endif // !MACOSX
#if defined MACOSX
Directory gid_Dir_Ure_Share_Misc
ParentID = gid_Brand_Dir_Share_Ure_Share;
......@@ -53,13 +27,6 @@ Directory gid_Dir_Ure_Share_Misc
End
#endif
#ifdef WNT
Directory gid_Dir_Ure_Misc
ParentID = gid_Dir_Common_Ure;
DosName = "misc";
End
#endif
// Public Dynamic Libraries:
#ifdef AIX
......@@ -293,9 +260,7 @@ End
File gid_File_Misc_TypesRdb
TXT_FILE_BODY;
#ifdef WNT
Dir = gid_Dir_Ure_Misc;
#elif defined MACOSX
#if defined MACOSX
Dir = gid_Dir_Ure_Share_Misc;
#else
Dir = gid_Brand_Dir_Program;
......@@ -306,9 +271,7 @@ End
File gid_File_Misc_ServicesRdb
TXT_FILE_BODY;
#ifdef WNT
Dir = gid_Dir_Ure_Misc;
#elif defined MACOSX
#if defined MACOSX
Dir = gid_Dir_Ure_Share_Misc;
#else
Dir = gid_Brand_Dir_Program;
......@@ -328,10 +291,7 @@ Module gid_Module_Root_Ure_Hidden
Sortkey = "2200";
Default = YES;
Styles = (HIDDEN_ROOT);
Dirs = (gid_Dir_Ure_Bin,
gid_Dir_Ure_Misc,
gid_Dir_Ure_Java,
gid_Dir_Ure_Share_Misc);
Dirs = (gid_Dir_Ure_Share_Misc);
Files = (auto_ure_ALL,
gid_File_ThirdpartylicensereadmeHtml_Ure,
gid_File_Readme_Ure,
......
......@@ -102,107 +102,6 @@ WCHAR * buildPath(
}
}
WCHAR * resolveLink(WCHAR * path) {
HANDLE h = CreateFileW(
path, FILE_READ_DATA, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
if (h == INVALID_HANDLE_VALUE) {
return NULL;
}
char p1[MAX_PATH];
DWORD n;
BOOL ok = ReadFile(h, p1, MAX_PATH, &n, NULL);
CloseHandle(h);
if (!ok) {
return NULL;
}
WCHAR p2[MAX_PATH];
std::size_t n2 = 0;
bool colon = false;
for (DWORD i = 0; i < n;) {
unsigned char c = static_cast< unsigned char >(p1[i++]);
switch (c) {
case '\0':
SetLastError(ERROR_BAD_PATHNAME);
return NULL;
case '\x0A':
case '\x0D':
if (n2 == MAX_PATH) {
SetLastError(ERROR_FILENAME_EXCED_RANGE);
return NULL;
}
p2[n2] = L'\0';
break;
case ':':
colon = true;
// fall through
default:
// Convert from UTF-8 to UTF-16:
if (c <= 0x7F) {
p2[n2++] = c;
} else if (c >= 0xC2 && c <= 0xDF && i < n &&
static_cast< unsigned char >(p1[i]) >= 0x80 &&
static_cast< unsigned char >(p1[i]) <= 0xBF)
{
p2[n2++] = ((c & 0x1F) << 6) |
(static_cast< unsigned char >(p1[i++]) & 0x3F);
} else if (n - i > 1 &&
((c == 0xE0 &&
static_cast< unsigned char >(p1[i]) >= 0xA0 &&
static_cast< unsigned char >(p1[i]) <= 0xBF) ||
(((c >= 0xE1 && c <= 0xEC) || (c >= 0xEE && c <= 0xEF)) &&
static_cast< unsigned char >(p1[i]) >= 0x80 &&
static_cast< unsigned char >(p1[i]) <= 0xBF) ||
(c == 0xED &&
static_cast< unsigned char >(p1[i]) >= 0x80 &&
static_cast< unsigned char >(p1[i]) <= 0x9F)) &&
static_cast< unsigned char >(p1[i + 1]) >= 0x80 &&
static_cast< unsigned char >(p1[i + 1]) <= 0xBF)
{
p2[n2++] = ((c & 0x0F) << 12) |
((static_cast< unsigned char >(p1[i]) & 0x3F) << 6) |
(static_cast< unsigned char >(p1[i + 1]) & 0x3F);
i += 2;
} else if (n - 2 > 1 &&
((c == 0xF0 &&
static_cast< unsigned char >(p1[i]) >= 0x90 &&
static_cast< unsigned char >(p1[i]) <= 0xBF) ||
(c >= 0xF1 && c <= 0xF3 &&
static_cast< unsigned char >(p1[i]) >= 0x80 &&
static_cast< unsigned char >(p1[i]) <= 0xBF) ||
(c == 0xF4 &&
static_cast< unsigned char >(p1[i]) >= 0x80 &&
static_cast< unsigned char >(p1[i]) <= 0x8F)) &&
static_cast< unsigned char >(p1[i + 1]) >= 0x80 &&
static_cast< unsigned char >(p1[i + 1]) <= 0xBF &&
static_cast< unsigned char >(p1[i + 2]) >= 0x80 &&
static_cast< unsigned char >(p1[i + 2]) <= 0xBF)
{
sal_Int32 u = ((c & 0x07) << 18) |
((static_cast< unsigned char >(p1[i]) & 0x3F) << 12) |
((static_cast< unsigned char >(p1[i + 1]) & 0x3F) << 6) |
(static_cast< unsigned char >(p1[i + 2]) & 0x3F);
i += 3;
p2[n2++] = static_cast< WCHAR >(((u - 0x10000) >> 10) | 0xD800);
p2[n2++] = static_cast< WCHAR >(
((u - 0x10000) & 0x3FF) | 0xDC00);
} else {
SetLastError(ERROR_BAD_PATHNAME);
return NULL;
}
break;
}
}
WCHAR * end;
if (colon || p2[0] == L'\\') {
// Interpret p2 as an absolute path:
end = path;
} else {
// Interpret p2 as a relative path:
end = filename(path);
}
return buildPath(path, path, end, p2, n2);
}
}
#endif
......
......@@ -15,8 +15,6 @@ endif
ifeq (MACOSX,$(OS))
$(eval $(call gb_Package_add_symbolic_link,ure_install,MacOS/urelibs,../Frameworks))
else ifeq (WNT,$(OS))
$(eval $(call gb_Package_add_file,ure_install,ure-link,ure-link))
endif
# vim:set noet sw=4 ts=4:
URE
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment