Commit 9b9646da authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander Trofimov

работа под линукс

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63679 954022d7-b5bf-4e40-9824-e11837661b57
parent 53e35b5a
...@@ -189,7 +189,7 @@ namespace NSOnlineOfficeBinToPdf ...@@ -189,7 +189,7 @@ namespace NSOnlineOfficeBinToPdf
if (sizeof(wchar_t) == 4) if (sizeof(wchar_t) == 4)
{ {
#if !defined(_WIN32) && !defined(_WIN64) #if !defined(_WIN32) && !defined(_WIN64)
wsTempString = stringUtf16ToWString((UTF16*)pData, nLen / 2); wsTempString = NSStringExt::CConverter::GetUnicodeFromUTF16((unsigned short*)pData, nLen / 2);
#endif #endif
} }
else else
...@@ -792,4 +792,4 @@ namespace NSOnlineOfficeBinToPdf ...@@ -792,4 +792,4 @@ namespace NSOnlineOfficeBinToPdf
return true; return true;
} }
} }
\ No newline at end of file
...@@ -1469,11 +1469,11 @@ bool CPdfRenderer::PathCommandDrawText(unsigned int* pUnicodes, unsigned int unL ...@@ -1469,11 +1469,11 @@ bool CPdfRenderer::PathCommandDrawText(unsigned int* pUnicodes, unsigned int unL
void CPdfRenderer::UpdateFont() void CPdfRenderer::UpdateFont()
{ {
m_bNeedUpdateTextFont = false; m_bNeedUpdateTextFont = false;
std::wstring& wsFontPath = m_oFont.GetPath(); std::wstring wsFontPath = m_oFont.GetPath();
LONG lFaceIndex = m_oFont.GetFaceIndex(); LONG lFaceIndex = m_oFont.GetFaceIndex();
if (L"" == wsFontPath) if (L"" == wsFontPath)
{ {
std::wstring& wsFontName = m_oFont.GetName(); std::wstring wsFontName = m_oFont.GetName();
bool bBold = m_oFont.IsBold(); bool bBold = m_oFont.IsBold();
bool bItalic = m_oFont.IsItalic(); bool bItalic = m_oFont.IsItalic();
bool bFind = false; bool bFind = false;
...@@ -1521,7 +1521,7 @@ void CPdfRenderer::UpdateTransform() ...@@ -1521,7 +1521,7 @@ void CPdfRenderer::UpdateTransform()
} }
void CPdfRenderer::UpdatePen() void CPdfRenderer::UpdatePen()
{ {
TColor& oColor = m_oPen.GetTColor(); TColor oColor = m_oPen.GetTColor();
m_pPage->SetStrokeColor(oColor.r, oColor.g, oColor.b); m_pPage->SetStrokeColor(oColor.r, oColor.g, oColor.b);
m_pPage->SetStrokeAlpha((unsigned char)m_oPen.GetAlpha()); m_pPage->SetStrokeAlpha((unsigned char)m_oPen.GetAlpha());
m_pPage->SetLineWidth(MM_2_PT(m_oPen.GetSize())); m_pPage->SetLineWidth(MM_2_PT(m_oPen.GetSize()));
...@@ -1587,7 +1587,7 @@ void CPdfRenderer::UpdateBrush() ...@@ -1587,7 +1587,7 @@ void CPdfRenderer::UpdateBrush()
LONG lBrushType = m_oBrush.GetType(); LONG lBrushType = m_oBrush.GetType();
if (c_BrushTypeTexture == lBrushType) if (c_BrushTypeTexture == lBrushType)
{ {
std::wstring& wsTexturePath = m_oBrush.GetTexturePath(); std::wstring wsTexturePath = m_oBrush.GetTexturePath();
CImageFileFormatChecker oImageFormat(wsTexturePath); CImageFileFormatChecker oImageFormat(wsTexturePath);
CImageDict* pImage = NULL; CImageDict* pImage = NULL;
...@@ -1636,8 +1636,8 @@ void CPdfRenderer::UpdateBrush() ...@@ -1636,8 +1636,8 @@ void CPdfRenderer::UpdateBrush()
dR += 1; dR += 1;
// Растягиваем картинку по размерам пата // Растягиваем картинку по размерам пата
dW = max(10, dR - dL); dW = std::max(10.0, dR - dL);
dH = max(10, dB - dT); dH = std::max(10.0, dB - dT);
} }
else else
{ {
...@@ -1657,13 +1657,13 @@ void CPdfRenderer::UpdateBrush() ...@@ -1657,13 +1657,13 @@ void CPdfRenderer::UpdateBrush()
} }
else if (c_BrushTypeHatch1 == lBrushType) else if (c_BrushTypeHatch1 == lBrushType)
{ {
std::wstring& wsHatchType = m_oBrush.GetTexturePath(); std::wstring wsHatchType = m_oBrush.GetTexturePath();
double dW = 8 * 72 / 96; double dW = 8 * 72 / 96;
double dH = 8 * 72 / 96; double dH = 8 * 72 / 96;
TColor& oColor1 = m_oBrush.GetTColor1(); TColor oColor1 = m_oBrush.GetTColor1();
TColor& oColor2 = m_oBrush.GetTColor2(); TColor oColor2 = m_oBrush.GetTColor2();
BYTE nAlpha1 = (BYTE)m_oBrush.GetAlpha1(); BYTE nAlpha1 = (BYTE)m_oBrush.GetAlpha1();
BYTE nAlpha2 = (BYTE)m_oBrush.GetAlpha2(); BYTE nAlpha2 = (BYTE)m_oBrush.GetAlpha2();
...@@ -1710,7 +1710,7 @@ void CPdfRenderer::UpdateBrush() ...@@ -1710,7 +1710,7 @@ void CPdfRenderer::UpdateBrush()
} }
else// if (c_BrushTypeSolid == lBrushType) else// if (c_BrushTypeSolid == lBrushType)
{ {
TColor& oColor1 = m_oBrush.GetTColor1(); TColor oColor1 = m_oBrush.GetTColor1();
m_pPage->SetFillColor(oColor1.r, oColor1.g, oColor1.b); m_pPage->SetFillColor(oColor1.r, oColor1.g, oColor1.b);
m_pPage->SetFillAlpha((unsigned char)m_oBrush.GetAlpha1()); m_pPage->SetFillAlpha((unsigned char)m_oBrush.GetAlpha1());
} }
...@@ -1895,4 +1895,4 @@ void CPdfRenderer::CBrushState::Reset() ...@@ -1895,4 +1895,4 @@ void CPdfRenderer::CBrushState::Reset()
m_pShadingColors = NULL; m_pShadingColors = NULL;
m_pShadingPoints = NULL; m_pShadingPoints = NULL;
m_lShadingPointsCount = 0; m_lShadingPointsCount = 0;
} }
\ No newline at end of file
...@@ -313,7 +313,7 @@ private: ...@@ -313,7 +313,7 @@ private:
} }
inline void SetAlpha(const LONG& lAlpha) inline void SetAlpha(const LONG& lAlpha)
{ {
m_nAlpha = (BYTE)max(0, min(255, (int)lAlpha)); m_nAlpha = (BYTE)std::max(0, std::min(255, (int)lAlpha));
} }
inline double GetSize() inline double GetSize()
{ {
...@@ -543,7 +543,7 @@ private: ...@@ -543,7 +543,7 @@ private:
} }
inline void SetAlpha1(const LONG& lAlpha) inline void SetAlpha1(const LONG& lAlpha)
{ {
m_nAlpha1 = (BYTE)max(0, min(255, (int)lAlpha)); m_nAlpha1 = (BYTE)std::max(0, std::min(255, (int)lAlpha));
} }
inline LONG GetAlpha2() inline LONG GetAlpha2()
{ {
...@@ -551,7 +551,7 @@ private: ...@@ -551,7 +551,7 @@ private:
} }
inline void SetAlpha2(const LONG& lAlpha) inline void SetAlpha2(const LONG& lAlpha)
{ {
m_nAlpha2 = (BYTE)max(0, min(255, (int)lAlpha)); m_nAlpha2 = (BYTE)std::max(0, std::min(255, (int)lAlpha));
} }
inline std::wstring GetTexturePath() inline std::wstring GetTexturePath()
{ {
...@@ -575,7 +575,7 @@ private: ...@@ -575,7 +575,7 @@ private:
} }
inline void SetTextureAlpha(const LONG& lAlpha) inline void SetTextureAlpha(const LONG& lAlpha)
{ {
m_nTextureAlpha = (BYTE)max(0, min(255, (int)lAlpha)); m_nTextureAlpha = (BYTE)std::max(0, std::min(255, (int)lAlpha));
} }
inline double GetLinearAngle() inline double GetLinearAngle()
{ {
...@@ -870,10 +870,10 @@ private: ...@@ -870,10 +870,10 @@ private:
TColor oColor1 = lColor1; TColor oColor1 = lColor1;
TColor oColor2 = lColor2; TColor oColor2 = lColor2;
BYTE r = (BYTE)max(0, min(255, (int)(oColor1.r + (oColor2.r - oColor1.r) / dDiff * (dDstPoint - dPoint1)))); BYTE r = (BYTE)std::max(0, std::min(255, (int)(oColor1.r + (oColor2.r - oColor1.r) / dDiff * (dDstPoint - dPoint1))));
BYTE g = (BYTE)max(0, min(255, (int)(oColor1.g + (oColor2.g - oColor1.g) / dDiff * (dDstPoint - dPoint1)))); BYTE g = (BYTE)std::max(0, std::min(255, (int)(oColor1.g + (oColor2.g - oColor1.g) / dDiff * (dDstPoint - dPoint1))));
BYTE b = (BYTE)max(0, min(255, (int)(oColor1.b + (oColor2.b - oColor1.b) / dDiff * (dDstPoint - dPoint1)))); BYTE b = (BYTE)std::max(0, std::min(255, (int)(oColor1.b + (oColor2.b - oColor1.b) / dDiff * (dDstPoint - dPoint1))));
BYTE a = (BYTE)max(0, min(255, (int)(oColor1.a + (oColor2.a - oColor1.a) / dDiff * (dDstPoint - dPoint1)))); BYTE a = (BYTE)std::max(0, std::min(255, (int)(oColor1.a + (oColor2.a - oColor1.a) / dDiff * (dDstPoint - dPoint1))));
TColor oResColor; TColor oResColor;
oResColor.Set(r, g, b, a); oResColor.Set(r, g, b, a);
......
...@@ -94,7 +94,8 @@ DEFINES += \ ...@@ -94,7 +94,8 @@ DEFINES += \
win32 { win32 {
DEFINES += \ DEFINES += \
JAS_WIN_MSVC_BUILD \ JAS_WIN_MSVC_BUILD \
WIN32 WIN32 \
NOMINMAX
message(windows) message(windows)
} }
......
...@@ -107,7 +107,7 @@ namespace PdfWriter ...@@ -107,7 +107,7 @@ namespace PdfWriter
} }
void CLinkAnnotation::SetBorderStyle(float fWidth, unsigned short nDashOn, unsigned short nDashOff) void CLinkAnnotation::SetBorderStyle(float fWidth, unsigned short nDashOn, unsigned short nDashOff)
{ {
fWidth = max(fWidth, 0); fWidth = std::max(fWidth, 0.f);
CArrayObject* pArray = new CArrayObject(); CArrayObject* pArray = new CArrayObject();
if (!pArray) if (!pArray)
...@@ -152,7 +152,7 @@ namespace PdfWriter ...@@ -152,7 +152,7 @@ namespace PdfWriter
void SetOpened(bool bOpened); void SetOpened(bool bOpened);
void CTextAnnotation::SetIcon(EAnnotIcon eIcon) void CTextAnnotation::SetIcon(EAnnotIcon eIcon)
{ {
eIcon = (EAnnotIcon)min(max(AnnotIconMin, eIcon), AnnotIconMax); eIcon = (EAnnotIcon)std::min(std::max(AnnotIconMin, eIcon), AnnotIconMax);
Add("Name", c_sAnnotIconNames[(int)eIcon]); Add("Name", c_sAnnotIconNames[(int)eIcon]);
} }
void CTextAnnotation::SetOpened(bool bOpened) void CTextAnnotation::SetOpened(bool bOpened)
...@@ -173,4 +173,4 @@ namespace PdfWriter ...@@ -173,4 +173,4 @@ namespace PdfWriter
pAction->Add("S", "URI"); pAction->Add("S", "URI");
pAction->Add("URI", new CStringObject(sUri)); pAction->Add("URI", new CStringObject(sUri));
} }
} }
\ No newline at end of file
#ifndef _PDF_WRITER_SRC_CONSTS_H #ifndef _PDF_WRITER_SRC_CONSTS_H
#define _PDF_WRITER_SRC_CONSTS_H #define _PDF_WRITER_SRC_CONSTS_H
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
#define OK 0 #define OK 0
#define NOERROR 0 #define NOERROR 0
......
...@@ -44,8 +44,8 @@ namespace PdfWriter ...@@ -44,8 +44,8 @@ namespace PdfWriter
if (fZoom < 0.08 || fZoom > 32) if (fZoom < 0.08 || fZoom > 32)
fZoom = 0; fZoom = 0;
fLeft = max(fLeft, 0); fLeft = std::max(fLeft, 0.f);
fTop = max(fTop, 0); fTop = std::max(fTop, 0.f);
PrepareArray(); PrepareArray();
Add("XYZ"); Add("XYZ");
......
...@@ -249,7 +249,7 @@ namespace PdfWriter ...@@ -249,7 +249,7 @@ namespace PdfWriter
if (!pLabel) if (!pLabel)
return NULL; return NULL;
eStyle = min(max(eStyle, pagenumstyle_Min), pagenumstyle_Max); eStyle = std::min(std::max(eStyle, pagenumstyle_Min), pagenumstyle_Max);
switch (eStyle) switch (eStyle)
{ {
case pagenumstyle_UpperRoman: pLabel->Add("S", "R"); break; case pagenumstyle_UpperRoman: pLabel->Add("S", "R"); break;
......
...@@ -88,19 +88,19 @@ namespace PdfWriter ...@@ -88,19 +88,19 @@ namespace PdfWriter
} }
void CExtGrState::SetAlphaStroke (double dValue) void CExtGrState::SetAlphaStroke (double dValue)
{ {
dValue = min(1, max(0, dValue)); dValue = std::min(1.0, std::max(0.0, dValue));
Add("CA", dValue); Add("CA", dValue);
m_dAlphaStroke = dValue; m_dAlphaStroke = dValue;
} }
void CExtGrState::SetAlphaFill (double dValue) void CExtGrState::SetAlphaFill (double dValue)
{ {
dValue = min(1, max(0, dValue)); dValue = std::min(1.0, std::max(0.0, dValue));
Add("ca", dValue); Add("ca", dValue);
m_dAlphaFill = dValue; m_dAlphaFill = dValue;
} }
void CExtGrState::SetBlendMode (EBlendMode eBlendMode) void CExtGrState::SetBlendMode (EBlendMode eBlendMode)
{ {
eBlendMode = min(blendmode_Max, max(blendmode_Min, eBlendMode)); eBlendMode = std::min(blendmode_Max, std::max(blendmode_Min, eBlendMode));
Add("BM", c_sBlendModeNames[(int)eBlendMode]); Add("BM", c_sBlendModeNames[(int)eBlendMode]);
m_eBlendMode = eBlendMode; m_eBlendMode = eBlendMode;
} }
......
...@@ -144,7 +144,7 @@ namespace PdfWriter ...@@ -144,7 +144,7 @@ namespace PdfWriter
} }
void CBinaryObject::Set(const BYTE* pValue, unsigned int unLen) void CBinaryObject::Set(const BYTE* pValue, unsigned int unLen)
{ {
unLen = min(LIMIT_MAX_STRING_LEN, unLen); unLen = std::min((unsigned int)LIMIT_MAX_STRING_LEN, unLen);
if (m_pValue) if (m_pValue)
{ {
delete[] m_pValue; delete[] m_pValue;
......
...@@ -161,11 +161,11 @@ namespace PdfWriter ...@@ -161,11 +161,11 @@ namespace PdfWriter
} }
void Set(float fValue) void Set(float fValue)
{ {
m_fValue = min(max(fValue, LIMIT_MIN_REAL), LIMIT_MAX_REAL); m_fValue = std::min(std::max(fValue, LIMIT_MIN_REAL), LIMIT_MAX_REAL);
} }
void Set(double dValue) void Set(double dValue)
{ {
m_fValue = (float)min(max(dValue, LIMIT_MIN_REAL), LIMIT_MAX_REAL); m_fValue = (float)std::min(std::max((float)dValue, LIMIT_MIN_REAL), LIMIT_MAX_REAL);
} }
float Get() const float Get() const
{ {
......
...@@ -209,7 +209,7 @@ namespace PdfWriter ...@@ -209,7 +209,7 @@ namespace PdfWriter
} }
void CPage::SetWidth(double dValue) void CPage::SetWidth(double dValue)
{ {
dValue = min(max(dValue, 1), 14400); dValue = std::min(std::max(dValue, 1.0), 14400.0);
SetMediaBoxValue(2, dValue); SetMediaBoxValue(2, dValue);
} }
double CPage::GetWidth() double CPage::GetWidth()
...@@ -218,7 +218,7 @@ namespace PdfWriter ...@@ -218,7 +218,7 @@ namespace PdfWriter
} }
void CPage::SetHeight(double dValue) void CPage::SetHeight(double dValue)
{ {
dValue = min(max(dValue, 1), 14400); dValue = std::min(std::max(dValue, 1.0), 14400.0);
SetMediaBoxValue(3, dValue); SetMediaBoxValue(3, dValue);
} }
double CPage::GetHeight() double CPage::GetHeight()
...@@ -421,8 +421,8 @@ namespace PdfWriter ...@@ -421,8 +421,8 @@ namespace PdfWriter
int nFirstPointQuard = int(_dAngle1) / 90 + 1; int nFirstPointQuard = int(_dAngle1) / 90 + 1;
int nSecondPointQuard = int(_dAngle2) / 90 + 1; int nSecondPointQuard = int(_dAngle2) / 90 + 1;
nSecondPointQuard = min(4, max(1, nSecondPointQuard)); nSecondPointQuard = std::min(4, std::max(1, nSecondPointQuard));
nFirstPointQuard = min(4, max(1, nFirstPointQuard)); nFirstPointQuard = std::min(4, std::max(1, nFirstPointQuard));
// Проведем линию в начальную точку дуги // Проведем линию в начальную точку дуги
double dStartX = 0.0, dStartY = 0.0, dEndX = 0.0, dEndY = 0.0; double dStartX = 0.0, dStartY = 0.0, dEndX = 0.0, dEndY = 0.0;
...@@ -603,7 +603,7 @@ namespace PdfWriter ...@@ -603,7 +603,7 @@ namespace PdfWriter
// Operator : w // Operator : w
// Descriprion: устанавливаем толщину линии // Descriprion: устанавливаем толщину линии
dLineWidth = max(dLineWidth, 0); dLineWidth = std::max(dLineWidth, 0.0);
m_pStream->WriteReal(dLineWidth); m_pStream->WriteReal(dLineWidth);
m_pStream->WriteStr(" w\012"); m_pStream->WriteStr(" w\012");
m_pGrState->m_dLineWidth = dLineWidth; m_pGrState->m_dLineWidth = dLineWidth;
...@@ -613,7 +613,7 @@ namespace PdfWriter ...@@ -613,7 +613,7 @@ namespace PdfWriter
// Operator : J // Operator : J
// Descriprion: устанавливаем вид окончания линии (LineCapStyle) // Descriprion: устанавливаем вид окончания линии (LineCapStyle)
eLineCap = max(linecap_Min, min(linecap_Max, eLineCap)); eLineCap = std::max(linecap_Min, std::min(linecap_Max, eLineCap));
m_pStream->WriteInt((unsigned int)eLineCap); m_pStream->WriteInt((unsigned int)eLineCap);
m_pStream->WriteStr(" J\012"); m_pStream->WriteStr(" J\012");
m_pGrState->m_eLineCap = eLineCap; m_pGrState->m_eLineCap = eLineCap;
...@@ -622,7 +622,7 @@ namespace PdfWriter ...@@ -622,7 +622,7 @@ namespace PdfWriter
{ {
// Operator : j // Operator : j
// Descriprion: устанавливаем вид соединения линий (LineJoinStyle) // Descriprion: устанавливаем вид соединения линий (LineJoinStyle)
eLineJoin = max(linejoin_Min, min(linejoin_Max, eLineJoin)); eLineJoin = std::max(linejoin_Min, std::min(linejoin_Max, eLineJoin));
m_pStream->WriteInt((unsigned int)eLineJoin); m_pStream->WriteInt((unsigned int)eLineJoin);
m_pStream->WriteStr(" j\012"); m_pStream->WriteStr(" j\012");
m_pGrState->m_eLineJoin = eLineJoin; m_pGrState->m_eLineJoin = eLineJoin;
...@@ -631,7 +631,7 @@ namespace PdfWriter ...@@ -631,7 +631,7 @@ namespace PdfWriter
{ {
// Operator : M // Operator : M
// Descriprion: устанавливаем MiterLimit - константа, относящаяся к виду соединения линий // Descriprion: устанавливаем MiterLimit - константа, относящаяся к виду соединения линий
dMiterLimit = max(1, dMiterLimit); dMiterLimit = std::max(1.0, dMiterLimit);
m_pStream->WriteReal(dMiterLimit); m_pStream->WriteReal(dMiterLimit);
m_pStream->WriteStr(" M\012"); m_pStream->WriteStr(" M\012");
m_pGrState->m_dMiterLimit = dMiterLimit; m_pGrState->m_dMiterLimit = dMiterLimit;
...@@ -673,7 +673,7 @@ namespace PdfWriter ...@@ -673,7 +673,7 @@ namespace PdfWriter
{ {
// Operator : i // Operator : i
// Descriprion: устанавливаем порог ошибки линии (Flatness tolerance) // Descriprion: устанавливаем порог ошибки линии (Flatness tolerance)
dFlatness = min(100, max(0, dFlatness)); dFlatness = std::min(100.0, std::max(0.0, dFlatness));
m_pStream->WriteReal(dFlatness); m_pStream->WriteReal(dFlatness);
m_pStream->WriteStr(" i\012"); m_pStream->WriteStr(" i\012");
m_pGrState->m_dFlatness = dFlatness; m_pGrState->m_dFlatness = dFlatness;
...@@ -1000,7 +1000,7 @@ namespace PdfWriter ...@@ -1000,7 +1000,7 @@ namespace PdfWriter
// Description: Устанавливаем расстояние между буквами // Description: Устанавливаем расстояние между буквами
CheckGrMode(grmode_TEXT); CheckGrMode(grmode_TEXT);
dValue = min(MAX_CHARSPACE, max(MIN_CHARSPACE, dValue)); dValue = std::min((double)MAX_CHARSPACE, std::max((double)MIN_CHARSPACE, dValue));
m_pStream->WriteReal(dValue); m_pStream->WriteReal(dValue);
m_pStream->WriteStr(" Tc\012"); m_pStream->WriteStr(" Tc\012");
} }
...@@ -1010,7 +1010,7 @@ namespace PdfWriter ...@@ -1010,7 +1010,7 @@ namespace PdfWriter
// Description: Устанавливаем горизонтальное растяжение/сжатие // Description: Устанавливаем горизонтальное растяжение/сжатие
CheckGrMode(grmode_TEXT); CheckGrMode(grmode_TEXT);
dValue = min(MAX_HORIZONTALSCALING, max(MIN_HORIZONTALSCALING, dValue)); dValue = std::min((double)MAX_HORIZONTALSCALING, std::max((double)MIN_HORIZONTALSCALING, dValue));
m_pStream->WriteReal(dValue); m_pStream->WriteReal(dValue);
m_pStream->WriteStr(" Tz\012"); m_pStream->WriteStr(" Tz\012");
} }
...@@ -1019,7 +1019,7 @@ namespace PdfWriter ...@@ -1019,7 +1019,7 @@ namespace PdfWriter
// Operator : Tf // Operator : Tf
// Description: Устанавливаем фонт и размер фонта // Description: Устанавливаем фонт и размер фонта
dSize = min(MAX_FONTSIZE, max(0, dSize)); dSize = std::min((double)MAX_FONTSIZE, std::max(0.0, dSize));
const char* sFontName = GetLocalFontName(pFont); const char* sFontName = GetLocalFontName(pFont);
if (!sFontName) if (!sFontName)
return; return;
...@@ -1369,4 +1369,4 @@ namespace PdfWriter ...@@ -1369,4 +1369,4 @@ namespace PdfWriter
m_vWords.clear(); m_vWords.clear();
m_vShifts.clear(); m_vShifts.clear();
} }
} }
\ No newline at end of file
...@@ -656,17 +656,17 @@ namespace PdfWriter ...@@ -656,17 +656,17 @@ namespace PdfWriter
unsigned int unRemainBytes = m_nBufferSize - Tell(); unsigned int unRemainBytes = m_nBufferSize - Tell();
if (unRemainBytes < unSize) if (unRemainBytes < unSize)
{ {
unsigned int unShrinkSize = max(unSize, STREAM_BUF_SIZ); unsigned int unShrinkSize = std::max(unSize, (unsigned int)STREAM_BUF_SIZ);
Shrink(unShrinkSize); Shrink(unShrinkSize);
} }
MemCpy(m_pCur, pBuffer, unSize); MemCpy(m_pCur, pBuffer, unSize);
m_pCur += unSize; m_pCur += unSize;
m_unSize = (unsigned int)max(m_unSize, m_pCur - m_pBuffer); m_unSize = (unsigned int)std::max(m_unSize, (unsigned int)(m_pCur - m_pBuffer));
} }
void CMemoryStream::Read(BYTE* pBuffer, unsigned int* punSize) void CMemoryStream::Read(BYTE* pBuffer, unsigned int* punSize)
{ {
unsigned int unRemainBytes = m_unSize - Tell(); unsigned int unRemainBytes = m_unSize - Tell();
unsigned int unReadedBytes = (punSize ? min(*punSize, unRemainBytes) : unRemainBytes); unsigned int unReadedBytes = (punSize ? std::min(*punSize, unRemainBytes) : unRemainBytes);
MemCpy(pBuffer, m_pCur, unReadedBytes); MemCpy(pBuffer, m_pCur, unReadedBytes);
m_pCur += unReadedBytes; m_pCur += unReadedBytes;
if (punSize) if (punSize)
...@@ -841,7 +841,7 @@ namespace PdfWriter ...@@ -841,7 +841,7 @@ namespace PdfWriter
switch (eMode) switch (eMode)
{ {
case SeekCur: m_nFilePos += nPos; break; case SeekCur: m_nFilePos += nPos; break;
case SeekEnd: m_nFilePos = max(0, (m_nFileSize - nPos)); break; case SeekEnd: m_nFilePos = std::max(0, (m_nFileSize - nPos)); break;
case SeekSet: m_nFilePos = nPos; break; case SeekSet: m_nFilePos = nPos; break;
} }
} }
......
...@@ -3,7 +3,20 @@ ...@@ -3,7 +3,20 @@
#include "Consts.h" #include "Consts.h"
#include "../../DesktopEditor/common/Types.h" #include "../../DesktopEditor/common/Types.h"
#ifdef max
#undef max
#endif
#ifdef min
#undef min
#endif
#include <string> #include <string>
#include <algorithm>
#ifdef __linux__
#include <string.h>
#endif
namespace PdfWriter namespace PdfWriter
{ {
...@@ -370,21 +383,21 @@ namespace PdfWriter ...@@ -370,21 +383,21 @@ namespace PdfWriter
}; };
enum EFontType enum EFontType
{ {
fontUnknownType, fontUnknownType,
//----- Gr8BitFont //----- Gr8BitFont
fontType1, fontType1,
fontType1C, fontType1C,
fontType1COT, fontType1COT,
fontType3, fontType3,
fontTrueType, fontTrueType,
fontTrueTypeOT, fontTrueTypeOT,
//----- GrCIDFont //----- GrCIDFont
fontCIDType0, fontCIDType0,
fontCIDType0C, fontCIDType0C,
fontCIDType0COT, fontCIDType0COT,
fontCIDType2, fontCIDType2,
fontCIDType2OT fontCIDType2OT
}; };
} }
#endif // _PDF_WRITER_SRC_TYPES_H #endif // _PDF_WRITER_SRC_TYPES_H
\ 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