Compare commits

..

12 Commits

Author SHA1 Message Date
a5122a6a47 Remove inline flag (#165) 2019-06-24 18:34:22 +03:00
c9330ee0f1 Feature/bug 41890 (#164)
* [x2t] Decode xlsx escaped chars

* [x2t] Fix bug #41890, #36575. Add CStringBuilder::WriteEncodeXmlStringHHHH
2019-06-24 14:56:02 +03:00
2214362426 Fix boost download error 2019-06-24 14:51:39 +03:00
bf600c6eb0 Core/mac build (#161) 2019-06-21 12:54:00 +03:00
0db6728463 Fix 3rdparty building 2019-06-20 14:32:51 +03:00
09c43b1179 Remove curl & add errors to bat files (#159) 2019-06-19 17:20:12 +03:00
390ab3bcc8 [ios] add constants (#157) 2019-06-18 13:46:28 +03:00
075f70c220 Fix prefious commit (#156) 2019-06-17 16:17:14 +03:00
6abf1613ec Fix mac build (#155) 2019-06-17 15:58:07 +03:00
0abc21d4ee Merge pull request #154 from ONLYOFFICE/ios/fixed-build
Fix ios build
2019-06-17 14:13:41 +03:00
7a7cdab770 up 2019-06-17 14:10:11 +03:00
7ae3c6f2ea Fix bug with svg (#153) 2019-06-07 15:22:15 +03:00
32 changed files with 517 additions and 216 deletions

View File

@ -26,15 +26,15 @@ if not exist "%folder%" (
md %folder%\shared
.\b2.exe --clean
.\bjam.exe link=static --with-filesystem --with-system --with-date_time --with-regex --toolset=%TOOLSET%
.\bjam.exe link=static --with-filesystem --with-system --with-date_time --with-regex --toolset=%TOOLSET% || goto :error
XCOPY /Y stage\lib\* "%folder%\static\"
.\b2.exe --clean
.\bjam.exe link=static cxxflags=-fPIC --with-filesystem --with-system --with-date_time --with-regex --toolset=%TOOLSET%
.\bjam.exe link=static cxxflags=-fPIC --with-filesystem --with-system --with-date_time --with-regex --toolset=%TOOLSET% || goto :error
XCOPY /Y stage\lib\* "%folder%\static_fpic\"
.\b2.exe --clean
.\bjam.exe link=shared --with-filesystem --with-system --with-date_time --with-regex --toolset=%TOOLSET%
.\bjam.exe link=shared --with-filesystem --with-system --with-date_time --with-regex --toolset=%TOOLSET% || goto :error
XCOPY /Y stage\lib\* "%folder%\shared\"
)
@ -54,14 +54,20 @@ if not exist "%folder%" (
md %folder%\shared
.\b2.exe --clean
.\bjam.exe link=static --with-filesystem --with-system --with-date_time --with-regex address-model=64 --toolset=%TOOLSET%
.\bjam.exe link=static --with-filesystem --with-system --with-date_time --with-regex address-model=64 --toolset=%TOOLSET% || goto :error
XCOPY /Y stage\lib\* "%folder%\static\"
.\b2.exe --clean
.\bjam.exe link=static cxxflags=-fPIC --with-filesystem --with-system --with-date_time --with-regex address-model=64 --toolset=%TOOLSET%
.\bjam.exe link=static cxxflags=-fPIC --with-filesystem --with-system --with-date_time --with-regex address-model=64 --toolset=%TOOLSET% || goto :error
XCOPY /Y stage\lib\* "%folder%\static_fpic\"
.\b2.exe --clean
.\bjam.exe link=shared --with-filesystem --with-system --with-date_time --with-regex address-model=64 --toolset=%TOOLSET%
.\bjam.exe link=shared --with-filesystem --with-system --with-date_time --with-regex address-model=64 --toolset=%TOOLSET% || goto :error
XCOPY /Y stage\lib\* "%folder%\shared\"
)
exit /b 0
:error
echo "Failed with error #%errorlevel%."
exit /b %errorlevel%

View File

@ -1,7 +1,5 @@
#!/bin/bash
SCRIPT=$(readlink -f "$0" || grealpath "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
os=$(uname -s)
platform=""

View File

@ -4,7 +4,7 @@ CD /D %~dp0
if exist "%SCRIPTPATH%boost_1_58_0.7z" (
echo "boost already downloaded"
) else (
Powershell.exe Invoke-WebRequest -OutFile boost_1_58_0.7z http://freefr.dl.sourceforge.net/project/boost/boost/1.58.0/boost_1_58_0.7z
Powershell.exe Invoke-WebRequest -OutFile boost_1_58_0.7z https://downloads.sourceforge.net/project/boost/boost/1.58.0/boost_1_58_0.7z
)
SET UNSIP_PROGRAMM="C:\Program Files\7-Zip\7z.exe"

View File

@ -1,7 +1,6 @@
#!/bin/bash
SCRIPT=$(readlink -f "$0" || grealpath "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
BOOST_URL=https://downloads.sourceforge.net/project/boost/boost/1.58.0/boost_1_58_0.7z
os=$(uname -s)
platform=""
@ -12,21 +11,11 @@ case "$os" in
*) exit ;;
esac
if [[ "$platform" == *"mac"* ]]
then
if [[ -f "$SCRIPTPATH/7zX_1.7.1.dmg" ]]
then
echo "7z already downloaded"
else
wget http://static.updatestar.net/dl/7zX/7zX_1.7.1.dmg
fi
fi
if [[ -f "$SCRIPTPATH/boost_1_58_0.7z" ]]
then
echo "boost already downloaded"
else
wget http://freefr.dl.sourceforge.net/project/boost/boost/1.58.0/boost_1_58_0.7z
wget $BOOST_URL || curl -O $BOOST_URL
fi
if [ -d "$SCRIPTPATH/boost_1_58_0" ]; then
@ -36,8 +25,6 @@ if [[ "$platform" == *"linux"* ]]
then
7z x -y "$SCRIPTPATH/boost_1_58_0.7z" -o"$SCRIPTPATH/"
else
hdiutil mount "$SCRIPTPATH/7zX_1.7.1.dmg"
/Volumes/7zX/7zX.app/Contents/Resources/7za x "$SCRIPTPATH/boost_1_58_0.7z" -o"$SCRIPTPATH/"
hdiutil unmount /Volumes/7zX
7za x "$SCRIPTPATH/boost_1_58_0.7z" -o"$SCRIPTPATH/"
fi
fi

View File

@ -1,7 +1,5 @@
#!/bin/bash
SCRIPT=$(readlink -f "$0" || grealpath "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
os=$(uname -s)
platform=""
@ -42,9 +40,10 @@ cef_version="3163"
if [[ "$platform" == *"linux"* ]]
then
cef_version="3202"
fi
cef_url=http://d2ettrnqo7v976.cloudfront.net/cef/$cef_version/$platform$arch/$cef_arch
else
cef_url=http://d2ettrnqo7v976.cloudfront.net/cef/$cef_version/$platform/$cef_arch
fi
if [[ "$platform" == *"linux"* ]]
then
@ -75,3 +74,15 @@ then
cp -r -t build/ ./$cef_binary/Release/* ./$cef_binary/Resources/*
chmod a+xr build/locales
fi
if [[ "$platform" == *"mac"* ]]
then
if [ -d "build/Chromium Embedded Framework.framework" ]
then
echo "cef_binary already extracted"
else
wget $cef_url || curl -O $cef_url
7za x $cef_arch
mv "$cef_binary" "build/Chromium Embedded Framework.framework"
fi
fi

View File

@ -1,43 +0,0 @@
SET SCRIPTPATH=%~dp0
CD /D %~dp0
SET MACHINE=x86
if defined ProgramFiles(x86) (
SET MACHINE=x64
)
if "%TARGET%" == "win-32" (
SET MACHINE=x86
)
if "%TARGET%" == "win-64" (
SET MACHINE=x64
)
if "%MACHINE%" == "x86" (
SET OUTPUT=win_32
)
if "%MACHINE%" == "x64" (
SET OUTPUT=win_64
)
SET VC=%ProgramFiles%\Microsoft Visual Studio 12.0\VC
SET VC64=%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\VC
if exist %VC64% (
SET VC=%VC64%
)
call "%VC%\vcvarsall.bat" %MACHINE%
cd curl
call buildconf.bat
cd winbuild
nmake /f Makefile.vc mode=static ENABLE_WINSSL=yes MACHINE=%MACHINE% VC=12
if not exist "%SCRIPTPATH%%OUTPUT%" (
md %SCRIPTPATH%%OUTPUT%\build
xcopy /Y /S ..\builds\libcurl-vc12-%MACHINE%-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib %SCRIPTPATH%%OUTPUT%\build\
move %SCRIPTPATH%%OUTPUT%\build\libcurl_a.lib %SCRIPTPATH%%OUTPUT%\build\curl.lib
)
cd ..\..

View File

@ -1,73 +0,0 @@
SCRIPT=$(readlink -f "$0" || grealpath "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
os=$(uname -s)
platform=""
case "$os" in
Linux*)
platform="linux"
BUILD_PLATFORM=Linux
;;
Darwin*)
platform="mac"
BUILD_PLATFORM=MacOSX
;;
*) exit ;;
esac
architecture=$(uname -m)
arch=""
case "$architecture" in
x86_64*) arch="_64" ;;
*) arch="_32" ;;
esac
if [[ -d "$SCRIPTPATH/$platform$arch" ]]
then
echo
else
mkdir "$SCRIPTPATH/$platform$arch"
fi
CURL_FOLDER=curl
cd ${CURL_FOLDER}
if [[ ! -f configure ]]
then
./buildconf
fi
if [[ ! -f Makefile ]]
then
./configure \
--disable-shared \
--enable-static \
--disable-ldap \
--disable-sspi \
--without-librtmp \
--disable-ftp \
--disable-file \
--disable-dict \
--disable-telnet \
--disable-tftp \
--disable-rtsp \
--disable-pop3 \
--disable-imap \
--disable-smtp \
--disable-gopher \
--disable-smb \
--without-libidn
fi
make
if [ ! -d "$SCRIPTPATH/$platform$arch/build" ]
then
DESTDIR="$SCRIPTPATH/$platform$arch" make install
mkdir -p "$SCRIPTPATH/$platform$arch/build"
cp "$SCRIPTPATH/$platform$arch/usr/local/lib/libcurl.a" "$SCRIPTPATH/$platform$arch/build/"
fi

View File

@ -1,5 +0,0 @@
core_linux {
INCLUDEPATH += $$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/usr/local/include
LIBS += -lcurl
}

View File

@ -1,7 +0,0 @@
CD /D %~dp0
SET CURL_FOLDER=curl
IF NOT EXIST %CURL_FOLDER% CALL git clone https://github.com/curl/curl.git %CURL_FOLDER%
CD %CURL_FOLDER%
CALL git fetch
CALL git checkout curl-7_54_1
CD ..

View File

@ -1,8 +0,0 @@
CURL_FOLDER=curl
if [ ! -d ${CURL_FOLDER} ]; then
git clone https://github.com/curl/curl.git ${CURL_FOLDER}
fi
cd ${CURL_FOLDER}
git fetch
git checkout curl-7_54_1
cd ..

View File

@ -1,7 +1,5 @@
#!/bin/bash
SCRIPT=$(readlink -f "$0" || grealpath "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
ICU_MAJOR_VER=58
ICU_MINOR_VER=2
@ -59,11 +57,19 @@ else
svn export http://source.icu-project.org/repos/icu/tags/release-$ICU_MAJOR_VER-$ICU_MINOR_VER/icu4c ./icu
fi
# Workaround for building icu older than 60.0
# on systems without xlocale.h (removed from glibc since 2.26)
# See https://sourceware.org/glibc/wiki/Release/2.26#Removal_of_.27xlocale.h.27
# See https://bugs.archlinux.org/task/55246
sed -i 's/xlocale/locale/' ./icu/source/i18n/digitlst.cpp
if [[ "$platform" == *"linux"* ]]
then
# Workaround for building icu older than 60.0
# on systems without xlocale.h (removed from glibc since 2.26)
# See https://sourceware.org/glibc/wiki/Release/2.26#Removal_of_.27xlocale.h.27
# See https://bugs.archlinux.org/task/55246
sed -i 's/xlocale/locale/' ./icu/source/i18n/digitlst.cpp
fi
if [[ "$platform" == *"mac"* ]]
then
sed -i -e 's/cmd\, \"%s %s -o %s%s %s %s%s %s %s\"\,/cmd\, \"%s %s -o %s%s %s %s %s %s %s\"\,/' ./icu/source/tools/pkgdata/pkgdata.cpp
fi
cd ./icu/source/

View File

@ -1,7 +1,5 @@
#!/bin/bash
SCRIPT=$(readlink -f "$0" || grealpath "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
ICU_MAJOR_VER=62
ICU_MINOR_VER=1

View File

@ -14,7 +14,13 @@ FOR /f "tokens=*" %%i in ('DIR /a:d /b *') DO (
ECHO %%i
if exist %%i/build.bat (
call %%i/build.bat
call %%i/build.bat || goto :error
)
)
exit /b 0
:error
echo "Failed with error #%errorlevel%."
exit /b %errorlevel%

View File

@ -1,8 +1,7 @@
#!/bin/bash
set -e
SCRIPT=$(readlink -f "$0" || grealpath "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "$SCRIPTPATH"

View File

@ -1,7 +1,5 @@
#!/bin/bash
SCRIPT=$(readlink -f "$0" || grealpath "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "$SCRIPTPATH"/openssl

View File

@ -1,7 +1,5 @@
#!/bin/bash
SCRIPT=$(readlink -f "$0" || grealpath "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "$SCRIPTPATH"

View File

@ -9,19 +9,25 @@ call powershell -File .\fix-static_crt.ps1
cd v8
call gn gen out.gn/win_64/release --args="is_debug=false target_cpu=\"x64\" v8_target_cpu=\"x64\" v8_static_library=true is_component_build=false v8_use_snapshot=false is_clang=false"
call ninja -C out.gn/win_64/release
call ninja -C out.gn/win_64/release || goto :error
call gn gen out.gn/win_64/debug --args="is_debug=true target_cpu=\"x64\" v8_target_cpu=\"x64\" v8_static_library=true is_component_build=false v8_use_snapshot=false is_clang=false"
call ninja -C out.gn/win_64/debug
call ninja -C out.gn/win_64/debug || goto :error
call gn gen out.gn/win_32/release --args="is_debug=false target_cpu=\"x86\" v8_target_cpu=\"x86\" v8_static_library=true is_component_build=false v8_use_snapshot=false is_clang=false"
call ninja -C out.gn/win_32/release
call ninja -C out.gn/win_32/release || goto :error
call gn gen out.gn/win_32/debug --args="is_debug=true target_cpu=\"x86\" v8_target_cpu=\"x86\" v8_static_library=true is_component_build=false v8_use_snapshot=false is_clang=false"
call ninja -C out.gn/win_32/debug
call ninja -C out.gn/win_32/debug || goto :error
rem v8_use_snapshot=true v8_use_external_startup_data=true
if not "%BUILD_PLATFORM%"=="%BUILD_PLATFORM:xp=%" (
call %~dp0v8_xp\build.bat
call %~dp0v8_xp\build.bat || goto :error
cd %~dp0
)
)
exit /b 0
:error
echo "Failed with error #%errorlevel%."
exit /b %errorlevel%

View File

@ -2,8 +2,7 @@
export PATH=`pwd`/depot_tools:"$PATH"
SCRIPT=$(readlink -f "$0" || grealpath "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
os=$(uname -s)
platform=""
@ -38,6 +37,7 @@ fi
if [[ "$platform" == "mac" ]]
then
sed -i -e "s/if (mac_sdk_version != mac_sdk_min_build_override/if (false \&\& mac_sdk_version != mac_sdk_min_build_override/g" build/config/mac/mac_sdk.gni
# for new macOS!!!
#sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
gn gen out.gn/mac_64 --args='is_debug=false target_cpu="x64" v8_static_library=true is_component_build=false v8_use_snapshot=false'

View File

@ -1,7 +1,5 @@
#!/bin/bash
SCRIPT=$(readlink -f "$0" || grealpath "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "$SCRIPTPATH"

View File

@ -1,7 +1,5 @@
#!/bin/bash
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
export PATH=`pwd`/depot_tools:"$PATH"

View File

@ -27,8 +27,8 @@ if not exist "win_32" (
cd "%SCRIPTPATH%v8\tools\gyp"
call devenv v8.sln /Rebuild "Release"
call devenv v8.sln /Rebuild "Debug"
call devenv v8.sln /Rebuild "Release" || goto :error
call devenv v8.sln /Rebuild "Debug" || goto :error
cd "%SCRIPTPATH%"
@ -51,8 +51,8 @@ if not exist "win_64" (
cd "%SCRIPTPATH%v8\tools\gyp"
call devenv v8.sln /Rebuild "Release"
call devenv v8.sln /Rebuild "Debug"
call devenv v8.sln /Rebuild "Release" || goto :error
call devenv v8.sln /Rebuild "Debug" || goto :error
cd "%SCRIPTPATH%"
@ -62,3 +62,9 @@ if not exist "win_64" (
XCOPY /Y "v8\build\Debug\lib\*" "win_64\debug\"
XCOPY /Y "v8\build\Debug\icudt.dll" "win_64\debug\"
)
exit /b 0
:error
echo "Failed with error #%errorlevel%."
exit /b %errorlevel%

View File

@ -61,7 +61,7 @@ namespace OOX
if(std::wstring::npos != m_sText.find(' ') || std::wstring::npos != m_sText.find('\n'))
writer.WriteString(_T(" xml:space=\"preserve\""));
writer.WriteString(_T(">"));
writer.WriteEncodeXmlString(m_sText);
writer.WriteEncodeXmlStringHHHH(m_sText);
writer.WriteString(_T("</t>"));
}
virtual void toXML2(NSStringUtils::CStringBuilder& writer, const wchar_t* name) const
@ -71,7 +71,7 @@ namespace OOX
if(std::wstring::npos != m_sText.find(' ') || std::wstring::npos != m_sText.find('\n'))
writer.WriteString(_T(" xml:space=\"preserve\""));
writer.WriteString(_T(">"));
writer.WriteEncodeXmlString(m_sText);
writer.WriteEncodeXmlStringHHHH(m_sText);
writer.WriteString(_T("</"));
writer.WriteString(name);
writer.WriteString(_T(">"));
@ -83,7 +83,21 @@ namespace OOX
if ( oReader.IsEmptyNode() )
return;
m_sText = oReader.GetText3();
int nDepth = oReader.GetDepth();
XmlUtils::XmlNodeType eNodeType = XmlUtils::XmlNodeType_EndElement;
while (oReader.Read(eNodeType) && oReader.GetDepth() >= nDepth && XmlUtils::XmlNodeType_EndElement != eNodeType)
{
if (eNodeType == XmlUtils::XmlNodeType_Text || eNodeType == XmlUtils::XmlNodeType_Whitespace || eNodeType == XmlUtils::XmlNodeType_SIGNIFICANT_WHITESPACE)
{
std::string sTemp = oReader.GetTextA();
wchar_t* pUnicodes = NULL;
LONG lOutputCount = 0;
NSFile::CUtf8Converter::GetUnicodeStringFromUTF8WithHHHH((BYTE*)sTemp.c_str(), sTemp.length(), pUnicodes, lOutputCount);
m_sText.append(pUnicodes);
RELEASEARRAYOBJECTS(pUnicodes);
}
}
NSStringExt::Replace(m_sText, L"\t", L"");
if(!(m_oSpace.IsInit() && SimpleTypes::xmlspacePreserve == m_oSpace->GetValue()))
{

View File

@ -788,4 +788,7 @@
#define ASC_MENU_EVENT_TYPE_ON_EDIT_TEXT 22003
#define ASC_EVENT_TYPE_SPELLCHECK_MESSAGE 22004
#define ASC_EVENT_TYPE_SPELLCHECK_TURN_ON 22005
#endif //_BUILD_EDITOR_DEFINES_CROSSPLATFORM_H_

View File

@ -121,6 +121,10 @@ namespace NSFile
std::wstring CUtf8Converter::GetUnicodeFromCharPtr(const std::string& sParam, INT bIsUtf8)
{
return GetUnicodeFromCharPtr(sParam.c_str(), (LONG)sParam.length(), bIsUtf8);
}
LONG CUtf8Converter::GetUnicodeStringFromUTF8BufferSize(LONG lCount)
{
return lCount + 1;
}
std::wstring CUtf8Converter::GetUnicodeStringFromUTF8_4bytes( BYTE* pBuffer, LONG lCount )
{
@ -305,6 +309,249 @@ namespace NSFile
return GetUnicodeStringFromUTF8_4bytes(pBuffer, lCount);
}
#define CHECK_HHHH(pBuffer) \
wchar_t code = 0; \
if('_' == pBuffer[0] && 'x' == pBuffer[1] && 0 != pBuffer[2] && 0 != pBuffer[3] && 0 != pBuffer[4] && 0 != pBuffer[5] && '_' == pBuffer[6]) \
{ \
int i = 2; \
for(; i < 6; ++i) \
{ \
code *= 16; \
if('0' <= pBuffer[i] && pBuffer[i] <= '9') \
{ \
code += pBuffer[i] - '0'; \
} \
else if('A' <= pBuffer[i] && pBuffer[i] <= 'F') \
{ \
code += pBuffer[i] - 'A' + 10; \
} \
else if('a' <= pBuffer[i] && pBuffer[i] <= 'f') \
{ \
code += pBuffer[i] - 'a' + 10; \
} \
else \
{ \
break; \
} \
} \
if(i == 6) \
{ \
if(0x005F == code) \
{ \
code = '_'; \
} \
return code; \
} \
} \
return -1;
long CUtf8Converter::CheckHHHHChar(const BYTE* pBuffer)
{
CHECK_HHHH(pBuffer);
}
long CUtf8Converter::CheckHHHHChar(const wchar_t* pBuffer)
{
CHECK_HHHH(pBuffer);
}
void CUtf8Converter::GetUnicodeStringFromUTF8WithHHHH_4bytes( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount )
{
if (NULL == pUnicodes)
{
pUnicodes = new wchar_t[GetUnicodeStringFromUTF8BufferSize(lCount)];
}
WCHAR* pUnicodeString = pUnicodes;
LONG lIndexUnicode = 0;
LONG lIndex = 0;
while (lIndex < lCount)
{
BYTE byteMain = pBuffer[lIndex];
if (0x00 == (byteMain & 0x80))
{
// 1 byte
long code = CheckHHHHChar(pBuffer + lIndex);
if(code < 0)
{
pUnicodeString[lIndexUnicode++] = (WCHAR)byteMain;
++lIndex;
}
else
{
pUnicodeString[lIndexUnicode++] = (WCHAR)code;
lIndex += 7;
}
}
else if (0x00 == (byteMain & 0x20))
{
// 2 byte
int val = (int)(((byteMain & 0x1F) << 6) |
(pBuffer[lIndex + 1] & 0x3F));
pUnicodeString[lIndexUnicode++] = (WCHAR)(val);
lIndex += 2;
}
else if (0x00 == (byteMain & 0x10))
{
// 3 byte
int val = (int)(((byteMain & 0x0F) << 12) |
((pBuffer[lIndex + 1] & 0x3F) << 6) |
(pBuffer[lIndex + 2] & 0x3F));
pUnicodeString[lIndexUnicode++] = (WCHAR)(val);
lIndex += 3;
}
else if (0x00 == (byteMain & 0x0F))
{
// 4 byte
int val = (int)(((byteMain & 0x07) << 18) |
((pBuffer[lIndex + 1] & 0x3F) << 12) |
((pBuffer[lIndex + 2] & 0x3F) << 6) |
(pBuffer[lIndex + 3] & 0x3F));
pUnicodeString[lIndexUnicode++] = (WCHAR)(val);
lIndex += 4;
}
else if (0x00 == (byteMain & 0x08))
{
// 4 byte
int val = (int)(((byteMain & 0x07) << 18) |
((pBuffer[lIndex + 1] & 0x3F) << 12) |
((pBuffer[lIndex + 2] & 0x3F) << 6) |
(pBuffer[lIndex + 3] & 0x3F));
pUnicodeString[lIndexUnicode++] = (WCHAR)(val);
lIndex += 4;
}
else if (0x00 == (byteMain & 0x04))
{
// 5 byte
int val = (int)(((byteMain & 0x03) << 24) |
((pBuffer[lIndex + 1] & 0x3F) << 18) |
((pBuffer[lIndex + 2] & 0x3F) << 12) |
((pBuffer[lIndex + 3] & 0x3F) << 6) |
(pBuffer[lIndex + 4] & 0x3F));
pUnicodeString[lIndexUnicode++] = (WCHAR)(val);
lIndex += 5;
}
else
{
// 6 byte
int val = (int)(((byteMain & 0x01) << 30) |
((pBuffer[lIndex + 1] & 0x3F) << 24) |
((pBuffer[lIndex + 2] & 0x3F) << 18) |
((pBuffer[lIndex + 3] & 0x3F) << 12) |
((pBuffer[lIndex + 4] & 0x3F) << 6) |
(pBuffer[lIndex + 5] & 0x3F));
pUnicodeString[lIndexUnicode++] = (WCHAR)(val);
lIndex += 5;
}
}
pUnicodeString[lIndexUnicode] = 0;
lOutputCount = lIndexUnicode;
}
void CUtf8Converter::GetUnicodeStringFromUTF8WithHHHH_2bytes( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount )
{
if (NULL == pUnicodes)
{
pUnicodes = new wchar_t[GetUnicodeStringFromUTF8BufferSize(lCount)];
}
WCHAR* pUnicodeString = pUnicodes;
WCHAR* pStart = pUnicodeString;
LONG lIndex = 0;
while (lIndex < lCount)
{
BYTE byteMain = pBuffer[lIndex];
if (0x00 == (byteMain & 0x80))
{
// 1 byte
long code = CheckHHHHChar(pBuffer + lIndex);
if(code < 0)
{
*pUnicodeString++ = (WCHAR)byteMain;
++lIndex;
}
else
{
*pUnicodeString++ = (WCHAR)code;
lIndex += 7;
}
}
else if (0x00 == (byteMain & 0x20))
{
// 2 byte
int val = (int)(((byteMain & 0x1F) << 6) |
(pBuffer[lIndex + 1] & 0x3F));
*pUnicodeString++ = (WCHAR)(val);
lIndex += 2;
}
else if (0x00 == (byteMain & 0x10))
{
// 3 byte
int val = (int)(((byteMain & 0x0F) << 12) |
((pBuffer[lIndex + 1] & 0x3F) << 6) |
(pBuffer[lIndex + 2] & 0x3F));
WriteUtf16_WCHAR(val, pUnicodeString);
lIndex += 3;
}
else if (0x00 == (byteMain & 0x0F))
{
// 4 byte
int val = (int)(((byteMain & 0x07) << 18) |
((pBuffer[lIndex + 1] & 0x3F) << 12) |
((pBuffer[lIndex + 2] & 0x3F) << 6) |
(pBuffer[lIndex + 3] & 0x3F));
WriteUtf16_WCHAR(val, pUnicodeString);
lIndex += 4;
}
else if (0x00 == (byteMain & 0x08))
{
// 4 byte
int val = (int)(((byteMain & 0x07) << 18) |
((pBuffer[lIndex + 1] & 0x3F) << 12) |
((pBuffer[lIndex + 2] & 0x3F) << 6) |
(pBuffer[lIndex + 3] & 0x3F));
WriteUtf16_WCHAR(val, pUnicodeString);
lIndex += 4;
}
else if (0x00 == (byteMain & 0x04))
{
// 5 byte
int val = (int)(((byteMain & 0x03) << 24) |
((pBuffer[lIndex + 1] & 0x3F) << 18) |
((pBuffer[lIndex + 2] & 0x3F) << 12) |
((pBuffer[lIndex + 3] & 0x3F) << 6) |
(pBuffer[lIndex + 4] & 0x3F));
WriteUtf16_WCHAR(val, pUnicodeString);
lIndex += 5;
}
else
{
// 6 byte
int val = (int)(((byteMain & 0x01) << 30) |
((pBuffer[lIndex + 1] & 0x3F) << 24) |
((pBuffer[lIndex + 2] & 0x3F) << 18) |
((pBuffer[lIndex + 3] & 0x3F) << 12) |
((pBuffer[lIndex + 4] & 0x3F) << 6) |
(pBuffer[lIndex + 5] & 0x3F));
WriteUtf16_WCHAR(val, pUnicodeString);
lIndex += 5;
}
}
*pUnicodeString++ = 0;
lOutputCount = pUnicodeString - pStart;
}
void CUtf8Converter::GetUnicodeStringFromUTF8WithHHHH( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount )
{
if (sizeof(WCHAR) == 2)
return GetUnicodeStringFromUTF8WithHHHH_2bytes(pBuffer, lCount, pUnicodes, lOutputCount);
return GetUnicodeStringFromUTF8WithHHHH_4bytes(pBuffer, lCount, pUnicodes, lOutputCount);
}
void CUtf8Converter::GetUtf8StringFromUnicode_4bytes(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM)
{
if (NULL == pData)

View File

@ -100,11 +100,17 @@ namespace NSFile
static std::wstring GetUnicodeFromCharPtr(const char* pData, LONG lCount, INT bIsUtf8 = FALSE);
static std::wstring GetUnicodeFromCharPtr(const std::string& sParam, INT bIsUtf8 = FALSE);
static std::wstring GetUnicodeStringFromUTF8_4bytes( BYTE* pBuffer, LONG lCount );
static std::wstring GetUnicodeStringFromUTF8_2bytes( BYTE* pBuffer, LONG lCount );
static std::wstring GetUnicodeStringFromUTF8( BYTE* pBuffer, LONG lCount );
static void GetUnicodeStringFromUTF8WithHHHH_4bytes( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount );
static void GetUnicodeStringFromUTF8WithHHHH_2bytes( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount );
static void GetUnicodeStringFromUTF8WithHHHH( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount );
static inline LONG GetUnicodeStringFromUTF8BufferSize( LONG lCount );
static void GetUtf8StringFromUnicode_4bytes(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM = false);
static void GetUtf8StringFromUnicode_2bytes(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM = false);
static void GetUtf8StringFromUnicode(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM = false);
@ -118,6 +124,9 @@ namespace NSFile
static std::wstring GetWStringFromUTF16(const CStringUtf16& data);
static std::wstring GetWStringFromUTF16(const unsigned short* pUtf16, LONG lCount);
static long CheckHHHHChar(const BYTE* pBuffer);
static long CheckHHHHChar(const wchar_t* pBuffer);
};
class KERNEL_DECL CFileBinary

View File

@ -30,6 +30,7 @@
*
*/
#include "StringBuilder.h"
#include "File.h"
namespace NSStringUtils
{
@ -301,6 +302,18 @@ namespace NSStringUtils
else
WriteEncodeXmlString_4bytes(pString, nCount);
}
void CStringBuilder::WriteEncodeXmlStringHHHH(const std::wstring& sString)
{
WriteEncodeXmlStringHHHH(sString.c_str(), (int)sString.length());
}
void CStringBuilder::WriteEncodeXmlStringHHHH(const wchar_t* pString, int nCount)
{
if (sizeof(wchar_t) == 2)
WriteEncodeXmlStringHHHH_2bytes(pString, nCount);
else
WriteEncodeXmlStringHHHH_4bytes(pString, nCount);
}
inline void CStringBuilder::WriteEncodeXmlString_4bytes(const wchar_t* pString, int nCount)
{
const wchar_t* pData = pString;
@ -354,6 +367,59 @@ namespace NSStringUtils
}
}
}
inline void CStringBuilder::WriteEncodeXmlStringHHHH_4bytes(const wchar_t* pString, int nCount)
{
const wchar_t* pData = pString;
int nCounter = 0;
unsigned int code;
while (*pData != 0)
{
code = (unsigned int)*pData;
WriteEncodeXmlChar(*pData, CheckXmlCodeHHHH(code, pData));
++pData;
if (-1 != nCount)
{
++nCounter;
if (nCounter >= nCount)
break;
}
}
}
inline void CStringBuilder::WriteEncodeXmlStringHHHH_2bytes(const wchar_t* pString, int nCount)
{
const wchar_t* pData = pString;
int nCounter = 0;
unsigned int code;
BYTE type;
while (*pData != 0)
{
code = (unsigned int)*pData;
if (code >= 0xD800 && code <= 0xDFFF && *(pData + 1) != 0)
{
code = 0x10000 + (((code & 0x3FF) << 10) | (0x03FF & *(pData + 1)));
type = CheckXmlCodeHHHH(code, pData);
if(0 != type)
{
WriteEncodeXmlChar(*pData, type);
++pData;
}
}
else
{
type = CheckXmlCodeHHHH(code, pData);
}
WriteEncodeXmlChar(*pData, type);
++pData;
if (-1 != nCount)
{
++nCounter;
if (nCounter >= nCount)
break;
}
}
}
inline void CStringBuilder::WriteEncodeXmlChar(wchar_t code, BYTE type)
{
switch (type)
@ -436,6 +502,27 @@ namespace NSStringUtils
*m_pDataCur++ = (wchar_t)(';');
m_lSizeCur += 5;
break;
case 10:
AddSize(7);
*m_pDataCur++ = (wchar_t)('_');
*m_pDataCur++ = (wchar_t)('x');
*m_pDataCur++ = (wchar_t)('0');
*m_pDataCur++ = (wchar_t)('0');
*m_pDataCur++ = (wchar_t)('5');
*m_pDataCur++ = (wchar_t)('F');
*m_pDataCur++ = (wchar_t)('_');
m_lSizeCur += 7;
break;
case 11:
AddSize(7);
*m_pDataCur++ = (wchar_t)('_');
*m_pDataCur++ = (wchar_t)('x');
m_lSizeCur += 2;
WriteHexByteNoSafe((code >> 8) & 0xFF);
WriteHexByteNoSafe(code & 0xFF);
*m_pDataCur++ = (wchar_t)('_');
++m_lSizeCur;
break;
default:
break;
}
@ -751,6 +838,35 @@ namespace NSStringUtils
return 0;
}
unsigned char CStringBuilder::CheckXmlCodeHHHH(unsigned int c, const wchar_t* pData)
{
if ('&' == c)
return 2;
if ('\'' == c)
return 3;
if ('<' == c)
return 4;
if ('>' == c)
return 5;
if ('\"' == c)
return 6;
if ('\n' == c)//when reading from the attributes is replaced by a space.
return 7;
if ('\r' == c)//when reading from the attributes is replaced by a space.
return 8;
if ('\t' == c)//when reading from the attributes is replaced by a space.
return 9;
if (NSFile::CUtf8Converter::CheckHHHHChar(pData) >= 0)
return 10;
//xml 1.0 Character Range https://www.w3.org/TR/xml/#charsets
if ((0x20 <= c && c <= 0xD7FF) || (0xE000 <= c && c <= 0xFFFD) || (0x10000 <= c && c <= 0x10FFFF))
return 1;
else if(c <= 0xFFFF)
return 11;
return 0;
}
void string_replace(std::wstring& text, const std::wstring& replaceFrom, const std::wstring& replaceTo)
{

View File

@ -109,9 +109,11 @@ namespace NSStringUtils
void AddChar2Safe(const wchar_t _c1, const wchar_t& _c2);
void WriteEncodeXmlString(const std::wstring& sString);
void WriteEncodeXmlString(const wchar_t* pString, int nCount = -1);
void WriteEncodeXmlStringHHHH(const std::wstring& sString);
void WriteEncodeXmlStringHHHH(const wchar_t* pString, int nCount = -1);
size_t GetCurSize();
void SetCurSize(size_t lCurSize);
size_t GetSize();
@ -147,8 +149,11 @@ namespace NSStringUtils
protected:
inline void WriteEncodeXmlString_4bytes(const wchar_t* pString, int nCount);
inline void WriteEncodeXmlString_2bytes(const wchar_t* pString, int nCount);
inline void WriteEncodeXmlStringHHHH_4bytes(const wchar_t* pString, int nCount);
inline void WriteEncodeXmlStringHHHH_2bytes(const wchar_t* pString, int nCount);
inline void WriteEncodeXmlChar(wchar_t code, unsigned char type);
inline unsigned char CheckXmlCode(unsigned int c);
inline unsigned char CheckXmlCodeHHHH(unsigned int c, const wchar_t* pData);
};
KERNEL_DECL void string_replace(std::wstring& text, const std::wstring& replaceFrom, const std::wstring& replaceTo);

View File

@ -173,6 +173,8 @@
17A7F02B1B13154500760AFB /* SvmPlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17A7F0221B13154500760AFB /* SvmPlayer.cpp */; };
17DD67B71B7E2778000F800F /* lepton_utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17DD67B51B7E2778000F800F /* lepton_utils.cpp */; };
697B72D41E3B78D90054C17C /* EmfFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 697B72D31E3B78D90054C17C /* EmfFile.cpp */; };
8A2EE9BB22AFBAC200E8AB1A /* SVGTransformer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A2EE9B922AFBAC200E8AB1A /* SVGTransformer.cpp */; };
8A2EE9BC22AFBAC200E8AB1A /* SVGFramework.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A2EE9BA22AFBAC200E8AB1A /* SVGFramework.cpp */; };
8AC2819D2195A582006FA3D7 /* StringExt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AC2819B2195A582006FA3D7 /* StringExt.cpp */; };
/* End PBXBuildFile section */
@ -436,6 +438,10 @@
17A7F0231B13154500760AFB /* SvmPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SvmPlayer.h; sourceTree = "<group>"; };
17DD67B51B7E2778000F800F /* lepton_utils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lepton_utils.cpp; sourceTree = "<group>"; };
697B72D31E3B78D90054C17C /* EmfFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EmfFile.cpp; sourceTree = "<group>"; };
8A2EE9B722AFBAC200E8AB1A /* SVGFramework.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGFramework.h; sourceTree = "<group>"; };
8A2EE9B822AFBAC200E8AB1A /* SVGTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTransformer.h; sourceTree = "<group>"; };
8A2EE9B922AFBAC200E8AB1A /* SVGTransformer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTransformer.cpp; sourceTree = "<group>"; };
8A2EE9BA22AFBAC200E8AB1A /* SVGFramework.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFramework.cpp; sourceTree = "<group>"; };
8AC2819B2195A582006FA3D7 /* StringExt.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringExt.cpp; path = ../../../common/StringExt.cpp; sourceTree = "<group>"; };
8AC2819C2195A582006FA3D7 /* StringExt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StringExt.h; path = ../../../common/StringExt.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
@ -470,6 +476,7 @@
17A762BC1B0F35320046BC0B /* metafile */ = {
isa = PBXGroup;
children = (
8A2EE9B622AFBAC200E8AB1A /* svg */,
17A7F0191B13154500760AFB /* StarView */,
17A765081B0F3A3E0046BC0B /* Jp2 */,
17A7631F1B0F38FE0046BC0B /* JBig2 */,
@ -793,6 +800,18 @@
path = ../../../raster/Metafile/StarView;
sourceTree = "<group>";
};
8A2EE9B622AFBAC200E8AB1A /* svg */ = {
isa = PBXGroup;
children = (
8A2EE9B722AFBAC200E8AB1A /* SVGFramework.h */,
8A2EE9B822AFBAC200E8AB1A /* SVGTransformer.h */,
8A2EE9B922AFBAC200E8AB1A /* SVGTransformer.cpp */,
8A2EE9BA22AFBAC200E8AB1A /* SVGFramework.cpp */,
);
name = svg;
path = ../../../raster/Metafile/svg;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@ -827,6 +846,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = 17A762B11B0F35320046BC0B;
@ -1002,6 +1022,8 @@
17A763EF1B0F39370046BC0B /* bardecode.cpp in Sources */,
17A7631E1B0F389C0046BC0B /* MetaFileUtils.cpp in Sources */,
17A763231B0F39120046BC0B /* JBig2File.cpp in Sources */,
8A2EE9BC22AFBAC200E8AB1A /* SVGFramework.cpp in Sources */,
8A2EE9BB22AFBAC200E8AB1A /* SVGTransformer.cpp in Sources */,
17A765031B0F39370046BC0B /* writefile.cpp in Sources */,
17A764B11B0F39370046BC0B /* psio2stub.cpp in Sources */,
17A764FF1B0F39370046BC0B /* webpio.cpp in Sources */,

View File

@ -144,7 +144,7 @@ namespace MetaFile
}
return false;
};
}
bool CMetaFile::DrawOnRenderer(IRenderer* pRenderer, double dX, double dY, double dWidth, double dHeight)
{
if (NULL == pRenderer)
@ -176,7 +176,7 @@ namespace MetaFile
}
pRenderer->EndCommand(c_nImageType);
return true;
};
}
void CMetaFile::Close()
{
m_oWmfFile.Close();
@ -185,7 +185,7 @@ namespace MetaFile
m_oSvgFile.Close();
m_lType = 0;
};
}
int CMetaFile::GetType()
{
return m_lType;

View File

@ -3003,7 +3003,7 @@ namespace SVG
bool CreateImage (BYTE* pBuffer, unsigned long Length, int ImageEncoder = INVALID_ENCODER)
{
return false;
}
private:

View File

@ -828,6 +828,12 @@ namespace NSHtmlRenderer
}
HRESULT CASCSVGWriter::GetTransform(double *pdA, double *pdB, double *pdC, double *pdD, double *pdE, double *pdF)
{
*pdA = m_pTransform->sx();
*pdB = m_pTransform->shy();
*pdC = m_pTransform->shx();
*pdD = m_pTransform->sy();
*pdE = m_pTransform->tx();
*pdF = m_pTransform->ty();
return S_OK;
}
HRESULT CASCSVGWriter::ResetTransform(void)

View File

@ -42,7 +42,7 @@
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"