This commit is contained in:
Elena.Subbotina
2020-07-10 10:21:36 +03:00
parent 8c605dca1c
commit d10a0ccadd
9 changed files with 831 additions and 815 deletions

View File

@ -201,14 +201,14 @@ bool CFontConverter::ToOTF(std::wstring sFontIn, std::wstring sFontOut, unsigned
{ {
// error parse font // error parse font
// Просто копируем файл // Просто копируем файл
NSFile::CFileBinary::Copy(sFontIn, sFontOut); oFileBinary.Copy(sFontIn, sFontOut);
} }
} }
} }
else else
{ {
// Просто копируем файл // Просто копируем файл
NSFile::CFileBinary::Copy(sFontIn, sFontOut); oFileBinary.Copy(sFontIn, sFontOut);
} }
FT_Done_Face( pFace ); FT_Done_Face( pFace );

View File

@ -75,7 +75,8 @@ public:
oMetafile.ConvertToRaster(sTempFile.c_str(), 4, 1000, -1); oMetafile.ConvertToRaster(sTempFile.c_str(), 4, 1000, -1);
m_oImage.Create(sTempFile); m_oImage.Create(sTempFile);
NSFile::CFileBinary::Remove(sTempFile); NSFile::CFileBinary file;
file.Remove(sTempFile);
} }
} }
} }

View File

@ -80,11 +80,13 @@ namespace NSOnlineOfficeBinToPdf
~CMetafileToRenderterRaster_private() ~CMetafileToRenderterRaster_private()
{ {
NSFile::CFileBinary file;
for (std::vector<std::wstring>::iterator i = m_arTempFiles.begin(); i != m_arTempFiles.end(); i++) for (std::vector<std::wstring>::iterator i = m_arTempFiles.begin(); i != m_arTempFiles.end(); i++)
{ {
std::wstring sPath = *i; std::wstring sPath = *i;
if (NSFile::CFileBinary::Exists(sPath))
NSFile::CFileBinary::Remove(sPath); if (file.Exists(sPath))
file.Remove(sPath);
} }
} }
}; };

File diff suppressed because it is too large Load Diff

View File

@ -50,13 +50,14 @@ namespace MetaFile
} }
CEmfLogBrushEx::~CEmfLogBrushEx() CEmfLogBrushEx::~CEmfLogBrushEx()
{ {
if (BS_DIBPATTERN == BrushStyle && L"" != DibPatternPath) if (BS_DIBPATTERN == BrushStyle && L"" != DibPatternPath)
{ {
NSFile::CFileBinary::Remove(DibPatternPath); NSFile::CFileBinary file;
} file.Remove(DibPatternPath);
}
if (DibBuffer) if (DibBuffer)
delete[] DibBuffer; delete[] DibBuffer;
} }
void CEmfLogBrushEx::SetDibPattern(unsigned char* pBuffer, unsigned int ulWidth, unsigned int ulHeight) void CEmfLogBrushEx::SetDibPattern(unsigned char* pBuffer, unsigned int ulWidth, unsigned int ulHeight)
{ {

View File

@ -57,53 +57,54 @@ namespace MetaFile
DibWidth = 0; DibWidth = 0;
DibHeigth = 0; DibHeigth = 0;
} }
CWmfBrush::~CWmfBrush() CWmfBrush::~CWmfBrush()
{ {
if (BS_DIBPATTERN == BrushStyle && L"" != DibPatternPath) if (BS_DIBPATTERN == BrushStyle && L"" != DibPatternPath)
{ {
NSFile::CFileBinary::Remove(DibPatternPath); NSFile::CFileBinary file;
} file.Remove(DibPatternPath);
}
if (DibBuffer) if (DibBuffer)
delete[] DibBuffer; delete[] DibBuffer;
} }
void CWmfBrush::SetDibPattern(unsigned char* pBuffer, unsigned int ulWidth, unsigned int ulHeight) void CWmfBrush::SetDibPattern(unsigned char* pBuffer, unsigned int ulWidth, unsigned int ulHeight)
{ {
DibBuffer = pBuffer; DibBuffer = pBuffer;
DibWidth = ulWidth; DibWidth = ulWidth;
DibHeigth = ulHeight; DibHeigth = ulHeight;
if (ulWidth <= 0 || ulHeight <= 0) if (ulWidth <= 0 || ulHeight <= 0)
return; return;
unsigned int ulBufferSize = 4 * ulWidth * ulHeight; unsigned int ulBufferSize = 4 * ulWidth * ulHeight;
Aggplus::CImage oImage; Aggplus::CImage oImage;
BYTE* pBufferPtr = new BYTE[ulBufferSize]; BYTE* pBufferPtr = new BYTE[ulBufferSize];
oImage.Create(pBufferPtr, ulWidth, ulHeight, 4 * ulWidth); oImage.Create(pBufferPtr, ulWidth, ulHeight, 4 * ulWidth);
// Пишем данные в pBufferPtr // Пишем данные в pBufferPtr
for (unsigned int ulIndex = 0; ulIndex < ulBufferSize; ulIndex += 4) for (unsigned int ulIndex = 0; ulIndex < ulBufferSize; ulIndex += 4)
{ {
pBufferPtr[0] = (unsigned char)pBuffer[ulIndex + 0]; pBufferPtr[0] = (unsigned char)pBuffer[ulIndex + 0];
pBufferPtr[1] = (unsigned char)pBuffer[ulIndex + 1]; pBufferPtr[1] = (unsigned char)pBuffer[ulIndex + 1];
pBufferPtr[2] = (unsigned char)pBuffer[ulIndex + 2]; pBufferPtr[2] = (unsigned char)pBuffer[ulIndex + 2];
pBufferPtr[3] = (unsigned char)pBuffer[ulIndex + 3]; pBufferPtr[3] = (unsigned char)pBuffer[ulIndex + 3];
pBufferPtr += 4; pBufferPtr += 4;
} }
FILE *pTempFile = NULL; FILE *pTempFile = NULL;
std::wstring wsTempFileName; std::wstring wsTempFileName;
if (!OpenTempFile(&wsTempFileName, &pTempFile, L"wb", L".emf0", NULL)) if (!OpenTempFile(&wsTempFileName, &pTempFile, L"wb", L".emf0", NULL))
return; return;
::fclose(pTempFile); ::fclose(pTempFile);
oImage.SaveFile(wsTempFileName, _CXIMAGE_FORMAT_PNG); oImage.SaveFile(wsTempFileName, _CXIMAGE_FORMAT_PNG);
BrushStyle = BS_DIBPATTERN; BrushStyle = BS_DIBPATTERN;
DibPatternPath = wsTempFileName; DibPatternPath = wsTempFileName;
} }
int CWmfBrush::GetColor() int CWmfBrush::GetColor()
{ {
return METAFILE_RGBA(Color.r, Color.g, Color.b); return METAFILE_RGBA(Color.r, Color.g, Color.b);
} }

View File

@ -4548,7 +4548,8 @@ namespace SVG
if (!m_sLivePath.empty()) if (!m_sLivePath.empty())
{ {
NSFile::CFileBinary::Remove(m_sLivePath); NSFile::CFileBinary file;
file.Remove(m_sLivePath);
} }
} }

View File

@ -346,6 +346,8 @@ int CHtmlFile::Convert(const std::vector<std::wstring>& arFiles, const std::wstr
oBuilder.WriteString(L"</destination>"); oBuilder.WriteString(L"</destination>");
NSFile::CFileBinary file;
std::vector<std::wstring> arTmpFiles; std::vector<std::wstring> arTmpFiles;
for (std::vector<std::wstring>::const_iterator iter = arFiles.begin(); iter != arFiles.end(); iter++) for (std::vector<std::wstring>::const_iterator iter = arFiles.begin(); iter != arFiles.end(); iter++)
{ {
@ -373,12 +375,14 @@ int CHtmlFile::Convert(const std::vector<std::wstring>& arFiles, const std::wstr
} }
std::wstring sTmpFile = NSFile::CFileBinary::CreateTempFileWithUniqueName(sTmpDir, L"HTM"); std::wstring sTmpFile = NSFile::CFileBinary::CreateTempFileWithUniqueName(sTmpDir, L"HTM");
if (NSFile::CFileBinary::Exists(sTmpFile))
NSFile::CFileBinary::Remove(sTmpFile); NSFile::CFileBinary file;
if (file.Exists(sTmpFile))
file.Remove(sTmpFile);
sTmpFile = sTmpFile + L".html"; sTmpFile = sTmpFile + L".html";
NSFile::CFileBinary::Copy(sFilePath, sTmpFile); file.Copy(sFilePath, sTmpFile);
oBuilder.WriteEncodeXmlString(CorrectHtmlPath(sTmpFile)); oBuilder.WriteEncodeXmlString(CorrectHtmlPath(sTmpFile));
arTmpFiles.push_back(sTmpFile); arTmpFiles.push_back(sTmpFile);
} }
@ -472,7 +476,7 @@ int CHtmlFile::Convert(const std::vector<std::wstring>& arFiles, const std::wstr
CloseHandle(processinfo.hProcess); CloseHandle(processinfo.hProcess);
CloseHandle(processinfo.hThread); CloseHandle(processinfo.hThread);
NSFile::CFileBinary::Remove(sTempFileForParams); file.Remove(sTempFileForParams);
#endif #endif
#ifdef LINUX #ifdef LINUX
@ -557,11 +561,12 @@ int CHtmlFile::Convert(const std::vector<std::wstring>& arFiles, const std::wstr
for (std::vector<std::wstring>::iterator i = arTmpFiles.begin(); i != arTmpFiles.end(); i++) for (std::vector<std::wstring>::iterator i = arTmpFiles.begin(); i != arTmpFiles.end(); i++)
{ {
NSFile::CFileBinary::Remove(*i); NSFile::CFileBinary file;
file.Remove(*i);
} }
arTmpFiles.clear(); arTmpFiles.clear();
NSFile::CFileBinary::Remove(sTempFileForParams); file.Remove(sTempFileForParams);
return nReturnCode; return nReturnCode;
} }
@ -1069,8 +1074,9 @@ namespace NSMht
#endif #endif
// под линуксом предыдущая функция создает файл!!! // под линуксом предыдущая функция создает файл!!!
if (NSFile::CFileBinary::Exists(m_sFolder)) NSFile::CFileBinary file;
NSFile::CFileBinary::Remove(m_sFolder); if (file.Exists(m_sFolder))
file.Remove(m_sFolder);
NSDirectory::CreateDirectory(m_sFolder); NSDirectory::CreateDirectory(m_sFolder);

View File

@ -1175,7 +1175,8 @@ namespace NSHtmlRenderer
RELEASEARRAYOBJECTS(pOutput); RELEASEARRAYOBJECTS(pOutput);
RELEASEARRAYOBJECTS(pData); RELEASEARRAYOBJECTS(pData);
NSFile::CFileBinary::Remove(strTempFont); NSFile::CFileBinary file;
file.Remove(strTempFont);
} }
NSFile::CFileBinary oFileFontFileJS_type; NSFile::CFileBinary oFileFontFileJS_type;
@ -2090,7 +2091,8 @@ namespace NSHtmlRenderer
oFilePages.CloseFile(); oFilePages.CloseFile();
NSFile::CFileBinary::Remove(m_strDstDirectoryFiles + L"/document_temp.bin"); NSFile::CFileBinary file;
file.Remove(m_strDstDirectoryFiles + L"/document_temp.bin");
if (bIsNoBase64) if (bIsNoBase64)
{ {