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

Пересобран pdfreader для linux64 с исправленной ошибкой с fclose.

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@64590 954022d7-b5bf-4e40-9824-e11837661b57
parent 25fb120e
......@@ -35,11 +35,9 @@ namespace PdfReader
if (NULL != wsFilePath)
{
NSFile::CFileBinary oFile;
if (!oFile.OpenFile(wsFilePath))
pFile = NSFile::CFileBinary::OpenFileNative(wsFilePath, L"rb");
if (!pFile)
return NULL;
pFile = oFile.GetFileNative();
}
else
{
......
......@@ -49,15 +49,14 @@ namespace PdfReader
{
char sBuffer[64];
Unicode nUnicode = 0;
NSFile::CFileBinary oFile;
if (!oFile.OpenFile(seFileName->GetWString()))
FILE* pFile = NSFile::CFileBinary::OpenFileNative(seFileName->GetWString(), L"rb");
if (!pFile)
{
// TO DO: Error "Couldn't open cidToUnicode file"
return NULL;
}
FILE* pFile = oFile.GetFileNative();
unsigned int nSize = 32768;
Unicode *pMap = (Unicode *)MemUtilsMallocArray(nSize, sizeof(Unicode));
unsigned int nMapLen = 0;
......@@ -94,14 +93,13 @@ namespace PdfReader
Unicode nUnicode0;
Unicode arrUnicodeBuffer[MaxUnicodeString];
NSFile::CFileBinary oFile;
if (!oFile.OpenFile(seFileName->GetWString()))
FILE* pFile = NSFile::CFileBinary::OpenFileNative(seFileName->GetWString(), L"rb");
if (!pFile)
{
// TO DO: Error ""Couldn't open unicodeToUnicode file"
return NULL;
}
FILE* pFile = oFile.GetFileNative();
unsigned int nSize = 4096;
Unicode *pMap = (Unicode *)MemUtilsMallocArray(nSize, sizeof(Unicode));
memset(pMap, 0, nSize * sizeof(Unicode));
......
......@@ -102,14 +102,12 @@ namespace PdfReader
sprintf(m_sFileName, "%s\\%04d.jpg", m_sFilePrefix, m_nImageCount);
NSFile::CFileBinary oFile;
if (!oFile.CreateFileW(AStringToWString(m_sFileName)))
pFile = NSFile::CFileBinary::OpenFileNative(AStringToWString(m_sFileName), L"wb");
if (!pFile)
{
// TO DO: Error "Couldn't open image file"
return;
}
pFile = oFile.GetFileNative();
pStream = ((DCTStream *)pStream)->GetRawStream();
pStream->Reset();
......@@ -141,13 +139,12 @@ namespace PdfReader
sprintf(m_sFileName, "%s\\%04d.bmp", m_sFilePrefix, m_nImageCount);
NSFile::CFileBinary oFile;
if (!oFile.CreateFileW(AStringToWString(m_sFileName)))
pFile = NSFile::CFileBinary::OpenFileNative(AStringToWString(m_sFileName), L"wb");
if (!pFile)
{
// TO DO: Error "Couldn't open image file"
return;
}
pFile = oFile.GetFileNative();
TBitmapFileHeader oFileHeader;
oFileHeader.bfType = 'M' * 256 + 'B';
......@@ -237,13 +234,12 @@ namespace PdfReader
return;
sprintf(m_sFileName, "%s\\%04d.jpg", m_sFilePrefix, m_nImageCount);
NSFile::CFileBinary oFile;
if (!oFile.CreateFileW(AStringToWString(m_sFileName)))
pFile = NSFile::CFileBinary::OpenFileNative(AStringToWString(m_sFileName), L"wb");
if (!pFile)
{
// TO DO: Error "Couldn't open image file"
return;
}
pFile = oFile.GetFileNative();
pStream = ((DCTStream *)pStream)->GetRawStream();
pStream->Reset();
......@@ -276,14 +272,12 @@ namespace PdfReader
sprintf(m_sFileName, "%s\\%04d.bmp", m_sFilePrefix, m_nImageCount);
NSFile::CFileBinary oFile;
if (!oFile.CreateFileW(AStringToWString(m_sFileName)))
pFile = NSFile::CFileBinary::OpenFileNative(AStringToWString(m_sFileName), L"wb");
if (!pFile)
{
// TO DO: Error "Couldn't open image file"
return;
}
pFile = oFile.GetFileNative();
TBitmapFileHeader oFileHeader;
oFileHeader.bfType = 'M' * 256 + 'B';
oFileHeader.bfSize = sizeof(TBitmapFileHeader) + sizeof(TBitmapInfoHeader) + 2 * sizeof(ColorTableEntry) + nHeight * ((nWidth + 7) / 8);
......@@ -365,14 +359,12 @@ namespace PdfReader
sprintf(m_sFileName, "%s\\%04d.bmp", m_sFilePrefix, m_nImageCount);
NSFile::CFileBinary oFile;
if (!oFile.CreateFileW(AStringToWString(m_sFileName)))
pFile = NSFile::CFileBinary::OpenFileNative(AStringToWString(m_sFileName), L"wb");
if (!pFile)
{
// TO DO: Error "Couldn't open image file"
return;
}
pFile = oFile.GetFileNative();
TBitmapFileHeader oFileHeader;
oFileHeader.bfType = 'M' * 256 + 'B';
oFileHeader.bfSize = sizeof(TBitmapFileHeader) + sizeof(TBitmapCoreHeader) + nWidth * nHeight * 4;
......
......@@ -24,12 +24,10 @@ namespace PdfReader
char *CFontFileBase::ReadFile(wchar_t *wsFileName, int *pnFileLen)
{
NSFile::CFileBinary oFile;
if (!oFile.OpenFile(wsFileName))
FILE* pFile = NSFile::CFileBinary::OpenFileNative(wsFileName, L"rb");
if (!pFile)
return NULL;
FILE* pFile = oFile.GetFileNative();
fseek(pFile, 0, SEEK_END);
int nLen = (int)ftell(pFile);
fseek(pFile, 0, SEEK_SET);
......@@ -41,7 +39,7 @@ namespace PdfReader
return NULL;
}
oFile.CloseFile();
fclose(pFile);
*pnFileLen = nLen;
return sBuffer;
}
......
......@@ -413,13 +413,12 @@ namespace PdfReader
char *GrFont::ReadExternalFontFile(int *pnLen)
{
NSFile::CFileBinary oFile;
if (!oFile.OpenFile(m_wsExternalFontFilePath))
FILE* pFile = NSFile::CFileBinary::OpenFileNative(m_wsExternalFontFilePath, L"rb");
if (!pFile)
{
// TO DO: Error "External font file vanished"
return NULL;
}
FILE* pFile = oFile.GetFileNative();
fseek(pFile, 0, SEEK_END);
*pnLen = (int)ftell(pFile);
......
......@@ -151,9 +151,7 @@ namespace PdfReader
if (m_wsCMapDirectory != L"")
{
std::wstring wsFilePath = m_wsCMapDirectory + seCMapName->GetWString();
NSFile::CFileBinary oFile;
oFile.OpenFile(wsFilePath);
return oFile.GetFileNative();
return NSFile::CFileBinary::OpenFileNative(wsFilePath, L"rb");
}
return NULL;
......
......@@ -371,11 +371,7 @@ namespace PdfReader
{
#ifdef _DEBUG
std::wstring wsFileName = L"D:\\Output\\PDF Dump\\DumpPDF_Page" + std::to_wstring(nPageNumber) + L".bin";
NSFile::CFileBinary oFile;
if (!oFile.CreateFileW(wsFileName))
m_pDumpFile = NULL;
else
m_pDumpFile = oFile.GetFileNative();
m_pDumpFile = NSFile::CFileBinary::OpenFileNative(wsFileName, L"wb");
#endif
m_pGlobalParams = pGlobalParams;
......
......@@ -53,9 +53,10 @@ namespace PdfReader
if (!m_pFileBuffer)
{
oFile.CloseFile();
// Не смогли выделить память под весь файл, тогда работаем непосредственно с самим файлом
m_pFileBuffer = NULL;
m_pFile = oFile.GetFileNative();
m_pFile = NSFile::CFileBinary::OpenFileNative(wsFileName, L"rb");
// Создаем поток
Object oTemp;
......
......@@ -637,9 +637,7 @@ namespace PdfReader
SpitPathExt(wsFileName, &wsSplitFileName, &wsSplitFileExt);
std::wstring wsAfmPath = wsSplitFileName + L".afm";
NSFile::CFileBinary oFile;
oFile.CreateFileW(wsAfmPath);
FILE* pFile = oFile.GetFileNative();
FILE* pFile = NSFile::CFileBinary::OpenFileNative(wsAfmPath, L"wb");
if (pFile)
{
Ref *pRef = pFont->GetID();
......@@ -815,6 +813,7 @@ namespace PdfReader
oDictItem.Free();
}
}
fclose(pFile);
}
// Загрузим сам файл со шрифтом, чтобы точно определить его тип
......
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