mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-20 02:48:12 +08:00
Fix bugs
This commit is contained in:
@ -99,15 +99,6 @@ namespace NSMemoryUtils
|
||||
m_pDataCur += nSizeof;
|
||||
}
|
||||
void CByteBuilder::WriteString(const std::wstring& sText)
|
||||
{
|
||||
size_t nSize = (sText.length() + 1) * sizeof(wchar_t);
|
||||
AddSize(nSize);
|
||||
memcpy(m_pDataCur, sText.c_str(), nSize - sizeof(wchar_t));
|
||||
|
||||
m_pDataCur += nSize;
|
||||
m_lSizeCur += nSize;
|
||||
}
|
||||
void CByteBuilder::WriteStringUTF8(const std::wstring& sText)
|
||||
{
|
||||
int nSizeof = sizeof(wchar_t);
|
||||
size_t nSize = (sText.length() + 1) * nSizeof;
|
||||
@ -119,6 +110,10 @@ namespace NSMemoryUtils
|
||||
m_lSizeCur += nSize;
|
||||
m_pDataCur += nSizeof;
|
||||
}
|
||||
void CByteBuilder::WriteStringUTF8(const std::wstring& sText)
|
||||
{
|
||||
WriteString(U_TO_UTF8(sText));
|
||||
}
|
||||
|
||||
void CByteBuilder::WriteInt(const int& value)
|
||||
{
|
||||
@ -181,7 +176,7 @@ namespace NSMemoryUtils
|
||||
std::string CByteReader::GetString()
|
||||
{
|
||||
BYTE* pEnd = m_pDataCur;
|
||||
while (pEnd != 0)
|
||||
while (*pEnd != 0)
|
||||
pEnd++;
|
||||
std::string sRet((char*)m_pDataCur, pEnd - m_pDataCur);
|
||||
m_pDataCur = pEnd + 1;
|
||||
@ -191,7 +186,7 @@ namespace NSMemoryUtils
|
||||
{
|
||||
wchar_t* pStart = (wchar_t*)m_pDataCur;
|
||||
wchar_t* pEnd = pStart;
|
||||
while (pEnd != 0)
|
||||
while (*pEnd != 0)
|
||||
pEnd++;
|
||||
std::wstring sRet((wchar_t*)m_pDataCur, pEnd - pStart);
|
||||
m_pDataCur += (((pEnd - pStart) + 1) * sizeof(wchar_t));
|
||||
@ -200,7 +195,7 @@ namespace NSMemoryUtils
|
||||
std::wstring CByteReader::GetStringUTF8()
|
||||
{
|
||||
BYTE* pEnd = m_pDataCur;
|
||||
while (pEnd != 0)
|
||||
while (*pEnd != 0)
|
||||
pEnd++;
|
||||
std::string sRet((char*)m_pDataCur, pEnd - m_pDataCur);
|
||||
m_pDataCur = pEnd + 1;
|
||||
|
||||
@ -103,6 +103,8 @@ public:
|
||||
RELEASEOBJECT(pTemp);
|
||||
}
|
||||
m_pList.clear();
|
||||
|
||||
RELEASEARRAYOBJECTS(m_pRanges);
|
||||
}
|
||||
|
||||
virtual std::vector<NSFonts::CFontInfo*>* GetFonts() { return &m_pList; }
|
||||
|
||||
@ -784,6 +784,7 @@ CFontFile* CFontManager::GetFontFileBySymbol(CFontFile* pFile, int code)
|
||||
|
||||
CFontFile* pFontOld = m_pFont;
|
||||
m_pFont = NULL;
|
||||
std::wstring sOldName = m_sName;
|
||||
|
||||
int nStyle = 0;
|
||||
if (pFile->m_bNeedDoBold || pFile->IsBold())
|
||||
@ -801,7 +802,10 @@ CFontFile* CFontManager::GetFontFileBySymbol(CFontFile* pFile, int code)
|
||||
|
||||
CFontFile* pFontNew = m_pFont;
|
||||
m_pFont = pFontOld;
|
||||
m_sName = sOldName;
|
||||
|
||||
memcpy(pFontNew->m_arrdTextMatrix, pFile->m_arrdTextMatrix, 6 * sizeof(double));
|
||||
pFontNew->UpdateMatrix2();
|
||||
|
||||
return pFontNew;
|
||||
}
|
||||
|
||||
@ -1030,9 +1030,11 @@ namespace NSCommon
|
||||
|
||||
if (pRangeBuilder)
|
||||
{
|
||||
size_t nPosCur = pRangeBuilder->GetCurSize();
|
||||
pRangeBuilder->SetCurSize(0);
|
||||
pRangeBuilder->WriteInt(nRangeBuilderCount);
|
||||
oFile.WriteFile(pRangeBuilder->GetData(), (DWORD)pRangeBuilder->GetSize());
|
||||
pRangeBuilder->SetCurSize(nPosCur);
|
||||
oFile.WriteFile(pRangeBuilder->GetData(), (DWORD)pRangeBuilder->GetCurSize());
|
||||
}
|
||||
|
||||
oFile.CloseFile();
|
||||
|
||||
@ -107,12 +107,18 @@ public:
|
||||
m_lMaxCount = 10;
|
||||
|
||||
m_oCS.InitializeCriticalSection();
|
||||
|
||||
if (m_pApplicationFonts)
|
||||
m_pApplicationFonts->AddRef();
|
||||
}
|
||||
|
||||
virtual ~CImageFilesCache()
|
||||
{
|
||||
Clear();
|
||||
m_oCS.DeleteCriticalSection();
|
||||
|
||||
if (m_pApplicationFonts)
|
||||
m_pApplicationFonts->Release();
|
||||
}
|
||||
|
||||
virtual void Clear()
|
||||
@ -179,9 +185,13 @@ public:
|
||||
return m_lRef;
|
||||
}
|
||||
|
||||
virtual void SetApplicationFonts(CApplicationFonts* pApplicationFonts)
|
||||
virtual void SetApplicationFonts(NSFonts::IApplicationFonts* pApplicationFonts)
|
||||
{
|
||||
m_pApplicationFonts = pApplicationFonts;
|
||||
if (m_pApplicationFonts)
|
||||
m_pApplicationFonts->Release();
|
||||
m_pApplicationFonts = (CApplicationFonts*)pApplicationFonts;
|
||||
if (m_pApplicationFonts)
|
||||
m_pApplicationFonts->AddRef();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -63,7 +63,7 @@ namespace NSImages
|
||||
|
||||
virtual ICacheImage* Lock(const std::wstring& strFile) = 0;
|
||||
|
||||
void SetApplicationFonts(NSFonts::IApplicationFonts* pApplicationFonts);
|
||||
virtual void SetApplicationFonts(NSFonts::IApplicationFonts* pApplicationFonts) = 0;
|
||||
};
|
||||
|
||||
namespace NSFilesCache
|
||||
|
||||
Reference in New Issue
Block a user