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

Исправлен баг с записью текста в строковый буфер.

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63448 954022d7-b5bf-4e40-9824-e11837661b57
parent ad23dfaa
......@@ -20,6 +20,8 @@
#define MAX_CHARSPACE 300
#define MAX_FONTSIZE 1000
#define STR_BUF 200
namespace PdfWriter
{
static const double c_dKappa = 0.552;
......@@ -1262,12 +1264,29 @@ namespace PdfWriter
CTextWord::CTextWord()
{
m_nIndex = 0;
m_pText = (unsigned char*)malloc(STR_BUF);
m_nSize = STR_BUF;
}
CTextWord::~CTextWord()
{
if (m_pText)
free(m_pText);
}
void CTextWord::CheckBuffer()
{
if (2 * m_nIndex >= m_nSize)
{
m_nSize += STR_BUF;
m_pText = (unsigned char*)realloc(m_pText, m_nSize);
}
}
bool CTextWord::Add(unsigned char* pCodes, unsigned int unLen, double dX, double dY, double dWidth)
{
if (2 != unLen)
return false;
CheckBuffer();
if (0 == m_nIndex)
{
m_pText[0] = pCodes[0];
......
......@@ -162,11 +162,17 @@ namespace PdfWriter
public:
CTextWord();
~CTextWord();
bool Add(unsigned char* pCodes, unsigned int unLen, double dX, double dY, double dWidth);
private:
unsigned char m_pText[200];
void CheckBuffer();
private:
unsigned char*m_pText;
int m_nSize;
int m_nIndex;
double m_dStartX;
double m_dStartY;
......
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