Commit d92c01c2 authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander Trofimov

Конвертации строк переделаны на функции из DesktopEditor/Common

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@62616 954022d7-b5bf-4e40-9824-e11837661b57
parent 73f5c565
...@@ -15,7 +15,8 @@ DEFINES += _UNICODE ...@@ -15,7 +15,8 @@ DEFINES += _UNICODE
DEFINES += _USE_LIBXML2_READER_ DEFINES += _USE_LIBXML2_READER_
DEFINES += LIBXML_READER_ENABLED DEFINES += LIBXML_READER_ENABLED
SOURCES += djvufile.cpp \ SOURCES += DjVu.cpp \
DjVuFileImplementation.cpp \
libdjvu/Arrays.cpp \ libdjvu/Arrays.cpp \
libdjvu/atomic.cpp \ libdjvu/atomic.cpp \
libdjvu/BSByteStream.cpp \ libdjvu/BSByteStream.cpp \
...@@ -70,11 +71,10 @@ SOURCES += djvufile.cpp \ ...@@ -70,11 +71,10 @@ SOURCES += djvufile.cpp \
libdjvu/UnicodeByteStream.cpp \ libdjvu/UnicodeByteStream.cpp \
libdjvu/XMLParser.cpp \ libdjvu/XMLParser.cpp \
libdjvu/XMLTags.cpp \ libdjvu/XMLTags.cpp \
libdjvu/ZPCodec.cpp \ libdjvu/ZPCodec.cpp
DjVu.cpp \
DjVuFileImplementation.cpp
HEADERS += djvufile.h \ HEADERS += DjVu.h \
DjVuFileImplementation.h \
libdjvu/Arrays.h \ libdjvu/Arrays.h \
libdjvu/atomic.h \ libdjvu/atomic.h \
libdjvu/BSByteStream.h \ libdjvu/BSByteStream.h \
...@@ -124,9 +124,8 @@ HEADERS += djvufile.h \ ...@@ -124,9 +124,8 @@ HEADERS += djvufile.h \
libdjvu/UnicodeByteStream.h \ libdjvu/UnicodeByteStream.h \
libdjvu/XMLParser.h \ libdjvu/XMLParser.h \
libdjvu/XMLTags.h \ libdjvu/XMLTags.h \
libdjvu/ZPCodec.h \ libdjvu/ZPCodec.h
DjVu.h \
DjVuFileImplementation.h
unix { unix {
target.path = /usr/lib target.path = /usr/lib
INSTALLS += target INSTALLS += target
......
...@@ -21,65 +21,15 @@ namespace NSDjvu ...@@ -21,65 +21,15 @@ namespace NSDjvu
{ {
static GUTF8String MakeUTF8String(const std::wstring& wsText) static GUTF8String MakeUTF8String(const std::wstring& wsText)
{ {
int nSize; std::string sText = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(wsText);
GUTF8String utf8String(sText.c_str());
#ifdef _UNICODE return utf8String;
LPCWSTR pszUnicodeText = wsText.c_str();
#else
nSize = ::MultiByteToWideChar(CP_ACP, 0, (LPCSTR)strText, -1, NULL, 0);
if (nSize == 0)
return "";
LPWSTR pszUnicodeText = new WCHAR[nSize];
::MultiByteToWideChar(CP_ACP, 0, (LPCSTR)strText, -1, pszUnicodeText, nSize);
#endif
nSize = ::WideCharToMultiByte(CP_UTF8, 0, pszUnicodeText, -1, NULL, 0, NULL, NULL);
if (nSize == 0)
{
#ifndef _UNICODE
delete[] pszUnicodeText;
#endif
return "";
}
LPSTR pszTextUTF8 = new CHAR[nSize];
::WideCharToMultiByte(CP_UTF8, 0, pszUnicodeText, -1, pszTextUTF8, nSize, NULL, NULL);
GUTF8String utf8String(pszTextUTF8);
delete[] pszTextUTF8;
#ifndef _UNICODE
delete[] pszUnicodeText;
#endif
return utf8String;
//std::string sText = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(wsText);
//GUTF8String utf8String(sText.c_str());
//return utf8String;
} }
static CString MakeCString(GUTF8String& strText) static CString MakeCString(GUTF8String& strText)
{ {
int nSize; std::string sString(strText.getbuf());
std::wstring wsString = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)sString.c_str(), sString.length());
LPSTR pszUtf8Text = strText.getbuf(); return CString(wsString.c_str());
//nSize = ::WideCharToMultiByte(CP_UTF8, 0, pszUtf8Text, -1, NULL, 0, NULL, NULL);
nSize = ::MultiByteToWideChar(CP_UTF8, 0, pszUtf8Text, -1, NULL, 0);
if (nSize == 0)
{
return _T("");
}
LPWSTR pszUnicodeText = new WCHAR[nSize];
::MultiByteToWideChar(CP_UTF8, 0, pszUtf8Text, -1, pszUnicodeText, nSize);
CString String(pszUnicodeText);
delete[] pszUnicodeText;
return String;
} }
static int GetInteger(const std::wstring& wsString) static int GetInteger(const std::wstring& wsString)
{ {
...@@ -672,4 +622,4 @@ void CDjVuFileImplementation::ParseCoords(const std::wstring& wsCo ...@@ -672,4 +622,4 @@ void CDjVuFileImplementation::ParseCoords(const std::wstring& wsCo
pdCoords[nIndex] = NSDjvu::GetInteger(vCoords.at(nIndex)) * dKoef; pdCoords[nIndex] = NSDjvu::GetInteger(vCoords.at(nIndex)) * dKoef;
} }
} }
} }
\ 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