Compare commits

..

65 Commits

Author SHA1 Message Date
4c930e716b Merge remote-tracking branch 'origin/hotfix/v5.2.3' into develop 2018-10-17 15:38:13 +03:00
595ecae254 x2t - binary - native convert locked canvas - bix bug #28246 2018-10-17 13:29:55 +03:00
d34b850c52 [ios][pe] events 2018-10-12 19:15:18 +03:00
24332cca42 [ios][x2t] fixed build 2018-10-12 12:39:04 +03:00
55e7777abb [zlib] Remove zlib-1.2.3 2018-10-10 18:46:27 +03:00
b7c8bc2769 [zlib] Update zlib to 1.2.11
Fix opening of xlsx created by NPOI(bad-zip.xlsx)
2018-10-10 18:42:45 +03:00
13900daf08 [zlib] Repeat local changes from zlib-1.2.3 2018-10-10 18:39:00 +03:00
2feb1ac8e8 Add zlib-1.2.11 2018-10-10 17:52:04 +03:00
d872f4220c Merge remote-tracking branch 'origin/hotfix/v5.2.1' into develop 2018-10-09 18:14:42 +03:00
e859821647 Merge remote-tracking branch 'origin/hotfix/v5.2.1' into develop 2018-10-09 17:02:46 +03:00
18cbd41c84 Add GetImage method to IImageCache 2018-10-08 18:16:06 +03:00
8985395ef1 [x2t] Move from mm to twips in Editor.bin 2018-10-04 17:58:29 +03:00
f4d72572c0 Merge remote-tracking branch 'origin/hotfix/v5.2.1' into develop 2018-10-04 13:04:52 +03:00
bc319bddbf Gost algorithms 2018-10-03 19:18:01 +03:00
8625e93ac5 [x2t] Rename READ2_DEF -> READ2_DEF_SPREADSHEET 2018-10-01 18:14:04 +03:00
1493e4a949 [ios][x2t] fixed build 2018-09-28 16:36:12 +03:00
85bf4b8fac Merge remote-tracking branch 'origin/hotfix/v5.2.1' into develop 2018-09-28 15:57:47 +03:00
b1b911b538 Merge remote-tracking branch 'origin/hotfix/v5.2.1' into develop 2018-09-28 14:51:13 +03:00
2192bff46b Merge remote-tracking branch 'origin/hotfix/v5.2.1' into develop 2018-09-28 14:39:43 +03:00
e4e6acd1bc [android][x2t] added doctrenderer file stub 2018-09-27 15:03:47 +03:00
7418b2327a Merge remote-tracking branch 'origin/develop' into develop 2018-09-27 14:10:28 +03:00
18d610e3e0 [android][x2t] added example of converter 2018-09-27 14:09:12 +03:00
4e81420eed [ios][x2t] fixed build 2018-09-26 16:18:50 +03:00
e26f836da7 Merge commit '69d2b12f5315e96442fc5a0620d4f4c2070c4e77' into develop 2018-09-24 18:34:51 +03:00
538e477818 Revert "[test] Define AVS_ERROR_FIRST as 0 to avoid issues with assignment and comparison uint64, int64, int32"
This reverts commit 05694d13f3.
2018-09-24 13:19:18 +03:00
b212e878c6 Merge pull request #114 from ONLYOFFICE/release/v5.2.0
Release/v5.2.0
2018-09-24 01:13:01 +03:00
05694d13f3 [test] Define AVS_ERROR_FIRST as 0 to avoid issues with assignment and comparison uint64, int64, int32 2018-09-24 01:04:14 +03:00
1dd72c99a2 Remove define GetCharWidth 2018-09-21 16:43:39 +02:00
4b73e58693 [bug] Fix missing function name 2018-09-21 17:36:32 +03:00
bee4f57dd3 [bug] Fix opening encrypted odf files 2018-09-21 17:36:32 +03:00
142f9f57a3 OdfFormatReader&Writer - refactoring converting wordarts from/to ooxml 2018-09-20 18:59:51 +03:00
28346c4571 Fix bug with squares in combobox fonts (& empty rects) 2018-09-20 14:53:10 +03:00
9810087ee1 Merge pull request #108 from ONLYOFFICE/release/v5.2.0
Release/v5.2.0
2018-09-20 14:38:32 +03:00
2b8e1456c2 . 2018-09-20 11:41:42 +03:00
49723e648a . 2018-09-19 11:29:43 +03:00
b0a2104b21 Merge commit 'de51052f6ae59ac36665fb3f85804081a888c7c5' into develop 2018-09-18 20:03:33 +03:00
e4986f4202 . 2018-09-18 19:35:06 +03:00
bd1dc5a7b6 . 2018-09-17 17:28:46 +03:00
1ccbe323f4 . 2018-09-14 19:21:12 +03:00
3811169415 Merge commit '185dc3064f731e4adb04040e116dc53110c6d866' into develop 2018-09-14 11:36:36 +03:00
2871769479 . 2018-09-14 11:34:07 +03:00
acdce1edb9 . 2018-09-12 17:53:40 +03:00
67a40a5fc4 Constructor of __ox_drawing doesn't receive parameters 2018-09-12 15:41:37 +03:00
67cd654785 OdfFormatReader - convert form controls in spreadsheets 2018-09-11 14:59:10 +03:00
3816162555 Merge commit '3fb166f99a211e85474c121009019d06710722f8' into develop 2018-09-10 18:43:15 +03:00
d8121d1a12 [ios][x2t] fixed array check 2018-09-06 19:11:47 +03:00
a76bf57051 fix bug #38817 2018-09-06 13:46:47 +03:00
97b92cf75c . 2018-09-05 18:39:32 +03:00
506de8e9e1 fix bug #38678 2018-09-05 18:38:55 +03:00
677e3e49e0 . 2018-08-31 17:38:17 +03:00
02c84d107b Merge commit 'b59908e4c25b265641e77b2167826f236b3b9d64' into develop 2018-08-31 17:27:06 +03:00
49cd76d0f3 Ooxml encrypt files - add support compatibility with Office 2003-2007(+ add rc4 method to encrtypt); add des method in agile encryption 2018-08-30 17:47:17 +03:00
26f32dd511 [ios][pe] chart events 2018-08-29 18:25:08 +03:00
395e54cf76 [ios][x2t] fixed build 2018-08-24 15:11:04 +03:00
40476e7555 [ios][x2t] use system libxml2 2018-08-24 14:59:54 +03:00
04f06c23a1 DocxFormat - extend shading pPr 2018-08-24 13:22:45 +03:00
a9a635747a [ios][x2t] fixed build 2018-08-24 12:50:05 +03:00
4027a0de25 Merge commit 'a232fcd9e1042811d624ff8934dc689f57ac2f57' into develop 2018-08-24 11:10:03 +03:00
f4fa754ce4 Merge pull request #96 from ONLYOFFICE/release/v5.2.0
Release/v5.2.0
2018-08-08 15:04:56 +02:00
7d88a91fcc up 2018-08-03 10:39:59 +03:00
069b12839f Merge commit 'c23ff4c8cd5bb2040f75a3a9845fc41d9d496216' into develop 2018-07-30 10:45:09 +03:00
aa609336ca [ios][x2t] fixed build 2018-07-23 19:48:36 +03:00
452917f213 [pe][ios] Apply timing to all 2018-07-19 11:13:28 +03:00
5b5ccdc9be [pe][ios] Events 2018-07-18 19:19:13 +03:00
adf7ca65ea [ios][pe] events 2018-07-18 16:48:45 +03:00
478 changed files with 57758 additions and 29352 deletions

View File

@ -52,6 +52,7 @@
#include <string.h>
#endif
#include "../../Common/DocxFormat/Source/Base/Types_32.h"
#include "../../DesktopEditor/common/Types.h"
#include "../../Common/DocxFormat/Source/Base/unicode_util.h"
#include "../../Common/DocxFormat/Source/Base/Types_32.h"

View File

@ -217,7 +217,7 @@ public:
private:
unsigned char* m_Data;
unsigned char* m_Data;
unsigned long m_Size;
unsigned long m_Position;
bool bMemoryCopy;

View File

@ -42,15 +42,15 @@ class SectPr
{
public:
std::wstring sHeaderFooterReference;
double W;
double H;
long W;
long H;
BYTE cOrientation;
double Left;
double Top;
double Right;
double Bottom;
double Header;
double Footer;
long Left;
long Top;
long Right;
long Bottom;
long Header;
long Footer;
bool TitlePg;
bool EvenAndOddHeaders;
BYTE SectionType;
@ -61,6 +61,13 @@ public:
std::wstring footnotePr;
std::wstring endnotePr;
bool bW;
bool bH;
bool bOrientation;
bool bLeft;
bool bTop;
bool bRight;
bool bBottom;
bool bHeader;
bool bFooter;
bool bTitlePg;
@ -69,18 +76,16 @@ public:
bool bPageNumStart;
SectPr()
{
W = Page_Width;
H = Page_Height;
cOrientation = orientation_Portrait;
Left = 30;
Top = 20;
Right = 15;
Bottom = 20;
Header = 12.5;
Footer = 12.5;
sHeaderFooterReference = _T("");
cols = _T("<w:cols w:space=\"708\"/>");
bW = false;
bH = false;
bOrientation = false;
bLeft = false;
bTop = false;
bRight = false;
bBottom = false;
bHeader = false;
bFooter = false;
bTitlePg = false;
@ -91,14 +96,6 @@ public:
std::wstring Write()
{
std::wstring sRes = _T("");
long nWidth = SerializeCommon::Round(W * g_dKoef_mm_to_twips);
long nHeight = SerializeCommon::Round(H * g_dKoef_mm_to_twips);
long nMLeft = SerializeCommon::Round(Left * g_dKoef_mm_to_twips);
long nMTop = SerializeCommon::Round(Top * g_dKoef_mm_to_twips);
long nMRight = SerializeCommon::Round(Right * g_dKoef_mm_to_twips);
long nMBottom = SerializeCommon::Round(Bottom * g_dKoef_mm_to_twips);
long nMHeader = SerializeCommon::Round(Header * g_dKoef_mm_to_twips);
long nMFooter = SerializeCommon::Round(Footer * g_dKoef_mm_to_twips);
if(!sHeaderFooterReference.empty())
sRes += sHeaderFooterReference;
@ -120,19 +117,41 @@ public:
}
sRes += L"<w:type w:val=\"" + sType + L"\"/>";
}
sRes += L"<w:pgSz w:w=\"" + std::to_wstring(nWidth) + L"\" w:h=\"" + std::to_wstring(nHeight) + L"\"";
if(orientation_Portrait != cOrientation)
sRes += L" w:orient=\"landscape\"";
sRes += L"/>";
if((bW && bH) || bOrientation)
{
sRes += L"<w:pgSz";
if(bW && bH)
{
sRes += L" w:w=\"" + std::to_wstring(W) + L"\" w:h=\"" + std::to_wstring(H) + L"\"";
}
if(bOrientation)
{
if(orientation_Portrait != cOrientation)
sRes += L" w:orient=\"landscape\"";
else
sRes += L" w:orient=\"portrait\"";
}
sRes += L"<w:pgMar w:top=\"" + std::to_wstring(nMTop) + L"\" w:right=\"" + std::to_wstring(nMRight) +
L"\" w:bottom=\"" + std::to_wstring(nMBottom) + L"\" w:left=\"" + std::to_wstring(nMLeft) + L"\" w:gutter=\"0\"";
sRes += L"/>";
}
if(bHeader)
sRes += L" w:header=\"" + std::to_wstring(nMHeader) + L"\"";
if(bFooter)
sRes += L" w:footer=\"" + std::to_wstring(nMFooter) + L"\"";
sRes += L"/>";
if(bLeft || bTop || bRight || bBottom || bHeader || bFooter)
{
sRes += L"<w:pgMar";
if(bTop)
sRes += L" w:top=\"" + std::to_wstring(Top) + L"\"";
if(bRight)
sRes += L" w:right=\"" + std::to_wstring(Right) + L"\"";
if(bBottom)
sRes += L" w:bottom=\"" + std::to_wstring(Bottom) + L"\"";
if(bLeft)
sRes += L" w:left=\"" + std::to_wstring(Left) + L"\"";
if(bHeader)
sRes += L" w:header=\"" + std::to_wstring(Header) + L"\"";
if(bFooter)
sRes += L" w:footer=\"" + std::to_wstring(Footer) + L"\"";
sRes += L" w:gutter=\"0\"/>";
}
if(!pgBorders.empty())
sRes += pgBorders;
@ -245,6 +264,7 @@ class Spacing
public:
bool bLineRule;
bool bLine;
bool bLineTwips;
bool bAfter;
bool bBefore;
bool bAfterAuto;
@ -252,14 +272,16 @@ public:
BYTE LineRule;
double Line;
double After;
double Before;
long LineTwips;
long After;
long Before;
bool AfterAuto;
bool BeforeAuto;
Spacing()
{
bLineRule = false;
bLine = false;
bLineTwips = false;
bAfter = false;
bBefore = false;
bAfterAuto = false;
@ -335,10 +357,48 @@ public:
sShd += L"<w:shd";
if(bValue)
{
if(shd_Nil == Value)
sShd += L" w:val=\"nil\"";
else
sShd += L" w:val=\"clear\"";
switch(Value)
{
case SimpleTypes::shdClear : sShd += L" w:val=\"clear\""; break;
case SimpleTypes::shdDiagCross : sShd += L" w:val=\"diagCross\""; break;
case SimpleTypes::shdDiagStripe : sShd += L" w:val=\"diagStripe\""; break;
case SimpleTypes::shdHorzCross : sShd += L" w:val=\"horzCross\""; break;
case SimpleTypes::shdHorzStripe : sShd += L" w:val=\"horzStripe\""; break;
case SimpleTypes::shdNil : sShd += L" w:val=\"nil\""; break;
case SimpleTypes::shdPct10 : sShd += L" w:val=\"pct10\""; break;
case SimpleTypes::shdPct12 : sShd += L" w:val=\"pct12\""; break;
case SimpleTypes::shdPct15 : sShd += L" w:val=\"pct15\""; break;
case SimpleTypes::shdPct20 : sShd += L" w:val=\"pct20\""; break;
case SimpleTypes::shdPct25 : sShd += L" w:val=\"pct25\""; break;
case SimpleTypes::shdPct30 : sShd += L" w:val=\"pct30\""; break;
case SimpleTypes::shdPct35 : sShd += L" w:val=\"pct35\""; break;
case SimpleTypes::shdPct37 : sShd += L" w:val=\"pct37\""; break;
case SimpleTypes::shdPct40 : sShd += L" w:val=\"pct40\""; break;
case SimpleTypes::shdPct45 : sShd += L" w:val=\"pct45\""; break;
case SimpleTypes::shdPct5 : sShd += L" w:val=\"pct5\""; break;
case SimpleTypes::shdPct50 : sShd += L" w:val=\"pct50\""; break;
case SimpleTypes::shdPct55 : sShd += L" w:val=\"pct55\""; break;
case SimpleTypes::shdPct60 : sShd += L" w:val=\"pct60\""; break;
case SimpleTypes::shdPct62 : sShd += L" w:val=\"pct62\""; break;
case SimpleTypes::shdPct65 : sShd += L" w:val=\"pct65\""; break;
case SimpleTypes::shdPct70 : sShd += L" w:val=\"pct70\""; break;
case SimpleTypes::shdPct75 : sShd += L" w:val=\"pct75\""; break;
case SimpleTypes::shdPct80 : sShd += L" w:val=\"pct80\""; break;
case SimpleTypes::shdPct85 : sShd += L" w:val=\"pct85\""; break;
case SimpleTypes::shdPct87 : sShd += L" w:val=\"pct87\""; break;
case SimpleTypes::shdPct90 : sShd += L" w:val=\"pct90\""; break;
case SimpleTypes::shdPct95 : sShd += L" w:val=\"pct95\""; break;
case SimpleTypes::shdReverseDiagStripe : sShd += L" w:val=\"reverseDiagStripe\""; break;
case SimpleTypes::shdSolid : sShd += L" w:val=\"solid\""; break;
case SimpleTypes::shdThinDiagCross : sShd += L" w:val=\"thinDiagCross\""; break;
case SimpleTypes::shdThinDiagStripe : sShd += L" w:val=\"thinDiagStripe\""; break;
case SimpleTypes::shdThinHorzCross : sShd += L" w:val=\"thinHorzCross\""; break;
case SimpleTypes::shdThinHorzStripe : sShd += L" w:val=\"thinHorzStripe\""; break;
case SimpleTypes::shdThinReverseDiagStripe : sShd += L" w:val=\"thinReverseDiagStripe\""; break;
case SimpleTypes::shdThinVertStripe : sShd += L" w:val=\"thinVertStripe\""; break;
case SimpleTypes::shdVertStripe : sShd += L" w:val=\"vertStripe\""; break;
default : sShd += L" w:val=\"solid\""; break;
}
}
sShd += L" w:color=\"auto\"";
if(bColor)
@ -363,7 +423,7 @@ class Tab
{
public:
BYTE Val;
double Pos;
long Pos;
BYTE Leader;
bool bLeader;
Tab()
@ -397,11 +457,11 @@ public:
docRGB HighLight;
std::wstring Shd;
std::wstring RStyle;
double Spacing;
long Spacing;
bool DStrikeout;
bool Caps;
bool SmallCaps;
double Position;
long Position;
BYTE FontHint;
bool BoldCs;
bool ItalicCs;
@ -642,13 +702,11 @@ public:
}
if(bSpacing)
{
long nSpacing = SerializeCommon::Round( g_dKoef_mm_to_twips * Spacing);
pCStringWriter->WriteString(L"<w:spacing w:val=\"" + std::to_wstring(nSpacing) + L"\"/>");
pCStringWriter->WriteString(L"<w:spacing w:val=\"" + std::to_wstring(Spacing) + L"\"/>");
}
if(bPosition)
{
long nPosition = SerializeCommon::Round( g_dKoef_mm_to_hps * Position);
std::wstring sPosition = L"<w:position w:val=\"" + std::to_wstring(nPosition) + L"\"/>";
std::wstring sPosition = L"<w:position w:val=\"" + std::to_wstring(Position) + L"\"/>";
pCStringWriter->WriteString(sPosition);
}
if(bFontSize)
@ -1001,6 +1059,26 @@ public:
};
class PaddingsToWrite
{
public:
long Left;
long Top;
long Right;
long Bottom;
bool bLeft;
bool bTop;
bool bRight;
bool bBottom;
public: PaddingsToWrite()
{
bLeft = false;
bTop = false;
bRight = false;
bBottom = false;
}
};
class PaddingsToWriteMM
{
public:
double Left;
double Top;
@ -1011,7 +1089,7 @@ public:
bool bTop;
bool bRight;
bool bBottom;
public: PaddingsToWrite()
public: PaddingsToWriteMM()
{
bLeft = false;
bTop = false;
@ -1028,7 +1106,7 @@ public:
double Y;
double Width;
double Height;
PaddingsToWrite Paddings;
PaddingsToWriteMM Paddings;
int m_nDocPr;
bool bMediaId;
@ -1167,8 +1245,8 @@ class docBorder
{
public:
docRGB Color;
double Space;
double Size;
long Space;
long Size;
BYTE Value;
CThemeColor ThemeColor;
@ -1201,13 +1279,11 @@ public:
}
if(bSize)
{
long nSize = SerializeCommon::Round(g_dKoef_mm_to_eightpoint * Size);
pCStringWriter->WriteString(L" w:sz=\"" + std::to_wstring(nSize) + L"\"");
pCStringWriter->WriteString(L" w:sz=\"" + std::to_wstring(Size) + L"\"");
}
if(bSpace)
{
long nSpace = SerializeCommon::Round(g_dKoef_mm_to_pt * Space);
pCStringWriter->WriteString(L" w:space=\"" + std::to_wstring(nSpace) + L"\"");
pCStringWriter->WriteString(L" w:space=\"" + std::to_wstring(Space) + L"\"");
}
if(bThemeColor && ThemeColor.IsNoEmpty())
{
@ -2074,8 +2150,8 @@ public:
class CDrawingPropertyWrapPoint
{
public:
double X;
double Y;
__int64 X;
__int64 Y;
bool bX;
bool bY;
@ -2122,29 +2198,29 @@ public:
long DataLength;
BYTE Type;
bool BehindDoc;
double DistL;
double DistT;
double DistR;
double DistB;
__int64 DistL;
__int64 DistT;
__int64 DistR;
__int64 DistB;
bool LayoutInCell;
unsigned long RelativeHeight;
bool BSimplePos;
double EffectExtentL;
double EffectExtentT;
double EffectExtentR;
double EffectExtentB;
double Width;
double Height;
__int64 EffectExtentL;
__int64 EffectExtentT;
__int64 EffectExtentR;
__int64 EffectExtentB;
__int64 Width;
__int64 Height;
BYTE PositionHRelativeFrom;
BYTE PositionHAlign;
double PositionHPosOffset;
double PositionHPctOffset;
__int64 PositionHPosOffset;
double PositionHPctOffset;
BYTE PositionVRelativeFrom;
BYTE PositionVAlign;
double PositionVPosOffset;
__int64 PositionVPosOffset;
double PositionVPctOffset;
double SimplePosX;
double SimplePosY;
__int64 SimplePosX;
__int64 SimplePosY;
std::wstring sChartRels;
std::wstring sSizeRelH;
std::wstring sSizeRelV;
@ -2234,24 +2310,17 @@ public:
{
if(bWidth && bHeight)
{
__int64 emuWidth = (__int64)(g_dKoef_mm_to_emu * Width);
__int64 emuHeight = (__int64)(g_dKoef_mm_to_emu * Height);
if(false == bChart)
sXml += L"<wp:inline xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" \
distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\"><wp:extent cx=\"" + std::to_wstring(emuWidth) + L"\" cy=\"" + std::to_wstring(emuHeight) + L"\"/>";
distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\"><wp:extent cx=\"" + std::to_wstring(Width) + L"\" cy=\"" + std::to_wstring(Height) + L"\"/>";
else
sXml += L"<w:drawing><wp:inline distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\">\
<wp:extent cx=\"" + std::to_wstring(emuWidth) + L"\" cy=\"" + std::to_wstring(emuHeight) + L"\"/>";
<wp:extent cx=\"" + std::to_wstring(Width) + L"\" cy=\"" + std::to_wstring(Height) + L"\"/>";
if(bEffectExtentL && bEffectExtentT && bEffectExtentR && bEffectExtentB)
{
__int64 emuEffectExtentL = (__int64)(g_dKoef_mm_to_emu * EffectExtentL);
__int64 emuEffectExtentT = (__int64)(g_dKoef_mm_to_emu * EffectExtentT);
__int64 emuEffectExtentR = (__int64)(g_dKoef_mm_to_emu * EffectExtentR);
__int64 emuEffectExtentB = (__int64)(g_dKoef_mm_to_emu * EffectExtentB);
sXml += L"<wp:effectExtent l=\"" + std::to_wstring(emuEffectExtentL) + L"\" t=\"" + std::to_wstring(emuEffectExtentT) +
L"\" r=\"" + std::to_wstring(emuEffectExtentR) + L"\" b=\"" + std::to_wstring(emuEffectExtentB) + L"\"/>";
sXml += L"<wp:effectExtent l=\"" + std::to_wstring(EffectExtentL) + L"\" t=\"" + std::to_wstring(EffectExtentT) +
L"\" r=\"" + std::to_wstring(EffectExtentR) + L"\" b=\"" + std::to_wstring(EffectExtentB) + L"\"/>";
}
if(!sDocPr.empty())
@ -2293,13 +2362,13 @@ distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\"><wp:extent cx=\"" + std::to_wstr
__int64 emuDistB = 0;
if(bDistL)
emuDistL = (__int64)(g_dKoef_mm_to_emu * DistL);
emuDistL = DistL;
if(bDistT)
emuDistT = (__int64)(g_dKoef_mm_to_emu * DistT);
emuDistT = DistT;
if(bDistR)
emuDistR = (__int64)(g_dKoef_mm_to_emu * DistR);
emuDistR = DistR;
if(bDistB)
emuDistB = (__int64)(g_dKoef_mm_to_emu * DistB);
emuDistB = DistB;
int nSimplePos = 0;
if(bBSimplePos && BSimplePos)
nSimplePos = 1;
@ -2328,10 +2397,10 @@ distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\"><wp:extent cx=\"" + std::to_wstr
__int64 emuX = 0;
if(bSimplePosX)
emuX = (__int64)(g_dKoef_mm_to_emu * SimplePosX);
emuX = SimplePosX;
__int64 emuY = 0;
if(bSimplePosY)
emuY = (__int64)(g_dKoef_mm_to_emu * SimplePosY);
emuY = SimplePosY;
sXml += L"<wp:simplePos x=\"" + std::to_wstring(emuX) + L"\" y=\"" + std::to_wstring(emuY) + L"\"/>";
if(bPositionHRelativeFrom && (bPositionHAlign || bPositionHPosOffset || bPositionHPctOffset))
@ -2362,8 +2431,7 @@ distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\"><wp:extent cx=\"" + std::to_wstr
}
else if(bPositionHPosOffset)
{
__int64 emuPosOffset = (__int64)(g_dKoef_mm_to_emu * PositionHPosOffset);
sContent = L"<wp:posOffset>" + std::to_wstring(emuPosOffset) + L"</wp:posOffset>";
sContent = L"<wp:posOffset>" + std::to_wstring(PositionHPosOffset) + L"</wp:posOffset>";
}
else if(bPositionHPctOffset)
{
@ -2400,8 +2468,7 @@ distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\"><wp:extent cx=\"" + std::to_wstr
}
else if(bPositionVPosOffset)
{
__int64 emuPosOffset = (__int64)(g_dKoef_mm_to_emu * PositionVPosOffset);
sContent = L"<wp:posOffset>" + std::to_wstring(emuPosOffset) + L"</wp:posOffset>";
sContent = L"<wp:posOffset>" + std::to_wstring(PositionVPosOffset) + L"</wp:posOffset>";
}
else if(bPositionVPctOffset)
{
@ -2410,20 +2477,13 @@ distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\"><wp:extent cx=\"" + std::to_wstr
}
sXml += L"<wp:positionV relativeFrom=\"" + sRelativeFrom + L"\">" + sContent + L"</wp:positionV>";
}
__int64 emuWidth = (__int64)(g_dKoef_mm_to_emu * Width);
__int64 emuHeight = (__int64)(g_dKoef_mm_to_emu * Height);
sXml += L"<wp:extent cx=\"" + std::to_wstring(emuWidth) + L"\" cy=\"" + std::to_wstring(emuHeight)+ L"\"/>";
sXml += L"<wp:extent cx=\"" + std::to_wstring(Width) + L"\" cy=\"" + std::to_wstring(Height)+ L"\"/>";
if(bEffectExtentL && bEffectExtentT && bEffectExtentR && bEffectExtentB)
{
__int64 emuEffectExtentL = (__int64)(g_dKoef_mm_to_emu * EffectExtentL);
__int64 emuEffectExtentT = (__int64)(g_dKoef_mm_to_emu * EffectExtentT);
__int64 emuEffectExtentR = (__int64)(g_dKoef_mm_to_emu * EffectExtentR);
__int64 emuEffectExtentB = (__int64)(g_dKoef_mm_to_emu * EffectExtentB);
sXml += L"<wp:effectExtent l=\"" + std::to_wstring(emuEffectExtentL) +
L"\" t=\"" + std::to_wstring(emuEffectExtentT) + L"\" r=\"" + std::to_wstring(emuEffectExtentR) +
L"\" b=\"" + std::to_wstring(emuEffectExtentB) + L"\"/>";
sXml += L"<wp:effectExtent l=\"" + std::to_wstring(EffectExtentL) +
L"\" t=\"" + std::to_wstring(EffectExtentT) + L"\" r=\"" + std::to_wstring(EffectExtentR) +
L"\" b=\"" + std::to_wstring(EffectExtentB) + L"\"/>";
}
if(bDrawingPropertyWrap && DrawingPropertyWrap.bWrappingType)
{
@ -2454,9 +2514,7 @@ distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\"><wp:extent cx=\"" + std::to_wstr
if(DrawingPropertyWrap.bStart && DrawingPropertyWrap.Start.bX && DrawingPropertyWrap.Start.bY)
{
__int64 emuX = (__int64)(g_dKoef_mm_to_emu * DrawingPropertyWrap.Start.X);
__int64 emuY = (__int64)(g_dKoef_mm_to_emu * DrawingPropertyWrap.Start.Y);
sXml += L"<wp:start x=\"" + std::to_wstring(emuX) + L"\" y=\"" + std::to_wstring(emuY) + L"\"/>";
sXml += L"<wp:start x=\"" + std::to_wstring(DrawingPropertyWrap.Start.X) + L"\" y=\"" + std::to_wstring(DrawingPropertyWrap.Start.Y) + L"\"/>";
}
for(size_t i = 0; i < DrawingPropertyWrap.Points.size(); ++i)
@ -2464,9 +2522,7 @@ distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\"><wp:extent cx=\"" + std::to_wstr
CDrawingPropertyWrapPoint* pWrapPoint = DrawingPropertyWrap.Points[i];
if(pWrapPoint->bX && pWrapPoint->bY)
{
__int64 emuX = (__int64)(g_dKoef_mm_to_emu * pWrapPoint->X);
__int64 emuY = (__int64)(g_dKoef_mm_to_emu * pWrapPoint->Y);
sXml += L"<wp:lineTo x=\"" + std::to_wstring(emuX) + L"\" y=\"" + std::to_wstring(emuY) + L"\"/>";
sXml += L"<wp:lineTo x=\"" + std::to_wstring(pWrapPoint->X) + L"\" y=\"" + std::to_wstring(pWrapPoint->Y) + L"\"/>";
}
}
sXml += L"</wp:wrapPolygon>";

View File

@ -455,7 +455,13 @@ public:
case c_oSerProp_rPrType::Spacing:
{
orPr->bSpacing = true;
orPr->Spacing = m_oBufferedStream.GetDouble();
orPr->Spacing = SerializeCommon::Round( g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble());
}
break;
case c_oSerProp_rPrType::SpacingTwips:
{
orPr->bSpacing = true;
orPr->Spacing = m_oBufferedStream.GetLong();
}
break;
case c_oSerProp_rPrType::DStrikeout:
@ -479,7 +485,13 @@ public:
case c_oSerProp_rPrType::Position:
{
orPr->bPosition = true;
orPr->Position = m_oBufferedStream.GetDouble();
orPr->Position = SerializeCommon::Round( g_dKoef_mm_to_hps * m_oBufferedStream.GetDouble());
}
break;
case c_oSerProp_rPrType::PositionHps:
{
orPr->bPosition = true;
orPr->Position = m_oBufferedStream.GetLong();
}
break;
case c_oSerProp_rPrType::FontHint:
@ -723,12 +735,12 @@ public:
{
Spacing oSpacing;
READ2_DEF(length, res, this->ReadSpacing, &oSpacing);
if(oSpacing.bLine || oSpacing.bAfter || oSpacing.bAfterAuto || oSpacing.bBefore || oSpacing.bBeforeAuto)
if(oSpacing.bLine || oSpacing.bLineTwips || oSpacing.bAfter || oSpacing.bAfterAuto || oSpacing.bBefore || oSpacing.bBeforeAuto)
{
pCStringWriter->WriteString(std::wstring(L"<w:spacing"));
BYTE bLineRule = linerule_Auto;
//проверяется bLine, а не bLineRule чтобы всегда писать LineRule, если есть w:line
if(oSpacing.bLine)
if(oSpacing.bLine || oSpacing.bLineTwips)
{
if(oSpacing.bLineRule)
bLineRule = oSpacing.LineRule;
@ -756,10 +768,13 @@ public:
}
pCStringWriter->WriteString(sLine);
}
else if(oSpacing.bLineTwips)
{
pCStringWriter->WriteString(L" w:line=\"" + std::to_wstring(oSpacing.LineTwips) + L"\"");
}
if(oSpacing.bAfter)
{
long After = SerializeCommon::Round( g_dKoef_mm_to_twips * oSpacing.After);
std::wstring sAfter = L" w:after=\"" + std::to_wstring(After) + L"\"";
std::wstring sAfter = L" w:after=\"" + std::to_wstring(oSpacing.After) + L"\"";
pCStringWriter->WriteString(sAfter);
}
if(oSpacing.bAfterAuto)
@ -771,8 +786,7 @@ public:
}
if(oSpacing.bBefore)
{
long Before = SerializeCommon::Round( g_dKoef_mm_to_twips * oSpacing.Before);
std::wstring sBefore = L" w:before=\"" + std::to_wstring(Before) + L"\"";
std::wstring sBefore = L" w:before=\"" + std::to_wstring(oSpacing.Before) + L"\"";
pCStringWriter->WriteString(sBefore);
}
if(oSpacing.bBeforeAuto)
@ -816,7 +830,6 @@ public:
for(size_t i = 0; i < nLen; ++i)
{
Tab& oTab = oTabs.m_aTabs[i];
long nTab = SerializeCommon::Round( g_dKoef_mm_to_twips * oTab.Pos);
std::wstring sVal;
switch(oTab.Val)
{
@ -825,7 +838,7 @@ public:
case g_tabtype_clear: sVal = L"clear"; break;
default: sVal = L"left"; break;
}
pCStringWriter->WriteString(L"<w:tab w:val=\"" + sVal + L"\" w:pos=\"" + std::to_wstring(nTab) + L"\"");
pCStringWriter->WriteString(L"<w:tab w:val=\"" + sVal + L"\" w:pos=\"" + std::to_wstring(oTab.Pos) + L"\"");
if (oTab.bLeader)
{
std::wstring sLeader;
@ -937,6 +950,11 @@ public:
pCStringWriter->WriteString(L" w:left=\"" + std::to_wstring(nIndLeft) + L"\"");
break;
}
case c_oSerProp_pPrType::Ind_LeftTwips:
{
pCStringWriter->WriteString(L" w:left=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"");
break;
}
case c_oSerProp_pPrType::Ind_Right:
{
double dIndRight = m_oBufferedStream.GetDouble();
@ -945,18 +963,34 @@ public:
pCStringWriter->WriteString(L" w:right=\"" + std::to_wstring(nIndRight) + L"\"");
break;
}
case c_oSerProp_pPrType::Ind_RightTwips:
{
pCStringWriter->WriteString(L" w:right=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"");
break;
}
case c_oSerProp_pPrType::Ind_FirstLine:
{
double dIndFirstLine = m_oBufferedStream.GetDouble();
long nIndFirstLine = SerializeCommon::Round(dIndFirstLine * g_dKoef_mm_to_twips);
std::wstring sIndFirstLine;
if(nIndFirstLine > 0)
if(nIndFirstLine >= 0)
sIndFirstLine = L" w:firstLine =\"" + std::to_wstring(nIndFirstLine) + L"\"";
else
sIndFirstLine = L" w:hanging=\"" + std::to_wstring(-nIndFirstLine) + L"\"";
pCStringWriter->WriteString(sIndFirstLine);
break;
}
case c_oSerProp_pPrType::Ind_FirstLineTwips:
{
long nIndFirstLine = m_oBufferedStream.GetLong();
std::wstring sIndFirstLine;
if(nIndFirstLine >= 0)
sIndFirstLine = L" w:firstLine =\"" + std::to_wstring(nIndFirstLine) + L"\"";
else
sIndFirstLine = L" w:hanging=\"" + std::to_wstring(-nIndFirstLine) + L"\"";
pCStringWriter->WriteString(sIndFirstLine);
break;
}
default:
res = c_oSerConstants::ReadUnknown;
break;
@ -973,17 +1007,29 @@ public:
pSpacing->bLine = true;
pSpacing->Line = m_oBufferedStream.GetDouble();
break;
case c_oSerProp_pPrType::Spacing_LineTwips:
pSpacing->bLineTwips = true;
pSpacing->LineTwips = m_oBufferedStream.GetLong();
break;
case c_oSerProp_pPrType::Spacing_LineRule:
pSpacing->bLineRule = true;
pSpacing->LineRule = m_oBufferedStream.GetUChar();
break;
case c_oSerProp_pPrType::Spacing_Before:
pSpacing->bBefore = true;
pSpacing->Before = m_oBufferedStream.GetDouble();
pSpacing->Before = SerializeCommon::Round( g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble());
break;
case c_oSerProp_pPrType::Spacing_BeforeTwips:
pSpacing->bBefore = true;
pSpacing->Before = m_oBufferedStream.GetLong();
break;
case c_oSerProp_pPrType::Spacing_After:
pSpacing->bAfter = true;
pSpacing->After = m_oBufferedStream.GetDouble();
pSpacing->After = SerializeCommon::Round( g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble());
break;
case c_oSerProp_pPrType::Spacing_AfterTwips:
pSpacing->bAfter = true;
pSpacing->After = m_oBufferedStream.GetLong();
break;
case c_oSerProp_pPrType::Spacing_BeforeAuto:
pSpacing->bBeforeAuto = true;
@ -1020,7 +1066,9 @@ public:
if(c_oSerProp_pPrType::Tab_Item_Val == type)
poTabItem->Val = m_oBufferedStream.GetUChar();
else if(c_oSerProp_pPrType::Tab_Item_Pos == type)
poTabItem->Pos = m_oBufferedStream.GetDouble();
poTabItem->Pos = SerializeCommon::Round( g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble());
else if(c_oSerProp_pPrType::Tab_Item_PosTwips == type)
poTabItem->Pos = m_oBufferedStream.GetLong();
else if(c_oSerProp_pPrType::Tab_Item_Leader == type)
{
poTabItem->bLeader = true;
@ -1113,12 +1161,22 @@ public:
else if( c_oSerBorderType::Space == type )
{
odocBorder->bSpace = true;
odocBorder->Space = m_oBufferedStream.GetDouble();
odocBorder->Space = SerializeCommon::Round(g_dKoef_mm_to_pt * m_oBufferedStream.GetDouble());
}
else if( c_oSerBorderType::SpacePoint == type )
{
odocBorder->bSpace = true;
odocBorder->Space = m_oBufferedStream.GetLong();
}
else if( c_oSerBorderType::Size == type )
{
odocBorder->bSize = true;
odocBorder->Size = m_oBufferedStream.GetDouble();
odocBorder->Size = SerializeCommon::Round(g_dKoef_mm_to_eightpoint * m_oBufferedStream.GetDouble());
}
else if( c_oSerBorderType::Size8Point == type )
{
odocBorder->bSize = true;
odocBorder->Size = m_oBufferedStream.GetLong();
}
else if( c_oSerBorderType::Value == type )
{
@ -1374,15 +1432,28 @@ public:
int res = c_oSerConstants::ReadOk;
if( c_oSer_pgSzType::Orientation == type )
{
pSectPr->bOrientation = true;
pSectPr->cOrientation = m_oBufferedStream.GetUChar();
}
else if( c_oSer_pgSzType::W == type )
{
pSectPr->W = m_oBufferedStream.GetDouble();
pSectPr->bW = true;
pSectPr->W = SerializeCommon::Round(g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble());
}
else if( c_oSer_pgSzType::WTwips == type )
{
pSectPr->bW = true;
pSectPr->W = m_oBufferedStream.GetLong();
}
else if( c_oSer_pgSzType::H == type )
{
pSectPr->H = m_oBufferedStream.GetDouble();
pSectPr->bH = true;
pSectPr->H = SerializeCommon::Round(g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble());
}
else if( c_oSer_pgSzType::HTwips == type )
{
pSectPr->bH = true;
pSectPr->H = m_oBufferedStream.GetLong();
}
else
res = c_oSerConstants::ReadUnknown;
@ -1394,29 +1465,63 @@ public:
int res = c_oSerConstants::ReadOk;
if( c_oSer_pgMarType::Left == type )
{
pSectPr->Left = m_oBufferedStream.GetDouble();
pSectPr->bLeft = true;
pSectPr->Left = SerializeCommon::Round(g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble());
}
else if( c_oSer_pgMarType::LeftTwips == type )
{
pSectPr->bLeft = true;
pSectPr->Left = m_oBufferedStream.GetLong();
}
else if( c_oSer_pgMarType::Top == type )
{
pSectPr->Top = m_oBufferedStream.GetDouble();
pSectPr->bTop = true;
pSectPr->Top = SerializeCommon::Round(g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble());
}
else if( c_oSer_pgMarType::TopTwips == type )
{
pSectPr->bTop = true;
pSectPr->Top = m_oBufferedStream.GetLong();
}
else if( c_oSer_pgMarType::Right == type )
{
pSectPr->Right = m_oBufferedStream.GetDouble();
pSectPr->bRight = true;
pSectPr->Right = SerializeCommon::Round(g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble());
}
else if( c_oSer_pgMarType::RightTwips == type )
{
pSectPr->bRight = true;
pSectPr->Right = m_oBufferedStream.GetLong();
}
else if( c_oSer_pgMarType::Bottom == type )
{
pSectPr->Bottom = m_oBufferedStream.GetDouble();
pSectPr->bBottom = true;
pSectPr->Bottom = SerializeCommon::Round(g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble());
}
else if( c_oSer_pgMarType::BottomTwips == type )
{
pSectPr->bBottom = true;
pSectPr->Bottom = m_oBufferedStream.GetLong();
}
else if( c_oSer_pgMarType::Header == type )
{
pSectPr->bHeader = true;
pSectPr->Header = m_oBufferedStream.GetDouble();
pSectPr->Header = SerializeCommon::Round(g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble());
}
else if( c_oSer_pgMarType::HeaderTwips == type )
{
pSectPr->bHeader = true;
pSectPr->Header = m_oBufferedStream.GetLong();
}
else if( c_oSer_pgMarType::Footer == type )
{
pSectPr->bFooter = true;
pSectPr->Footer = m_oBufferedStream.GetDouble();
pSectPr->Footer = SerializeCommon::Round(g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble());
}
else if( c_oSer_pgMarType::FooterTwips == type )
{
pSectPr->bFooter = true;
pSectPr->Footer = m_oBufferedStream.GetLong();
}
else
res = c_oSerConstants::ReadUnknown;
@ -1716,6 +1821,10 @@ public:
long nInd = SerializeCommon::Round( g_dKoef_mm_to_twips * dInd);
pWiterTblPr->TableInd = L"<w:tblInd w:w=\"" + std::to_wstring(nInd) + L"\" w:type=\"dxa\"/>";
}
else if( c_oSerProp_tblPrType::TableIndTwips == type )
{
pWiterTblPr->TableInd = L"<w:tblInd w:w=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\" w:type=\"dxa\"/>";
}
else if( c_oSerProp_tblPrType::TableW == type )
{
docW odocW;
@ -1815,6 +1924,10 @@ public:
long nSpacing = SerializeCommon::Round( g_dKoef_mm_to_twips * dSpacing);
pWiterTblPr->TableCellSpacing = L"<w:tblCellSpacing w:w=\"" + std::to_wstring(nSpacing) + L"\" w:type=\"dxa\"/>";
}
else if( c_oSerProp_tblPrType::TableCellSpacingTwips == type )
{
pWiterTblPr->TableCellSpacing = L"<w:tblCellSpacing w:w=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\" w:type=\"dxa\"/>";
}
else if( c_oSerProp_tblPrType::tblCaption == type )
{
pWiterTblPr->Caption = m_oBufferedStream.GetString3(length);
@ -1959,6 +2072,10 @@ public:
pCStringWriter->WriteString(L" w:tblpX=\"" + std::to_wstring(nX) + L"\"");
}
else if( c_oSer_tblpPrType2::TblpXTwips == type )
{
pCStringWriter->WriteString(L" w:tblpX=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"");
}
else if( c_oSer_tblpPrType2::TblpXSpec == type )
{
std::wstring sXml;
@ -1992,6 +2109,10 @@ public:
pCStringWriter->WriteString(L" w:tblpY=\"" + std::to_wstring(nY) + L"\"");
}
else if( c_oSer_tblpPrType2::TblpYTwips == type )
{
pCStringWriter->WriteString(L" w:tblpY=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"");
}
else if( c_oSer_tblpPrType2::TblpYSpec == type )
{
std::wstring sXml;
@ -2087,6 +2208,10 @@ public:
pCStringWriter->WriteString(L"<w:tblCellSpacing w:w=\"" + std::to_wstring(nSpacing) + L"\" w:type=\"dxa\"/>");
}
else if( c_oSerProp_rowPrType::TableCellSpacingTwips == type )
{
pCStringWriter->WriteString(L"<w:tblCellSpacing w:w=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\" w:type=\"dxa\"/>");
}
else if( c_oSerProp_rowPrType::Height == type )
{
RowHeight val;
@ -2180,6 +2305,10 @@ public:
double dHeight = m_oBufferedStream.GetDouble();
pHeight->nHeight = SerializeCommon::Round( g_dKoef_mm_to_twips * dHeight);
}
else if( c_oSerProp_rowPrType::Height_ValueTwips == type )
{
pHeight->nHeight = m_oBufferedStream.GetLong();
}
else
res = c_oSerConstants::ReadUnknown;
return res;
@ -2358,6 +2487,10 @@ public:
pCStringWriter->WriteString(L" w:leftFromText=\"" + std::to_wstring(nLeft) + L"\"");
}
else if (c_oSerPaddingType::leftTwips == type)
{
pCStringWriter->WriteString(L" w:leftFromText=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"");
}
else if (c_oSerPaddingType::top == type)
{
double dTop = m_oBufferedStream.GetDouble();
@ -2365,6 +2498,10 @@ public:
pCStringWriter->WriteString(L" w:topFromText=\"" + std::to_wstring(nTop) + L"\"");
}
else if (c_oSerPaddingType::topTwips == type)
{
pCStringWriter->WriteString(L" w:topFromText=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"");
}
else if (c_oSerPaddingType::right == type)
{
double dRight = m_oBufferedStream.GetDouble();
@ -2372,6 +2509,10 @@ public:
pCStringWriter->WriteString(L" w:rightFromText=\"" + std::to_wstring(nRight) + L"\"");
}
else if (c_oSerPaddingType::rightTwips == type)
{
pCStringWriter->WriteString(L" w:rightFromText=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"");
}
else if (c_oSerPaddingType::bottom == type)
{
double dBottom = m_oBufferedStream.GetDouble();
@ -2379,6 +2520,10 @@ public:
pCStringWriter->WriteString(L" w:bottomFromText=\"" + std::to_wstring(nBottom) + L"\"");
}
else if (c_oSerPaddingType::bottomTwips == type)
{
pCStringWriter->WriteString(L" w:bottomFromText=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"");
}
else
res = c_oSerConstants::ReadUnknown;
return res;
@ -3295,10 +3440,12 @@ public:
{
double dDefTabStop = m_oBufferedStream.GetDouble();
long nDefTabStop = SerializeCommon::Round(dDefTabStop * g_dKoef_mm_to_twips);
std::wstring sXml;
m_oFileWriter.m_oSettingWriter.AddSetting(L"<w:defaultTabStop w:val=\"" + std::to_wstring(nDefTabStop) + L"\"/>");
}
else if ( c_oSer_SettingsType::DefaultTabStopTwips == type )
{
m_oFileWriter.m_oSettingWriter.AddSetting(L"<w:defaultTabStop w:val=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"/>");
}
else if ( c_oSer_SettingsType::MathPr == type )
{
m_oFileWriter.m_oSettingWriter.AddSetting(_T("<m:mathPr>"));
@ -3583,6 +3730,10 @@ public:
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:interSp m:val=\"" + std::to_wstring(lVal) + L"\"/>");
}
else if ( c_oSer_OMathBottomNodesValType::ValTwips == type )
{
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:interSp m:val=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"/>");
}
else
res = c_oSerConstants::ReadUnknown;
return res;
@ -3615,6 +3766,10 @@ public:
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:intraSp m:val=\"" + std::to_wstring(lVal) + L"\"/>");
}
else if ( c_oSer_OMathBottomNodesValType::ValTwips == type )
{
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:intraSp m:val=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"/>");
}
else
res = c_oSerConstants::ReadUnknown;
return res;
@ -3628,6 +3783,10 @@ public:
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:lMargin m:val=\"" + std::to_wstring(lVal) + L"\"/>");
}
else if ( c_oSer_OMathBottomNodesValType::ValTwips == type )
{
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:lMargin m:val=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"/>");
}
else
res = c_oSerConstants::ReadUnknown;
return res;
@ -3679,6 +3838,10 @@ public:
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:postSp m:val=\"" + std::to_wstring(lVal) + L"\"/>");
}
else if ( c_oSer_OMathBottomNodesValType::ValTwips == type )
{
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:postSp m:val=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"/>");
}
else
res = c_oSerConstants::ReadUnknown;
return res;
@ -3692,6 +3855,10 @@ public:
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:preSp m:val=\"" + std::to_wstring(lVal)+ L"\"/>");
}
else if ( c_oSer_OMathBottomNodesValType::ValTwips == type )
{
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:preSp m:val=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"/>");
}
else
res = c_oSerConstants::ReadUnknown;
return res;
@ -3705,6 +3872,10 @@ public:
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:rMargin m:val=\"" + std::to_wstring(lVal) + L"\"/>");
}
else if ( c_oSer_OMathBottomNodesValType::ValTwips == type )
{
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:rMargin m:val=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"/>");
}
else
res = c_oSerConstants::ReadUnknown;
return res;
@ -3735,6 +3906,10 @@ public:
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:wrapIndent m:val=\"" + std::to_wstring(lVal) + L"\"/>");
}
else if ( c_oSer_OMathBottomNodesValType::ValTwips == type )
{
m_oFileWriter.m_oSettingWriter.AddSetting(L"<m:wrapIndent m:val=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\"/>");
}
else
res = c_oSerConstants::ReadUnknown;
return res;
@ -7150,6 +7325,10 @@ public:
pCStringWriter->WriteString(L"<w:gridCol w:w=\"" + std::to_wstring(ngridCol)+ L"\"/>");
}
else if( c_oSerDocTableType::tblGrid_ItemTwips == type )
{
pCStringWriter->WriteString(L"<w:gridCol w:w=\"" + std::to_wstring(m_oBufferedStream.GetLong())+ L"\"/>");
}
else if( c_oSerDocTableType::tblGridChange == type )
{
TrackRevision oTrackRevision;
@ -7490,22 +7669,42 @@ public:
else if ( c_oSerImageType2::DistL == type )
{
pDrawingProperty->bDistL = true;
pDrawingProperty->DistL = m_oBufferedStream.GetDouble();
pDrawingProperty->DistL = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
}
else if ( c_oSerImageType2::DistLEmu == type )
{
pDrawingProperty->bDistL = true;
pDrawingProperty->DistL = (__int64)m_oBufferedStream.GetULong();
}
else if ( c_oSerImageType2::DistT == type )
{
pDrawingProperty->bDistT = true;
pDrawingProperty->DistT = m_oBufferedStream.GetDouble();
pDrawingProperty->DistT = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
}
else if ( c_oSerImageType2::DistTEmu == type )
{
pDrawingProperty->bDistT = true;
pDrawingProperty->DistT = (__int64)m_oBufferedStream.GetULong();
}
else if ( c_oSerImageType2::DistR == type )
{
pDrawingProperty->bDistR = true;
pDrawingProperty->DistR = m_oBufferedStream.GetDouble();
pDrawingProperty->DistR = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
}
else if ( c_oSerImageType2::DistREmu == type )
{
pDrawingProperty->bDistR = true;
pDrawingProperty->DistR = (__int64)m_oBufferedStream.GetULong();
}
else if ( c_oSerImageType2::DistB == type )
{
pDrawingProperty->bDistB = true;
pDrawingProperty->DistB = m_oBufferedStream.GetDouble();
pDrawingProperty->DistB = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
}
else if ( c_oSerImageType2::DistBEmu == type )
{
pDrawingProperty->bDistB = true;
pDrawingProperty->DistB = (__int64)m_oBufferedStream.GetULong();
}
else if ( c_oSerImageType2::LayoutInCell == type )
{
@ -7745,22 +7944,42 @@ public:
if ( c_oSerEffectExtent::Left == type )
{
pDrawingProperty->bEffectExtentL = true;
pDrawingProperty->EffectExtentL = m_oBufferedStream.GetDouble();
pDrawingProperty->EffectExtentL = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
}
else if ( c_oSerEffectExtent::LeftEmu == type )
{
pDrawingProperty->bEffectExtentL = true;
pDrawingProperty->EffectExtentL = (__int64)m_oBufferedStream.GetLong();
}
else if ( c_oSerEffectExtent::Top == type )
{
pDrawingProperty->bEffectExtentT = true;
pDrawingProperty->EffectExtentT = m_oBufferedStream.GetDouble();
pDrawingProperty->EffectExtentT = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
}
else if ( c_oSerEffectExtent::TopEmu == type )
{
pDrawingProperty->bEffectExtentT = true;
pDrawingProperty->EffectExtentT = (__int64)m_oBufferedStream.GetLong();
}
else if ( c_oSerEffectExtent::Right == type )
{
pDrawingProperty->bEffectExtentR = true;
pDrawingProperty->EffectExtentR = m_oBufferedStream.GetDouble();
pDrawingProperty->EffectExtentR = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
}
else if ( c_oSerEffectExtent::RightEmu == type )
{
pDrawingProperty->bEffectExtentR = true;
pDrawingProperty->EffectExtentR = (__int64)m_oBufferedStream.GetLong();
}
else if ( c_oSerEffectExtent::Bottom == type )
{
pDrawingProperty->bEffectExtentB = true;
pDrawingProperty->EffectExtentB = m_oBufferedStream.GetDouble();
pDrawingProperty->EffectExtentB = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
}
else if ( c_oSerEffectExtent::BottomEmu == type )
{
pDrawingProperty->bEffectExtentB = true;
pDrawingProperty->EffectExtentB = (__int64)m_oBufferedStream.GetLong();
}
else
res = c_oSerConstants::ReadUnknown;
@ -7773,12 +7992,22 @@ public:
if ( c_oSerExtent::Cx == type )
{
pDrawingProperty->bWidth = true;
pDrawingProperty->Width = m_oBufferedStream.GetDouble();
pDrawingProperty->Width = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
}
else if ( c_oSerExtent::CxEmu == type )
{
pDrawingProperty->bWidth = true;
pDrawingProperty->Width = (__int64)m_oBufferedStream.GetULong();
}
else if ( c_oSerExtent::Cy == type )
{
pDrawingProperty->bHeight = true;
pDrawingProperty->Height = m_oBufferedStream.GetDouble();
pDrawingProperty->Height = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
}
else if ( c_oSerExtent::CyEmu == type )
{
pDrawingProperty->bHeight = true;
pDrawingProperty->Height = (__int64)m_oBufferedStream.GetULong();
}
else
res = c_oSerConstants::ReadUnknown;
@ -7801,7 +8030,12 @@ public:
else if ( c_oSerPosHV::PosOffset == type )
{
pDrawingProperty->bPositionHPosOffset = true;
pDrawingProperty->PositionHPosOffset = m_oBufferedStream.GetDouble();
pDrawingProperty->PositionHPosOffset = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
}
else if ( c_oSerPosHV::PosOffsetEmu == type )
{
pDrawingProperty->bPositionHPosOffset = true;
pDrawingProperty->PositionHPosOffset = (__int64)m_oBufferedStream.GetLong();
}
else if ( c_oSerPosHV::PctOffset == type )
{
@ -7829,7 +8063,12 @@ public:
else if ( c_oSerPosHV::PosOffset == type )
{
pDrawingProperty->bPositionVPosOffset = true;
pDrawingProperty->PositionVPosOffset = m_oBufferedStream.GetDouble();
pDrawingProperty->PositionVPosOffset = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
}
else if ( c_oSerPosHV::PosOffsetEmu == type )
{
pDrawingProperty->bPositionVPosOffset = true;
pDrawingProperty->PositionVPosOffset = (__int64)m_oBufferedStream.GetLong();
}
else if ( c_oSerPosHV::PctOffset == type )
{
@ -7847,12 +8086,22 @@ public:
if ( c_oSerSimplePos::X == type )
{
pDrawingProperty->bSimplePosX = true;
pDrawingProperty->SimplePosX = m_oBufferedStream.GetDouble();
pDrawingProperty->SimplePosX = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
}
else if ( c_oSerSimplePos::XEmu == type )
{
pDrawingProperty->bSimplePosX = true;
pDrawingProperty->SimplePosX = (__int64)m_oBufferedStream.GetLong();
}
else if ( c_oSerSimplePos::Y == type )
{
pDrawingProperty->bSimplePosY = true;
pDrawingProperty->SimplePosY = m_oBufferedStream.GetDouble();
pDrawingProperty->SimplePosY = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
}
else if ( c_oSerSimplePos::YEmu == type )
{
pDrawingProperty->bSimplePosY = true;
pDrawingProperty->SimplePosY = (__int64)m_oBufferedStream.GetLong();
}
else
res = c_oSerConstants::ReadUnknown;
@ -7948,12 +8197,22 @@ public:
if ( c_oSerPoint2D::X == type )
{
pWrapPoint->bX = true;
pWrapPoint->X = m_oBufferedStream.GetDouble();
pWrapPoint->X = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
}
else if ( c_oSerPoint2D::XEmu == type )
{
pWrapPoint->bX = true;
pWrapPoint->X = (__int64)m_oBufferedStream.GetLong();
}
else if ( c_oSerPoint2D::Y == type )
{
pWrapPoint->bY = true;
pWrapPoint->Y = m_oBufferedStream.GetDouble();
pWrapPoint->Y = (__int64)(g_dKoef_mm_to_emu * m_oBufferedStream.GetDouble());
}
else if ( c_oSerPoint2D::YEmu == type )
{
pWrapPoint->bY = true;
pWrapPoint->Y = (__int64)m_oBufferedStream.GetLong();
}
else
res = c_oSerConstants::ReadUnknown;

View File

@ -36,17 +36,6 @@ namespace BinDocxRW
{
const double eps = 0.001;
const int Page_Width = 210;
const int Page_Height = 297;
const int X_Left_Margin = 30; // 3 cm
const int X_Right_Margin = 15; // 1.5 cm
const int Y_Bottom_Margin = 20; // 2 cm
const int Y_Top_Margin = 20; // 2 cm
const double Y_Default_Header = 12.5; // 1.25 cm расстояние от верха страницы до верха верхнего колонтитула
const double Y_Default_Footer = 12.5; // 1.25 cm расстояние от низа страницы до низа нижнего колонтитула
const int shd_Clear = 0;
const int shd_Nil = 1;
@ -311,7 +300,9 @@ extern int g_nCurFormatVersion;
RowBandSize = 15,
ColBandSize = 16,
tblCaption = 17,
tblDescription = 18
tblDescription = 18,
TableIndTwips = 19,
TableCellSpacingTwips = 20
};}
namespace c_oSer_tblpPrType{enum c_oSer_tblpPrType
{
@ -328,7 +319,9 @@ extern int g_nCurFormatVersion;
VertAnchor = 3,
TblpY = 4,
TblpYSpec = 5,
Paddings = 6
Paddings = 6,
TblpXTwips = 7,
TblpYTwips = 8
};}
namespace c_oSerProp_pPrType{enum c_oSerProp_pPrType
{
@ -365,7 +358,14 @@ extern int g_nCurFormatVersion;
numPr_Ins = 32,
pPrChange = 33,
outlineLvl = 34,
Tab_Item_Leader = 35
Tab_Item_Leader = 35,
Ind_LeftTwips = 36,
Ind_RightTwips = 37,
Ind_FirstLineTwips = 38,
Spacing_LineTwips = 39,
Spacing_BeforeTwips = 40,
Spacing_AfterTwips = 41,
Tab_Item_PosTwips = 42
};}
namespace c_oSerProp_rPrType{enum c_oSerProp_rPrType
{
@ -406,7 +406,9 @@ extern int g_nCurFormatVersion;
Ins = 34,
rPrChange = 35,
MoveFrom = 36,
MoveTo = 37
MoveTo = 37,
SpacingTwips = 38,
PositionHps = 39
};}
namespace c_oSerProp_rowPrType{enum c_oSerProp_rowPrType
{
@ -427,7 +429,9 @@ extern int g_nCurFormatVersion;
TableHeader = 14,
Del = 15,
Ins = 16,
trPrChange = 17
trPrChange = 17,
TableCellSpacingTwips = 18,
Height_ValueTwips = 19
};}
namespace c_oSerProp_cellPrType{enum c_oSerProp_cellPrType
{
@ -517,7 +521,8 @@ extern int g_nCurFormatVersion;
tblGridChange = 9,
Sdt = 10,
BookmarkStart = 11,
BookmarkEnd = 12
BookmarkEnd = 12,
tblGrid_ItemTwips = 13
};}
namespace c_oSerRunType{enum c_oSerRunType
{
@ -607,26 +612,37 @@ extern int g_nCurFormatVersion;
SizeRelV = 28,
Embedded = 29,
GraphicFramePr = 30,
DocPr = 31
DocPr = 31,
DistBEmu = 32,
DistLEmu = 33,
DistREmu = 34,
DistTEmu = 35
};}
namespace c_oSerEffectExtent{enum c_oSerEffectExtent
{
Left = 0,
Top = 1,
Right = 2,
Bottom = 3
Bottom = 3,
LeftEmu = 4,
TopEmu = 5,
RightEmu = 6,
BottomEmu = 7
};}
namespace c_oSerExtent{enum c_oSerExtent
{
Cx = 0,
Cy = 1
Cy = 1,
CxEmu = 2,
CyEmu = 3
};}
namespace c_oSerPosHV{enum c_oSerPosHV
{
RelativeFrom = 0,
Align = 1,
PosOffset = 2,
PctOffset = 3
PctOffset = 3,
PosOffsetEmu = 4
};}
namespace c_oSerSizeRelHV{enum c_oSerSizeRelHV
{
@ -636,7 +652,9 @@ extern int g_nCurFormatVersion;
namespace c_oSerSimplePos{enum c_oSerSimplePos
{
X = 0,
Y = 1
Y = 1,
XEmu = 2,
YEmu = 3
};}
namespace c_oSerWrapSquare{enum c_oSerWrapSquare
{
@ -645,20 +663,28 @@ extern int g_nCurFormatVersion;
DistR = 2,
DistB = 3,
WrapText = 4,
EffectExtent = 5
EffectExtent = 5,
DistLEmu = 6,
DistTEmu = 7,
DistREmu = 8,
DistBEmu = 9
};}
namespace c_oSerWrapThroughTight{enum c_oSerWrapThroughTight
{
DistL = 0,
DistR = 1,
WrapText = 2,
WrapPolygon = 3
WrapPolygon = 3,
DistLEmu = 4,
DistREmu = 5
};}
namespace c_oSerWrapTopBottom{enum c_oSerWrapTopBottom
{
DistT = 0,
DistB = 1,
EffectExtent = 2
EffectExtent = 2,
DistTEmu = 3,
DistBEmu = 4
};}
namespace c_oSerWrapPolygon{enum c_oSerWrapPolygon
{
@ -670,7 +696,9 @@ extern int g_nCurFormatVersion;
namespace c_oSerPoint2D{enum c_oSerPoint2D
{
X = 0,
Y = 1
Y = 1,
XEmu = 2,
YEmu = 3
};}
namespace c_oSerBorderType{enum c_oSerBorderType
{
@ -678,7 +706,9 @@ extern int g_nCurFormatVersion;
Space = 1,
Size = 2,
Value = 3,
ColorTheme = 4
ColorTheme = 4,
SpacePoint = 5,
Size8Point = 6
};}
namespace c_oSerShdType{enum c_oSerShdType
{
@ -691,7 +721,11 @@ extern int g_nCurFormatVersion;
left = 0,
top = 1,
right = 2,
bottom = 3
bottom = 3,
leftTwips = 4,
topTwips = 5,
rightTwips = 6,
bottomTwips = 7
};}
namespace c_oSerMarginsType{enum c_oSerMarginsType
{
@ -725,7 +759,9 @@ extern int g_nCurFormatVersion;
{
W = 0,
H = 1,
Orientation = 2
Orientation = 2,
WTwips = 3,
HTwips = 4
};}
namespace c_oSer_pgMarType{enum c_oSer_pgMarType
{
@ -734,7 +770,13 @@ extern int g_nCurFormatVersion;
Right = 2,
Bottom = 3,
Header = 4,
Footer = 5
Footer = 5,
LeftTwips = 6,
TopTwips = 7,
RightTwips = 8,
BottomTwips = 9,
HeaderTwips = 10,
FooterTwips = 11
};}
namespace c_oSer_ColorType{enum c_oSer_ColorType
{
@ -765,7 +807,8 @@ extern int g_nCurFormatVersion;
EndnotePr = 5,
SdtGlobalColor = 6,
SdtGlobalShowHighlight = 7,
Compat = 8
Compat = 8,
DefaultTabStopTwips = 9
};}
namespace c_oSer_MathPrType{enum c_oSer_SettingsType
{
@ -860,7 +903,8 @@ extern int g_nCurFormatVersion;
namespace c_oSer_OMathBottomNodesValType{enum c_oSer_OMathBottomNodesValType
{
Val = 0,
AlnAt = 1
AlnAt = 1,
ValTwips = 2
};}
namespace c_oSer_OMathContentType{enum c_oSer_OMathContentType
{

View File

@ -148,15 +148,15 @@ namespace BinDocxRW
WriteThemeColor(c_oSerBorderType::ColorTheme, border.m_oColor, border.m_oThemeColor, border.m_oThemeTint, border.m_oThemeShade);
if(border.m_oSpace.IsInit())
{
m_oStream.WriteBYTE(c_oSerBorderType::Space);
m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oStream.WriteDouble(border.m_oSpace->ToMM());
m_oStream.WriteBYTE(c_oSerBorderType::SpacePoint);
m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oStream.WriteLONG(border.m_oSpace->GetValue());
}
if(border.m_oSz.IsInit())
{
m_oStream.WriteBYTE(c_oSerBorderType::Size);
m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oStream.WriteDouble(border.m_oSz->ToMM());
m_oStream.WriteBYTE(c_oSerBorderType::Size8Point);
m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oStream.WriteLONG(border.m_oSz->GetValue());
}
//Val
m_oStream.WriteBYTE(c_oSerBorderType::Value);
@ -315,85 +315,51 @@ namespace BinDocxRW
void WriteShd(const ComplexTypes::Word::CShading& Shd)
{
//Type
if(false != Shd.m_oVal.IsInit())
if (false != Shd.m_oVal.IsInit())
{
m_oStream.WriteBYTE(c_oSerShdType::Value);
m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
switch(Shd.m_oVal.get().GetValue())
{
case SimpleTypes::shdNil: m_oStream.WriteBYTE(shd_Nil);break;
default: m_oStream.WriteBYTE(shd_Clear);break;
}
m_oStream.WriteBYTE(Shd.m_oVal.get().GetValue()); //Misalignment-footer.doc
}
//Value
if(false != Shd.m_oFill.IsInit())
if (false != Shd.m_oFill.IsInit())
WriteColor(c_oSerShdType::Color, Shd.m_oFill.get());
else if (false != Shd.m_oColor.IsInit())
WriteColor(c_oSerShdType::Color, Shd.m_oColor.get());
WriteThemeColor(c_oSerShdType::ColorTheme, Shd.m_oFill, Shd.m_oThemeFill, Shd.m_oThemeFillTint, Shd.m_oThemeFillShade);
}
void WriteDistance(const NSCommon::nullable<SimpleTypes::CWrapDistance<>>& m_oDistL,
const NSCommon::nullable<SimpleTypes::CWrapDistance<>>& m_oDistT,
const NSCommon::nullable<SimpleTypes::CWrapDistance<>>& m_oDistR,
const NSCommon::nullable<SimpleTypes::CWrapDistance<>>& m_oDistB)
{
//left
if(false != m_oDistL.IsInit())
{
m_oStream.WriteBYTE(c_oSerPaddingType::left);
m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oStream.WriteDouble(m_oDistL.get().ToMM());
}
//top
if(false != m_oDistT.IsInit())
{
m_oStream.WriteBYTE(c_oSerPaddingType::top);
m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oStream.WriteDouble(m_oDistT.get().ToMM());
}
//Right
if(false != m_oDistR.IsInit())
{
m_oStream.WriteBYTE(c_oSerPaddingType::right);
m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oStream.WriteDouble(m_oDistR.get().ToMM());
}
//bottom
if(false != m_oDistB.IsInit())
{
m_oStream.WriteBYTE(c_oSerPaddingType::bottom);
m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oStream.WriteDouble(m_oDistB.get().ToMM());
}
}
void WritePaddings(const nullable<SimpleTypes::CTwipsMeasure>& left, const nullable<SimpleTypes::CTwipsMeasure>& top,
const nullable<SimpleTypes::CTwipsMeasure>& right, const nullable<SimpleTypes::CTwipsMeasure>& bottom)
{
//left
if(left.IsInit())
{
m_oStream.WriteBYTE(c_oSerPaddingType::left);
m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oStream.WriteDouble(left.get().ToMm());
m_oStream.WriteBYTE(c_oSerPaddingType::leftTwips);
m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oStream.WriteLONG(left->ToTwips());
}
//top
if(top.IsInit())
{
m_oStream.WriteBYTE(c_oSerPaddingType::top);
m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oStream.WriteDouble(top.get().ToMm());
m_oStream.WriteBYTE(c_oSerPaddingType::topTwips);
m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oStream.WriteLONG(top->ToTwips());
}
//Right
if(right.IsInit())
{
m_oStream.WriteBYTE(c_oSerPaddingType::right);
m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oStream.WriteDouble(right.get().ToMm());
m_oStream.WriteBYTE(c_oSerPaddingType::rightTwips);
m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oStream.WriteLONG(right->ToTwips());
}
//bottom
if(bottom.IsInit())
{
m_oStream.WriteBYTE(c_oSerPaddingType::bottom);
m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oStream.WriteDouble(bottom.get().ToMm());
m_oStream.WriteBYTE(c_oSerPaddingType::bottomTwips);
m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oStream.WriteLONG(bottom->ToTwips());
}
}
void WriteFont(std::wstring& sFontName, BYTE bType, DocWrapper::FontProcessor& m_oFontProcessor)
@ -701,9 +667,9 @@ namespace BinDocxRW
//Spacing
if(false != rPr->m_oSpacing.IsInit() && false != rPr->m_oSpacing->m_oVal.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::Spacing);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(rPr->m_oSpacing->m_oVal->ToMm());
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::SpacingTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(rPr->m_oSpacing->m_oVal->ToTwips());
}
//DStrikeout
if(false != rPr->m_oDStrike.IsInit())
@ -729,9 +695,9 @@ namespace BinDocxRW
//Position
if(false != rPr->m_oPosition.IsInit() && false != rPr->m_oPosition->m_oVal.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::Position);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(rPr->m_oPosition->m_oVal->ToMm());
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::PositionHps);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(rPr->m_oPosition->m_oVal->ToHps());
}
//BoldCs
if(rPr->m_oBoldCs.IsInit())
@ -1066,29 +1032,29 @@ namespace BinDocxRW
//Left
if(false != Ind.m_oStart.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Ind_Left);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(Ind.m_oStart.get().ToMm());
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Ind_LeftTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(Ind.m_oStart.get().ToTwips());
}
//Right
if(false != Ind.m_oEnd.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Ind_Right);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(Ind.m_oEnd.get().ToMm());
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Ind_RightTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(Ind.m_oEnd.get().ToTwips());
}
//FirstLine
if(false != Ind.m_oFirstLine.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Ind_FirstLine);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(Ind.m_oFirstLine.get().ToMm());
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Ind_FirstLineTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(Ind.m_oFirstLine.get().ToTwips());
}
else if(false != Ind.m_oHanging.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Ind_FirstLine);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble( -1 * Ind.m_oHanging.get().ToMm());
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Ind_FirstLineTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG( -1 * Ind.m_oHanging.get().ToTwips());
}
}
void WriteSpacing(const ComplexTypes::Word::CSpacing& Spacing)
@ -1101,24 +1067,9 @@ namespace BinDocxRW
//Line
if(false != Spacing.m_oLine.IsInit())
{
const SimpleTypes::CSignedTwipsMeasure& oLine = Spacing.m_oLine.get();
double dLineMm = oLine.ToMm();
if(dLineMm < 0)
{
dLineMm = -dLineMm;
eLineSpacingRule = SimpleTypes::linespacingruleExact;
}
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Spacing_Line);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
if(SimpleTypes::linespacingruleAuto == eLineSpacingRule)
{
SimpleTypes::CSignedTwipsMeasure oTmp;oTmp.FromPoints(12);//240 twips
m_oBcw.m_oStream.WriteDouble(dLineMm / oTmp.ToMm());
}
else
{
m_oBcw.m_oStream.WriteDouble(dLineMm);
}
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Spacing_LineTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(Spacing.m_oLine->ToTwips());
//Write LineRule
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Spacing_LineRule);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
@ -1138,9 +1089,9 @@ namespace BinDocxRW
}
if(false != Spacing.m_oBefore.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Spacing_Before);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(Spacing.m_oBefore.get().ToMm());
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Spacing_BeforeTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(Spacing.m_oBefore.get().ToTwips());
}
//After
if(Spacing.m_oAfterAutospacing.IsInit())
@ -1151,9 +1102,9 @@ namespace BinDocxRW
}
if(false != Spacing.m_oAfter.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Spacing_After);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(Spacing.m_oAfter.get().ToMm());
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Spacing_AfterTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(Spacing.m_oAfter.get().ToTwips());
}
}
void WriteTabs(const OOX::Logic::CTabs& Tab, const nullable<ComplexTypes::Word::CInd>& oInd)
@ -1197,9 +1148,9 @@ namespace BinDocxRW
//pos
if(false != TabItem.m_oPos.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Tab_Item_Pos);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(TabItem.m_oPos.get().ToMm());
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Tab_Item_PosTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(TabItem.m_oPos.get().ToTwips());
}
if(false != TabItem.m_oLeader.IsInit())
{
@ -1425,93 +1376,78 @@ namespace BinDocxRW
}
void WritePageSize(OOX::Logic::CSectionProperty* pSectPr)
{
double W = Page_Width;
double H = Page_Height;
BYTE Orientation = orientation_Portrait;
if(NULL != pSectPr && pSectPr->m_oPgSz.IsInit())
{
const ComplexTypes::Word::CPageSz& pSz = pSectPr->m_oPgSz.get();
if(pSz.m_oW.IsInit())
W = pSz.m_oW.get().ToMm();
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgSzType::WTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(pSz.m_oW->ToTwips());
}
if(pSz.m_oH.IsInit())
H = pSz.m_oH.get().ToMm();
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgSzType::HTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(pSz.m_oH->ToTwips());
}
if(pSz.m_oOrient.IsInit())
{
BYTE Orientation = orientation_Portrait;
switch(pSz.m_oOrient.get().GetValue())
{
case SimpleTypes::pageorientPortrait: Orientation = orientation_Portrait;break;
case SimpleTypes::pageorientLandscape: Orientation = orientation_Landscape;break;
default: break;
}
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgSzType::Orientation);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(Orientation);
}
}
//W
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgSzType::W);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(W);
//H
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgSzType::H);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(H);
//Orientation
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgSzType::Orientation);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(Orientation);
}
void WritePageMargin(OOX::Logic::CSectionProperty* pSectPr)
{
double H = Page_Height;
double L = X_Left_Margin;
double T = Y_Top_Margin;
double R = X_Right_Margin;
double B = Y_Bottom_Margin;
double Header = Y_Default_Header;
double Footer = Y_Default_Footer;
if(NULL != pSectPr && pSectPr->m_oPgSz.IsInit() && pSectPr->m_oPgMar.IsInit())
{
const ComplexTypes::Word::CPageSz& pSz = pSectPr->m_oPgSz.get();
if(pSz.m_oH.IsInit())
H = pSz.m_oH.get().ToMm();
const ComplexTypes::Word::CPageMar& pMar = pSectPr->m_oPgMar.get();
if(pMar.m_oLeft.IsInit())
L = pMar.m_oLeft.get().ToMm();
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgMarType::LeftTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(pMar.m_oLeft->ToTwips());
}
if(pMar.m_oTop.IsInit())
T = pMar.m_oTop.get().ToMm();
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgMarType::TopTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(pMar.m_oTop->ToTwips());
}
if(pMar.m_oRight.IsInit())
R = pMar.m_oRight.get().ToMm();
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgMarType::RightTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(pMar.m_oRight->ToTwips());
}
if(pMar.m_oBottom.IsInit())
B = pMar.m_oBottom.get().ToMm();
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgMarType::BottomTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(pMar.m_oBottom->ToTwips());
}
if(pMar.m_oHeader.IsInit())
Header = pMar.m_oHeader.get().ToMm();
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgMarType::HeaderTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(pMar.m_oHeader->ToTwips());
}
if(pMar.m_oFooter.IsInit())
Footer = pMar.m_oFooter.get().ToMm();
}
//Left
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgMarType::Left);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(L);
//Top
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgMarType::Top);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(T);
//Right
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgMarType::Right);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(R);
//Bottom
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgMarType::Bottom);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(B);
//Header
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgMarType::Header);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(Header);
//Footer
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgMarType::Footer);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(Footer);
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_pgMarType::FooterTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(pMar.m_oFooter->ToTwips());
}
}
}
void WriteHeaderFooter(OOX::Logic::CSectionProperty* pSectPr, std::vector<ComplexTypes::Word::CHdrFtrRef*>& aRefs, bool bHdr)
{
@ -1816,11 +1752,8 @@ namespace BinDocxRW
if(tblPr.m_oTblInd->m_oW.IsInit() && false == tblPr.m_oTblInd->m_oW->IsPercent() &&
tblPr.m_oTblInd->m_oType.IsInit() && SimpleTypes::tblwidthDxa == tblPr.m_oTblInd->m_oType->GetValue())
{
SimpleTypes::CPoint oPoint;
oPoint.FromTwips(tblPr.m_oTblInd->m_oW->GetValue());
nCurPos = m_oBcw.WriteItemStart(c_oSerProp_tblPrType::TableInd);
m_oBcw.m_oStream.WriteDouble(oPoint.ToMm());
nCurPos = m_oBcw.WriteItemStart(c_oSerProp_tblPrType::TableIndTwips);
m_oBcw.m_oStream.WriteLONG(tblPr.m_oTblInd->m_oW->GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
}
@ -1886,11 +1819,8 @@ namespace BinDocxRW
if(cs.m_oW.IsInit() && false == cs.m_oW->IsPercent() &&
cs.m_oType.IsInit() && SimpleTypes::tblwidthDxa == cs.m_oType->GetValue())
{
SimpleTypes::CPoint oPoint;
oPoint.FromTwips(cs.m_oW->GetValue());
nCurPos = m_oBcw.WriteItemStart(c_oSerProp_tblPrType::TableCellSpacing);
m_oBcw.m_oStream.WriteDouble(oPoint.ToMm() * 2);//Умножаем на 2 из-за разного понимания cellSpacing
nCurPos = m_oBcw.WriteItemStart(c_oSerProp_tblPrType::TableCellSpacingTwips);
m_oBcw.m_oStream.WriteLONG(cs.m_oW->GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
}
@ -1948,9 +1878,9 @@ namespace BinDocxRW
}
if(pr.m_oTblpX.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_tblpPrType2::TblpX);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(pr.m_oTblpX->ToMm());
m_oBcw.m_oStream.WriteBYTE(c_oSer_tblpPrType2::TblpXTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(pr.m_oTblpX->ToTwips());
}
if(pr.m_oTblpXSpec.IsInit())
{
@ -1966,9 +1896,9 @@ namespace BinDocxRW
}
if(pr.m_oTblpY.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_tblpPrType2::TblpY);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(pr.m_oTblpY->ToMm());
m_oBcw.m_oStream.WriteBYTE(c_oSer_tblpPrType2::TblpYTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(pr.m_oTblpY->ToTwips());
}
if(pr.m_oTblpYSpec.IsInit())
{
@ -2035,12 +1965,9 @@ namespace BinDocxRW
if(cs.m_oW.IsInit() && false == cs.m_oW->IsPercent() &&
cs.m_oType.IsInit() && SimpleTypes::tblwidthDxa == cs.m_oType->GetValue())
{
SimpleTypes::CPoint oPoint;
oPoint.FromTwips(cs.m_oW->GetValue());
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rowPrType::TableCellSpacing);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(oPoint.ToMm() * 2);//Умножаем на 2 из-за разного понимания cellSpacing
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rowPrType::TableCellSpacingTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(cs.m_oW->GetValue());
}
}
//Height
@ -2133,9 +2060,9 @@ namespace BinDocxRW
//Value
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rowPrType::Height_Value);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(rowHeight.m_oVal->ToMm());
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rowPrType::Height_ValueTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(rowHeight.m_oVal->ToTwips());
}
}
void WriteW(int nType, const ComplexTypes::Word::CTblWidth& tableW, bool bWrite2 = false)
@ -6141,27 +6068,28 @@ namespace BinDocxRW
}
if(pAnchor.m_oDistL.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerImageType2::DistL);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(pAnchor.m_oDistL->ToMM());
//document is corrupted if the value is greater UINT32
m_oBcw.m_oStream.WriteBYTE(c_oSerImageType2::DistLEmu);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteULONG((_UINT32)pAnchor.m_oDistL->GetValue());
}
if(pAnchor.m_oDistT.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerImageType2::DistT);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(pAnchor.m_oDistT->ToMM());
m_oBcw.m_oStream.WriteBYTE(c_oSerImageType2::DistTEmu);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteULONG((_UINT32)pAnchor.m_oDistT->GetValue());
}
if(pAnchor.m_oDistR.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerImageType2::DistR);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(pAnchor.m_oDistR->ToMM());
m_oBcw.m_oStream.WriteBYTE(c_oSerImageType2::DistREmu);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteULONG((_UINT32)pAnchor.m_oDistR->GetValue());
}
if(pAnchor.m_oDistB.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerImageType2::DistB);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(pAnchor.m_oDistB->ToMM());
m_oBcw.m_oStream.WriteBYTE(c_oSerImageType2::DistBEmu);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteULONG((_UINT32)pAnchor.m_oDistB->GetValue());
}
if(pAnchor.m_oHidden.IsInit())
{
@ -6380,34 +6308,39 @@ namespace BinDocxRW
}
void WriteEffectExtent(const OOX::Drawing::CEffectExtent& oEffectExtent)
{
m_oBcw.m_oStream.WriteBYTE(c_oSerEffectExtent::Left);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(oEffectExtent.m_oL.ToMm());
int nCurPos = 0;
//document is corrupted if the value is greater INT32
m_oBcw.m_oStream.WriteBYTE(c_oSerEffectExtent::LeftEmu);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG((_INT32)oEffectExtent.m_oL.ToEmu());
m_oBcw.m_oStream.WriteBYTE(c_oSerEffectExtent::Top);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(oEffectExtent.m_oT.ToMm());
m_oBcw.m_oStream.WriteBYTE(c_oSerEffectExtent::TopEmu);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG((_INT32)oEffectExtent.m_oT.ToEmu());
m_oBcw.m_oStream.WriteBYTE(c_oSerEffectExtent::Right);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(oEffectExtent.m_oR.ToMm());
m_oBcw.m_oStream.WriteBYTE(c_oSerEffectExtent::RightEmu);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG((_INT32)oEffectExtent.m_oR.ToEmu());
m_oBcw.m_oStream.WriteBYTE(c_oSerEffectExtent::Bottom);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(oEffectExtent.m_oB.ToMm());
m_oBcw.m_oStream.WriteBYTE(c_oSerEffectExtent::BottomEmu);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG((_INT32)oEffectExtent.m_oB.ToEmu());
}
void WriteExtent(const ComplexTypes::Drawing::CPositiveSize2D& oExtent)
{
m_oBcw.m_oStream.WriteBYTE(c_oSerExtent::Cx);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(oExtent.m_oCx.ToMM());
int nCurPos = 0;
//document is corrupted if the value is greater UINT32
m_oBcw.m_oStream.WriteBYTE(c_oSerExtent::CxEmu);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteULONG((_UINT32)oExtent.m_oCx.GetValue());
m_oBcw.m_oStream.WriteBYTE(c_oSerExtent::Cy);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(oExtent.m_oCy.ToMM());
m_oBcw.m_oStream.WriteBYTE(c_oSerExtent::CyEmu);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteULONG((_UINT32)oExtent.m_oCy.GetValue());
}
void WritePositionH(const OOX::Drawing::CPosH& oPosH)
{
int nCurPos = 0;
if(oPosH.m_oRelativeFrom.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerPosHV::RelativeFrom);
@ -6422,9 +6355,10 @@ namespace BinDocxRW
}
if(oPosH.m_oPosOffset.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerPosHV::PosOffset);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(oPosH.m_oPosOffset->ToMM());
//document is corrupted if the value is greater INT32
m_oBcw.m_oStream.WriteBYTE(c_oSerPosHV::PosOffsetEmu);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG((_INT32)oPosH.m_oPosOffset->GetValue());
}
if(oPosH.m_oPctOffset.IsInit())
{
@ -6435,6 +6369,7 @@ namespace BinDocxRW
}
void WritePositionV(const OOX::Drawing::CPosV& oPosV)
{
int nCurPos = 0;
if(oPosV.m_oRelativeFrom.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerPosHV::RelativeFrom);
@ -6449,9 +6384,9 @@ namespace BinDocxRW
}
if(oPosV.m_oPosOffset.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerPosHV::PosOffset);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(oPosV.m_oPosOffset->ToMM());
m_oBcw.m_oStream.WriteBYTE(c_oSerPosHV::PosOffsetEmu);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG((_INT32)oPosV.m_oPosOffset->GetValue());
}
if(oPosV.m_oPctOffset.IsInit())
{
@ -6492,40 +6427,43 @@ namespace BinDocxRW
}
void WriteSimplePos(const ComplexTypes::Drawing::CPoint2D& oSimplePos)
{
m_oBcw.m_oStream.WriteBYTE(c_oSerSimplePos::X);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(oSimplePos.m_oX.ToMm());
int nCurPos = 0;
//document is corrupted if the value is greater INT32
m_oBcw.m_oStream.WriteBYTE(c_oSerSimplePos::XEmu);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG((_INT32)oSimplePos.m_oX.GetValue());
m_oBcw.m_oStream.WriteBYTE(c_oSerSimplePos::Y);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(oSimplePos.m_oY.ToMm());
m_oBcw.m_oStream.WriteBYTE(c_oSerSimplePos::YEmu);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG((_INT32)oSimplePos.m_oY.GetValue());
}
void WriteWrapSquare(const OOX::Drawing::CWrapSquare& oWrapSquare)
{
int nCurPos = 0;
if(oWrapSquare.m_oDistL.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapSquare::DistL);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(oWrapSquare.m_oDistL->ToMM());
//document is corrupted if the value is greater UINT32
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapSquare::DistLEmu);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteULONG((_UINT32)oWrapSquare.m_oDistL->GetValue());
}
if(oWrapSquare.m_oDistT.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapSquare::DistT);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(oWrapSquare.m_oDistT->ToMM());
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapSquare::DistTEmu);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteULONG((_UINT32)oWrapSquare.m_oDistT->GetValue());
}
if(oWrapSquare.m_oDistR.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapSquare::DistR);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(oWrapSquare.m_oDistR->ToMM());
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapSquare::DistREmu);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteULONG((_UINT32)oWrapSquare.m_oDistR->GetValue());
}
if(oWrapSquare.m_oDistB.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapSquare::DistB);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(oWrapSquare.m_oDistB->ToMM());
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapSquare::DistBEmu);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteULONG((_UINT32)oWrapSquare.m_oDistB->GetValue());
}
if(oWrapSquare.m_oWrapText.IsInit())
{
@ -6548,15 +6486,16 @@ namespace BinDocxRW
int nCurPos = 0;
if(oWrapThrough.m_oDistL.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapThroughTight::DistL);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(oWrapThrough.m_oDistL->ToMM());
//document is corrupted if the value is greater UINT32
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapThroughTight::DistLEmu);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteULONG((_UINT32)oWrapThrough.m_oDistL->GetValue());
}
if(oWrapThrough.m_oDistR.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapThroughTight::DistR);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(oWrapThrough.m_oDistR->ToMM());
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapThroughTight::DistREmu);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteULONG((_UINT32)oWrapThrough.m_oDistR->GetValue());
}
if(oWrapThrough.m_oWrapText.IsInit())
{
@ -6579,15 +6518,16 @@ namespace BinDocxRW
int nCurPos = 0;
if(oWrapTight.m_oDistL.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapThroughTight::DistL);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(oWrapTight.m_oDistL->ToMM());
//document is corrupted if the value is greater UINT32
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapThroughTight::DistLEmu);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteULONG((_UINT32)oWrapTight.m_oDistL->GetValue());
}
if(oWrapTight.m_oDistR.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapThroughTight::DistR);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(oWrapTight.m_oDistR->ToMM());
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapThroughTight::DistREmu);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteULONG((_UINT32)oWrapTight.m_oDistR->GetValue());
}
if(oWrapTight.m_oWrapText.IsInit())
{
@ -6610,23 +6550,23 @@ namespace BinDocxRW
int nCurPos = 0;
if(oWrapTopBottom.m_oDistT.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapTopBottom::DistT);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(oWrapTopBottom.m_oDistT->ToMM());
//document is corrupted if the value is greater UINT32
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapTopBottom::DistTEmu);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteULONG((_UINT32)oWrapTopBottom.m_oDistT->GetValue());
}
if(oWrapTopBottom.m_oDistB.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapTopBottom::DistB);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(oWrapTopBottom.m_oDistB->ToMM());
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapTopBottom::DistBEmu);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteULONG((_UINT32)oWrapTopBottom.m_oDistB->GetValue());
}
if(oWrapTopBottom.m_oEffectExtent.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapTopBottom::EffectExtent);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
nCurPos = m_oBcw.WriteItemWithLengthStart();
WriteEffectExtent(oWrapTopBottom.m_oEffectExtent.get());
WriteEffectExtent(oWrapTopBottom.m_oEffectExtent.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
@ -6643,9 +6583,8 @@ namespace BinDocxRW
{
m_oBcw.m_oStream.WriteBYTE(c_oSerWrapPolygon::Start);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
nCurPos = m_oBcw.WriteItemWithLengthStart();
WritePoint2D(oWrapPath.m_oStart.get());
WritePoint2D(oWrapPath.m_oStart.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(oWrapPath.m_arrLineTo.size() > 0)
@ -6672,14 +6611,15 @@ namespace BinDocxRW
}
void WritePoint2D(const ComplexTypes::Drawing::CPoint2D& oPoint2D)
{
//document is corrupted if the value is greater INT32
int nCurPos = 0;
m_oBcw.m_oStream.WriteBYTE(c_oSerPoint2D::X);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(oPoint2D.m_oX.ToMm());
m_oBcw.m_oStream.WriteBYTE(c_oSerPoint2D::XEmu);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG((_INT32)oPoint2D.m_oX.ToEmu());
m_oBcw.m_oStream.WriteBYTE(c_oSerPoint2D::Y);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(oPoint2D.m_oY.ToMm());
m_oBcw.m_oStream.WriteBYTE(c_oSerPoint2D::YEmu);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG((_INT32)oPoint2D.m_oY.ToEmu());
}
void WriteDocTable(OOX::Logic::CTbl* tbl)
{
@ -6880,9 +6820,9 @@ namespace BinDocxRW
const ComplexTypes::Word::CTblGridCol& item = *grid.m_arrGridCol[i];
if(item.m_oW.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerDocTableType::tblGrid_Item);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(item.m_oW->ToMm());
m_oBcw.m_oStream.WriteBYTE(c_oSerDocTableType::tblGrid_ItemTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(item.m_oW->ToTwips());
}
}
if(grid.m_oTblGridChange.IsInit())
@ -7557,8 +7497,8 @@ namespace BinDocxRW
}
if(oSettings.m_oDefaultTabStop.IsInit() && oSettings.m_oDefaultTabStop->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_SettingsType::DefaultTabStop);
m_oBcw.m_oStream.WriteDouble(oSettings.m_oDefaultTabStop->m_oVal->ToMm());
nCurPos = m_oBcw.WriteItemStart(c_oSer_SettingsType::DefaultTabStopTwips);
m_oBcw.m_oStream.WriteLONG(oSettings.m_oDefaultTabStop->m_oVal->ToTwips());
m_oBcw.WriteItemEnd(nCurPos);
}
if(oSettings.m_oMathPr.IsInit())
@ -7675,9 +7615,9 @@ namespace BinDocxRW
int nCurPos = m_oBcw.WriteItemStart(c_oSer_MathPrType::InterSp);
if (pInterSp->m_val.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::Val);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(pInterSp->m_val->ToMm());
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::ValTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(pInterSp->m_val->ToTwips());
}
m_oBcw.WriteItemEnd(nCurPos);
break;
@ -7701,9 +7641,9 @@ namespace BinDocxRW
int nCurPos = m_oBcw.WriteItemStart(c_oSer_MathPrType::IntraSp);
if (pIntraSp->m_val.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::Val);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(pIntraSp->m_val->ToMm());
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::ValTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(pIntraSp->m_val->ToTwips());
}
m_oBcw.WriteItemEnd(nCurPos);
break;
@ -7714,9 +7654,9 @@ namespace BinDocxRW
int nCurPos = m_oBcw.WriteItemStart(c_oSer_MathPrType::LMargin);
if (pLMargin->m_val.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::Val);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(pLMargin->m_val->ToMm());
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::ValTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(pLMargin->m_val->ToTwips());
}
m_oBcw.WriteItemEnd(nCurPos);
break;
@ -7753,9 +7693,9 @@ namespace BinDocxRW
int nCurPos = m_oBcw.WriteItemStart(c_oSer_MathPrType::PostSp);
if (pPostSp->m_val.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::Val);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(pPostSp->m_val->ToMm());
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::ValTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(pPostSp->m_val->ToTwips());
}
m_oBcw.WriteItemEnd(nCurPos);
break;
@ -7766,9 +7706,9 @@ namespace BinDocxRW
int nCurPos = m_oBcw.WriteItemStart(c_oSer_MathPrType::PreSp);
if (pPreSp->m_val.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::Val);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(pPreSp->m_val->ToMm());
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::ValTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(pPreSp->m_val->ToTwips());
}
m_oBcw.WriteItemEnd(nCurPos);
break;
@ -7779,9 +7719,9 @@ namespace BinDocxRW
int nCurPos = m_oBcw.WriteItemStart(c_oSer_MathPrType::RMargin);
if (pRMargin->m_val.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::Val);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(pRMargin->m_val->ToMm());
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::ValTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(pRMargin->m_val->ToTwips());
}
m_oBcw.WriteItemEnd(nCurPos);
break;
@ -7805,9 +7745,9 @@ namespace BinDocxRW
int nCurPos = m_oBcw.WriteItemStart(c_oSer_MathPrType::WrapIndent);
if (pWrapIndent->m_val.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::Val);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Double);
m_oBcw.m_oStream.WriteDouble(pWrapIndent->m_val->ToMm());
m_oBcw.m_oStream.WriteBYTE(c_oSer_OMathBottomNodesValType::ValTwips);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(pWrapIndent->m_val->ToTwips());
}
m_oBcw.WriteItemEnd(nCurPos);
break;

View File

@ -53,6 +53,8 @@
69F181AF1C77274E00B2952B /* FileDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 69F181AD1C77274E00B2952B /* FileDownloader.h */; };
8A404FD3208A01AF00F2D5CF /* FileDownloader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A404FD2208A01AF00F2D5CF /* FileDownloader.cpp */; };
8A404FD5208A01CE00F2D5CF /* FileDownloader_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A404FD4208A01CE00F2D5CF /* FileDownloader_private.h */; };
8AB24BFD213004E400E80DDD /* CustormXmlWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AB24BFB213004E300E80DDD /* CustormXmlWriter.cpp */; };
8AB24BFE213004E400E80DDD /* CustormXmlWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 8AB24BFC213004E300E80DDD /* CustormXmlWriter.h */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@ -103,6 +105,8 @@
69F181AD1C77274E00B2952B /* FileDownloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileDownloader.h; path = ../../../Common/FileDownloader/FileDownloader.h; sourceTree = "<group>"; };
8A404FD2208A01AF00F2D5CF /* FileDownloader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FileDownloader.cpp; path = ../../../Common/FileDownloader/FileDownloader.cpp; sourceTree = "<group>"; };
8A404FD4208A01CE00F2D5CF /* FileDownloader_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileDownloader_private.h; path = ../../../Common/FileDownloader/FileDownloader_private.h; sourceTree = "<group>"; };
8AB24BFB213004E300E80DDD /* CustormXmlWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CustormXmlWriter.cpp; sourceTree = "<group>"; };
8AB24BFC213004E300E80DDD /* CustormXmlWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustormXmlWriter.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -149,6 +153,8 @@
children = (
17E17EEB1AC4544900BEA2EA /* ChartWriter.h */,
17E17EEC1AC4544900BEA2EA /* CommentsWriter.h */,
8AB24BFB213004E300E80DDD /* CustormXmlWriter.cpp */,
8AB24BFC213004E300E80DDD /* CustormXmlWriter.h */,
17A765271B0F3DC30046BC0B /* DefaultThemeWriter.h */,
17E17EF01AC4544900BEA2EA /* DocumentRelsWriter.h */,
17E17EF11AC4544900BEA2EA /* DocumentWriter.h */,
@ -292,6 +298,7 @@
17C1FEBC1ACC42C4006B99B3 /* DocxSerializer.h in Headers */,
17C1FEBD1ACC42C4006B99B3 /* FileWriter.h in Headers */,
17C1FEBE1ACC42C4006B99B3 /* CSVWriter.h in Headers */,
8AB24BFE213004E400E80DDD /* CustormXmlWriter.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -346,6 +353,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8AB24BFD213004E400E80DDD /* CustormXmlWriter.cpp in Sources */,
17C1FE961ACC42C4006B99B3 /* Common.cpp in Sources */,
17C1FE971ACC42C4006B99B3 /* ChartFromToBinary.cpp in Sources */,
17C1FE981ACC42C4006B99B3 /* CSVReader.cpp in Sources */,
@ -375,18 +383,11 @@
GCC_PREPROCESSOR_DEFINITIONS = (
UNICODE,
_UNICODE,
NODOCX,
_USE_XMLLITE_READER_,
USE_LITE_READER,
USE_ATL_CSTRING,
USE_AVSOFFICESTUDIO_XMLUTILS,
SOLUTION_ASCOFFICEDOCXFILE2,
_USE_LIBXML2_READER_,
LIBXML_READER_ENABLED,
DONT_WRITE_EMBEDDED_FONTS,
MAC,
unix,
_IOS,
DONT_WRITE_EMBEDDED_FONTS,
_XCODE,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
@ -414,18 +415,11 @@
GCC_PREPROCESSOR_DEFINITIONS = (
UNICODE,
_UNICODE,
NODOCX,
_USE_XMLLITE_READER_,
USE_LITE_READER,
USE_ATL_CSTRING,
USE_AVSOFFICESTUDIO_XMLUTILS,
SOLUTION_ASCOFFICEDOCXFILE2,
_USE_LIBXML2_READER_,
LIBXML_READER_ENABLED,
DONT_WRITE_EMBEDDED_FONTS,
MAC,
unix,
_IOS,
DONT_WRITE_EMBEDDED_FONTS,
_XCODE,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;

View File

@ -105,7 +105,7 @@ HRESULT convert_single(std::wstring srcFileName)
}
_CP_LOG << L"[info] " << srcFileName << std::endl;
nResult = ConvertODF2OOXml(srcTempPath, dstTempPath, L"C:\\Windows\\Fonts", srcTempPath2, L"password", NULL);
nResult = ConvertODF2OOXml(srcTempPath, dstTempPath, L"C:\\Windows\\Fonts", srcTempPath2, L"", NULL);
if (srcTempPath != srcFileName)
{

View File

@ -373,6 +373,7 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
case OOX::et_p_ShapeTree:
case OOX::et_a_GroupShape:
case OOX::et_w_GroupShape:
case OOX::et_lc_LockedCanvas:
{
convert(dynamic_cast<PPTX::Logic::SpTree *>(oox_unknown));
}break;

View File

@ -352,6 +352,7 @@ void DocxConverter::convert(OOX::WritingElement *oox_unknown)
}break;
case OOX::et_w_GroupShape:
case OOX::et_p_ShapeTree:
case OOX::et_lc_LockedCanvas:
{
convert(dynamic_cast<PPTX::Logic::SpTree*>(oox_unknown));
}break;

View File

@ -1346,21 +1346,10 @@ std::wstring CDrawingConverter::ObjectToDrawingML(const std::wstring& sXml, int
oXmlWriter.WriteString(strMainProps);
if (oElem.is<PPTX::Logic::SpTree>())
{
oXmlWriter.WriteString(L"<a:graphic xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\">\
<a:graphicData uri=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\">");
}
else if (oElem.is<PPTX::Logic::Pic>())
{
oXmlWriter.WriteString(L"<a:graphic xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\">\
<a:graphicData uri=\"http://schemas.openxmlformats.org/drawingml/2006/picture\">");
}
else
{
oXmlWriter.WriteString(L"<a:graphic xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\">\
<a:graphicData uri=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\">");
}
std::wstring uri = oElem.GetUriElem();
oXmlWriter.WriteString(L"<a:graphic xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\"><a:graphicData uri=\"" + uri + L"\">");
oElem.toXmlWriter(&oXmlWriter);
oXmlWriter.WriteString(L"</a:graphicData></a:graphic>");
@ -1411,7 +1400,31 @@ std::wstring CDrawingConverter::ObjectToVML (const std::wstring& sXml)
HRESULT CDrawingConverter::AddObject(const std::wstring& bsXml, std::wstring** pMainProps)
{
std::wstring sBegin(L"<main xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:p=\"urn:schemas-microsoft-com:office:powerpoint\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:ve=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" xmlns:a14=\"http://schemas.microsoft.com/office/drawing/2010/main\" xmlns:pic=\"http://schemas.openxmlformats.org/drawingml/2006/picture\" xmlns:xdr=\"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing\">");
std::wstring sBegin(L"<main \
xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
xmlns:p=\"urn:schemas-microsoft-com:office:powerpoint\" \
xmlns:v=\"urn:schemas-microsoft-com:vml\" \
xmlns:x=\"urn:schemas-microsoft-com:office:excel\" \
xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" \
xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" \
xmlns:ve=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" \
xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" \
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" \
xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" \
xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" \
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" \
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
xmlns:a14=\"http://schemas.microsoft.com/office/drawing/2010/main\" \
xmlns:pic=\"http://schemas.openxmlformats.org/drawingml/2006/picture\" \
xmlns:xdr=\"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing\" \
mc:Ignorable=\"w14 w15 wp14\">");
std::wstring sEnd(L"</main>");
std::wstring strXml = sBegin + bsXml + sEnd;
@ -2386,6 +2399,25 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
XmlMacroReadAttributeBase(oNodeShape, L"strokecolor", sStrokeColor);
XmlMacroReadAttributeBase(oNodeShape, L"strokeweight", sStrokeWeight);
XmlMacroReadAttributeBase(oNodeShape, L"stroked", sStroked);
XmlUtils::CXmlNode oNodeStroke = oNodeShape.ReadNode(L"v:stroke");
if (oNodeStroke.IsValid())
{
nullable_string sStrokeOn;
XmlMacroReadAttributeBase(oNodeStroke, L"on", sStrokeOn);
if (sStrokeOn.is_init())
{
sStroked.reset();
sStroked = sStrokeOn;
}
nullable_string sStrokeColor1;
XmlMacroReadAttributeBase(oNodeStroke, L"strokecolor", sStrokeColor1);
if (sStrokeColor1.is_init())
{
sStrokeColor1.reset();
sStrokeColor = sStrokeColor1;
}
}
//textFill
strRPr += L"<w14:textFill>";
@ -2533,8 +2565,7 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
strRPr += L"<w14:noFill/>";
bStroked = false;
}
}
}
if (sStrokeColor.is_init())
{
color = NS_DWC_Common::getColorFromString(*sStrokeColor);
@ -4461,9 +4492,21 @@ void CDrawingConverter::CheckPenShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils::
pSpPr->ln->w = size;
pPPTShape->m_bIsStroked = true;
}
XmlUtils::CXmlNode oNodeStroke = oNode.ReadNode(L"v:stroke");
nullable_string sStroked;
XmlMacroReadAttributeBase(oNode, L"stroked", sStroked);
if (oNodeStroke.IsValid())
{
nullable_string sStrokeOn;
XmlMacroReadAttributeBase(oNodeStroke, L"on", sStrokeOn);
if (sStrokeOn.is_init())
{
sStroked.reset();
sStroked = sStrokeOn;
}
}
if (sStroked.is_init())
{
if (*sStroked == L"false" || *sStroked == L"f")
@ -4484,16 +4527,8 @@ void CDrawingConverter::CheckPenShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils::
pSpPr->ln->Fill.Fill = new PPTX::Logic::NoFill();
}
XmlUtils::CXmlNode oNodeStroke = oNode.ReadNode(L"v:stroke");
if (oNodeStroke.IsValid())
{
nullable_string sStrokeOn;
XmlMacroReadAttributeBase(oNodeStroke, L"on", sStrokeOn);
if (sStrokeOn.is_init())
{
sStroked.reset();
sStroked = sStrokeOn;
}
sStrokeColor.reset();
XmlMacroReadAttributeBase(oNodeStroke, L"strokecolor", sStrokeColor);
if (sStrokeColor.is_init())
@ -4809,24 +4844,12 @@ HRESULT CDrawingConverter::SaveObject(LONG lStart, LONG lLength, const std::wstr
oXmlWriter.WriteString(L"<w:drawing>");
oXmlWriter.WriteString(strMainProps);
if (oElem.is<PPTX::Logic::SpTree>())
{
oXmlWriter.WriteString(L"<a:graphic xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\">\
<a:graphicData uri=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\">");
}
else if (oElem.is<PPTX::Logic::Pic>())
{
oXmlWriter.WriteString(L"<a:graphic xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\">\
<a:graphicData uri=\"http://schemas.openxmlformats.org/drawingml/2006/picture\">");
}
else
{
oXmlWriter.WriteString(L"<a:graphic xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\">\
<a:graphicData uri=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\">");
}
std::wstring uri = oElem.GetUriElem();
oXmlWriter.WriteString(L"<a:graphic xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\"><a:graphicData uri=\"" + uri + L"\">");
oElem.toXmlWriter(&oXmlWriter);
oXmlWriter.WriteString(L"</a:graphicData>\
</a:graphic>");
oXmlWriter.WriteString(L"</a:graphicData></a:graphic>");
oXmlWriter.WriteString(strMainPropsTail);
oXmlWriter.WriteString(bIsInline ? L"</wp:inline>" : L"</wp:anchor>");

View File

@ -190,6 +190,7 @@ namespace NSBinPptxRW
#define SPTREE_TYPE_OLE 6
#define SPTREE_TYPE_VIDEO 7
#define SPTREE_TYPE_AUDIO 8
#define SPTREE_TYPE_LOCKED_CANVAS 9
static BYTE SchemeClr_GetBYTECode(const std::wstring& sValue)
{
@ -274,9 +275,9 @@ static std::wstring SchemeClr_GetStringCode(const BYTE& val)
#define XMLWRITER_DOC_TYPE_PPTX 0
#define XMLWRITER_DOC_TYPE_DOCX 1
#define XMLWRITER_DOC_TYPE_XLSX 2
#define XMLWRITER_DOC_TYPE_CHART 3
#define XMLWRITER_DOC_TYPE_WORDART 4
#define XMLWRITER_DOC_TYPE_DOCX_CHILD 5
#define XMLWRITER_DOC_TYPE_CHART 3
#define XMLWRITER_DOC_TYPE_WORDART 4
#define XMLWRITER_DOC_TYPE_GRAPHICS 5
#define XMLWRITER_RECORD_TYPE_SPPR 0
#define XMLWRITER_RECORD_TYPE_CLRMAPOVR 1

View File

@ -717,7 +717,7 @@ namespace NSBinPptxRW
void CBinaryFileWriter::WriteUSHORT(const _UINT16& lValue)
{
CheckBufferSize(UINT16_SIZEOF);
#ifdef _IOS
#if defined(_IOS) || defined(__ANDROID__)
memcpy(m_pStreamCur, &lValue, sizeof(_UINT16));
#else
*((_UINT16*)m_pStreamCur) = lValue; // EXC_ARM_DA_ALIGN on ios
@ -728,7 +728,7 @@ namespace NSBinPptxRW
void CBinaryFileWriter::WriteULONG(const _UINT32& lValue)
{
CheckBufferSize(UINT32_SIZEOF);
#ifdef _IOS
#if defined(_IOS) || defined(__ANDROID__)
memcpy(m_pStreamCur, &lValue, sizeof(_UINT32));
#else
*((_UINT32*)m_pStreamCur) = lValue; // EXC_ARM_DA_ALIGN on ios
@ -739,7 +739,7 @@ namespace NSBinPptxRW
void CBinaryFileWriter::WriteLONG(const _INT32& lValue)
{
CheckBufferSize(INT32_SIZEOF);
#ifdef _IOS
#if defined(_IOS) || defined(__ANDROID__)
memcpy(m_pStreamCur, &lValue, sizeof(_INT32));
#else
*((_INT32*)m_pStreamCur) = lValue; // EXC_ARM_DA_ALIGN on ios
@ -750,7 +750,7 @@ namespace NSBinPptxRW
void CBinaryFileWriter::WriteLONG64(const _INT64& lValue)
{
CheckBufferSize(INT64_SIZEOF);
#ifdef _IOS
#if defined(_IOS) || defined(__ANDROID__)
memcpy(m_pStreamCur, &lValue, sizeof(_INT64));
#else
*((_INT64*)m_pStreamCur) = lValue; // EXC_ARM_DA_ALIGN on ios
@ -761,7 +761,7 @@ namespace NSBinPptxRW
void CBinaryFileWriter::WriteINT(const _INT32& lValue)
{
CheckBufferSize(INT32_SIZEOF);
#ifdef _IOS
#if defined(_IOS) || defined(__ANDROID__)
memcpy(m_pStreamCur, &lValue, sizeof(_INT32));
#else
*((_INT32*)m_pStreamCur) = lValue; // EXC_ARM_DA_ALIGN on ios
@ -794,7 +794,7 @@ namespace NSBinPptxRW
void CBinaryFileWriter::WriteDoubleReal(const double& dValue)
{
CheckBufferSize(DOUBLE_SIZEOF);
#ifdef _IOS
#if defined(_IOS) || defined(__ANDROID__)
memcpy(m_pStreamCur, &dValue, sizeof(double));
#else
*((double*)m_pStreamCur) = dValue; // EXC_ARM_DA_ALIGN on ios
@ -815,7 +815,7 @@ namespace NSBinPptxRW
_UINT32 lSizeMem = lSize * sizeof(char);
CheckBufferSize(UINT32_SIZEOF + lSizeMem);
#ifdef _IOS
#if defined(_IOS) || defined(__ANDROID__)
memcpy(m_pStreamCur, &lSizeMem, sizeof(_UINT32));
#else
*((_UINT32*)m_pStreamCur) = lSizeMem; // EXC_ARM_DA_ALIGN on ios
@ -926,7 +926,7 @@ namespace NSBinPptxRW
{
*pData = (BYTE)m_arMainTables[i].Type;
++pData;
#ifdef _IOS
#if defined(_IOS) || defined(__ANDROID__)
memcpy(pData, &m_arMainTables[i].SeekPos, sizeof(_INT32));
#else
*((_INT32*)pData) = m_arMainTables[i].SeekPos; // EXC_ARM_DA_ALIGN on ios
@ -1661,7 +1661,7 @@ namespace NSBinPptxRW
{
if (m_lPos + 1 >= m_lSize)
return 0;
#ifdef _IOS
#if defined(_IOS) || defined(__ANDROID__)
_UINT16 res = 0;
memcpy(&res, m_pDataCur, sizeof(_UINT16));
#else
@ -1677,7 +1677,7 @@ namespace NSBinPptxRW
{
if (m_lPos + 3 >= m_lSize)
return 0;
#ifdef _IOS
#if defined(_IOS) || defined(__ANDROID__)
_UINT32 res = 0;
memcpy(&res, m_pDataCur, sizeof(_UINT32));
#else
@ -1691,7 +1691,7 @@ namespace NSBinPptxRW
{
if (m_lPos + 7 >= m_lSize)
return 0;
#ifdef _IOS
#if defined(_IOS) || defined(__ANDROID__)
_INT64 res = 0;
memcpy(&res, m_pDataCur, sizeof(_INT64));
#else
@ -1717,7 +1717,7 @@ namespace NSBinPptxRW
{
if (m_lPos + (int)DOUBLE_SIZEOF > m_lSize)
return 0;
#ifdef _IOS
#if defined(_IOS) || defined(__ANDROID__)
double res = 0.0;
memcpy(&res, m_pDataCur, sizeof(double));
#else

View File

@ -192,8 +192,9 @@ namespace PPTX
{
std::wstring namespace_ = m_namespace;
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_ = _T("wps");
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = _T("xdr");
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_ = L"wps";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = L"xdr";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_GRAPHICS)namespace_ = L"a";
pWriter->StartNode(namespace_ + L":cNvCxnSpPr");

View File

@ -143,6 +143,7 @@ namespace PPTX
namespaceLockLink_ = PPTX::g_Namespaces.a.m_strLink;
namespace_ = L"wp";
}
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_GRAPHICS) namespace_ = L"a";
pWriter->StartNode(namespace_ + L":cNvGraphicFramePr");

View File

@ -58,9 +58,10 @@ namespace PPTX
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
std::wstring ns = m_namespace;
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX)
ns = L"xdr";
std::wstring namespace_ = m_namespace;
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = L"xdr";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_GRAPHICS) namespace_ = L"a";
if (!noChangeAspect.is_init() &&
!noGrp.is_init() &&
@ -70,11 +71,11 @@ namespace PPTX
!noSelect.is_init() &&
!noUngrp.is_init())
{
pWriter->WriteString(L"<" + ns + L":cNvGrpSpPr/>");
pWriter->WriteString(L"<" + namespace_ + L":cNvGrpSpPr/>");
return;
}
pWriter->WriteString(L"<" + ns + L":cNvGrpSpPr>");
pWriter->WriteString(L"<" + namespace_ + L":cNvGrpSpPr>");
pWriter->StartNode(_T("a:grpSpLocks"));
@ -90,7 +91,7 @@ namespace PPTX
pWriter->EndNode(_T("a:grpSpLocks"));
pWriter->WriteString(L"</" + ns + L":cNvGrpSpPr>");
pWriter->WriteString(L"</" + namespace_ + L":cNvGrpSpPr>");
}
void toXmlWriter2(const std::wstring& strNS, NSBinPptxRW::CXmlWriter* pWriter) const

View File

@ -169,6 +169,7 @@ namespace PPTX
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_ = L"pic";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = L"xdr";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_GRAPHICS) namespace_ = L"a";
pWriter->StartNode(namespace_ + L":cNvPicPr");

View File

@ -178,8 +178,9 @@ namespace PPTX
{
std::wstring namespace_ = m_namespace;
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_= _T("pic");
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_= _T("xdr");
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_= L"pic";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_= L"xdr";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_GRAPHICS)namespace_= L"a";
toXmlWriter2(namespace_, pWriter);

View File

@ -161,8 +161,9 @@ namespace PPTX
{
std::wstring namespace_ = m_namespace;
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_ = _T("wps");
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = _T("xdr");
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_ = L"wps";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = L"xdr";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_GRAPHICS) namespace_ = L"a";
pWriter->StartNode(namespace_ + L":cNvSpPr");

View File

@ -91,7 +91,8 @@ namespace PPTX
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_ = L"wps";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = L"xdr";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_GRAPHICS)namespace_ = L"a";
pWriter->StartNode(namespace_ + L":cxnSp");
pWriter->EndAttributes();
@ -101,10 +102,9 @@ namespace PPTX
if (style.is_init())
{
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX)
style->m_namespace = _T("wps");
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX)
style->m_namespace = _T("xdr");
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) style->m_namespace = L"wps";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) style->m_namespace = L"xdr";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_GRAPHICS)style->m_namespace = L"a";
pWriter->Write(style);
}

View File

@ -351,14 +351,12 @@ namespace PPTX
nvGraphicFramePr.toXmlWriter(pWriter);
if (xfrm.IsInit() && pWriter->m_lDocType != XMLWRITER_DOC_TYPE_DOCX)
{
std::wstring namespace_ = m_namespace;
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX && pWriter->m_lGroupIndex >= 0) namespace_ = L"xdr";
{
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX && pWriter->m_lGroupIndex >= 0) xfrm->m_ns = L"xdr";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_GRAPHICS) xfrm->m_ns = L"a";
xfrm->m_ns = namespace_;
xfrm->toXmlWriter(pWriter);
}
if (table.is_init())
{
pWriter->WriteString (L"<a:graphic><a:graphicData uri=\"http://schemas.openxmlformats.org/drawingml/2006/table\">");
@ -378,6 +376,7 @@ namespace PPTX
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX && pWriter->m_lGroupIndex >= 0) namespace_ = L"wpg";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX && pWriter->m_lGroupIndex >= 0) namespace_ = L"xdr";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_GRAPHICS) namespace_ = L"a";
pWriter->StartNode(namespace_ + L":graphicFrame");

View File

@ -165,6 +165,7 @@ namespace PPTX
std::wstring namespace_ = m_namespace;
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_ = L"wpg";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = L"xdr";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_GRAPHICS) namespace_ = L"a";
pWriter->StartNode(namespace_ + L":grpSpPr");

View File

@ -109,8 +109,9 @@ namespace PPTX
{
std::wstring namespace_ = m_namespace;
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_ = _T("wps");
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = _T("xdr");
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_ = L"wps";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = L"xdr";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_GRAPHICS)namespace_ = L"a";
pWriter->StartNode(namespace_ + L":nvCxnSpPr");

View File

@ -117,7 +117,7 @@ namespace PPTX
return;
}
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX && pWriter->m_lGroupIndex >= 0)
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX && pWriter->m_lGroupIndex >= 0)
{
pWriter->StartNode(_T("xdr:nvGraphicFramePr"));
pWriter->EndAttributes();
@ -128,15 +128,20 @@ namespace PPTX
pWriter->EndNode(_T("xdr:nvGraphicFramePr"));
return;
}
std::wstring namespace_ = m_namespace;
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_GRAPHICS)
{
namespace_ = L"a";
}
pWriter->StartNode(_T("p:nvGraphicFramePr"));
pWriter->StartNode(namespace_ + L":nvGraphicFramePr");
pWriter->EndAttributes();
cNvPr.toXmlWriter(pWriter);
cNvGraphicFramePr.toXmlWriter(pWriter);
nvPr.toXmlWriter(pWriter);
pWriter->EndNode(_T("p:nvGraphicFramePr"));
pWriter->EndNode(namespace_ + L":nvGraphicFramePr");
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const

View File

@ -79,6 +79,7 @@ namespace PPTX
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_ = L"wpg";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = L"xdr";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_GRAPHICS) namespace_ = L"a";
pWriter->StartNode(namespace_ + L":nvGrpSpPr");

View File

@ -129,6 +129,7 @@ namespace PPTX
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_ = L"pic";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = L"xdr";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_GRAPHICS) namespace_ = L"a";
pWriter->StartNode(namespace_ + L":nvPicPr");

View File

@ -125,8 +125,9 @@ namespace PPTX
{
std::wstring namespace_ = m_namespace;
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_ = _T("wps");
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = _T("xdr");
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_ = L"wps";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = L"xdr";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_GRAPHICS) namespace_ = L"a";
pWriter->StartNode( namespace_ + L":nvSpPr");

View File

@ -752,6 +752,7 @@ namespace PPTX
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = L"xdr";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_ = L"pic";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_GRAPHICS) namespace_ = L"a";
if (pWriter->m_lDocType != XMLWRITER_DOC_TYPE_XLSX &&
pWriter->m_lDocType != XMLWRITER_DOC_TYPE_DOCX)

View File

@ -207,6 +207,7 @@ namespace PPTX
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) name_ = L"wps:wsp";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) name_ = L"xdr:sp";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_GRAPHICS) name_ = L"a:sp";
pWriter->StartNode(name_);
@ -236,21 +237,6 @@ namespace PPTX
pWriter->m_lFlag -= 0x02;
}
if (style.is_init())
{
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) style->m_namespace = _T("wps");
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) style->m_namespace = _T("xdr");
pWriter->Write(style);
}
if (pWriter->m_lDocType != XMLWRITER_DOC_TYPE_DOCX)
{
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX && txBody.is_init())
txBody->m_name = _T("xdr:txBody");
pWriter->Write(txBody);
}
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX)
{
bool bIsWritedBodyPr = false;
@ -279,7 +265,33 @@ namespace PPTX
pWriter->WriteString(_T("<wps:bodyPr rot=\"0\"><a:prstTxWarp prst=\"textNoShape\"><a:avLst/></a:prstTxWarp><a:noAutofit/></wps:bodyPr>"));
}
}
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_GRAPHICS)
{
txBody->m_name = L"a:txBody";
pWriter->StartNode(L"a:txSp");
pWriter->EndAttributes();
pWriter->Write(txBody);
pWriter->WriteString(L"<a:useSpRect/>");
pWriter->EndNode(L"a:txSp");
}
else
{
if (txBody.is_init())
{
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX)
txBody->m_name = L"xdr:txBody";
}
pWriter->Write(txBody);
}
if (style.is_init())
{
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) style->m_namespace = L"wps";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) style->m_namespace = L"xdr";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_GRAPHICS) style->m_namespace = L"a";
pWriter->Write(style);
}
pWriter->EndNode(name_);
}

View File

@ -80,24 +80,22 @@ namespace PPTX
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
std::wstring name_ = L"a:spPr";
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX)
{
if (0 == (pWriter->m_lFlag & 0x01))
pWriter->StartNode(_T("wps:spPr"));
else
pWriter->StartNode(_T("pic:spPr"));
if (0 == (pWriter->m_lFlag & 0x01)) name_ = L"wps:spPr";
else name_ = L"pic:spPr";
}
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX)
pWriter->StartNode(_T("xdr:spPr"));
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_CHART)
pWriter->StartNode(_T("c:spPr"));
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) name_ = L"xdr:spPr";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_CHART) name_ = L"c:spPr";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_GRAPHICS) name_ = L"a:spPr";
else
{
if (0 != (pWriter->m_lFlag & 0x04))//theme
pWriter->StartNode(_T("a:spPr"));
else
pWriter->StartNode(_T("p:spPr"));
{//theme
if (0 != (pWriter->m_lFlag & 0x04)) name_ = L"a:spPr";
else name_ = L"p:spPr";
}
pWriter->StartNode(name_);
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("bwMode"), bwMode);
@ -117,24 +115,7 @@ namespace PPTX
pWriter->Write(scene3d);
pWriter->Write(sp3d);
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX)
{
if (0 == (pWriter->m_lFlag & 0x01))
pWriter->EndNode(_T("wps:spPr"));
else
pWriter->EndNode(_T("pic:spPr"));
}
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX)
pWriter->EndNode(_T("xdr:spPr"));
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_CHART)
pWriter->EndNode(_T("c:spPr"));
else
{
if (0 != (pWriter->m_lFlag & 0x04))//theme
pWriter->EndNode(_T("a:spPr"));
else
pWriter->EndNode(_T("p:spPr"));
}
pWriter->EndNode(name_);
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const

View File

@ -195,12 +195,14 @@ namespace PPTX
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
std::wstring name_;
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX)
{
if (pWriter->m_lGroupIndex == 0) name_ = L"wpg:wgp";
else name_ = L"wpg:grpSp";
}
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) name_ = L"xdr:grpSp";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_GRAPHICS) name_ = L"a:grpSp";
else
{
if (pWriter->m_lGroupIndex == 0) name_ = L"p:spTree";
@ -212,7 +214,7 @@ namespace PPTX
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX)
{
nvGrpSpPr.cNvGrpSpPr.toXmlWriter2(_T("wpg"), pWriter);
nvGrpSpPr.cNvGrpSpPr.toXmlWriter2(L"wpg", pWriter);
}
else
nvGrpSpPr.toXmlWriter(pWriter);
@ -221,8 +223,7 @@ namespace PPTX
pWriter->m_lGroupIndex++;
size_t nCount = SpTreeElems.size();
for (size_t i = 0; i < nCount; ++i)
for (size_t i = 0; i < SpTreeElems.size(); ++i)
SpTreeElems[i].toXmlWriter(pWriter);
pWriter->m_lGroupIndex--;
@ -252,7 +253,10 @@ namespace PPTX
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->StartRecord(SPTREE_TYPE_SPTREE);
if (getType() == OOX::et_lc_LockedCanvas)
pWriter->StartRecord(SPTREE_TYPE_LOCKED_CANVAS);
else
pWriter->StartRecord(SPTREE_TYPE_SPTREE);
pWriter->WriteRecord1(0, nvGrpSpPr);
pWriter->WriteRecord1(1, grpSpPr);
@ -263,7 +267,8 @@ namespace PPTX
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
LONG _end_rec = pReader->GetPos() + pReader->GetLong() + 4;
pReader->Skip(5); // type SPTREE + len
pReader->Skip(5); //+ len
while (pReader->GetPos() < _end_rec)
{
@ -329,11 +334,166 @@ namespace PPTX
nvGrpSpPr.SetParentPointer(this);
grpSpPr.SetParentPointer(this);
size_t count = SpTreeElems.size();
for (size_t i = 0; i < count; ++i)
for (size_t i = 0; i < SpTreeElems.size(); ++i)
SpTreeElems[i].SetParentPointer(this);
}
};
class LockedCanvas : public SpTree
{
public:
WritingElement_AdditionConstructors(LockedCanvas)
LockedCanvas() : SpTree(L"a")
{
}
LockedCanvas& operator=(const LockedCanvas& oSrc)
{
parentFile = oSrc.parentFile;
parentElement = oSrc.parentElement;
nvGrpSpPr = oSrc.nvGrpSpPr;
grpSpPr = oSrc.grpSpPr;
for (size_t i=0; i < oSrc.SpTreeElems.size(); i++)
SpTreeElems.push_back(oSrc.SpTreeElems[i]);
m_lGroupIndex = oSrc.m_lGroupIndex;
return *this;
}
virtual OOX::EElementType getType () const
{
return OOX::et_lc_LockedCanvas;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
SpTree::fromXML(oReader);
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
SpTree::fromXML(node);
}
virtual std::wstring toXML() const
{
XmlUtils::CAttribute oAttr;
oAttr.Write(L"xmlns:lc", L"http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas");
XmlUtils::CNodeValue oValue;
oValue.Write(nvGrpSpPr);
oValue.Write(grpSpPr);
oValue.WriteArray(SpTreeElems);
return XmlUtils::CreateNode(L"lc:lockedCanvas", oAttr, oValue);
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
BYTE lDocType = pWriter->m_lDocType;
pWriter->m_lDocType = XMLWRITER_DOC_TYPE_GRAPHICS;
pWriter->StartNode(L"lc:lockedCanvas");
pWriter->StartAttributes();
pWriter->WriteAttribute(L"xmlns:lc", L"http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas");
pWriter->EndAttributes();
nvGrpSpPr.toXmlWriter(pWriter);
grpSpPr.toXmlWriter(pWriter);
pWriter->m_lGroupIndex++;
for (size_t i = 0; i < SpTreeElems.size(); ++i)
{
SpTreeElems[i].toXmlWriter(pWriter);
}
pWriter->m_lGroupIndex--;
pWriter->EndNode(L"lc:lockedCanvas");
pWriter->m_lDocType = lDocType;
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
BinDocxRW::CDocxSerializer* docx = pWriter->m_pMainDocument;
pWriter->m_pMainDocument = NULL;
pWriter->StartRecord(SPTREE_TYPE_LOCKED_CANVAS);
pWriter->WriteRecord1(0, nvGrpSpPr);
pWriter->WriteRecord1(1, grpSpPr);
pWriter->WriteRecordArray(2, 0, SpTreeElems);
pWriter->EndRecord();
pWriter->m_pMainDocument = docx;
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
LONG _end_rec = pReader->GetPos() + pReader->GetLong() + 4;
pReader->Skip(5); // type + len
BinDocxRW::CDocxSerializer* docx = pReader->m_pMainDocument;
pReader->m_pMainDocument = NULL;
while (pReader->GetPos() < _end_rec)
{
BYTE _at = pReader->GetUChar();
switch (_at)
{
case 0:
{
nvGrpSpPr.fromPPTY(pReader);
break;
}
case 1:
{
grpSpPr.fromPPTY(pReader);
break;
}
case 2:
{
pReader->Skip(4); // len
ULONG _c = pReader->GetULong();
for (ULONG i = 0; i < _c; ++i)
{
pReader->Skip(1); // type (0)
LONG nElemLength = pReader->GetLong(); // len
//SpTreeElem::fromPPTY сразу делает GetChar, а toPPTY ничего не пишет если не инициализирован
if(nElemLength > 0)
{
SpTreeElem elm;
elm.fromPPTY(pReader);
if (elm.is_init())
{
if (elm.getType() == OOX::et_p_ShapeTree)
{
smart_ptr<SpTree> e = elm.GetElem().smart_dynamic_cast<SpTree>();
e->m_lGroupIndex = m_lGroupIndex + 1;
}
SpTreeElems.push_back(elm);
}
}
}
}
default:
{
break;
}
}
}
pReader->Seek(_end_rec);
pReader->m_pMainDocument = docx;
}
};
} // namespace Logic
} // namespace PPTX

View File

@ -89,7 +89,7 @@ namespace PPTX
if (oBlip.blip.is_init() && oBlip.blip->embed.is_init())
{
std::wstring fopacity = _T("");
std::wstring fopacity;
size_t eff_count = oBlip.blip->Effects.size();
for (size_t eff = 0; eff < eff_count; ++eff)
{
@ -108,7 +108,7 @@ namespace PPTX
if (nA > 65536)
nA = 65536;
fopacity = _T(" opacity=\"") + std::to_wstring(nA) + _T("f\"");
fopacity = L" opacity=\"" + std::to_wstring(nA) + L"f\"";
}
break;
}
@ -118,28 +118,28 @@ namespace PPTX
if (bOle || bSignature)
{
strAttr = _T(" filled=\"f\"");
strNode = _T("<v:imagedata r:id=\"") + strId + _T("\" o:title=\"\" />");
strAttr = L" filled=\"f\"";
strNode = L"<v:imagedata r:id=\"" + strId + L"\" o:title=\"\" />";
}
else
{
if (oBlip.tile.is_init())
strNode = _T("<v:fill r:id=\"") + strId + _T("\" o:title=\"\" type=\"tile\"") + fopacity + _T(" />");
strNode = L"<v:fill r:id=\"" + strId + L"\" o:title=\"\" type=\"tile\"" + fopacity + L" />";
else
strNode = _T("<v:fill r:id=\"") + strId + _T("\" o:title=\"\" type=\"frame\"") + fopacity + _T(" />");
strNode = L"<v:fill r:id=\"" + strId + L"\" o:title=\"\" type=\"frame\"" + fopacity + L" />";
}
}
}
else if (fill.is<SolidFill>())
{
ARGB = fill.as<SolidFill>().Color.GetRGBColor(oTheme, oClrMap, ARGB);
strAttr = _T(" fillcolor=\"") + GetHexColor(ARGB) + _T("\"");
strAttr = L" fillcolor=\"" + GetHexColor(ARGB) + L"\"";
BYTE A = (BYTE)((ARGB >> 24) & 0xFF);
if (A != 255)
{
int fopacity = 100 - (int)(((double)A / 255.0) * 65536);
strNode = _T("<v:fill opacity=\"") + std::to_wstring(fopacity) + _T("f\" />");
strNode = L"<v:fill opacity=\"" + std::to_wstring(fopacity) + L"f\" />";
}
}
else if (fill.is<GradFill>())
@ -148,29 +148,29 @@ namespace PPTX
if (oGrad.GsLst.size() > 0)
{
ARGB = oGrad.GsLst[0].color.GetRGBColor(oTheme, oClrMap, ARGB);
strAttr = _T(" fillcolor=\"") + GetHexColor(ARGB) + _T("\"");
strAttr = L" fillcolor=\"" + GetHexColor(ARGB) + L"\"";
BYTE A = (BYTE)((ARGB >> 24) & 0xFF);
if (A != 255)
{
int fopacity = 100 - (int)(((double)A / 255.0) * 65536);
strNode = _T("<v:fill opacity=\"") + std::to_wstring(fopacity) + _T("f\" />");
strNode = L"<v:fill opacity=\"" + std::to_wstring(fopacity) + L"f\" />";
}
}
}
else if (fill.is<NoFill>() || !fill.is_init())
{
strAttr = _T(" filled=\"f\"");
strAttr = L" filled=\"f\"";
}
else
{
strAttr = _T(" fillcolor=\"") + GetHexColor(ARGB) + _T("\"");
strAttr = L" fillcolor=\"" + GetHexColor(ARGB) + L"\"";
BYTE A = (BYTE)((ARGB >> 24) & 0xFF);
if (A != 255)
{
int fopacity = (int)(((double)A / 255.0) * 65536);
strNode = _T("<v:fill opacity=\"") + std::to_wstring(fopacity) + _T("f\" />");
strNode = L"<v:fill opacity=\"" + std::to_wstring(fopacity) + L"f\" />";
}
}
@ -200,10 +200,10 @@ namespace PPTX
if (line.Fill.is<SolidFill>())
{
ARGB = line.Fill.as<SolidFill>().Color.GetRGBColor(oTheme, oClrMap, ARGB);
strAttr = _T(" strokecolor=\"") + GetHexColor(ARGB) + _T("\"");
strAttr = L" strokecolor=\"" + GetHexColor(ARGB) + L"\"";
}
else if (bOle || bSignature)
strAttr = _T(" stroked=\"f\"");
strAttr = L" stroked=\"f\"";
if (line.w.is_init())
{
@ -241,15 +241,17 @@ namespace PPTX
{
std::wstring name = XmlUtils::GetNameNoNS(oReader.GetName());
if (name == _T("sp") || name == _T("wsp"))
if (name == L"sp" || name == L"wsp")
m_elem.reset(new Logic::Shape(oReader));
else if (name == _T("pic"))
else if (name == L"pic")
m_elem.reset(new Logic::Pic(oReader));
else if (name == _T("cxnSp"))
else if (name == L"cxnSp")
m_elem.reset(new Logic::CxnSp(oReader));
else if (name == _T("grpSp") || name == _T("wgp") || name == _T("spTree") || name == _T("lockedCanvas") || name == _T("wpc"))
else if (name == L"lockedCanvas")
m_elem.reset(new Logic::LockedCanvas(oReader));
else if (name == L"grpSp" || name == L"wgp" || name == L"spTree" || name == L"wpc")
m_elem.reset(new Logic::SpTree(oReader));
else if (name == _T("graphicFrame"))
else if (name == L"graphicFrame")
{
Logic::GraphicFrame *pGraphic = new Logic::GraphicFrame(oReader);
@ -258,7 +260,7 @@ namespace PPTX
else
RELEASEOBJECT(pGraphic);
}
else if (name == _T("AlternateContent"))
else if (name == L"AlternateContent")
{
if ( oReader.IsEmptyNode() )
return;
@ -291,21 +293,23 @@ namespace PPTX
{
std::wstring name = XmlUtils::GetNameNoNS(node.GetName());
if (name == _T("sp") || name == _T("wsp"))
if (name == L"sp" || name == L"wsp")
m_elem.reset(new Logic::Shape(node));
else if (name == _T("pic"))
else if (name == L"pic")
m_elem.reset(new Logic::Pic(node));
else if (name == _T("cxnSp"))
else if (name == L"cxnSp")
m_elem.reset(new Logic::CxnSp(node));
else if (name == _T("grpSp") || name == _T("wgp") || name == _T("spTree") || name == _T("lockedCanvas") || name == _T("wpc"))
else if (name == L"lockedCanvas")
m_elem.reset(new Logic::LockedCanvas(node));
else if (name == L"grpSp" || name == L"wgp" || name == L"spTree" || name == L"wpc")
m_elem.reset(new Logic::SpTree(node));
else if (name == _T("graphicFrame"))
else if (name == L"graphicFrame")
m_elem.reset(new Logic::GraphicFrame(node));
else if (name == _T("AlternateContent"))
else if (name == L"AlternateContent")
{
bool isEmpty = true;
XmlUtils::CXmlNode oNodeChoice;
if (node.GetNode(_T("mc:Choice"), oNodeChoice))
if (node.GetNode(L"mc:Choice", oNodeChoice))
{
XmlUtils::CXmlNode oNodeFall;
XmlUtils::CXmlNodes oNodesC;
@ -313,11 +317,11 @@ namespace PPTX
//todo better check (a14 can be math, slicer)
if(oNodeChoice.GetAttributeIfExist(L"Requires", sRequires) && L"a14" == sRequires)
{
oNodeChoice.GetNodes(_T("*"), oNodesC);
oNodeChoice.GetNodes(L"*", oNodesC);
}
else if (node.GetNode(_T("mc:Fallback"), oNodeFall))
else if (node.GetNode(L"mc:Fallback", oNodeFall))
{
oNodeFall.GetNodes(_T("*"), oNodesC);
oNodeFall.GetNodes(L"*", oNodesC);
}
if (1 == oNodesC.GetCount())
{
@ -337,6 +341,30 @@ namespace PPTX
else m_elem.reset();
}
std::wstring SpTreeElem::GetUriElem()
{
if (m_elem.IsInit() == false)
{
return L"";
//return L"http://schemas.microsoft.com/office/word/2010/wordprocessingShape";
}
else if (m_elem->getType() == OOX::et_lc_LockedCanvas)
{
return L"http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas";
}
else if (m_elem->getType() == OOX::et_p_ShapeTree)
{
return L"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup";
}
else if (m_elem->getType() == OOX::et_pic)
{
return L"http://schemas.openxmlformats.org/drawingml/2006/picture";
}
else
{
return L"http://schemas.microsoft.com/office/word/2010/wordprocessingShape";
}
}
void SpTreeElem::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
BYTE _type = pReader->GetUChar();
@ -347,9 +375,8 @@ namespace PPTX
{
Logic::Shape* p = new Logic::Shape();
p->fromPPTY(pReader);
m_elem.reset(p);
break;
}
m_elem.reset(p);
}break;
case SPTREE_TYPE_OLE:
case SPTREE_TYPE_PIC:
case SPTREE_TYPE_AUDIO:
@ -369,16 +396,27 @@ namespace PPTX
}
p->fromPPTY(pReader);
m_elem.reset(p);
break;
}
m_elem.reset(p);
}break;
case SPTREE_TYPE_CXNSP:
{
Logic::CxnSp* p = new Logic::CxnSp();
p->fromPPTY(pReader);
m_elem.reset(p);
break;
}
m_elem.reset(p);
}break;
case SPTREE_TYPE_LOCKED_CANVAS:
{
Logic::LockedCanvas* p = new Logic::LockedCanvas();
pReader->Seek(pReader->GetPos() - 5); // type back + len
p->fromPPTY(pReader);
if (getType() == OOX::et_lc_LockedCanvas)
{
smart_ptr<PPTX::Logic::LockedCanvas> parent = GetElem().smart_dynamic_cast<PPTX::Logic::LockedCanvas>();
p->m_lGroupIndex = parent->m_lGroupIndex + 1;
}
m_elem.reset(p);
}break;
case SPTREE_TYPE_SPTREE:
{
Logic::SpTree* p = new Logic::SpTree();
@ -390,23 +428,19 @@ namespace PPTX
smart_ptr<PPTX::Logic::SpTree> parent = GetElem().smart_dynamic_cast<PPTX::Logic::SpTree>();
p->m_lGroupIndex = parent->m_lGroupIndex + 1;
}
m_elem.reset(p);
break;
}
m_elem.reset(p);
}break;
case SPTREE_TYPE_GRFRAME:
{
Logic::GraphicFrame* pFrame = new Logic::GraphicFrame();
pFrame->fromPPTY(pReader);
m_elem.reset(pFrame);
break;
}
m_elem.reset(pFrame);
}break;
case SPTREE_TYPE_NONE:
{
pReader->SkipRecord();
break;
}
default:
break;
{
pReader->SkipRecord();
}break;
}
}
@ -414,7 +448,7 @@ namespace PPTX
{
if (m_elem.IsInit())
return m_elem->toXML();
return _T("");
return L"";
}
void SpTreeElem::toXmlWriterVML (NSBinPptxRW::CXmlWriter* pWriter, smart_ptr<PPTX::Theme>& oTheme, smart_ptr<PPTX::Logic::ClrMap>& oClrMap, const WCHAR* pId) const
@ -434,6 +468,7 @@ namespace PPTX
if (oPic.IsInit()) oPic->toXmlWriterVML(pWriter, oTheme, oClrMap, pId);
}break;
case OOX::et_p_ShapeTree:
case OOX::et_lc_LockedCanvas:
{
smart_ptr<PPTX::Logic::SpTree> oSpTree = m_elem.smart_dynamic_cast<PPTX::Logic::SpTree>();
if (oSpTree.IsInit()) oSpTree->toXmlWriterVML(pWriter, oTheme, oClrMap, pId);

View File

@ -71,8 +71,7 @@ namespace PPTX
{
m_elem = oSrc.m_elem;
return *this;
}
}
virtual void fromXML(XmlUtils::CXmlNode& node);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
@ -88,6 +87,7 @@ namespace PPTX
m_elem.reset(pElem);
}
virtual void fromPPTY (NSBinPptxRW::CBinaryFileReader* pReader);
virtual void toPPTY (NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
@ -100,7 +100,8 @@ namespace PPTX
if (m_elem.is_init())
m_elem->toXmlWriter(pWriter);
}
std::wstring GetUriElem();
smart_ptr<WrapperWritingElement> GetElem()
{
return m_elem;

View File

@ -19,7 +19,6 @@
17C1FCB71ACC429D006B99B3 /* CxnSp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 179A44361AC57B83005A27F7 /* CxnSp.cpp */; };
17C1FCB81ACC429D006B99B3 /* Hyperlink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 179A44771AC57B83005A27F7 /* Hyperlink.cpp */; };
17C1FCB91ACC429D006B99B3 /* SpPr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 179A44B11AC57B83005A27F7 /* SpPr.cpp */; };
17C1FCBA1ACC429D006B99B3 /* TableCell.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 179A44BC1AC57B83005A27F7 /* TableCell.cpp */; };
17C1FCBB1ACC429D006B99B3 /* FileFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 179A43A11AC57B83005A27F7 /* FileFactory.cpp */; };
17C1FCBC1ACC429D006B99B3 /* pptxformatlib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 179A43681AC57B46005A27F7 /* pptxformatlib.cpp */; };
17C1FCBD1ACC429D006B99B3 /* TxBody.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 179A45091AC57B83005A27F7 /* TxBody.cpp */; };
@ -831,6 +830,13 @@
696791821D9E8B81002CA4BA /* MathParaWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 696791801D9E8B81002CA4BA /* MathParaWrapper.cpp */; };
696791831D9E8B81002CA4BA /* MathParaWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 696791811D9E8B81002CA4BA /* MathParaWrapper.h */; };
697DFC1E200F51A700F0A9AF /* WavAudioFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 697DFC1D200F51A600F0A9AF /* WavAudioFile.cpp */; };
8A35A6FF215E612C005CC806 /* xmlutils.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A35A6FE215E612B005CC806 /* xmlutils.h */; };
8A35A701215E6194005CC806 /* xmldom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A35A700215E6194005CC806 /* xmldom.cpp */; };
8A35A706215E61BE005CC806 /* xmllight_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A35A703215E61BE005CC806 /* xmllight_private.h */; };
8A35A707215E61BE005CC806 /* xmllight.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A35A704215E61BE005CC806 /* xmllight.cpp */; };
8A35A709215E622B005CC806 /* BlipFill.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A35A708215E622B005CC806 /* BlipFill.cpp */; };
8A35A70B215E626D005CC806 /* UniFill.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A35A70A215E626D005CC806 /* UniFill.cpp */; };
8A35A70D215E62D0005CC806 /* TableCell.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A35A70C215E62D0005CC806 /* TableCell.cpp */; };
8A9FACE120777BA7007787F6 /* Structures.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A9FACE020777BA7007787F6 /* Structures.h */; };
/* End PBXBuildFile section */
@ -1109,7 +1115,6 @@
179A44B81AC57B83005A27F7 /* SupplementalFont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SupplementalFont.h; sourceTree = "<group>"; };
179A44B91AC57B83005A27F7 /* Tab.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tab.h; sourceTree = "<group>"; };
179A44BB1AC57B83005A27F7 /* Table.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Table.h; sourceTree = "<group>"; };
179A44BC1AC57B83005A27F7 /* TableCell.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TableCell.cpp; sourceTree = "<group>"; };
179A44BD1AC57B83005A27F7 /* TableCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableCell.h; sourceTree = "<group>"; };
179A44BE1AC57B83005A27F7 /* TableCellProperties.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableCellProperties.h; sourceTree = "<group>"; };
179A44BF1AC57B83005A27F7 /* TableCol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableCol.h; sourceTree = "<group>"; };
@ -1662,6 +1667,13 @@
696791801D9E8B81002CA4BA /* MathParaWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathParaWrapper.cpp; sourceTree = "<group>"; };
696791811D9E8B81002CA4BA /* MathParaWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathParaWrapper.h; sourceTree = "<group>"; };
697DFC1D200F51A600F0A9AF /* WavAudioFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WavAudioFile.cpp; sourceTree = "<group>"; };
8A35A6FE215E612B005CC806 /* xmlutils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = xmlutils.h; path = ../../../DesktopEditor/xml/include/xmlutils.h; sourceTree = "<group>"; };
8A35A700215E6194005CC806 /* xmldom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = xmldom.cpp; path = ../../../DesktopEditor/xml/src/xmldom.cpp; sourceTree = "<group>"; };
8A35A703215E61BE005CC806 /* xmllight_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = xmllight_private.h; path = ../../../DesktopEditor/xml/src/xmllight_private.h; sourceTree = "<group>"; };
8A35A704215E61BE005CC806 /* xmllight.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = xmllight.cpp; path = ../../../DesktopEditor/xml/src/xmllight.cpp; sourceTree = "<group>"; };
8A35A708215E622B005CC806 /* BlipFill.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BlipFill.cpp; sourceTree = "<group>"; };
8A35A70A215E626D005CC806 /* UniFill.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UniFill.cpp; sourceTree = "<group>"; };
8A35A70C215E62D0005CC806 /* TableCell.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TableCell.cpp; sourceTree = "<group>"; };
8A9FACE020777BA7007787F6 /* Structures.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Structures.h; path = Drawing/Structures.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
@ -1679,6 +1691,7 @@
17063B5A1AC5708E0056A3F1 = {
isa = PBXGroup;
children = (
8A35A6FD215E6124005CC806 /* XmlUtils */,
695BC0221C070DCB00817D7E /* HtmlRenderer */,
175CC2441AC96AA0007D7DEC /* OfficeDrawing */,
17D91A141AC5A4DF0096D788 /* Editor */,
@ -1983,14 +1996,15 @@
179A44CC1AC57B83005A27F7 /* TextSpacing.h */,
179A44CD1AC57B83005A27F7 /* Timing */,
179A44FA1AC57B83005A27F7 /* Transitions */,
179A45091AC57B83005A27F7 /* TxBody.cpp */,
179A450A1AC57B83005A27F7 /* TxBody.h */,
179A45091AC57B83005A27F7 /* TxBody.cpp */,
179A450B1AC57B83005A27F7 /* TxStyles.h */,
179A450C1AC57B83005A27F7 /* UniColor.cpp */,
179A450D1AC57B83005A27F7 /* UniColor.h */,
179A450E1AC57B83005A27F7 /* UniEffect.cpp */,
179A450F1AC57B83005A27F7 /* UniEffect.h */,
179A450E1AC57B83005A27F7 /* UniEffect.cpp */,
179A45101AC57B83005A27F7 /* UniFill.h */,
8A35A70A215E626D005CC806 /* UniFill.cpp */,
179A45111AC57B83005A27F7 /* UniMedia.h */,
179A45121AC57B83005A27F7 /* UniPath2D.h */,
179A45131AC57B83005A27F7 /* Xfrm.h */,
@ -2076,6 +2090,7 @@
179A44611AC57B83005A27F7 /* Blip.cpp */,
179A44621AC57B83005A27F7 /* Blip.h */,
179A44631AC57B83005A27F7 /* BlipFill.h */,
8A35A708215E622B005CC806 /* BlipFill.cpp */,
179A44641AC57B83005A27F7 /* GradFill.h */,
179A44651AC57B83005A27F7 /* NoFill.h */,
179A44661AC57B83005A27F7 /* PattFill.h */,
@ -2128,8 +2143,8 @@
isa = PBXGroup;
children = (
179A44BB1AC57B83005A27F7 /* Table.h */,
179A44BC1AC57B83005A27F7 /* TableCell.cpp */,
179A44BD1AC57B83005A27F7 /* TableCell.h */,
8A35A70C215E62D0005CC806 /* TableCell.cpp */,
179A44BE1AC57B83005A27F7 /* TableCellProperties.h */,
179A44BF1AC57B83005A27F7 /* TableCol.h */,
179A44C01AC57B83005A27F7 /* TableProperties.h */,
@ -2737,6 +2752,17 @@
path = OOXMLShapes;
sourceTree = "<group>";
};
8A35A6FD215E6124005CC806 /* XmlUtils */ = {
isa = PBXGroup;
children = (
8A35A6FE215E612B005CC806 /* xmlutils.h */,
8A35A703215E61BE005CC806 /* xmllight_private.h */,
8A35A704215E61BE005CC806 /* xmllight.cpp */,
8A35A700215E6194005CC806 /* xmldom.cpp */,
);
name = XmlUtils;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
@ -3230,6 +3256,7 @@
69656E411FC2FF800028C4BA /* QuadArrowCalloutType.h in Headers */,
17C1FDE51ACC429D006B99B3 /* OuterShdw.h in Headers */,
69656E5F1FC2FF800028C4BA /* WaveType.h in Headers */,
8A35A6FF215E612C005CC806 /* xmlutils.h in Headers */,
17C1FDE61ACC429D006B99B3 /* PPTXEvent.h in Headers */,
69656ED01FC2FF800028C4BA /* CHeptagon.h in Headers */,
69656EF71FC2FF800028C4BA /* CQuadArrowCallout.h in Headers */,
@ -3380,6 +3407,7 @@
17C1FE401ACC429D006B99B3 /* Conformance.h in Headers */,
17C1FE411ACC429D006B99B3 /* TLColorSpace.h in Headers */,
69656E5C1FC2FF800028C4BA /* UturnArrowType.h in Headers */,
8A35A706215E61BE005CC806 /* xmllight_private.h in Headers */,
69656EFF1FC2FF800028C4BA /* CRound1Rect.h in Headers */,
69656EA21FC2FF800028C4BA /* CDiagStripe.h in Headers */,
17C1FE421ACC429D006B99B3 /* Sld.h in Headers */,
@ -3588,8 +3616,8 @@
17C1FCB91ACC429D006B99B3 /* SpPr.cpp in Sources */,
695BBFF81C06FFA100817D7E /* TextAttributesEx.cpp in Sources */,
17C1E3E11AD40612001E3D18 /* Controls.cpp in Sources */,
17C1FCBA1ACC429D006B99B3 /* TableCell.cpp in Sources */,
17C1FCBB1ACC429D006B99B3 /* FileFactory.cpp in Sources */,
8A35A709215E622B005CC806 /* BlipFill.cpp in Sources */,
17C1FCBC1ACC429D006B99B3 /* pptxformatlib.cpp in Sources */,
17C1FCBD1ACC429D006B99B3 /* TxBody.cpp in Sources */,
697DFC1E200F51A700F0A9AF /* WavAudioFile.cpp in Sources */,
@ -3602,8 +3630,10 @@
17C1FCC51ACC429D006B99B3 /* Shape.cpp in Sources */,
17C1FCC71ACC429D006B99B3 /* BuildNodeBase.cpp in Sources */,
17C1FCC81ACC429D006B99B3 /* ContentPart.cpp in Sources */,
8A35A707215E61BE005CC806 /* xmllight.cpp in Sources */,
69656F501FC2FF800028C4BA /* PptxShape.cpp in Sources */,
69656E631FC2FF800028C4BA /* PptFormula.cpp in Sources */,
8A35A70D215E62D0005CC806 /* TableCell.cpp in Sources */,
17C1FCC91ACC429D006B99B3 /* CNvGrpSpPr.cpp in Sources */,
17C1FCCA1ACC429D006B99B3 /* EffectStyle.cpp in Sources */,
17C1FCCB1ACC429D006B99B3 /* UniColor.cpp in Sources */,
@ -3615,6 +3645,7 @@
17C1FCD11ACC429D006B99B3 /* Bg.cpp in Sources */,
17C1FCD21ACC429D006B99B3 /* Folder.cpp in Sources */,
17C1FCD31ACC429D006B99B3 /* BinaryFileReaderWriter.cpp in Sources */,
8A35A701215E6194005CC806 /* xmldom.cpp in Sources */,
17C1FCD41ACC429D006B99B3 /* TimeNodeBase.cpp in Sources */,
17C1FCD51ACC429D006B99B3 /* GraphicFrame.cpp in Sources */,
69656E651FC2FF800028C4BA /* PptShape.cpp in Sources */,
@ -3623,6 +3654,7 @@
17C1FCD81ACC429D006B99B3 /* UniEffect.cpp in Sources */,
17C1FCDA1ACC429D006B99B3 /* Pic.cpp in Sources */,
17C1FCDB1ACC429D006B99B3 /* NvGraphicFramePr.cpp in Sources */,
8A35A70B215E626D005CC806 /* UniFill.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -3738,20 +3770,9 @@
GCC_PREPROCESSOR_DEFINITIONS = (
UNICODE,
_UNICODE,
_USE_LIBXML2_READER_,
_USE_XMLLITE_READER_,
USE_LITE_READER,
PPTX_DEF,
PPT_DEF,
ENABLE_PPT_TO_PPTX_CONVERT,
DONT_WRITE_EMBEDDED_FONTS,
AVS_USE_CONVERT_PPTX_TOCUSTOM_VML,
NODOCX,
CXIMAGE_DONT_DECLARE_TCHAR,
BUILD_CONFIG_FULL_VERSION,
DONT_WRITE_EMBEDDED_FONTS,
CXIMAGE_DONT_DECLARE_TCHAR,
_IOS,
DONT_WRITE_EMBEDDED_FONTS,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
HEADER_SEARCH_PATHS = (
@ -3780,20 +3801,9 @@
GCC_PREPROCESSOR_DEFINITIONS = (
UNICODE,
_UNICODE,
_USE_LIBXML2_READER_,
_USE_XMLLITE_READER_,
USE_LITE_READER,
PPTX_DEF,
PPT_DEF,
ENABLE_PPT_TO_PPTX_CONVERT,
DONT_WRITE_EMBEDDED_FONTS,
AVS_USE_CONVERT_PPTX_TOCUSTOM_VML,
NODOCX,
CXIMAGE_DONT_DECLARE_TCHAR,
BUILD_CONFIG_FULL_VERSION,
DONT_WRITE_EMBEDDED_FONTS,
CXIMAGE_DONT_DECLARE_TCHAR,
_IOS,
DONT_WRITE_EMBEDDED_FONTS,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
HEADER_SEARCH_PATHS = (

View File

@ -86,7 +86,6 @@
6967B1561E27B4B800A129E2 /* OOXParagraphElementReaders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OOXParagraphElementReaders.cpp; sourceTree = "<group>"; };
6967B1571E27B4B800A129E2 /* OOXParagraphReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOXParagraphReader.h; sourceTree = "<group>"; };
6967B1581E27B4B800A129E2 /* OOXPictureAnchorReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOXPictureAnchorReader.h; sourceTree = "<group>"; };
6967B1591E27B4B800A129E2 /* OOXPictureGraphicReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOXPictureGraphicReader.h; sourceTree = "<group>"; };
6967B15A1E27B4B800A129E2 /* OOXPictureInlineReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOXPictureInlineReader.h; sourceTree = "<group>"; };
6967B15B1E27B4B800A129E2 /* OOXPictureReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOXPictureReader.h; sourceTree = "<group>"; };
6967B15C1E27B4B800A129E2 /* OOXpPrFrameReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOXpPrFrameReader.h; sourceTree = "<group>"; };
@ -241,7 +240,6 @@
6967B1561E27B4B800A129E2 /* OOXParagraphElementReaders.cpp */,
6967B1571E27B4B800A129E2 /* OOXParagraphReader.h */,
6967B1581E27B4B800A129E2 /* OOXPictureAnchorReader.h */,
6967B1591E27B4B800A129E2 /* OOXPictureGraphicReader.h */,
6967B15A1E27B4B800A129E2 /* OOXPictureInlineReader.h */,
6967B15B1E27B4B800A129E2 /* OOXPictureReader.h */,
6967B15C1E27B4B800A129E2 /* OOXpPrFrameReader.h */,
@ -574,21 +572,14 @@
GCC_PREPROCESSOR_DEFINITIONS = (
UNICODE,
_UNICODE,
_USE_LIBXML2_READER_,
LINUX,
_USE_XMLLITE_READER_,
USE_LITE_READER,
PPT_DEF,
_IOS,
DONT_WRITE_EMBEDDED_FONTS,
AVS_USE_CONVERT_PPTX_TOCUSTOM_VML,
_XCODE,
_IOS,
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
/usr/include/,
/usr/include/libxml2/,
/usr/include/libxml2,
"$(PROJECT_DIR)/../../../Common/3dParty/boost/boost_1_58_0",
"$(PROJECT_DIR)/../../../DesktopEditor",
"$(PROJECT_DIR)/../../../DesktopEditor/freetype-2.5.2/include",
@ -608,21 +599,14 @@
GCC_PREPROCESSOR_DEFINITIONS = (
UNICODE,
_UNICODE,
_USE_LIBXML2_READER_,
LINUX,
_USE_XMLLITE_READER_,
USE_LITE_READER,
PPT_DEF,
_IOS,
DONT_WRITE_EMBEDDED_FONTS,
AVS_USE_CONVERT_PPTX_TOCUSTOM_VML,
_XCODE,
_IOS,
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
/usr/include/,
/usr/include/libxml2/,
/usr/include/libxml2,
"$(PROJECT_DIR)/../../../Common/3dParty/boost/boost_1_58_0",
"$(PROJECT_DIR)/../../../DesktopEditor",
"$(PROJECT_DIR)/../../../DesktopEditor/freetype-2.5.2/include",

View File

@ -42,7 +42,8 @@ int OOXGraphicReader::Parse( ReaderParameter oParam , RtfShapePtr & pOutput)
if (m_ooxGraphic->element.is_init())
{
if (m_ooxGraphic->element.getType() == OOX::et_p_ShapeTree)
if (m_ooxGraphic->element.getType() == OOX::et_p_ShapeTree ||
m_ooxGraphic->element.getType() == OOX::et_lc_LockedCanvas)
{
OOXShapeGroupReader groupReader(dynamic_cast<PPTX::Logic::SpTree*>(m_ooxGraphic->element.GetElem().operator->()));
return (groupReader.Parse(oParam, pOutput) ? 1 : 0);

View File

@ -1924,7 +1924,8 @@ bool OOXShapeGroupReader::Parse( ReaderParameter oParam , RtfShapePtr& pOutput)
for (size_t i = 0; i < m_ooxGroup->SpTreeElems.size() ; i++ )
{
if (m_ooxGroup->SpTreeElems[i].getType() == OOX::et_p_ShapeTree)
if (m_ooxGroup->SpTreeElems[i].getType() == OOX::et_p_ShapeTree ||
m_ooxGroup->SpTreeElems[i].getType() == OOX::et_lc_LockedCanvas)
{
RtfShapePtr pNewShape( new RtfShape() );
pNewShape->m_bIsGroup = true;

View File

@ -14,6 +14,7 @@
6967AFE91E279C6F00A129E2 /* ToString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6967AFE51E279C6F00A129E2 /* ToString.cpp */; };
6967AFF01E279C7700A129E2 /* File.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6967AFEB1E279C7700A129E2 /* File.cpp */; };
6967AFF11E279C7700A129E2 /* TxtFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6967AFED1E279C7700A129E2 /* TxtFile.cpp */; };
8AB24C012130055700E80DDD /* SystemUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AB24C002130055700E80DDD /* SystemUtils.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@ -49,6 +50,8 @@
6967AFED1E279C7700A129E2 /* TxtFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TxtFile.cpp; sourceTree = "<group>"; };
6967AFEE1E279C7700A129E2 /* TxtFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TxtFile.h; sourceTree = "<group>"; };
6967AFEF1E279C7700A129E2 /* TxtFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TxtFormat.h; sourceTree = "<group>"; };
8AB24BFF2130055700E80DDD /* SystemUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SystemUtils.h; path = ../../../../DesktopEditor/common/SystemUtils.h; sourceTree = "<group>"; };
8AB24C002130055700E80DDD /* SystemUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SystemUtils.cpp; path = ../../../../DesktopEditor/common/SystemUtils.cpp; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -104,6 +107,8 @@
6967AFE51E279C6F00A129E2 /* ToString.cpp */,
6967AFE61E279C6F00A129E2 /* ToString.h */,
6967AFE71E279C6F00A129E2 /* Utility.h */,
8AB24C002130055700E80DDD /* SystemUtils.cpp */,
8AB24BFF2130055700E80DDD /* SystemUtils.h */,
);
name = Common;
path = ../../../Source/Common;
@ -186,6 +191,7 @@
6967AFD61E2798DB00A129E2 /* TxtXmlFile.cpp in Sources */,
6967AFF01E279C7700A129E2 /* File.cpp in Sources */,
6967AFD51E2798DB00A129E2 /* ConvertTxt2Docx.cpp in Sources */,
8AB24C012130055700E80DDD /* SystemUtils.cpp in Sources */,
6967AFD41E2798DB00A129E2 /* ConvertDocx2Txt.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -304,10 +310,6 @@
GCC_PREPROCESSOR_DEFINITIONS = (
UNICODE,
_UNICODE,
_USE_LIBXML2_READER_,
_USE_XMLLITE_READER_,
USE_LITE_READER,
LIBXML_READER_ENABLED,
MAC,
unix,
_IOS,
@ -316,8 +318,7 @@
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
/usr/include/,
/usr/include/libxml2/,
/usr/include/libxml2,
"$(PROJECT_DIR)/../../../../Common/3dParty/boost/boost_1_58_0",
"$(PROJECT_DIR)/../../../../DesktopEditor/xml/libxml2/include",
"$(PROJECT_DIR)/../../../../DesktopEditor/freetype-2.5.2/include",
@ -335,10 +336,6 @@
GCC_PREPROCESSOR_DEFINITIONS = (
UNICODE,
_UNICODE,
_USE_LIBXML2_READER_,
_USE_XMLLITE_READER_,
USE_LITE_READER,
LIBXML_READER_ENABLED,
MAC,
unix,
_IOS,
@ -347,8 +344,7 @@
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
/usr/include/,
/usr/include/libxml2/,
/usr/include/libxml2,
"$(PROJECT_DIR)/../../../../Common/3dParty/boost/boost_1_58_0",
"$(PROJECT_DIR)/../../../../DesktopEditor/xml/libxml2/include",
"$(PROJECT_DIR)/../../../../DesktopEditor/freetype-2.5.2/include",

View File

@ -708,7 +708,7 @@ NAMESPACE_END
// ***************** Miscellaneous ********************
// Nearly all Intel's and AMD's have SSE. Enable it independent of SSE ASM and intrinscs
#if (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64) && !defined(CRYPTOPP_DISABLE_ASM) && !defined(_IOS)
#if (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64) && !defined(CRYPTOPP_DISABLE_ASM) && !(defined(_IOS) || defined(__ANDROID__))
#define CRYPTOPP_BOOL_ALIGN16 1
#else
#define CRYPTOPP_BOOL_ALIGN16 0

View File

@ -1231,9 +1231,6 @@
GCC_PREPROCESSOR_DEFINITIONS = (
UNICODE,
_UNICODE,
_USE_LIBXML2_READER_,
_USE_XMLLITE_READER_,
USE_LITE_READER,
MAC,
unix,
_IOS,
@ -1245,7 +1242,7 @@
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
/usr/include/,
/usr/include/libxml2/,
/usr/include/libxml2,
"$(PROJECT_DIR)/../../../UnicodeConverter/icubuilds/mac/icu/**",
"$(PROJECT_DIR)/../../../UnicodeConverter/icubuilds/mac/icu/icu/common",
"$(PROJECT_DIR)/../../../UnicodeConverter/icubuilds/mac/icu/icu/i18n",
@ -1273,9 +1270,6 @@
GCC_PREPROCESSOR_DEFINITIONS = (
UNICODE,
_UNICODE,
_USE_LIBXML2_READER_,
_USE_XMLLITE_READER_,
USE_LITE_READER,
MAC,
unix,
_IOS,
@ -1287,7 +1281,7 @@
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
/usr/include/,
/usr/include/libxml2/,
/usr/include/libxml2,
"$(PROJECT_DIR)/../../../UnicodeConverter/icubuilds/mac/icu/**",
"$(PROJECT_DIR)/../../../UnicodeConverter/icubuilds/mac/icu/icu/common",
"$(PROJECT_DIR)/../../../UnicodeConverter/icubuilds/mac/icu/icu/i18n",

View File

@ -165,6 +165,10 @@ namespace SimpleTypes
{
return (long)Pt_To_Dx(m_dValue);
}
long ToHps() const
{
return (long)(m_dValue * 2);
}
unsigned long ToUnsignedTwips() const
{
return (unsigned long)Pt_To_Dx(m_dValue);

View File

@ -4884,11 +4884,11 @@ namespace SimpleTypes
enum EShd
{
shdClear = 0,
shdDiagCross = 1,
shdDiagStripe = 2,
shdHorzCross = 3,
shdHorzStripe = 4,
shdNil = 5,
shdNil = 1,
shdDiagCross = 2,
shdDiagStripe = 3,
shdHorzCross = 4,
shdHorzStripe = 5,
shdPct10 = 6,
shdPct12 = 7,
shdPct15 = 8,

View File

@ -357,6 +357,8 @@ namespace OOX
et_dsp_cNvPr,
et_dsp_txXfrm,
et_lc_LockedCanvas, // <lc:lockedCanvas>
et_graphicFrame, // <...:graphicFrame>
et_pic, // <...:pic>
et_cxnSp, // <...:cxnSp>

View File

@ -29,6 +29,11 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#ifdef __ANDROID__
#include <gcvt.h>
#endif
#include "CommonInclude.h"
#include "Common.h"

View File

@ -991,10 +991,10 @@ namespace NSEditorApi
js_wrapper<int> m_nTransitionType;
js_wrapper<int> m_nTransitionOption;
js_wrapper<int> m_nTransitionDuration;
js_wrapper<int> m_nSlideAdvanceDuration;
js_wrapper<bool> m_bSlideAdvanceOnMouseClick;
js_wrapper<bool> m_bSlideAdvanceAfter;
js_wrapper<bool> m_bSlideAdvanceDuration;
js_wrapper<bool> m_bShowLoop;
public:
@ -1007,10 +1007,10 @@ namespace NSEditorApi
LINK_PROPERTY_INT_JS(TransitionType)
LINK_PROPERTY_INT_JS(TransitionOption)
LINK_PROPERTY_INT_JS(TransitionDuration)
LINK_PROPERTY_INT_JS(SlideAdvanceDuration)
LINK_PROPERTY_BOOL_JS(SlideAdvanceOnMouseClick)
LINK_PROPERTY_BOOL_JS(SlideAdvanceAfter)
LINK_PROPERTY_BOOL_JS(SlideAdvanceDuration)
LINK_PROPERTY_BOOL_JS(ShowLoop)
};

View File

@ -548,6 +548,10 @@
#define shd_Clear 0
#define shd_Nil 1
#define c_oAscHyperlinkType_InternalLink 0
#define c_oAscHyperlinkType_WebLink 1
#define c_oAscHyperlinkType_RangeLink 2
#define c_oAscContextMenuTypes_Common 0 // Обычное контекстное меню
#define c_oAscContextMenuTypes_ChangeHdrFtr 1 // Специальное контестное меню для попадания в колонтитул
@ -690,6 +694,7 @@
#define ASC_MENU_EVENT_TYPE_SECTION 17
#define ASC_MENU_EVENT_TYPE_SHAPE 18
#define ASC_MENU_EVENT_TYPE_SLIDE 20
#define ASC_MENU_EVENT_TYPE_CHART 21
// insert commands
#define ASC_MENU_EVENT_TYPE_INSERT_IMAGE 50
@ -748,6 +753,7 @@
#define ASC_MENU_EVENT_TYPE_USER_ZOOM 301
#define ASC_MENU_EVENT_TYPE_INSERT_CHART 400
#define ASC_MENU_EVENT_TYPE_ADD_CHART_DATA 440
#define ASC_MENU_EVENT_TYPE_GET_CHART_DATA 450
#define ASC_MENU_EVENT_TYPE_SET_CHART_DATA 460
@ -758,6 +764,8 @@
#define ASC_MENU_EVENT_TYPE_COLOR_SCHEMES 2404 // CAscColorSchemes
#define ASC_MENU_EVENT_TYPE_CHANGE_COLOR_SCHEME 2415 // SET(int)
#define ASC_MENU_EVENT_TYPE_GO_TO_INTERNAL_LINK 5000
#define ASC_SOCKET_EVENT_TYPE_OPEN 10000
#define ASC_SOCKET_EVENT_TYPE_ON_CLOSE 10010
#define ASC_SOCKET_EVENT_TYPE_MESSAGE 10020

View File

@ -10,6 +10,10 @@
* Copyright 1997-2007 by Dave Coffin, dcoffin a cybercom o net
*/
#ifdef __ANDROID__
#include <swab.h>
#endif
#include "ximaraw.h"
#include "../../common/File.h"

View File

@ -0,0 +1,60 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "doctrenderer.h"
#include "docbuilder.h"
#ifdef BOOL
#undef BOOL
#endif
#include <iostream>
namespace NSDoctRenderer
{
CDoctrenderer::CDoctrenderer(const std::wstring& sAllFontsPath) {}
CDoctrenderer::~CDoctrenderer() {}
bool CDoctrenderer::Execute(const std::wstring& strXml, std::wstring& strError)
{
return false;
}
std::vector<std::wstring> CDoctrenderer::GetImagesInChanges()
{
std::vector<std::wstring> stub;
return stub;
}
void CDocBuilder::Dispose() {}
}

View File

@ -35,6 +35,10 @@
#include "../common/Types.h"
#include "../common/File.h"
#ifdef GetCharWidth
#undef GetCharWidth
#endif
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif

View File

@ -29,6 +29,11 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#ifdef __ANDROID__
#include <pthread_setcanceltype.h>
#endif
#include "./BaseThread.h"
#if defined(_WIN32) || defined(_WIN64) ||defined(_WIN32_WCE)

View File

@ -84,7 +84,7 @@ public:
{
}
Aggplus::CImage* GetImage()
virtual Aggplus::CImage* GetImage()
{
return &m_oImage;
}

View File

@ -35,6 +35,7 @@
#include "../../common/Types.h"
#include "./Fonts.h"
#include "./../IRenderer.h"
#include "./../Image.h"
namespace NSImages
{
@ -43,6 +44,8 @@ namespace NSImages
public:
ICacheImage() : NSBase::CBaseRefCounter() {}
virtual ~ICacheImage() {}
virtual Aggplus::CImage* GetImage() { return NULL; }
};
namespace NSCacheImage

View File

@ -51,6 +51,7 @@
8ABC65A3208A1EFA00E96FFE /* pro_Image.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8ABC65A2208A1EFA00E96FFE /* pro_Image.cpp */; };
8ABC65A5208A1F1B00E96FFE /* pro_Fonts.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8ABC65A4208A1F1B00E96FFE /* pro_Fonts.cpp */; };
8ABC65A7208A1F3A00E96FFE /* MetafileToRenderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8ABC65A6208A1F3A00E96FFE /* MetafileToRenderer.cpp */; };
8ADE001421302B3600BFAD8C /* SystemUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8ADE001321302B3600BFAD8C /* SystemUtils.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@ -129,6 +130,8 @@
8ABC65A2208A1EFA00E96FFE /* pro_Image.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = pro_Image.cpp; path = ../../graphics/pro/pro_Image.cpp; sourceTree = "<group>"; };
8ABC65A4208A1F1B00E96FFE /* pro_Fonts.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = pro_Fonts.cpp; path = ../../graphics/pro/pro_Fonts.cpp; sourceTree = "<group>"; };
8ABC65A6208A1F3A00E96FFE /* MetafileToRenderer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MetafileToRenderer.cpp; path = ../../graphics/MetafileToRenderer.cpp; sourceTree = "<group>"; };
8ADE001221302B3600BFAD8C /* SystemUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SystemUtils.h; path = ../../common/SystemUtils.h; sourceTree = "<group>"; };
8ADE001321302B3600BFAD8C /* SystemUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SystemUtils.cpp; path = ../../common/SystemUtils.cpp; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -145,11 +148,13 @@
1791A2181BAC19C600FC9C28 /* PdfWriter */ = {
isa = PBXGroup;
children = (
698AF5031C0766200080D889 /* unicode_util.cpp */,
698AF5041C0766200080D889 /* unicode_util.h */,
698AF5031C0766200080D889 /* unicode_util.cpp */,
7C560FF01AA71C5C000E5860 /* AscEditorPDFPrinter.h */,
7C560FFB1AA73B7D000E5860 /* AscEditorPDFPrinter.mm */,
8A7E89E020E6211000E06CBE /* ICCProfile.h */,
8ADE001221302B3600BFAD8C /* SystemUtils.h */,
8ADE001321302B3600BFAD8C /* SystemUtils.cpp */,
17FFC2C11BAB15CE00D91F59 /* PdfRenderer.h */,
17FFC2C01BAB15CE00D91F59 /* PdfRenderer.cpp */,
17FFC2C41BAB163500D91F59 /* OnlineOfficeBinToPdf.h */,
@ -322,6 +327,7 @@
176285F11BAAFC3B00AEDA07 /* Font.cpp in Sources */,
176285F21BAAFC3B00AEDA07 /* Font14.cpp in Sources */,
176E57401BB0057700276C19 /* ImageFileFormatChecker.cpp in Sources */,
8ADE001421302B3600BFAD8C /* SystemUtils.cpp in Sources */,
176285FD1BAAFC3B00AEDA07 /* Streams.cpp in Sources */,
176285FA1BAAFC3B00AEDA07 /* Pages.cpp in Sources */,
17FFC2C21BAB15CE00D91F59 /* PdfRenderer.cpp in Sources */,
@ -467,9 +473,6 @@
UNICODE,
_LINUX_QT,
LINUX,
_USE_LIBXML2_READER_,
_USE_XMLLITE_READER_,
USE_LITE_READER,
BUILD_CONFIG_FULL_VERSION,
DONT_WRITE_EMBEDDED_FONTS,
LIBXML_READER_ENABLED,
@ -482,6 +485,7 @@
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
/usr/include/libxml2,
"../../agg-2.4/include",
"../../freetype-2.5.2/include",
../../cximage/zlib,
@ -509,9 +513,6 @@
UNICODE,
_LINUX_QT,
LINUX,
_USE_LIBXML2_READER_,
_USE_XMLLITE_READER_,
USE_LITE_READER,
BUILD_CONFIG_FULL_VERSION,
DONT_WRITE_EMBEDDED_FONTS,
LIBXML_READER_ENABLED,
@ -524,6 +525,7 @@
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
/usr/include/libxml2,
"../../agg-2.4/include",
"../../freetype-2.5.2/include",
../../cximage/zlib,

View File

@ -584,15 +584,20 @@
DEVELOPMENT_TEAM = 2WH24U26GJ;
GCC_PREPROCESSOR_DEFINITIONS = (
UNICODE,
_UNICODE,
USE_LITE_READER,
_USE_LIBXML2_READER_,
_USE_XMLLITE_READER_,
LINUX,
MAC,
_IOS,
LIBXML_READER_ENABLED,
_XCODE,
LIBXML_PUSH_ENABLED,
LIBXML_HTML_ENABLED,
LIBXML_XPATH_ENABLED,
LIBXML_OUTPUT_ENABLED,
LIBXML_C14N_ENABLED,
LIBXML_SAX1_ENABLED,
LIBXML_TREE_ENABLED,
LIBXML_XPTR_ENABLED,
IN_LIBXML,
LIBXML_STATIC,
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
@ -612,15 +617,20 @@
DEVELOPMENT_TEAM = 2WH24U26GJ;
GCC_PREPROCESSOR_DEFINITIONS = (
UNICODE,
_UNICODE,
USE_LITE_READER,
_USE_LIBXML2_READER_,
_USE_XMLLITE_READER_,
LINUX,
MAC,
_IOS,
LIBXML_READER_ENABLED,
_XCODE,
LIBXML_PUSH_ENABLED,
LIBXML_HTML_ENABLED,
LIBXML_XPATH_ENABLED,
LIBXML_OUTPUT_ENABLED,
LIBXML_C14N_ENABLED,
LIBXML_SAX1_ENABLED,
LIBXML_TREE_ENABLED,
LIBXML_XPTR_ENABLED,
IN_LIBXML,
LIBXML_STATIC,
);
HEADER_SEARCH_PATHS = (
"$(inherited)",

View File

@ -1,4 +1,4 @@
/*
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or

View File

@ -1,4 +1,4 @@
/*
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
@ -34,9 +34,15 @@
#include "../../../DesktopEditor/common/File.h"
#include "../libxml2/libxml.h"
#include "../libxml2/include/libxml/xmlreader.h"
#include "../libxml2/include/libxml/c14n.h"
#ifdef _IOS
#include <libxml2/libxml/xmlreader.h>
#include <libxml2/libxml/c14n.h>
#else
#include "../libxml2/libxml.h"
#include "../libxml2/include/libxml/xmlreader.h"
#include "../libxml2/include/libxml/c14n.h"
#endif
#include "../include/xmlutils.h"
namespace XmlUtils

View File

@ -12,6 +12,10 @@
#define OOXML_HASH_ALG_SHA384 4
#define OOXML_HASH_ALG_SHA512 5
#define OOXML_HASH_ALG_GOST_GR3411 10
#define OOXML_HASH_ALG_GOST_GR3411_2012_256 11
#define OOXML_HASH_ALG_GOST_GR3411_2012_512 12
#define OPEN_SSL_WARNING_OK 0
#define OPEN_SSL_WARNING_ERR 1
#define OPEN_SSL_WARNING_ALL_OK 2
@ -91,6 +95,7 @@ public:
public:
virtual std::string GetNumber() = 0;
virtual std::wstring GetSignerName() = 0;
virtual std::wstring GetIssuerName() = 0;
virtual std::string GetCertificateBase64() = 0;
virtual std::string GetCertificateHash() = 0;
@ -111,6 +116,8 @@ public:
virtual std::vector<int> GetHashAlgs() = 0;
virtual int GetHashAlg() = 0;
virtual bool IsGOST() = 0;
public:
virtual int ShowSelectDialog(void* parent = NULL) = 0;
virtual int ShowCertificate(void* parent = NULL) = 0;

View File

@ -445,7 +445,10 @@ Type=\"http://schemas.openxmlformats.org/package/2006/relationships/digital-sign
builder.WriteString(L"<SignatureImage>");
builder.WriteString(m_image_valid);
builder.WriteString(L"</SignatureImage>");
builder.WriteString(L"<SignatureComments/>\
if (!m_certificate->IsGOST())
{
builder.WriteString(L"<SignatureComments/>\
<WindowsVersion>10.0</WindowsVersion>\
<OfficeVersion>16.0</OfficeVersion>\
<ApplicationVersion>16.0</ApplicationVersion>\
@ -460,6 +463,25 @@ Type=\"http://schemas.openxmlformats.org/package/2006/relationships/digital-sign
</SignatureInfoV1>\
</SignatureProperty>\
</SignatureProperties>");
}
else
{
builder.WriteString(L"<SignatureComments/>\
<WindowsVersion>10.0</WindowsVersion>\
<OfficeVersion>16.0</OfficeVersion>\
<ApplicationVersion>16.0</ApplicationVersion>\
<Monitors>2</Monitors>\
<HorizontalResolution>1680</HorizontalResolution>\
<VerticalResolution>1050</VerticalResolution>\
<ColorDepth>32</ColorDepth>\
<SignatureProviderId>{F5AC7D23-DA04-45F5-ABCB-38CE7A982553}</SignatureProviderId>\
<SignatureProviderUrl>http://www.cryptopro.ru/products/office/signature</SignatureProviderUrl>\
<SignatureProviderDetails>8</SignatureProviderDetails>\
<SignatureType>1</SignatureType>\
</SignatureInfoV1>\
</SignatureProperty>\
</SignatureProperties>");
}
m_signed_info.WriteString("<Reference Type=\"http://www.w3.org/2000/09/xmldsig#Object\" URI=\"#idOfficeObject\">");
m_signed_info.WriteString(GetReferenceMain(builder.GetData(), L"idOfficeObject", false));
@ -486,7 +508,7 @@ Type=\"http://schemas.openxmlformats.org/package/2006/relationships/digital-sign
std::wstring GenerateSignPropertiesObject()
{
std::wstring sName = m_certificate->GetSignerName();
std::wstring sName = m_certificate->GetIssuerName();
std::string sKeyA = m_certificate->GetNumber();
std::wstring sKey = UTF8_TO_U(sKeyA);

View File

@ -369,6 +369,22 @@ public:
return s;
}
void string_replaceA(std::string& text, const std::string& replaceFrom, const std::string& replaceTo)
{
size_t posn = 0;
while (std::string::npos != (posn = text.find(replaceFrom, posn)))
{
text.replace(posn, replaceFrom.length(), replaceTo);
posn += replaceTo.length();
}
}
void MakeBase64_NOCRLF(std::string& value)
{
string_replaceA(value, "\r", "");
string_replaceA(value, "\n", "");
}
friend class COOXMLVerifier;
public:
@ -396,6 +412,8 @@ public:
return OOXML_SIGNATURE_NOTSUPPORTED;
std::string sValue = U_TO_UTF8((node.ReadNodeText(L"DigestValue")));
MakeBase64_NOCRLF(sValue);
std::string sCalcValue = "";
XmlUtils::CXmlNode nodeTransform = node.ReadNode(L"Transforms");
@ -404,6 +422,7 @@ public:
// simple hash
sCalcValue = m_cert->GetHash(sFile, nAlg);
sValue = U_TO_UTF8((node.ReadNodeText(L"DigestValue")));
MakeBase64_NOCRLF(sValue);
}
else
{
@ -419,6 +438,7 @@ public:
sCalcValue = m_cert->GetHash(sXml, nAlg);
sValue = U_TO_UTF8((node.ReadNodeText(L"DigestValue")));
MakeBase64_NOCRLF(sValue);
}
if (sCalcValue != sValue)
@ -437,6 +457,7 @@ public:
sURI = sURI.substr(1);
std::string sValue = U_TO_UTF8((node.ReadNodeText(L"DigestValue")));
MakeBase64_NOCRLF(sValue);
CXmlTransforms oTransforms;
@ -451,6 +472,7 @@ public:
// simple hash
sCalcValue = m_cert->GetHash(sFile, nAlg);
sValue = U_TO_UTF8((node.ReadNodeText(L"DigestValue")));
MakeBase64_NOCRLF(sValue);
}
else
{
@ -466,6 +488,7 @@ public:
sCalcValue = m_cert->GetHash(sXml, nAlg);
sValue = U_TO_UTF8((node.ReadNodeText(L"DigestValue")));
MakeBase64_NOCRLF(sValue);
}
#endif

View File

@ -57,6 +57,18 @@ int ICertificate::GetOOXMLHashAlg(const std::string& sAlg)
"http://www.w3.org/2001/04/xmlenc#sha512" == sAlg)
return OOXML_HASH_ALG_SHA512;
if ("urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411" == sAlg ||
"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411" == sAlg)
return OOXML_HASH_ALG_GOST_GR3411;
if ("urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256" == sAlg ||
"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256" == sAlg)
return OOXML_HASH_ALG_GOST_GR3411_2012_256;
if ("urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-512" == sAlg ||
"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-512" == sAlg)
return OOXML_HASH_ALG_GOST_GR3411_2012_512;
return OOXML_HASH_ALG_INVALID;
}
@ -74,6 +86,12 @@ std::string ICertificate::GetDigestMethodA(const int& nAlg)
return "http://www.w3.org/2001/04/xmldsig-more#sha384";
case OOXML_HASH_ALG_SHA512:
return "http://www.w3.org/2001/04/xmlenc#sha512";
case OOXML_HASH_ALG_GOST_GR3411:
return "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411";
case OOXML_HASH_ALG_GOST_GR3411_2012_256:
return "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256";
case OOXML_HASH_ALG_GOST_GR3411_2012_512:
return "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-512";
default:
break;
}
@ -98,6 +116,12 @@ std::string ICertificate::GetSignatureMethodA(const int& nAlg)
return "http://www.w3.org/2001/04/xmldsig-more#rsa-sha384";
case OOXML_HASH_ALG_SHA512:
return "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512";
case OOXML_HASH_ALG_GOST_GR3411:
return "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411";
case OOXML_HASH_ALG_GOST_GR3411_2012_256:
return "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256";
case OOXML_HASH_ALG_GOST_GR3411_2012_512:
return "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-512";
default:
break;
}

View File

@ -11,6 +11,18 @@
#include "../../../common/File.h"
#include "../../../common/BigInteger.h"
#define ALG_SID_GR3411 30
#define ALG_SID_GR3411_2012_256 33
#define ALG_SID_GR3411_2012_512 34
#define CALG_GR3411 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_GR3411)
#define CALG_GR3411_2012_256 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_GR3411_2012_256)
#define CALG_GR3411_2012_512 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_GR3411_2012_512)
#define PROV_GOST_2001_DH 75
#define PROV_GOST_2012_256 80
#define PROV_GOST_2012_512 81
#ifdef MS_CRYPTO_PRIVATE
namespace NSMSCryptoPrivate
{
@ -153,6 +165,19 @@ public:
}
virtual std::wstring GetSignerName()
{
if (!m_context)
return L"";
DWORD dwNameLen = CertGetNameStringW(m_context, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0, NULL, NULL, 0);
wchar_t* pNameData = new wchar_t[dwNameLen];
CertGetNameStringW(m_context, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0, NULL, pNameData, dwNameLen);
std::wstring sName(pNameData);
RELEASEARRAYOBJECTS(pNameData);
return sName;
}
virtual std::wstring GetIssuerName()
{
if (!m_context)
return L"";
@ -231,6 +256,16 @@ public:
algs.push_back(OOXML_HASH_ALG_SHA384);
else if ("1.2.840.113549.1.1.13" == sAlg)
algs.push_back(OOXML_HASH_ALG_SHA512);
else if ("1.2.643.2.2.3" == sAlg)
{
std::string sHashAlg = m_context->pCertInfo->SubjectPublicKeyInfo.Algorithm.pszObjId;
if ("1.2.643.2.2.20" == sHashAlg || "1.2.643.2.2.19" == sHashAlg)
algs.push_back(OOXML_HASH_ALG_GOST_GR3411);
else if ("1.2.643.7.1.1.1.1" == sHashAlg)
algs.push_back(OOXML_HASH_ALG_GOST_GR3411_2012_256);
else if ("1.2.643.7.1.1.1.2" == sHashAlg)
algs.push_back(OOXML_HASH_ALG_GOST_GR3411_2012_512);
}
else
algs.push_back(OOXML_HASH_ALG_SHA1);
@ -239,7 +274,7 @@ public:
else
m_alg = algs[0];
m_alg = OOXML_HASH_ALG_SHA1;
//m_alg = OOXML_HASH_ALG_SHA1;
return algs;
}
int GetHashAlg()
@ -249,6 +284,43 @@ public:
return m_alg;
}
bool IsGOST()
{
if (m_alg == OOXML_HASH_ALG_INVALID)
GetHashAlgs();
switch (m_alg)
{
case OOXML_HASH_ALG_GOST_GR3411:
case OOXML_HASH_ALG_GOST_GR3411_2012_256:
case OOXML_HASH_ALG_GOST_GR3411_2012_512:
return true;
default:
break;
}
return false;
}
int GetGOSTProviderType()
{
if (!IsGOST())
return PROV_RSA_FULL;
switch (m_alg)
{
case OOXML_HASH_ALG_GOST_GR3411:
return PROV_GOST_2001_DH;
case OOXML_HASH_ALG_GOST_GR3411_2012_256:
return PROV_GOST_2012_256;
case OOXML_HASH_ALG_GOST_GR3411_2012_512:
return PROV_GOST_2012_512;
default:
break;
}
return PROV_RSA_FULL;
}
public:
PCRYPT_KEY_PROV_INFO GetProviderInfo()
{
@ -302,7 +374,11 @@ public:
if (!bResult)
{
CryptReleaseContext(hCryptProv, 0);
if (!CryptAcquireContextW(&hCryptProv, info->pwszContainerName, NULL, PROV_RSA_AES, 0))
int nProvType = PROV_RSA_AES;
if (IsGOST())
nProvType = GetGOSTProviderType();
if (!CryptAcquireContextW(&hCryptProv, info->pwszContainerName, NULL, nProvType, 0))
{
CryptReleaseContext(hCryptProv, 0);
free(info);
@ -399,6 +475,21 @@ public:
dwProvType = PROV_RSA_AES;
break;
}
case OOXML_HASH_ALG_GOST_GR3411:
{
dwProvType = PROV_GOST_2001_DH;
break;
}
case OOXML_HASH_ALG_GOST_GR3411_2012_256:
{
dwProvType = PROV_GOST_2012_256;
break;
}
case OOXML_HASH_ALG_GOST_GR3411_2012_512:
{
dwProvType = PROV_GOST_2012_512;
break;
}
default:
break;
}
@ -497,6 +588,21 @@ public:
dwProvType = PROV_RSA_AES;
break;
}
case OOXML_HASH_ALG_GOST_GR3411:
{
dwProvType = PROV_GOST_2001_DH;
break;
}
case OOXML_HASH_ALG_GOST_GR3411_2012_256:
{
dwProvType = PROV_GOST_2012_256;
break;
}
case OOXML_HASH_ALG_GOST_GR3411_2012_512:
{
dwProvType = PROV_GOST_2012_512;
break;
}
default:
break;
}
@ -616,6 +722,12 @@ private:
return CALG_SHA_512;
case OOXML_HASH_ALG_SHA224:
return CALG_SHA1;
case OOXML_HASH_ALG_GOST_GR3411:
return CALG_GR3411;
case OOXML_HASH_ALG_GOST_GR3411_2012_256:
return CALG_GR3411_2012_256;
case OOXML_HASH_ALG_GOST_GR3411_2012_512:
return CALG_GR3411_2012_512;
default:
return CALG_SHA1;
}

View File

@ -167,6 +167,11 @@ public:
return sNameW;
}
std::wstring GetIssuerName()
{
return GetSignerName();
}
std::string GetCertificateBase64()
{
if (NULL == m_cert)
@ -830,6 +835,11 @@ std::wstring CCertificate_openssl::GetSignerName()
return m_internal->GetSignerName();
}
std::wstring CCertificate_openssl::GetIssuerName()
{
return m_internal->GetIssuerName();
}
std::string CCertificate_openssl::GetCertificateBase64()
{
return m_internal->GetCertificateBase64();
@ -914,6 +924,11 @@ int CCertificate_openssl::GetHashAlg()
return m_internal->GetHashAlg();
}
bool CCertificate_openssl::IsGOST()
{
return false;
}
namespace NSOpenSSL
{
int LoadKey(std::wstring file, std::string password)

View File

@ -18,6 +18,8 @@ public:
virtual std::wstring GetSignerName();
virtual std::wstring GetIssuerName();
virtual std::string GetCertificateBase64();
virtual std::string GetCertificateHash();
@ -44,6 +46,8 @@ public:
virtual std::vector<int> GetHashAlgs();
virtual int GetHashAlg();
virtual bool IsGOST();
public:
virtual int ShowSelectDialog(void* parent = NULL);
virtual int ShowCertificate(void* parent = NULL);

View File

@ -248,10 +248,6 @@
GCC_PREPROCESSOR_DEFINITIONS = (
UNICODE,
_UNICODE,
_USE_LIBXML2_READER_,
_USE_XMLLITE_READER_,
USE_LITE_READER,
LIBXML_READER_ENABLED,
MAC,
unix,
_IOS,
@ -262,8 +258,7 @@
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
/usr/include/,
/usr/include/libxml2/,
/usr/include/libxml2,
);
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
OTHER_LDFLAGS = "-ObjC";
@ -279,10 +274,6 @@
GCC_PREPROCESSOR_DEFINITIONS = (
UNICODE,
_UNICODE,
_USE_LIBXML2_READER_,
_USE_XMLLITE_READER_,
USE_LITE_READER,
LIBXML_READER_ENABLED,
MAC,
unix,
_IOS,
@ -293,8 +284,7 @@
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
/usr/include/,
/usr/include/libxml2/,
/usr/include/libxml2,
);
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
OTHER_LDFLAGS = "-ObjC";

View File

@ -11,43 +11,47 @@ build_zlib_as_sources {
}
INCLUDEPATH += \
$$PWD/src/zlib-1.2.3/contrib/minizip \
$$PWD/src/zlib-1.2.3
$$PWD/src/zlib-1.2.11/contrib/minizip \
$$PWD/src/zlib-1.2.11
SOURCES += \
$$PWD/src/OfficeUtils.cpp \
$$PWD/src/ZipUtilsCP.cpp \
$$PWD/src/zlib-1.2.3/contrib/minizip/ioapi.c \
$$PWD/src/zlib-1.2.3/contrib/minizip/miniunz.c \
$$PWD/src/zlib-1.2.3/contrib/minizip/minizip.c \
$$PWD/src/zlib-1.2.3/contrib/minizip/mztools.c \
$$PWD/src/zlib-1.2.3/contrib/minizip/unzip.c \
$$PWD/src/zlib-1.2.3/contrib/minizip/zip.c
$$PWD/src/zlib-1.2.11/contrib/minizip/ioapi.c \
$$PWD/src/zlib-1.2.11/contrib/minizip/miniunz.c \
$$PWD/src/zlib-1.2.11/contrib/minizip/minizip.c \
$$PWD/src/zlib-1.2.11/contrib/minizip/mztools.c \
$$PWD/src/zlib-1.2.11/contrib/minizip/unzip.c \
$$PWD/src/zlib-1.2.11/contrib/minizip/zip.c
core_windows {
SOURCES += \
$$PWD/src/zlib-1.2.11/contrib/minizip/iowin32.c
}
build_all_zlib {
SOURCES += \
$$PWD/src/zlib-1.2.3/adler32.c \
$$PWD/src/zlib-1.2.3/compress.c \
$$PWD/src/zlib-1.2.3/crc32.c \
$$PWD/src/zlib-1.2.3/deflate.c \
$$PWD/src/zlib-1.2.3/example.c \
$$PWD/src/zlib-1.2.3/gzio.c \
$$PWD/src/zlib-1.2.3/infback.c \
$$PWD/src/zlib-1.2.3/inffast.c \
$$PWD/src/zlib-1.2.3/inflate.c \
$$PWD/src/zlib-1.2.3/inftrees.c \
$$PWD/src/zlib-1.2.3/minigzip.c \
$$PWD/src/zlib-1.2.3/trees.c \
$$PWD/src/zlib-1.2.3/uncompr.c \
$$PWD/src/zlib-1.2.3/zutil.c
$$PWD/src/zlib-1.2.11/adler32.c \
$$PWD/src/zlib-1.2.11/compress.c \
$$PWD/src/zlib-1.2.11/crc32.c \
$$PWD/src/zlib-1.2.11/deflate.c \
$$PWD/src/zlib-1.2.11/gzclose.c \
$$PWD/src/zlib-1.2.11/gzlib.c \
$$PWD/src/zlib-1.2.11/gzread.c \
$$PWD/src/zlib-1.2.11/gzwrite.c \
$$PWD/src/zlib-1.2.11/infback.c \
$$PWD/src/zlib-1.2.11/inffast.c \
$$PWD/src/zlib-1.2.11/inflate.c \
$$PWD/src/zlib-1.2.11/inftrees.c \
$$PWD/src/zlib-1.2.11/trees.c \
$$PWD/src/zlib-1.2.11/uncompr.c \
$$PWD/src/zlib-1.2.11/zutil.c
}
HEADERS += \
$$PWD/src/OfficeUtilsCommon.h \
$$PWD/src/OfficeUtils.h \
$$PWD/src/ZipUtilsCP.h \
$$PWD/src/zlib-1.2.3/contrib/minizip/crypt.h \
$$PWD/src/zlib-1.2.3/contrib/minizip/ioapi.h \
$$PWD/src/zlib-1.2.3/contrib/minizip/mztools.h \
$$PWD/src/zlib-1.2.3/contrib/minizip/unzip.h \
$$PWD/src/zlib-1.2.3/contrib/minizip/zip.h
$$PWD/src/zlib-1.2.11/contrib/minizip/crypt.h \
$$PWD/src/zlib-1.2.11/contrib/minizip/ioapi.h \
$$PWD/src/zlib-1.2.11/contrib/minizip/mztools.h \
$$PWD/src/zlib-1.2.11/contrib/minizip/unzip.h \
$$PWD/src/zlib-1.2.11/contrib/minizip/zip.h

View File

@ -9,12 +9,12 @@
/* Begin PBXBuildFile section */
69676DAA1CA58BBE00D7A1D1 /* OfficeUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 69676CB81CA58BBD00D7A1D1 /* OfficeUtils.cpp */; };
69676DAB1CA58BBE00D7A1D1 /* ZipUtilsCP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 69676CBB1CA58BBD00D7A1D1 /* ZipUtilsCP.cpp */; };
69676DD01CA58BBE00D7A1D1 /* ioapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 69676D2A1CA58BBD00D7A1D1 /* ioapi.c */; };
69676DD31CA58BBE00D7A1D1 /* miniunz.c in Sources */ = {isa = PBXBuildFile; fileRef = 69676D2F1CA58BBD00D7A1D1 /* miniunz.c */; };
69676DD41CA58BBE00D7A1D1 /* minizip.c in Sources */ = {isa = PBXBuildFile; fileRef = 69676D301CA58BBD00D7A1D1 /* minizip.c */; };
69676DD51CA58BBE00D7A1D1 /* mztools.c in Sources */ = {isa = PBXBuildFile; fileRef = 69676D311CA58BBD00D7A1D1 /* mztools.c */; };
69676DD61CA58BBE00D7A1D1 /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 69676D331CA58BBD00D7A1D1 /* unzip.c */; };
69676DD71CA58BBE00D7A1D1 /* zip.c in Sources */ = {isa = PBXBuildFile; fileRef = 69676D351CA58BBD00D7A1D1 /* zip.c */; };
8A22E3A6216F71B0007A9BE4 /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 8A22E301216F71AF007A9BE4 /* unzip.c */; };
8A22E3A7216F71B0007A9BE4 /* zip.c in Sources */ = {isa = PBXBuildFile; fileRef = 8A22E302216F71AF007A9BE4 /* zip.c */; };
8A22E3A9216F71B0007A9BE4 /* ioapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 8A22E305216F71AF007A9BE4 /* ioapi.c */; };
8A22E3AA216F71B0007A9BE4 /* mztools.c in Sources */ = {isa = PBXBuildFile; fileRef = 8A22E306216F71AF007A9BE4 /* mztools.c */; };
8A22E3AC216F71B0007A9BE4 /* minizip.c in Sources */ = {isa = PBXBuildFile; fileRef = 8A22E313216F71AF007A9BE4 /* minizip.c */; };
8A22E3AD216F71B0007A9BE4 /* miniunz.c in Sources */ = {isa = PBXBuildFile; fileRef = 8A22E314216F71AF007A9BE4 /* miniunz.c */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@ -31,24 +31,23 @@
/* Begin PBXFileReference section */
69676CA91CA58B7400D7A1D1 /* libOfficeUtils.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libOfficeUtils.a; sourceTree = BUILT_PRODUCTS_DIR; };
69676CB61CA58BBD00D7A1D1 /* ASCOfficeCriticalSection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASCOfficeCriticalSection.h; sourceTree = "<group>"; };
69676CB71CA58BBD00D7A1D1 /* CSLocker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSLocker.h; sourceTree = "<group>"; };
69676CB81CA58BBD00D7A1D1 /* OfficeUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OfficeUtils.cpp; sourceTree = "<group>"; };
69676CB91CA58BBD00D7A1D1 /* OfficeUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OfficeUtils.h; sourceTree = "<group>"; };
69676CBA1CA58BBD00D7A1D1 /* OfficeUtilsCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OfficeUtilsCommon.h; sourceTree = "<group>"; };
69676CBB1CA58BBD00D7A1D1 /* ZipUtilsCP.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp.preprocessed; fileEncoding = 4; path = ZipUtilsCP.cpp; sourceTree = "<group>"; };
69676CBC1CA58BBD00D7A1D1 /* ZipUtilsCP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZipUtilsCP.h; sourceTree = "<group>"; };
69676D291CA58BBD00D7A1D1 /* crypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = crypt.h; sourceTree = "<group>"; };
69676D2A1CA58BBD00D7A1D1 /* ioapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ioapi.c; sourceTree = "<group>"; };
69676D2B1CA58BBD00D7A1D1 /* ioapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ioapi.h; sourceTree = "<group>"; };
69676D2F1CA58BBD00D7A1D1 /* miniunz.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = miniunz.c; sourceTree = "<group>"; };
69676D301CA58BBD00D7A1D1 /* minizip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = minizip.c; sourceTree = "<group>"; };
69676D311CA58BBD00D7A1D1 /* mztools.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mztools.c; sourceTree = "<group>"; };
69676D321CA58BBD00D7A1D1 /* mztools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mztools.h; sourceTree = "<group>"; };
69676D331CA58BBD00D7A1D1 /* unzip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = unzip.c; sourceTree = "<group>"; };
69676D341CA58BBD00D7A1D1 /* unzip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unzip.h; sourceTree = "<group>"; };
69676D351CA58BBD00D7A1D1 /* zip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip.c; sourceTree = "<group>"; };
69676D361CA58BBD00D7A1D1 /* zip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = zip.h; sourceTree = "<group>"; };
8A22E301216F71AF007A9BE4 /* unzip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = unzip.c; sourceTree = "<group>"; };
8A22E302216F71AF007A9BE4 /* zip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip.c; sourceTree = "<group>"; };
8A22E303216F71AF007A9BE4 /* iowin32.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iowin32.h; sourceTree = "<group>"; };
8A22E305216F71AF007A9BE4 /* ioapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ioapi.c; sourceTree = "<group>"; };
8A22E306216F71AF007A9BE4 /* mztools.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mztools.c; sourceTree = "<group>"; };
8A22E30B216F71AF007A9BE4 /* crypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = crypt.h; sourceTree = "<group>"; };
8A22E30C216F71AF007A9BE4 /* zip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = zip.h; sourceTree = "<group>"; };
8A22E30E216F71AF007A9BE4 /* unzip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unzip.h; sourceTree = "<group>"; };
8A22E310216F71AF007A9BE4 /* mztools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mztools.h; sourceTree = "<group>"; };
8A22E311216F71AF007A9BE4 /* ioapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ioapi.h; sourceTree = "<group>"; };
8A22E313216F71AF007A9BE4 /* minizip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = minizip.c; sourceTree = "<group>"; };
8A22E314216F71AF007A9BE4 /* miniunz.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = miniunz.c; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -81,48 +80,47 @@
69676CB51CA58BBD00D7A1D1 /* src */ = {
isa = PBXGroup;
children = (
69676CB61CA58BBD00D7A1D1 /* ASCOfficeCriticalSection.h */,
69676CB71CA58BBD00D7A1D1 /* CSLocker.h */,
8A22E26A216F71AF007A9BE4 /* zlib-1.2.11 */,
69676CB81CA58BBD00D7A1D1 /* OfficeUtils.cpp */,
69676CB91CA58BBD00D7A1D1 /* OfficeUtils.h */,
69676CBA1CA58BBD00D7A1D1 /* OfficeUtilsCommon.h */,
69676CBB1CA58BBD00D7A1D1 /* ZipUtilsCP.cpp */,
69676CBC1CA58BBD00D7A1D1 /* ZipUtilsCP.h */,
69676CBD1CA58BBD00D7A1D1 /* zlib-1.2.3 */,
);
path = src;
sourceTree = "<group>";
};
69676CBD1CA58BBD00D7A1D1 /* zlib-1.2.3 */ = {
8A22E26A216F71AF007A9BE4 /* zlib-1.2.11 */ = {
isa = PBXGroup;
children = (
69676CCB1CA58BBD00D7A1D1 /* contrib */,
8A22E299216F71AF007A9BE4 /* contrib */,
);
path = "zlib-1.2.3";
path = "zlib-1.2.11";
sourceTree = "<group>";
};
69676CCB1CA58BBD00D7A1D1 /* contrib */ = {
8A22E299216F71AF007A9BE4 /* contrib */ = {
isa = PBXGroup;
children = (
69676D271CA58BBD00D7A1D1 /* minizip */,
8A22E2FE216F71AF007A9BE4 /* minizip */,
);
path = contrib;
sourceTree = "<group>";
};
69676D271CA58BBD00D7A1D1 /* minizip */ = {
8A22E2FE216F71AF007A9BE4 /* minizip */ = {
isa = PBXGroup;
children = (
69676D291CA58BBD00D7A1D1 /* crypt.h */,
69676D2A1CA58BBD00D7A1D1 /* ioapi.c */,
69676D2B1CA58BBD00D7A1D1 /* ioapi.h */,
69676D2F1CA58BBD00D7A1D1 /* miniunz.c */,
69676D301CA58BBD00D7A1D1 /* minizip.c */,
69676D311CA58BBD00D7A1D1 /* mztools.c */,
69676D321CA58BBD00D7A1D1 /* mztools.h */,
69676D331CA58BBD00D7A1D1 /* unzip.c */,
69676D341CA58BBD00D7A1D1 /* unzip.h */,
69676D351CA58BBD00D7A1D1 /* zip.c */,
69676D361CA58BBD00D7A1D1 /* zip.h */,
8A22E301216F71AF007A9BE4 /* unzip.c */,
8A22E302216F71AF007A9BE4 /* zip.c */,
8A22E303216F71AF007A9BE4 /* iowin32.h */,
8A22E305216F71AF007A9BE4 /* ioapi.c */,
8A22E306216F71AF007A9BE4 /* mztools.c */,
8A22E30B216F71AF007A9BE4 /* crypt.h */,
8A22E30C216F71AF007A9BE4 /* zip.h */,
8A22E30E216F71AF007A9BE4 /* unzip.h */,
8A22E310216F71AF007A9BE4 /* mztools.h */,
8A22E311216F71AF007A9BE4 /* ioapi.h */,
8A22E313216F71AF007A9BE4 /* minizip.c */,
8A22E314216F71AF007A9BE4 /* miniunz.c */,
);
path = minizip;
sourceTree = "<group>";
@ -184,13 +182,13 @@
buildActionMask = 2147483647;
files = (
69676DAB1CA58BBE00D7A1D1 /* ZipUtilsCP.cpp in Sources */,
69676DD41CA58BBE00D7A1D1 /* minizip.c in Sources */,
69676DD01CA58BBE00D7A1D1 /* ioapi.c in Sources */,
69676DD31CA58BBE00D7A1D1 /* miniunz.c in Sources */,
69676DAA1CA58BBE00D7A1D1 /* OfficeUtils.cpp in Sources */,
69676DD61CA58BBE00D7A1D1 /* unzip.c in Sources */,
69676DD51CA58BBE00D7A1D1 /* mztools.c in Sources */,
69676DD71CA58BBE00D7A1D1 /* zip.c in Sources */,
8A22E3AC216F71B0007A9BE4 /* minizip.c in Sources */,
8A22E3AD216F71B0007A9BE4 /* miniunz.c in Sources */,
8A22E3A6216F71B0007A9BE4 /* unzip.c in Sources */,
8A22E3A9216F71B0007A9BE4 /* ioapi.c in Sources */,
8A22E3A7216F71B0007A9BE4 /* zip.c in Sources */,
8A22E3AA216F71B0007A9BE4 /* mztools.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -58,7 +58,9 @@ namespace ZLibZipUtils
#endif
#if defined(_WIN32) || defined (_WIN64)
zipFile zf = zipOpen( filename, APPEND_STATUS_CREATE );
zlib_filefunc64_def ffunc;
fill_win32_filefunc64W(&ffunc);
zipFile zf = zipOpen2_64(filename, APPEND_STATUS_CREATE, NULL, &ffunc);
#else
BYTE* pUtf8 = NULL;
LONG lLen = 0;
@ -78,7 +80,9 @@ namespace ZLibZipUtils
#endif
#if defined(_WIN32) || defined (_WIN64)
unzFile uf = unzOpen (filename);
zlib_filefunc64_def ffunc;
fill_win32_filefunc64W(&ffunc);
unzFile uf = unzOpen2_64(filename, &ffunc);
#else
BYTE* pUtf8 = NULL;
LONG lLen = 0;

View File

@ -47,9 +47,11 @@
using namespace std;
#include "zlib-1.2.3/contrib/minizip/unzip.h"
#include "zlib-1.2.3/contrib/minizip/zip.h"
#include "zlib-1.2.11/contrib/minizip/unzip.h"
#include "zlib-1.2.11/contrib/minizip/zip.h"
#if defined(_WIN32) || defined (_WIN64)
#include "zlib-1.2.11/contrib/minizip/iowin32.h"
#endif
#include <zlib.h>
namespace ZLibZipUtils

View File

@ -0,0 +1,249 @@
cmake_minimum_required(VERSION 2.4.4)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
project(zlib C)
set(VERSION "1.2.11")
option(ASM686 "Enable building i686 assembly implementation")
option(AMD64 "Enable building amd64 assembly implementation")
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages")
set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files")
include(CheckTypeSize)
include(CheckFunctionExists)
include(CheckIncludeFile)
include(CheckCSourceCompiles)
enable_testing()
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
check_include_file(stdint.h HAVE_STDINT_H)
check_include_file(stddef.h HAVE_STDDEF_H)
#
# Check to see if we have large file support
#
set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1)
# We add these other definitions here because CheckTypeSize.cmake
# in CMake 2.4.x does not automatically do so and we want
# compatibility with CMake 2.4.x.
if(HAVE_SYS_TYPES_H)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H)
endif()
if(HAVE_STDINT_H)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H)
endif()
if(HAVE_STDDEF_H)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H)
endif()
check_type_size(off64_t OFF64_T)
if(HAVE_OFF64_T)
add_definitions(-D_LARGEFILE64_SOURCE=1)
endif()
set(CMAKE_REQUIRED_DEFINITIONS) # clear variable
#
# Check for fseeko
#
check_function_exists(fseeko HAVE_FSEEKO)
if(NOT HAVE_FSEEKO)
add_definitions(-DNO_FSEEKO)
endif()
#
# Check for unistd.h
#
check_include_file(unistd.h Z_HAVE_UNISTD_H)
if(MSVC)
set(CMAKE_DEBUG_POSTFIX "d")
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
endif()
if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
# If we're doing an out of source build and the user has a zconf.h
# in their source tree...
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h)
message(STATUS "Renaming")
message(STATUS " ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h")
message(STATUS "to 'zconf.h.included' because this file is included with zlib")
message(STATUS "but CMake generates it automatically in the build directory.")
file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.included)
endif()
endif()
set(ZLIB_PC ${CMAKE_CURRENT_BINARY_DIR}/zlib.pc)
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein
${ZLIB_PC} @ONLY)
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein
${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
#============================================================================
# zlib
#============================================================================
set(ZLIB_PUBLIC_HDRS
${CMAKE_CURRENT_BINARY_DIR}/zconf.h
zlib.h
)
set(ZLIB_PRIVATE_HDRS
crc32.h
deflate.h
gzguts.h
inffast.h
inffixed.h
inflate.h
inftrees.h
trees.h
zutil.h
)
set(ZLIB_SRCS
adler32.c
compress.c
crc32.c
deflate.c
gzclose.c
gzlib.c
gzread.c
gzwrite.c
inflate.c
infback.c
inftrees.c
inffast.c
trees.c
uncompr.c
zutil.c
)
if(NOT MINGW)
set(ZLIB_DLL_SRCS
win32/zlib1.rc # If present will override custom build rule below.
)
endif()
if(CMAKE_COMPILER_IS_GNUCC)
if(ASM686)
set(ZLIB_ASMS contrib/asm686/match.S)
elseif (AMD64)
set(ZLIB_ASMS contrib/amd64/amd64-match.S)
endif ()
if(ZLIB_ASMS)
add_definitions(-DASMV)
set_source_files_properties(${ZLIB_ASMS} PROPERTIES LANGUAGE C COMPILE_FLAGS -DNO_UNDERLINE)
endif()
endif()
if(MSVC)
if(ASM686)
ENABLE_LANGUAGE(ASM_MASM)
set(ZLIB_ASMS
contrib/masmx86/inffas32.asm
contrib/masmx86/match686.asm
)
elseif (AMD64)
ENABLE_LANGUAGE(ASM_MASM)
set(ZLIB_ASMS
contrib/masmx64/gvmat64.asm
contrib/masmx64/inffasx64.asm
)
endif()
if(ZLIB_ASMS)
add_definitions(-DASMV -DASMINF)
endif()
endif()
# parse the full version number from zlib.h and include in ZLIB_FULL_VERSION
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents)
string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*"
"\\1" ZLIB_FULL_VERSION ${_zlib_h_contents})
if(MINGW)
# This gets us DLL resource information when compiling on MinGW.
if(NOT CMAKE_RC_COMPILER)
set(CMAKE_RC_COMPILER windres.exe)
endif()
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
COMMAND ${CMAKE_RC_COMPILER}
-D GCC_WINDRES
-I ${CMAKE_CURRENT_SOURCE_DIR}
-I ${CMAKE_CURRENT_BINARY_DIR}
-o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
-i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc)
set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj)
endif(MINGW)
add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
set_target_properties(zlib PROPERTIES SOVERSION 1)
if(NOT CYGWIN)
# This property causes shared libraries on Linux to have the full version
# encoded into their final filename. We disable this on Cygwin because
# it causes cygz-${ZLIB_FULL_VERSION}.dll to be created when cygz.dll
# seems to be the default.
#
# This has no effect with MSVC, on that platform the version info for
# the DLL comes from the resource file win32/zlib1.rc
set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION})
endif()
if(UNIX)
# On unix-like platforms the library is almost always called libz
set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z)
if(NOT APPLE)
set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")
endif()
elseif(BUILD_SHARED_LIBS AND WIN32)
# Creates zlib1.dll when building shared library version
set_target_properties(zlib PROPERTIES SUFFIX "1.dll")
endif()
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
install(TARGETS zlib zlibstatic
RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
LIBRARY DESTINATION "${INSTALL_LIB_DIR}" )
endif()
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
install(FILES ${ZLIB_PUBLIC_HDRS} DESTINATION "${INSTALL_INC_DIR}")
endif()
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
install(FILES zlib.3 DESTINATION "${INSTALL_MAN_DIR}/man3")
endif()
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
install(FILES ${ZLIB_PC} DESTINATION "${INSTALL_PKGCONFIG_DIR}")
endif()
#============================================================================
# Example binaries
#============================================================================
add_executable(example test/example.c)
target_link_libraries(example zlib)
add_test(example example)
add_executable(minigzip test/minigzip.c)
target_link_libraries(minigzip zlib)
if(HAVE_OFF64_T)
add_executable(example64 test/example.c)
target_link_libraries(example64 zlib)
set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
add_test(example64 example64)
add_executable(minigzip64 test/minigzip.c)
target_link_libraries(minigzip64 zlib)
set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
endif()

View File

@ -1,6 +1,666 @@
ChangeLog file for zlib
Changes in 1.2.11 (15 Jan 2017)
- Fix deflate stored bug when pulling last block from window
- Permit immediate deflateParams changes before any deflate input
Changes in 1.2.10 (2 Jan 2017)
- Avoid warnings on snprintf() return value
- Fix bug in deflate_stored() for zero-length input
- Fix bug in gzwrite.c that produced corrupt gzip files
- Remove files to be installed before copying them in Makefile.in
- Add warnings when compiling with assembler code
Changes in 1.2.9 (31 Dec 2016)
- Fix contrib/minizip to permit unzipping with desktop API [Zouzou]
- Improve contrib/blast to return unused bytes
- Assure that gzoffset() is correct when appending
- Improve compress() and uncompress() to support large lengths
- Fix bug in test/example.c where error code not saved
- Remedy Coverity warning [Randers-Pehrson]
- Improve speed of gzprintf() in transparent mode
- Fix inflateInit2() bug when windowBits is 16 or 32
- Change DEBUG macro to ZLIB_DEBUG
- Avoid uninitialized access by gzclose_w()
- Allow building zlib outside of the source directory
- Fix bug that accepted invalid zlib header when windowBits is zero
- Fix gzseek() problem on MinGW due to buggy _lseeki64 there
- Loop on write() calls in gzwrite.c in case of non-blocking I/O
- Add --warn (-w) option to ./configure for more compiler warnings
- Reject a window size of 256 bytes if not using the zlib wrapper
- Fix bug when level 0 used with Z_HUFFMAN or Z_RLE
- Add --debug (-d) option to ./configure to define ZLIB_DEBUG
- Fix bugs in creating a very large gzip header
- Add uncompress2() function, which returns the input size used
- Assure that deflateParams() will not switch functions mid-block
- Dramatically speed up deflation for level 0 (storing)
- Add gzfread(), duplicating the interface of fread()
- Add gzfwrite(), duplicating the interface of fwrite()
- Add deflateGetDictionary() function
- Use snprintf() for later versions of Microsoft C
- Fix *Init macros to use z_ prefix when requested
- Replace as400 with os400 for OS/400 support [Monnerat]
- Add crc32_z() and adler32_z() functions with size_t lengths
- Update Visual Studio project files [AraHaan]
Changes in 1.2.8 (28 Apr 2013)
- Update contrib/minizip/iowin32.c for Windows RT [Vollant]
- Do not force Z_CONST for C++
- Clean up contrib/vstudio [Roß]
- Correct spelling error in zlib.h
- Fix mixed line endings in contrib/vstudio
Changes in 1.2.7.3 (13 Apr 2013)
- Fix version numbers and DLL names in contrib/vstudio/*/zlib.rc
Changes in 1.2.7.2 (13 Apr 2013)
- Change check for a four-byte type back to hexadecimal
- Fix typo in win32/Makefile.msc
- Add casts in gzwrite.c for pointer differences
Changes in 1.2.7.1 (24 Mar 2013)
- Replace use of unsafe string functions with snprintf if available
- Avoid including stddef.h on Windows for Z_SOLO compile [Niessink]
- Fix gzgetc undefine when Z_PREFIX set [Turk]
- Eliminate use of mktemp in Makefile (not always available)
- Fix bug in 'F' mode for gzopen()
- Add inflateGetDictionary() function
- Correct comment in deflate.h
- Use _snprintf for snprintf in Microsoft C
- On Darwin, only use /usr/bin/libtool if libtool is not Apple
- Delete "--version" file if created by "ar --version" [Richard G.]
- Fix configure check for veracity of compiler error return codes
- Fix CMake compilation of static lib for MSVC2010 x64
- Remove unused variable in infback9.c
- Fix argument checks in gzlog_compress() and gzlog_write()
- Clean up the usage of z_const and respect const usage within zlib
- Clean up examples/gzlog.[ch] comparisons of different types
- Avoid shift equal to bits in type (caused endless loop)
- Fix uninitialized value bug in gzputc() introduced by const patches
- Fix memory allocation error in examples/zran.c [Nor]
- Fix bug where gzopen(), gzclose() would write an empty file
- Fix bug in gzclose() when gzwrite() runs out of memory
- Check for input buffer malloc failure in examples/gzappend.c
- Add note to contrib/blast to use binary mode in stdio
- Fix comparisons of differently signed integers in contrib/blast
- Check for invalid code length codes in contrib/puff
- Fix serious but very rare decompression bug in inftrees.c
- Update inflateBack() comments, since inflate() can be faster
- Use underscored I/O function names for WINAPI_FAMILY
- Add _tr_flush_bits to the external symbols prefixed by --zprefix
- Add contrib/vstudio/vc10 pre-build step for static only
- Quote --version-script argument in CMakeLists.txt
- Don't specify --version-script on Apple platforms in CMakeLists.txt
- Fix casting error in contrib/testzlib/testzlib.c
- Fix types in contrib/minizip to match result of get_crc_table()
- Simplify contrib/vstudio/vc10 with 'd' suffix
- Add TOP support to win32/Makefile.msc
- Suport i686 and amd64 assembler builds in CMakeLists.txt
- Fix typos in the use of _LARGEFILE64_SOURCE in zconf.h
- Add vc11 and vc12 build files to contrib/vstudio
- Add gzvprintf() as an undocumented function in zlib
- Fix configure for Sun shell
- Remove runtime check in configure for four-byte integer type
- Add casts and consts to ease user conversion to C++
- Add man pages for minizip and miniunzip
- In Makefile uninstall, don't rm if preceding cd fails
- Do not return Z_BUF_ERROR if deflateParam() has nothing to write
Changes in 1.2.7 (2 May 2012)
- Replace use of memmove() with a simple copy for portability
- Test for existence of strerror
- Restore gzgetc_ for backward compatibility with 1.2.6
- Fix build with non-GNU make on Solaris
- Require gcc 4.0 or later on Mac OS X to use the hidden attribute
- Include unistd.h for Watcom C
- Use __WATCOMC__ instead of __WATCOM__
- Do not use the visibility attribute if NO_VIZ defined
- Improve the detection of no hidden visibility attribute
- Avoid using __int64 for gcc or solo compilation
- Cast to char * in gzprintf to avoid warnings [Zinser]
- Fix make_vms.com for VAX [Zinser]
- Don't use library or built-in byte swaps
- Simplify test and use of gcc hidden attribute
- Fix bug in gzclose_w() when gzwrite() fails to allocate memory
- Add "x" (O_EXCL) and "e" (O_CLOEXEC) modes support to gzopen()
- Fix bug in test/minigzip.c for configure --solo
- Fix contrib/vstudio project link errors [Mohanathas]
- Add ability to choose the builder in make_vms.com [Schweda]
- Add DESTDIR support to mingw32 win32/Makefile.gcc
- Fix comments in win32/Makefile.gcc for proper usage
- Allow overriding the default install locations for cmake
- Generate and install the pkg-config file with cmake
- Build both a static and a shared version of zlib with cmake
- Include version symbols for cmake builds
- If using cmake with MSVC, add the source directory to the includes
- Remove unneeded EXTRA_CFLAGS from win32/Makefile.gcc [Truta]
- Move obsolete emx makefile to old [Truta]
- Allow the use of -Wundef when compiling or using zlib
- Avoid the use of the -u option with mktemp
- Improve inflate() documentation on the use of Z_FINISH
- Recognize clang as gcc
- Add gzopen_w() in Windows for wide character path names
- Rename zconf.h in CMakeLists.txt to move it out of the way
- Add source directory in CMakeLists.txt for building examples
- Look in build directory for zlib.pc in CMakeLists.txt
- Remove gzflags from zlibvc.def in vc9 and vc10
- Fix contrib/minizip compilation in the MinGW environment
- Update ./configure for Solaris, support --64 [Mooney]
- Remove -R. from Solaris shared build (possible security issue)
- Avoid race condition for parallel make (-j) running example
- Fix type mismatch between get_crc_table() and crc_table
- Fix parsing of version with "-" in CMakeLists.txt [Snider, Ziegler]
- Fix the path to zlib.map in CMakeLists.txt
- Force the native libtool in Mac OS X to avoid GNU libtool [Beebe]
- Add instructions to win32/Makefile.gcc for shared install [Torri]
Changes in 1.2.6.1 (12 Feb 2012)
- Avoid the use of the Objective-C reserved name "id"
- Include io.h in gzguts.h for Microsoft compilers
- Fix problem with ./configure --prefix and gzgetc macro
- Include gz_header definition when compiling zlib solo
- Put gzflags() functionality back in zutil.c
- Avoid library header include in crc32.c for Z_SOLO
- Use name in GCC_CLASSIC as C compiler for coverage testing, if set
- Minor cleanup in contrib/minizip/zip.c [Vollant]
- Update make_vms.com [Zinser]
- Remove unnecessary gzgetc_ function
- Use optimized byte swap operations for Microsoft and GNU [Snyder]
- Fix minor typo in zlib.h comments [Rzesniowiecki]
Changes in 1.2.6 (29 Jan 2012)
- Update the Pascal interface in contrib/pascal
- Fix function numbers for gzgetc_ in zlibvc.def files
- Fix configure.ac for contrib/minizip [Schiffer]
- Fix large-entry detection in minizip on 64-bit systems [Schiffer]
- Have ./configure use the compiler return code for error indication
- Fix CMakeLists.txt for cross compilation [McClure]
- Fix contrib/minizip/zip.c for 64-bit architectures [Dalsnes]
- Fix compilation of contrib/minizip on FreeBSD [Marquez]
- Correct suggested usages in win32/Makefile.msc [Shachar, Horvath]
- Include io.h for Turbo C / Borland C on all platforms [Truta]
- Make version explicit in contrib/minizip/configure.ac [Bosmans]
- Avoid warning for no encryption in contrib/minizip/zip.c [Vollant]
- Minor cleanup up contrib/minizip/unzip.c [Vollant]
- Fix bug when compiling minizip with C++ [Vollant]
- Protect for long name and extra fields in contrib/minizip [Vollant]
- Avoid some warnings in contrib/minizip [Vollant]
- Add -I../.. -L../.. to CFLAGS for minizip and miniunzip
- Add missing libs to minizip linker command
- Add support for VPATH builds in contrib/minizip
- Add an --enable-demos option to contrib/minizip/configure
- Add the generation of configure.log by ./configure
- Exit when required parameters not provided to win32/Makefile.gcc
- Have gzputc return the character written instead of the argument
- Use the -m option on ldconfig for BSD systems [Tobias]
- Correct in zlib.map when deflateResetKeep was added
Changes in 1.2.5.3 (15 Jan 2012)
- Restore gzgetc function for binary compatibility
- Do not use _lseeki64 under Borland C++ [Truta]
- Update win32/Makefile.msc to build test/*.c [Truta]
- Remove old/visualc6 given CMakefile and other alternatives
- Update AS400 build files and documentation [Monnerat]
- Update win32/Makefile.gcc to build test/*.c [Truta]
- Permit stronger flushes after Z_BLOCK flushes
- Avoid extraneous empty blocks when doing empty flushes
- Permit Z_NULL arguments to deflatePending
- Allow deflatePrime() to insert bits in the middle of a stream
- Remove second empty static block for Z_PARTIAL_FLUSH
- Write out all of the available bits when using Z_BLOCK
- Insert the first two strings in the hash table after a flush
Changes in 1.2.5.2 (17 Dec 2011)
- fix ld error: unable to find version dependency 'ZLIB_1.2.5'
- use relative symlinks for shared libs
- Avoid searching past window for Z_RLE strategy
- Assure that high-water mark initialization is always applied in deflate
- Add assertions to fill_window() in deflate.c to match comments
- Update python link in README
- Correct spelling error in gzread.c
- Fix bug in gzgets() for a concatenated empty gzip stream
- Correct error in comment for gz_make()
- Change gzread() and related to ignore junk after gzip streams
- Allow gzread() and related to continue after gzclearerr()
- Allow gzrewind() and gzseek() after a premature end-of-file
- Simplify gzseek() now that raw after gzip is ignored
- Change gzgetc() to a macro for speed (~40% speedup in testing)
- Fix gzclose() to return the actual error last encountered
- Always add large file support for windows
- Include zconf.h for windows large file support
- Include zconf.h.cmakein for windows large file support
- Update zconf.h.cmakein on make distclean
- Merge vestigial vsnprintf determination from zutil.h to gzguts.h
- Clarify how gzopen() appends in zlib.h comments
- Correct documentation of gzdirect() since junk at end now ignored
- Add a transparent write mode to gzopen() when 'T' is in the mode
- Update python link in zlib man page
- Get inffixed.h and MAKEFIXED result to match
- Add a ./config --solo option to make zlib subset with no library use
- Add undocumented inflateResetKeep() function for CAB file decoding
- Add --cover option to ./configure for gcc coverage testing
- Add #define ZLIB_CONST option to use const in the z_stream interface
- Add comment to gzdopen() in zlib.h to use dup() when using fileno()
- Note behavior of uncompress() to provide as much data as it can
- Add files in contrib/minizip to aid in building libminizip
- Split off AR options in Makefile.in and configure
- Change ON macro to Z_ARG to avoid application conflicts
- Facilitate compilation with Borland C++ for pragmas and vsnprintf
- Include io.h for Turbo C / Borland C++
- Move example.c and minigzip.c to test/
- Simplify incomplete code table filling in inflate_table()
- Remove code from inflate.c and infback.c that is impossible to execute
- Test the inflate code with full coverage
- Allow deflateSetDictionary, inflateSetDictionary at any time (in raw)
- Add deflateResetKeep and fix inflateResetKeep to retain dictionary
- Fix gzwrite.c to accommodate reduced memory zlib compilation
- Have inflate() with Z_FINISH avoid the allocation of a window
- Do not set strm->adler when doing raw inflate
- Fix gzeof() to behave just like feof() when read is not past end of file
- Fix bug in gzread.c when end-of-file is reached
- Avoid use of Z_BUF_ERROR in gz* functions except for premature EOF
- Document gzread() capability to read concurrently written files
- Remove hard-coding of resource compiler in CMakeLists.txt [Blammo]
Changes in 1.2.5.1 (10 Sep 2011)
- Update FAQ entry on shared builds (#13)
- Avoid symbolic argument to chmod in Makefile.in
- Fix bug and add consts in contrib/puff [Oberhumer]
- Update contrib/puff/zeros.raw test file to have all block types
- Add full coverage test for puff in contrib/puff/Makefile
- Fix static-only-build install in Makefile.in
- Fix bug in unzGetCurrentFileInfo() in contrib/minizip [Kuno]
- Add libz.a dependency to shared in Makefile.in for parallel builds
- Spell out "number" (instead of "nb") in zlib.h for total_in, total_out
- Replace $(...) with `...` in configure for non-bash sh [Bowler]
- Add darwin* to Darwin* and solaris* to SunOS\ 5* in configure [Groffen]
- Add solaris* to Linux* in configure to allow gcc use [Groffen]
- Add *bsd* to Linux* case in configure [Bar-Lev]
- Add inffast.obj to dependencies in win32/Makefile.msc
- Correct spelling error in deflate.h [Kohler]
- Change libzdll.a again to libz.dll.a (!) in win32/Makefile.gcc
- Add test to configure for GNU C looking for gcc in output of $cc -v
- Add zlib.pc generation to win32/Makefile.gcc [Weigelt]
- Fix bug in zlib.h for _FILE_OFFSET_BITS set and _LARGEFILE64_SOURCE not
- Add comment in zlib.h that adler32_combine with len2 < 0 makes no sense
- Make NO_DIVIDE option in adler32.c much faster (thanks to John Reiser)
- Make stronger test in zconf.h to include unistd.h for LFS
- Apply Darwin patches for 64-bit file offsets to contrib/minizip [Slack]
- Fix zlib.h LFS support when Z_PREFIX used
- Add updated as400 support (removed from old) [Monnerat]
- Avoid deflate sensitivity to volatile input data
- Avoid division in adler32_combine for NO_DIVIDE
- Clarify the use of Z_FINISH with deflateBound() amount of space
- Set binary for output file in puff.c
- Use u4 type for crc_table to avoid conversion warnings
- Apply casts in zlib.h to avoid conversion warnings
- Add OF to prototypes for adler32_combine_ and crc32_combine_ [Miller]
- Improve inflateSync() documentation to note indeterminancy
- Add deflatePending() function to return the amount of pending output
- Correct the spelling of "specification" in FAQ [Randers-Pehrson]
- Add a check in configure for stdarg.h, use for gzprintf()
- Check that pointers fit in ints when gzprint() compiled old style
- Add dummy name before $(SHAREDLIBV) in Makefile [Bar-Lev, Bowler]
- Delete line in configure that adds -L. libz.a to LDFLAGS [Weigelt]
- Add debug records in assmebler code [Londer]
- Update RFC references to use http://tools.ietf.org/html/... [Li]
- Add --archs option, use of libtool to configure for Mac OS X [Borstel]
Changes in 1.2.5 (19 Apr 2010)
- Disable visibility attribute in win32/Makefile.gcc [Bar-Lev]
- Default to libdir as sharedlibdir in configure [Nieder]
- Update copyright dates on modified source files
- Update trees.c to be able to generate modified trees.h
- Exit configure for MinGW, suggesting win32/Makefile.gcc
- Check for NULL path in gz_open [Homurlu]
Changes in 1.2.4.5 (18 Apr 2010)
- Set sharedlibdir in configure [Torok]
- Set LDFLAGS in Makefile.in [Bar-Lev]
- Avoid mkdir objs race condition in Makefile.in [Bowler]
- Add ZLIB_INTERNAL in front of internal inter-module functions and arrays
- Define ZLIB_INTERNAL to hide internal functions and arrays for GNU C
- Don't use hidden attribute when it is a warning generator (e.g. Solaris)
Changes in 1.2.4.4 (18 Apr 2010)
- Fix CROSS_PREFIX executable testing, CHOST extract, mingw* [Torok]
- Undefine _LARGEFILE64_SOURCE in zconf.h if it is zero, but not if empty
- Try to use bash or ksh regardless of functionality of /bin/sh
- Fix configure incompatibility with NetBSD sh
- Remove attempt to run under bash or ksh since have better NetBSD fix
- Fix win32/Makefile.gcc for MinGW [Bar-Lev]
- Add diagnostic messages when using CROSS_PREFIX in configure
- Added --sharedlibdir option to configure [Weigelt]
- Use hidden visibility attribute when available [Frysinger]
Changes in 1.2.4.3 (10 Apr 2010)
- Only use CROSS_PREFIX in configure for ar and ranlib if they exist
- Use CROSS_PREFIX for nm [Bar-Lev]
- Assume _LARGEFILE64_SOURCE defined is equivalent to true
- Avoid use of undefined symbols in #if with && and ||
- Make *64 prototypes in gzguts.h consistent with functions
- Add -shared load option for MinGW in configure [Bowler]
- Move z_off64_t to public interface, use instead of off64_t
- Remove ! from shell test in configure (not portable to Solaris)
- Change +0 macro tests to -0 for possibly increased portability
Changes in 1.2.4.2 (9 Apr 2010)
- Add consistent carriage returns to readme.txt's in masmx86 and masmx64
- Really provide prototypes for *64 functions when building without LFS
- Only define unlink() in minigzip.c if unistd.h not included
- Update README to point to contrib/vstudio project files
- Move projects/vc6 to old/ and remove projects/
- Include stdlib.h in minigzip.c for setmode() definition under WinCE
- Clean up assembler builds in win32/Makefile.msc [Rowe]
- Include sys/types.h for Microsoft for off_t definition
- Fix memory leak on error in gz_open()
- Symbolize nm as $NM in configure [Weigelt]
- Use TEST_LDSHARED instead of LDSHARED to link test programs [Weigelt]
- Add +0 to _FILE_OFFSET_BITS and _LFS64_LARGEFILE in case not defined
- Fix bug in gzeof() to take into account unused input data
- Avoid initialization of structures with variables in puff.c
- Updated win32/README-WIN32.txt [Rowe]
Changes in 1.2.4.1 (28 Mar 2010)
- Remove the use of [a-z] constructs for sed in configure [gentoo 310225]
- Remove $(SHAREDLIB) from LIBS in Makefile.in [Creech]
- Restore "for debugging" comment on sprintf() in gzlib.c
- Remove fdopen for MVS from gzguts.h
- Put new README-WIN32.txt in win32 [Rowe]
- Add check for shell to configure and invoke another shell if needed
- Fix big fat stinking bug in gzseek() on uncompressed files
- Remove vestigial F_OPEN64 define in zutil.h
- Set and check the value of _LARGEFILE_SOURCE and _LARGEFILE64_SOURCE
- Avoid errors on non-LFS systems when applications define LFS macros
- Set EXE to ".exe" in configure for MINGW [Kahle]
- Match crc32() in crc32.c exactly to the prototype in zlib.h [Sherrill]
- Add prefix for cross-compilation in win32/makefile.gcc [Bar-Lev]
- Add DLL install in win32/makefile.gcc [Bar-Lev]
- Allow Linux* or linux* from uname in configure [Bar-Lev]
- Allow ldconfig to be redefined in configure and Makefile.in [Bar-Lev]
- Add cross-compilation prefixes to configure [Bar-Lev]
- Match type exactly in gz_load() invocation in gzread.c
- Match type exactly of zcalloc() in zutil.c to zlib.h alloc_func
- Provide prototypes for *64 functions when building zlib without LFS
- Don't use -lc when linking shared library on MinGW
- Remove errno.h check in configure and vestigial errno code in zutil.h
Changes in 1.2.4 (14 Mar 2010)
- Fix VER3 extraction in configure for no fourth subversion
- Update zlib.3, add docs to Makefile.in to make .pdf out of it
- Add zlib.3.pdf to distribution
- Don't set error code in gzerror() if passed pointer is NULL
- Apply destination directory fixes to CMakeLists.txt [Lowman]
- Move #cmakedefine's to a new zconf.in.cmakein
- Restore zconf.h for builds that don't use configure or cmake
- Add distclean to dummy Makefile for convenience
- Update and improve INDEX, README, and FAQ
- Update CMakeLists.txt for the return of zconf.h [Lowman]
- Update contrib/vstudio/vc9 and vc10 [Vollant]
- Change libz.dll.a back to libzdll.a in win32/Makefile.gcc
- Apply license and readme changes to contrib/asm686 [Raiter]
- Check file name lengths and add -c option in minigzip.c [Li]
- Update contrib/amd64 and contrib/masmx86/ [Vollant]
- Avoid use of "eof" parameter in trees.c to not shadow library variable
- Update make_vms.com for removal of zlibdefs.h [Zinser]
- Update assembler code and vstudio projects in contrib [Vollant]
- Remove outdated assembler code contrib/masm686 and contrib/asm586
- Remove old vc7 and vc8 from contrib/vstudio
- Update win32/Makefile.msc, add ZLIB_VER_SUBREVISION [Rowe]
- Fix memory leaks in gzclose_r() and gzclose_w(), file leak in gz_open()
- Add contrib/gcc_gvmat64 for longest_match and inflate_fast [Vollant]
- Remove *64 functions from win32/zlib.def (they're not 64-bit yet)
- Fix bug in void-returning vsprintf() case in gzwrite.c
- Fix name change from inflate.h in contrib/inflate86/inffas86.c
- Check if temporary file exists before removing in make_vms.com [Zinser]
- Fix make install and uninstall for --static option
- Fix usage of _MSC_VER in gzguts.h and zutil.h [Truta]
- Update readme.txt in contrib/masmx64 and masmx86 to assemble
Changes in 1.2.3.9 (21 Feb 2010)
- Expunge gzio.c
- Move as400 build information to old
- Fix updates in contrib/minizip and contrib/vstudio
- Add const to vsnprintf test in configure to avoid warnings [Weigelt]
- Delete zconf.h (made by configure) [Weigelt]
- Change zconf.in.h to zconf.h.in per convention [Weigelt]
- Check for NULL buf in gzgets()
- Return empty string for gzgets() with len == 1 (like fgets())
- Fix description of gzgets() in zlib.h for end-of-file, NULL return
- Update minizip to 1.1 [Vollant]
- Avoid MSVC loss of data warnings in gzread.c, gzwrite.c
- Note in zlib.h that gzerror() should be used to distinguish from EOF
- Remove use of snprintf() from gzlib.c
- Fix bug in gzseek()
- Update contrib/vstudio, adding vc9 and vc10 [Kuno, Vollant]
- Fix zconf.h generation in CMakeLists.txt [Lowman]
- Improve comments in zconf.h where modified by configure
Changes in 1.2.3.8 (13 Feb 2010)
- Clean up text files (tabs, trailing whitespace, etc.) [Oberhumer]
- Use z_off64_t in gz_zero() and gz_skip() to match state->skip
- Avoid comparison problem when sizeof(int) == sizeof(z_off64_t)
- Revert to Makefile.in from 1.2.3.6 (live with the clutter)
- Fix missing error return in gzflush(), add zlib.h note
- Add *64 functions to zlib.map [Levin]
- Fix signed/unsigned comparison in gz_comp()
- Use SFLAGS when testing shared linking in configure
- Add --64 option to ./configure to use -m64 with gcc
- Fix ./configure --help to correctly name options
- Have make fail if a test fails [Levin]
- Avoid buffer overrun in contrib/masmx64/gvmat64.asm [Simpson]
- Remove assembler object files from contrib
Changes in 1.2.3.7 (24 Jan 2010)
- Always gzopen() with O_LARGEFILE if available
- Fix gzdirect() to work immediately after gzopen() or gzdopen()
- Make gzdirect() more precise when the state changes while reading
- Improve zlib.h documentation in many places
- Catch memory allocation failure in gz_open()
- Complete close operation if seek forward in gzclose_w() fails
- Return Z_ERRNO from gzclose_r() if close() fails
- Return Z_STREAM_ERROR instead of EOF for gzclose() being passed NULL
- Return zero for gzwrite() errors to match zlib.h description
- Return -1 on gzputs() error to match zlib.h description
- Add zconf.in.h to allow recovery from configure modification [Weigelt]
- Fix static library permissions in Makefile.in [Weigelt]
- Avoid warnings in configure tests that hide functionality [Weigelt]
- Add *BSD and DragonFly to Linux case in configure [gentoo 123571]
- Change libzdll.a to libz.dll.a in win32/Makefile.gcc [gentoo 288212]
- Avoid access of uninitialized data for first inflateReset2 call [Gomes]
- Keep object files in subdirectories to reduce the clutter somewhat
- Remove default Makefile and zlibdefs.h, add dummy Makefile
- Add new external functions to Z_PREFIX, remove duplicates, z_z_ -> z_
- Remove zlibdefs.h completely -- modify zconf.h instead
Changes in 1.2.3.6 (17 Jan 2010)
- Avoid void * arithmetic in gzread.c and gzwrite.c
- Make compilers happier with const char * for gz_error message
- Avoid unused parameter warning in inflate.c
- Avoid signed-unsigned comparison warning in inflate.c
- Indent #pragma's for traditional C
- Fix usage of strwinerror() in glib.c, change to gz_strwinerror()
- Correct email address in configure for system options
- Update make_vms.com and add make_vms.com to contrib/minizip [Zinser]
- Update zlib.map [Brown]
- Fix Makefile.in for Solaris 10 make of example64 and minizip64 [Torok]
- Apply various fixes to CMakeLists.txt [Lowman]
- Add checks on len in gzread() and gzwrite()
- Add error message for no more room for gzungetc()
- Remove zlib version check in gzwrite()
- Defer compression of gzprintf() result until need to
- Use snprintf() in gzdopen() if available
- Remove USE_MMAP configuration determination (only used by minigzip)
- Remove examples/pigz.c (available separately)
- Update examples/gun.c to 1.6
Changes in 1.2.3.5 (8 Jan 2010)
- Add space after #if in zutil.h for some compilers
- Fix relatively harmless bug in deflate_fast() [Exarevsky]
- Fix same problem in deflate_slow()
- Add $(SHAREDLIBV) to LIBS in Makefile.in [Brown]
- Add deflate_rle() for faster Z_RLE strategy run-length encoding
- Add deflate_huff() for faster Z_HUFFMAN_ONLY encoding
- Change name of "write" variable in inffast.c to avoid library collisions
- Fix premature EOF from gzread() in gzio.c [Brown]
- Use zlib header window size if windowBits is 0 in inflateInit2()
- Remove compressBound() call in deflate.c to avoid linking compress.o
- Replace use of errno in gz* with functions, support WinCE [Alves]
- Provide alternative to perror() in minigzip.c for WinCE [Alves]
- Don't use _vsnprintf on later versions of MSVC [Lowman]
- Add CMake build script and input file [Lowman]
- Update contrib/minizip to 1.1 [Svensson, Vollant]
- Moved nintendods directory from contrib to .
- Replace gzio.c with a new set of routines with the same functionality
- Add gzbuffer(), gzoffset(), gzclose_r(), gzclose_w() as part of above
- Update contrib/minizip to 1.1b
- Change gzeof() to return 0 on error instead of -1 to agree with zlib.h
Changes in 1.2.3.4 (21 Dec 2009)
- Use old school .SUFFIXES in Makefile.in for FreeBSD compatibility
- Update comments in configure and Makefile.in for default --shared
- Fix test -z's in configure [Marquess]
- Build examplesh and minigzipsh when not testing
- Change NULL's to Z_NULL's in deflate.c and in comments in zlib.h
- Import LDFLAGS from the environment in configure
- Fix configure to populate SFLAGS with discovered CFLAGS options
- Adapt make_vms.com to the new Makefile.in [Zinser]
- Add zlib2ansi script for C++ compilation [Marquess]
- Add _FILE_OFFSET_BITS=64 test to make test (when applicable)
- Add AMD64 assembler code for longest match to contrib [Teterin]
- Include options from $SFLAGS when doing $LDSHARED
- Simplify 64-bit file support by introducing z_off64_t type
- Make shared object files in objs directory to work around old Sun cc
- Use only three-part version number for Darwin shared compiles
- Add rc option to ar in Makefile.in for when ./configure not run
- Add -WI,-rpath,. to LDFLAGS for OSF 1 V4*
- Set LD_LIBRARYN32_PATH for SGI IRIX shared compile
- Protect against _FILE_OFFSET_BITS being defined when compiling zlib
- Rename Makefile.in targets allstatic to static and allshared to shared
- Fix static and shared Makefile.in targets to be independent
- Correct error return bug in gz_open() by setting state [Brown]
- Put spaces before ;;'s in configure for better sh compatibility
- Add pigz.c (parallel implementation of gzip) to examples/
- Correct constant in crc32.c to UL [Leventhal]
- Reject negative lengths in crc32_combine()
- Add inflateReset2() function to work like inflateEnd()/inflateInit2()
- Include sys/types.h for _LARGEFILE64_SOURCE [Brown]
- Correct typo in doc/algorithm.txt [Janik]
- Fix bug in adler32_combine() [Zhu]
- Catch missing-end-of-block-code error in all inflates and in puff
Assures that random input to inflate eventually results in an error
- Added enough.c (calculation of ENOUGH for inftrees.h) to examples/
- Update ENOUGH and its usage to reflect discovered bounds
- Fix gzerror() error report on empty input file [Brown]
- Add ush casts in trees.c to avoid pedantic runtime errors
- Fix typo in zlib.h uncompress() description [Reiss]
- Correct inflate() comments with regard to automatic header detection
- Remove deprecation comment on Z_PARTIAL_FLUSH (it stays)
- Put new version of gzlog (2.0) in examples with interruption recovery
- Add puff compile option to permit invalid distance-too-far streams
- Add puff TEST command options, ability to read piped input
- Prototype the *64 functions in zlib.h when _FILE_OFFSET_BITS == 64, but
_LARGEFILE64_SOURCE not defined
- Fix Z_FULL_FLUSH to truly erase the past by resetting s->strstart
- Fix deflateSetDictionary() to use all 32K for output consistency
- Remove extraneous #define MIN_LOOKAHEAD in deflate.c (in deflate.h)
- Clear bytes after deflate lookahead to avoid use of uninitialized data
- Change a limit in inftrees.c to be more transparent to Coverity Prevent
- Update win32/zlib.def with exported symbols from zlib.h
- Correct spelling errors in zlib.h [Willem, Sobrado]
- Allow Z_BLOCK for deflate() to force a new block
- Allow negative bits in inflatePrime() to delete existing bit buffer
- Add Z_TREES flush option to inflate() to return at end of trees
- Add inflateMark() to return current state information for random access
- Add Makefile for NintendoDS to contrib [Costa]
- Add -w in configure compile tests to avoid spurious warnings [Beucler]
- Fix typos in zlib.h comments for deflateSetDictionary()
- Fix EOF detection in transparent gzread() [Maier]
Changes in 1.2.3.3 (2 October 2006)
- Make --shared the default for configure, add a --static option
- Add compile option to permit invalid distance-too-far streams
- Add inflateUndermine() function which is required to enable above
- Remove use of "this" variable name for C++ compatibility [Marquess]
- Add testing of shared library in make test, if shared library built
- Use ftello() and fseeko() if available instead of ftell() and fseek()
- Provide two versions of all functions that use the z_off_t type for
binary compatibility -- a normal version and a 64-bit offset version,
per the Large File Support Extension when _LARGEFILE64_SOURCE is
defined; use the 64-bit versions by default when _FILE_OFFSET_BITS
is defined to be 64
- Add a --uname= option to configure to perhaps help with cross-compiling
Changes in 1.2.3.2 (3 September 2006)
- Turn off silly Borland warnings [Hay]
- Use off64_t and define _LARGEFILE64_SOURCE when present
- Fix missing dependency on inffixed.h in Makefile.in
- Rig configure --shared to build both shared and static [Teredesai, Truta]
- Remove zconf.in.h and instead create a new zlibdefs.h file
- Fix contrib/minizip/unzip.c non-encrypted after encrypted [Vollant]
- Add treebuild.xml (see http://treebuild.metux.de/) [Weigelt]
Changes in 1.2.3.1 (16 August 2006)
- Add watcom directory with OpenWatcom make files [Daniel]
- Remove #undef of FAR in zconf.in.h for MVS [Fedtke]
- Update make_vms.com [Zinser]
- Use -fPIC for shared build in configure [Teredesai, Nicholson]
- Use only major version number for libz.so on IRIX and OSF1 [Reinholdtsen]
- Use fdopen() (not _fdopen()) for Interix in zutil.h [Bäck]
- Add some FAQ entries about the contrib directory
- Update the MVS question in the FAQ
- Avoid extraneous reads after EOF in gzio.c [Brown]
- Correct spelling of "successfully" in gzio.c [Randers-Pehrson]
- Add comments to zlib.h about gzerror() usage [Brown]
- Set extra flags in gzip header in gzopen() like deflate() does
- Make configure options more compatible with double-dash conventions
[Weigelt]
- Clean up compilation under Solaris SunStudio cc [Rowe, Reinholdtsen]
- Fix uninstall target in Makefile.in [Truta]
- Add pkgconfig support [Weigelt]
- Use $(DESTDIR) macro in Makefile.in [Reinholdtsen, Weigelt]
- Replace set_data_type() with a more accurate detect_data_type() in
trees.c, according to the txtvsbin.txt document [Truta]
- Swap the order of #include <stdio.h> and #include "zlib.h" in
gzio.c, example.c and minigzip.c [Truta]
- Shut up annoying VS2005 warnings about standard C deprecation [Rowe,
Truta] (where?)
- Fix target "clean" from win32/Makefile.bor [Truta]
- Create .pdb and .manifest files in win32/makefile.msc [Ziegler, Rowe]
- Update zlib www home address in win32/DLL_FAQ.txt [Truta]
- Update contrib/masmx86/inffas32.asm for VS2005 [Vollant, Van Wassenhove]
- Enable browse info in the "Debug" and "ASM Debug" configurations in
the Visual C++ 6 project, and set (non-ASM) "Debug" as default [Truta]
- Add pkgconfig support [Weigelt]
- Add ZLIB_VER_MAJOR, ZLIB_VER_MINOR and ZLIB_VER_REVISION in zlib.h,
for use in win32/zlib1.rc [Polushin, Rowe, Truta]
- Add a document that explains the new text detection scheme to
doc/txtvsbin.txt [Truta]
- Add rfc1950.txt, rfc1951.txt and rfc1952.txt to doc/ [Truta]
- Move algorithm.txt into doc/ [Truta]
- Synchronize FAQ with website
- Fix compressBound(), was low for some pathological cases [Fearnley]
- Take into account wrapper variations in deflateBound()
- Set examples/zpipe.c input and output to binary mode for Windows
- Update examples/zlib_how.html with new zpipe.c (also web site)
- Fix some warnings in examples/gzlog.c and examples/zran.c (it seems
that gcc became pickier in 4.0)
- Add zlib.map for Linux: "All symbols from zlib-1.1.4 remain
un-versioned, the patch adds versioning only for symbols introduced in
zlib-1.2.0 or later. It also declares as local those symbols which are
not designed to be exported." [Levin]
- Update Z_PREFIX list in zconf.in.h, add --zprefix option to configure
- Do not initialize global static by default in trees.c, add a response
NO_INIT_GLOBAL_POINTERS to initialize them if needed [Marquess]
- Don't use strerror() in gzio.c under WinCE [Yakimov]
- Don't use errno.h in zutil.h under WinCE [Yakimov]
- Move arguments for AR to its usage to allow replacing ar [Marot]
- Add HAVE_VISIBILITY_PRAGMA in zconf.in.h for Mozilla [Randers-Pehrson]
- Improve inflateInit() and inflateInit2() documentation
- Fix structure size comment in inflate.h
- Change configure help option from --h* to --help [Santos]
Changes in 1.2.3 (18 July 2005)
- Apply security vulnerability fixes to contrib/infback9 as well
- Clean up some text files (carriage returns, trailing space)
@ -13,7 +673,7 @@ Changes in 1.2.2.4 (11 July 2005)
compile
- Fix some spelling errors in comments [Betts]
- Correct inflateInit2() error return documentation in zlib.h
- Added zran.c example of compressed data random access to examples
- Add zran.c example of compressed data random access to examples
directory, shows use of inflatePrime()
- Fix cast for assignments to strm->state in inflate.c and infback.c
- Fix zlibCompileFlags() in zutil.c to use 1L for long shifts [Oberhumer]
@ -561,7 +1221,7 @@ Changes in 1.0.6 (19 Jan 1998)
386 asm code replacing longest_match().
contrib/iostream/ by Kevin Ruland <kevin@rodin.wustl.edu>
A C++ I/O streams interface to the zlib gz* functions
contrib/iostream2/ by Tyge Løvset <Tyge.Lovset@cmr.no>
contrib/iostream2/ by Tyge Løvset <Tyge.Lovset@cmr.no>
Another C++ I/O streams interface
contrib/untgz/ by "Pedro A. Aranda Guti\irrez" <paag@tid.es>
A very simple tar.gz file extractor using zlib
@ -650,7 +1310,7 @@ Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion]
- fix array overlay in deflate.c which sometimes caused bad compressed data
- fix inflate bug with empty stored block
- fix MSDOS medium model which was broken in 0.99
- fix deflateParams() which could generated bad compressed data.
- fix deflateParams() which could generate bad compressed data.
- Bytef is define'd instead of typedef'ed (work around Borland bug)
- added an INDEX file
- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32),

View File

@ -0,0 +1,368 @@
Frequently Asked Questions about zlib
If your question is not there, please check the zlib home page
http://zlib.net/ which may have more recent information.
The lastest zlib FAQ is at http://zlib.net/zlib_faq.html
1. Is zlib Y2K-compliant?
Yes. zlib doesn't handle dates.
2. Where can I get a Windows DLL version?
The zlib sources can be compiled without change to produce a DLL. See the
file win32/DLL_FAQ.txt in the zlib distribution. Pointers to the
precompiled DLL are found in the zlib web site at http://zlib.net/ .
3. Where can I get a Visual Basic interface to zlib?
See
* http://marknelson.us/1997/01/01/zlib-engine/
* win32/DLL_FAQ.txt in the zlib distribution
4. compress() returns Z_BUF_ERROR.
Make sure that before the call of compress(), the length of the compressed
buffer is equal to the available size of the compressed buffer and not
zero. For Visual Basic, check that this parameter is passed by reference
("as any"), not by value ("as long").
5. deflate() or inflate() returns Z_BUF_ERROR.
Before making the call, make sure that avail_in and avail_out are not zero.
When setting the parameter flush equal to Z_FINISH, also make sure that
avail_out is big enough to allow processing all pending input. Note that a
Z_BUF_ERROR is not fatal--another call to deflate() or inflate() can be
made with more input or output space. A Z_BUF_ERROR may in fact be
unavoidable depending on how the functions are used, since it is not
possible to tell whether or not there is more output pending when
strm.avail_out returns with zero. See http://zlib.net/zlib_how.html for a
heavily annotated example.
6. Where's the zlib documentation (man pages, etc.)?
It's in zlib.h . Examples of zlib usage are in the files test/example.c
and test/minigzip.c, with more in examples/ .
7. Why don't you use GNU autoconf or libtool or ...?
Because we would like to keep zlib as a very small and simple package.
zlib is rather portable and doesn't need much configuration.
8. I found a bug in zlib.
Most of the time, such problems are due to an incorrect usage of zlib.
Please try to reproduce the problem with a small program and send the
corresponding source to us at zlib@gzip.org . Do not send multi-megabyte
data files without prior agreement.
9. Why do I get "undefined reference to gzputc"?
If "make test" produces something like
example.o(.text+0x154): undefined reference to `gzputc'
check that you don't have old files libz.* in /usr/lib, /usr/local/lib or
/usr/X11R6/lib. Remove any old versions, then do "make install".
10. I need a Delphi interface to zlib.
See the contrib/delphi directory in the zlib distribution.
11. Can zlib handle .zip archives?
Not by itself, no. See the directory contrib/minizip in the zlib
distribution.
12. Can zlib handle .Z files?
No, sorry. You have to spawn an uncompress or gunzip subprocess, or adapt
the code of uncompress on your own.
13. How can I make a Unix shared library?
By default a shared (and a static) library is built for Unix. So:
make distclean
./configure
make
14. How do I install a shared zlib library on Unix?
After the above, then:
make install
However, many flavors of Unix come with a shared zlib already installed.
Before going to the trouble of compiling a shared version of zlib and
trying to install it, you may want to check if it's already there! If you
can #include <zlib.h>, it's there. The -lz option will probably link to
it. You can check the version at the top of zlib.h or with the
ZLIB_VERSION symbol defined in zlib.h .
15. I have a question about OttoPDF.
We are not the authors of OttoPDF. The real author is on the OttoPDF web
site: Joel Hainley, jhainley@myndkryme.com.
16. Can zlib decode Flate data in an Adobe PDF file?
Yes. See http://www.pdflib.com/ . To modify PDF forms, see
http://sourceforge.net/projects/acroformtool/ .
17. Why am I getting this "register_frame_info not found" error on Solaris?
After installing zlib 1.1.4 on Solaris 2.6, running applications using zlib
generates an error such as:
ld.so.1: rpm: fatal: relocation error: file /usr/local/lib/libz.so:
symbol __register_frame_info: referenced symbol not found
The symbol __register_frame_info is not part of zlib, it is generated by
the C compiler (cc or gcc). You must recompile applications using zlib
which have this problem. This problem is specific to Solaris. See
http://www.sunfreeware.com for Solaris versions of zlib and applications
using zlib.
18. Why does gzip give an error on a file I make with compress/deflate?
The compress and deflate functions produce data in the zlib format, which
is different and incompatible with the gzip format. The gz* functions in
zlib on the other hand use the gzip format. Both the zlib and gzip formats
use the same compressed data format internally, but have different headers
and trailers around the compressed data.
19. Ok, so why are there two different formats?
The gzip format was designed to retain the directory information about a
single file, such as the name and last modification date. The zlib format
on the other hand was designed for in-memory and communication channel
applications, and has a much more compact header and trailer and uses a
faster integrity check than gzip.
20. Well that's nice, but how do I make a gzip file in memory?
You can request that deflate write the gzip format instead of the zlib
format using deflateInit2(). You can also request that inflate decode the
gzip format using inflateInit2(). Read zlib.h for more details.
21. Is zlib thread-safe?
Yes. However any library routines that zlib uses and any application-
provided memory allocation routines must also be thread-safe. zlib's gz*
functions use stdio library routines, and most of zlib's functions use the
library memory allocation routines by default. zlib's *Init* functions
allow for the application to provide custom memory allocation routines.
Of course, you should only operate on any given zlib or gzip stream from a
single thread at a time.
22. Can I use zlib in my commercial application?
Yes. Please read the license in zlib.h.
23. Is zlib under the GNU license?
No. Please read the license in zlib.h.
24. The license says that altered source versions must be "plainly marked". So
what exactly do I need to do to meet that requirement?
You need to change the ZLIB_VERSION and ZLIB_VERNUM #defines in zlib.h. In
particular, the final version number needs to be changed to "f", and an
identification string should be appended to ZLIB_VERSION. Version numbers
x.x.x.f are reserved for modifications to zlib by others than the zlib
maintainers. For example, if the version of the base zlib you are altering
is "1.2.3.4", then in zlib.h you should change ZLIB_VERNUM to 0x123f, and
ZLIB_VERSION to something like "1.2.3.f-zachary-mods-v3". You can also
update the version strings in deflate.c and inftrees.c.
For altered source distributions, you should also note the origin and
nature of the changes in zlib.h, as well as in ChangeLog and README, along
with the dates of the alterations. The origin should include at least your
name (or your company's name), and an email address to contact for help or
issues with the library.
Note that distributing a compiled zlib library along with zlib.h and
zconf.h is also a source distribution, and so you should change
ZLIB_VERSION and ZLIB_VERNUM and note the origin and nature of the changes
in zlib.h as you would for a full source distribution.
25. Will zlib work on a big-endian or little-endian architecture, and can I
exchange compressed data between them?
Yes and yes.
26. Will zlib work on a 64-bit machine?
Yes. It has been tested on 64-bit machines, and has no dependence on any
data types being limited to 32-bits in length. If you have any
difficulties, please provide a complete problem report to zlib@gzip.org
27. Will zlib decompress data from the PKWare Data Compression Library?
No. The PKWare DCL uses a completely different compressed data format than
does PKZIP and zlib. However, you can look in zlib's contrib/blast
directory for a possible solution to your problem.
28. Can I access data randomly in a compressed stream?
No, not without some preparation. If when compressing you periodically use
Z_FULL_FLUSH, carefully write all the pending data at those points, and
keep an index of those locations, then you can start decompression at those
points. You have to be careful to not use Z_FULL_FLUSH too often, since it
can significantly degrade compression. Alternatively, you can scan a
deflate stream once to generate an index, and then use that index for
random access. See examples/zran.c .
29. Does zlib work on MVS, OS/390, CICS, etc.?
It has in the past, but we have not heard of any recent evidence. There
were working ports of zlib 1.1.4 to MVS, but those links no longer work.
If you know of recent, successful applications of zlib on these operating
systems, please let us know. Thanks.
30. Is there some simpler, easier to read version of inflate I can look at to
understand the deflate format?
First off, you should read RFC 1951. Second, yes. Look in zlib's
contrib/puff directory.
31. Does zlib infringe on any patents?
As far as we know, no. In fact, that was originally the whole point behind
zlib. Look here for some more information:
http://www.gzip.org/#faq11
32. Can zlib work with greater than 4 GB of data?
Yes. inflate() and deflate() will process any amount of data correctly.
Each call of inflate() or deflate() is limited to input and output chunks
of the maximum value that can be stored in the compiler's "unsigned int"
type, but there is no limit to the number of chunks. Note however that the
strm.total_in and strm_total_out counters may be limited to 4 GB. These
counters are provided as a convenience and are not used internally by
inflate() or deflate(). The application can easily set up its own counters
updated after each call of inflate() or deflate() to count beyond 4 GB.
compress() and uncompress() may be limited to 4 GB, since they operate in a
single call. gzseek() and gztell() may be limited to 4 GB depending on how
zlib is compiled. See the zlibCompileFlags() function in zlib.h.
The word "may" appears several times above since there is a 4 GB limit only
if the compiler's "long" type is 32 bits. If the compiler's "long" type is
64 bits, then the limit is 16 exabytes.
33. Does zlib have any security vulnerabilities?
The only one that we are aware of is potentially in gzprintf(). If zlib is
compiled to use sprintf() or vsprintf(), then there is no protection
against a buffer overflow of an 8K string space (or other value as set by
gzbuffer()), other than the caller of gzprintf() assuring that the output
will not exceed 8K. On the other hand, if zlib is compiled to use
snprintf() or vsnprintf(), which should normally be the case, then there is
no vulnerability. The ./configure script will display warnings if an
insecure variation of sprintf() will be used by gzprintf(). Also the
zlibCompileFlags() function will return information on what variant of
sprintf() is used by gzprintf().
If you don't have snprintf() or vsnprintf() and would like one, you can
find a portable implementation here:
http://www.ijs.si/software/snprintf/
Note that you should be using the most recent version of zlib. Versions
1.1.3 and before were subject to a double-free vulnerability, and versions
1.2.1 and 1.2.2 were subject to an access exception when decompressing
invalid compressed data.
34. Is there a Java version of zlib?
Probably what you want is to use zlib in Java. zlib is already included
as part of the Java SDK in the java.util.zip package. If you really want
a version of zlib written in the Java language, look on the zlib home
page for links: http://zlib.net/ .
35. I get this or that compiler or source-code scanner warning when I crank it
up to maximally-pedantic. Can't you guys write proper code?
Many years ago, we gave up attempting to avoid warnings on every compiler
in the universe. It just got to be a waste of time, and some compilers
were downright silly as well as contradicted each other. So now, we simply
make sure that the code always works.
36. Valgrind (or some similar memory access checker) says that deflate is
performing a conditional jump that depends on an uninitialized value.
Isn't that a bug?
No. That is intentional for performance reasons, and the output of deflate
is not affected. This only started showing up recently since zlib 1.2.x
uses malloc() by default for allocations, whereas earlier versions used
calloc(), which zeros out the allocated memory. Even though the code was
correct, versions 1.2.4 and later was changed to not stimulate these
checkers.
37. Will zlib read the (insert any ancient or arcane format here) compressed
data format?
Probably not. Look in the comp.compression FAQ for pointers to various
formats and associated software.
38. How can I encrypt/decrypt zip files with zlib?
zlib doesn't support encryption. The original PKZIP encryption is very
weak and can be broken with freely available programs. To get strong
encryption, use GnuPG, http://www.gnupg.org/ , which already includes zlib
compression. For PKZIP compatible "encryption", look at
http://www.info-zip.org/
39. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings?
"gzip" is the gzip format, and "deflate" is the zlib format. They should
probably have called the second one "zlib" instead to avoid confusion with
the raw deflate compressed data format. While the HTTP 1.1 RFC 2616
correctly points to the zlib specification in RFC 1950 for the "deflate"
transfer encoding, there have been reports of servers and browsers that
incorrectly produce or expect raw deflate data per the deflate
specification in RFC 1951, most notably Microsoft. So even though the
"deflate" transfer encoding using the zlib format would be the more
efficient approach (and in fact exactly what the zlib format was designed
for), using the "gzip" transfer encoding is probably more reliable due to
an unfortunate choice of name on the part of the HTTP 1.1 authors.
Bottom line: use the gzip format for HTTP 1.1 encoding.
40. Does zlib support the new "Deflate64" format introduced by PKWare?
No. PKWare has apparently decided to keep that format proprietary, since
they have not documented it as they have previous compression formats. In
any case, the compression improvements are so modest compared to other more
modern approaches, that it's not worth the effort to implement.
41. I'm having a problem with the zip functions in zlib, can you help?
There are no zip functions in zlib. You are probably using minizip by
Giles Vollant, which is found in the contrib directory of zlib. It is not
part of zlib. In fact none of the stuff in contrib is part of zlib. The
files in there are not supported by the zlib authors. You need to contact
the authors of the respective contribution for help.
42. The match.asm code in contrib is under the GNU General Public License.
Since it's part of zlib, doesn't that mean that all of zlib falls under the
GNU GPL?
No. The files in contrib are not part of zlib. They were contributed by
other authors and are provided as a convenience to the user within the zlib
distribution. Each item in contrib has its own license.
43. Is zlib subject to export controls? What is its ECCN?
zlib is not subject to export controls, and so is classified as EAR99.
44. Can you please sign these lengthy legal documents and fax them back to us
so that we can use your software in our product?
No. Go away. Shoo.

View File

@ -0,0 +1,68 @@
CMakeLists.txt cmake build file
ChangeLog history of changes
FAQ Frequently Asked Questions about zlib
INDEX this file
Makefile dummy Makefile that tells you to ./configure
Makefile.in template for Unix Makefile
README guess what
configure configure script for Unix
make_vms.com makefile for VMS
test/example.c zlib usages examples for build testing
test/minigzip.c minimal gzip-like functionality for build testing
test/infcover.c inf*.c code coverage for build coverage testing
treebuild.xml XML description of source file dependencies
zconf.h.cmakein zconf.h template for cmake
zconf.h.in zconf.h template for configure
zlib.3 Man page for zlib
zlib.3.pdf Man page in PDF format
zlib.map Linux symbol information
zlib.pc.in Template for pkg-config descriptor
zlib.pc.cmakein zlib.pc template for cmake
zlib2ansi perl script to convert source files for C++ compilation
amiga/ makefiles for Amiga SAS C
as400/ makefiles for AS/400
doc/ documentation for formats and algorithms
msdos/ makefiles for MSDOS
nintendods/ makefile for Nintendo DS
old/ makefiles for various architectures and zlib documentation
files that have not yet been updated for zlib 1.2.x
qnx/ makefiles for QNX
watcom/ makefiles for OpenWatcom
win32/ makefiles for Windows
zlib public header files (required for library use):
zconf.h
zlib.h
private source files used to build the zlib library:
adler32.c
compress.c
crc32.c
crc32.h
deflate.c
deflate.h
gzclose.c
gzguts.h
gzlib.c
gzread.c
gzwrite.c
infback.c
inffast.c
inffast.h
inffixed.h
inflate.c
inflate.h
inftrees.c
inftrees.h
trees.c
trees.h
uncompr.c
zutil.c
zutil.h
source files for sample programs
See examples/README.examples
unsupported contributions by third parties
See contrib/README.contrib

View File

@ -0,0 +1,410 @@
# Makefile for zlib
# Copyright (C) 1995-2017 Jean-loup Gailly, Mark Adler
# For conditions of distribution and use, see copyright notice in zlib.h
# To compile and test, type:
# ./configure; make test
# Normally configure builds both a static and a shared library.
# If you want to build just a static library, use: ./configure --static
# To use the asm code, type:
# cp contrib/asm?86/match.S ./match.S
# make LOC=-DASMV OBJA=match.o
# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
# make install
# To install in $HOME instead of /usr/local, use:
# make install prefix=$HOME
CC=cc
CFLAGS=-O
#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
#CFLAGS=-g -DZLIB_DEBUG
#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
# -Wstrict-prototypes -Wmissing-prototypes
SFLAGS=-O
LDFLAGS=
TEST_LDFLAGS=-L. libz.a
LDSHARED=$(CC)
CPP=$(CC) -E
STATICLIB=libz.a
SHAREDLIB=libz.so
SHAREDLIBV=libz.so.1.2.11
SHAREDLIBM=libz.so.1
LIBS=$(STATICLIB) $(SHAREDLIBV)
AR=ar
ARFLAGS=rc
RANLIB=ranlib
LDCONFIG=ldconfig
LDSHAREDLIBC=-lc
TAR=tar
SHELL=/bin/sh
EXE=
prefix = /usr/local
exec_prefix = ${prefix}
libdir = ${exec_prefix}/lib
sharedlibdir = ${libdir}
includedir = ${prefix}/include
mandir = ${prefix}/share/man
man3dir = ${mandir}/man3
pkgconfigdir = ${libdir}/pkgconfig
SRCDIR=
ZINC=
ZINCOUT=-I.
OBJZ = adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o
OBJG = compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
OBJC = $(OBJZ) $(OBJG)
PIC_OBJZ = adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo
PIC_OBJG = compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo
PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJG)
# to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
OBJA =
PIC_OBJA =
OBJS = $(OBJC) $(OBJA)
PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
all: static shared
static: example$(EXE) minigzip$(EXE)
shared: examplesh$(EXE) minigzipsh$(EXE)
all64: example64$(EXE) minigzip64$(EXE)
check: test
test: all teststatic testshared
teststatic: static
@TMPST=tmpst_$$; \
if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST ; then \
echo ' *** zlib test OK ***'; \
else \
echo ' *** zlib test FAILED ***'; false; \
fi; \
rm -f $$TMPST
testshared: shared
@LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
TMPSH=tmpsh_$$; \
if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh $$TMPSH; then \
echo ' *** zlib shared test OK ***'; \
else \
echo ' *** zlib shared test FAILED ***'; false; \
fi; \
rm -f $$TMPSH
test64: all64
@TMP64=tmp64_$$; \
if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64; then \
echo ' *** zlib 64-bit test OK ***'; \
else \
echo ' *** zlib 64-bit test FAILED ***'; false; \
fi; \
rm -f $$TMP64
infcover.o: $(SRCDIR)test/infcover.c $(SRCDIR)zlib.h zconf.h
$(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/infcover.c
infcover: infcover.o libz.a
$(CC) $(CFLAGS) -o $@ infcover.o libz.a
cover: infcover
rm -f *.gcda
./infcover
gcov inf*.c
libz.a: $(OBJS)
$(AR) $(ARFLAGS) $@ $(OBJS)
-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
match.o: match.S
$(CPP) match.S > _match.s
$(CC) -c _match.s
mv _match.o match.o
rm -f _match.s
match.lo: match.S
$(CPP) match.S > _match.s
$(CC) -c -fPIC _match.s
mv _match.o match.lo
rm -f _match.s
example.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h
$(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/example.c
minigzip.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h
$(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/minigzip.c
example64.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h
$(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/example.c
minigzip64.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h
$(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/minigzip.c
adler32.o: $(SRCDIR)adler32.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)adler32.c
crc32.o: $(SRCDIR)crc32.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)crc32.c
deflate.o: $(SRCDIR)deflate.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)deflate.c
infback.o: $(SRCDIR)infback.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)infback.c
inffast.o: $(SRCDIR)inffast.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inffast.c
inflate.o: $(SRCDIR)inflate.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inflate.c
inftrees.o: $(SRCDIR)inftrees.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inftrees.c
trees.o: $(SRCDIR)trees.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)trees.c
zutil.o: $(SRCDIR)zutil.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)zutil.c
compress.o: $(SRCDIR)compress.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)compress.c
uncompr.o: $(SRCDIR)uncompr.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)uncompr.c
gzclose.o: $(SRCDIR)gzclose.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzclose.c
gzlib.o: $(SRCDIR)gzlib.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzlib.c
gzread.o: $(SRCDIR)gzread.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzread.c
gzwrite.o: $(SRCDIR)gzwrite.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzwrite.c
adler32.lo: $(SRCDIR)adler32.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/adler32.o $(SRCDIR)adler32.c
-@mv objs/adler32.o $@
crc32.lo: $(SRCDIR)crc32.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/crc32.o $(SRCDIR)crc32.c
-@mv objs/crc32.o $@
deflate.lo: $(SRCDIR)deflate.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/deflate.o $(SRCDIR)deflate.c
-@mv objs/deflate.o $@
infback.lo: $(SRCDIR)infback.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/infback.o $(SRCDIR)infback.c
-@mv objs/infback.o $@
inffast.lo: $(SRCDIR)inffast.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inffast.o $(SRCDIR)inffast.c
-@mv objs/inffast.o $@
inflate.lo: $(SRCDIR)inflate.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inflate.o $(SRCDIR)inflate.c
-@mv objs/inflate.o $@
inftrees.lo: $(SRCDIR)inftrees.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inftrees.o $(SRCDIR)inftrees.c
-@mv objs/inftrees.o $@
trees.lo: $(SRCDIR)trees.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/trees.o $(SRCDIR)trees.c
-@mv objs/trees.o $@
zutil.lo: $(SRCDIR)zutil.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/zutil.o $(SRCDIR)zutil.c
-@mv objs/zutil.o $@
compress.lo: $(SRCDIR)compress.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/compress.o $(SRCDIR)compress.c
-@mv objs/compress.o $@
uncompr.lo: $(SRCDIR)uncompr.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/uncompr.o $(SRCDIR)uncompr.c
-@mv objs/uncompr.o $@
gzclose.lo: $(SRCDIR)gzclose.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzclose.o $(SRCDIR)gzclose.c
-@mv objs/gzclose.o $@
gzlib.lo: $(SRCDIR)gzlib.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzlib.o $(SRCDIR)gzlib.c
-@mv objs/gzlib.o $@
gzread.lo: $(SRCDIR)gzread.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzread.o $(SRCDIR)gzread.c
-@mv objs/gzread.o $@
gzwrite.lo: $(SRCDIR)gzwrite.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzwrite.o $(SRCDIR)gzwrite.c
-@mv objs/gzwrite.o $@
placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a
$(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
rm -f $(SHAREDLIB) $(SHAREDLIBM)
ln -s $@ $(SHAREDLIB)
ln -s $@ $(SHAREDLIBM)
-@rmdir objs
example$(EXE): example.o $(STATICLIB)
$(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS)
minigzip$(EXE): minigzip.o $(STATICLIB)
$(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS)
examplesh$(EXE): example.o $(SHAREDLIBV)
$(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV)
minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
$(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV)
example64$(EXE): example64.o $(STATICLIB)
$(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS)
minigzip64$(EXE): minigzip64.o $(STATICLIB)
$(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS)
install-libs: $(LIBS)
-@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
-@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi
-@if [ ! -d $(DESTDIR)$(sharedlibdir) ]; then mkdir -p $(DESTDIR)$(sharedlibdir); fi
-@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
-@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
rm -f $(DESTDIR)$(libdir)/$(STATICLIB)
cp $(STATICLIB) $(DESTDIR)$(libdir)
chmod 644 $(DESTDIR)$(libdir)/$(STATICLIB)
-@($(RANLIB) $(DESTDIR)$(libdir)/libz.a || true) >/dev/null 2>&1
-@if test -n "$(SHAREDLIBV)"; then \
rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir); \
echo "cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)"; \
chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
echo "chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV)"; \
rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \
ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
($(LDCONFIG) || true) >/dev/null 2>&1; \
fi
rm -f $(DESTDIR)$(man3dir)/zlib.3
cp $(SRCDIR)zlib.3 $(DESTDIR)$(man3dir)
chmod 644 $(DESTDIR)$(man3dir)/zlib.3
rm -f $(DESTDIR)$(pkgconfigdir)/zlib.pc
cp zlib.pc $(DESTDIR)$(pkgconfigdir)
chmod 644 $(DESTDIR)$(pkgconfigdir)/zlib.pc
# The ranlib in install is needed on NeXTSTEP which checks file times
# ldconfig is for Linux
install: install-libs
-@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
rm -f $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
cp $(SRCDIR)zlib.h zconf.h $(DESTDIR)$(includedir)
chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
uninstall:
cd $(DESTDIR)$(includedir) && rm -f zlib.h zconf.h
cd $(DESTDIR)$(libdir) && rm -f libz.a; \
if test -n "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
fi
cd $(DESTDIR)$(man3dir) && rm -f zlib.3
cd $(DESTDIR)$(pkgconfigdir) && rm -f zlib.pc
docs: zlib.3.pdf
zlib.3.pdf: $(SRCDIR)zlib.3
groff -mandoc -f H -T ps $(SRCDIR)zlib.3 | ps2pdf - $@
zconf.h.cmakein: $(SRCDIR)zconf.h.in
-@ TEMPFILE=zconfh_$$; \
echo "/#define ZCONF_H/ a\\\\\n#cmakedefine Z_PREFIX\\\\\n#cmakedefine Z_HAVE_UNISTD_H\n" >> $$TEMPFILE &&\
sed -f $$TEMPFILE $(SRCDIR)zconf.h.in > $@ &&\
touch -r $(SRCDIR)zconf.h.in $@ &&\
rm $$TEMPFILE
zconf: $(SRCDIR)zconf.h.in
cp -p $(SRCDIR)zconf.h.in zconf.h
mostlyclean: clean
clean:
rm -f *.o *.lo *~ \
example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
example64$(EXE) minigzip64$(EXE) \
infcover \
libz.* foo.gz so_locations \
_match.s maketree contrib/infback9/*.o
rm -rf objs
rm -f *.gcda *.gcno *.gcov
rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov
maintainer-clean: distclean
distclean: clean zconf zconf.h.cmakein docs
rm -f Makefile zlib.pc configure.log
-@rm -f .DS_Store
@if [ -f Makefile.in ]; then \
printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile ; \
printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile ; \
touch -r $(SRCDIR)Makefile.in Makefile ; fi
@if [ ! -f zconf.h.in ]; then rm -f zconf.h zconf.h.cmakein ; fi
@if [ ! -f zlib.3 ]; then rm -f zlib.3.pdf ; fi
tags:
etags $(SRCDIR)*.[ch]
adler32.o zutil.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
gzclose.o gzlib.o gzread.o gzwrite.o: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
compress.o example.o minigzip.o uncompr.o: $(SRCDIR)zlib.h zconf.h
crc32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h
deflate.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
infback.o inflate.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h
inffast.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h
inftrees.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h
trees.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h
adler32.lo zutil.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
gzclose.lo gzlib.lo gzread.lo gzwrite.lo: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
compress.lo example.lo minigzip.lo uncompr.lo: $(SRCDIR)zlib.h zconf.h
crc32.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h
deflate.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
infback.lo inflate.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h
inffast.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h
inftrees.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h
trees.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h

View File

@ -0,0 +1,115 @@
ZLIB DATA COMPRESSION LIBRARY
zlib 1.2.11 is a general purpose data compression library. All the code is
thread safe. The data format used by the zlib library is described by RFCs
(Request for Comments) 1950 to 1952 in the files
http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
rfc1952 (gzip format).
All functions of the compression library are documented in the file zlib.h
(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example
of the library is given in the file test/example.c which also tests that
the library is working correctly. Another example is given in the file
test/minigzip.c. The compression library itself is composed of all source
files in the root directory.
To compile all files and run the test program, follow the instructions given at
the top of Makefile.in. In short "./configure; make test", and if that goes
well, "make install" should work for most flavors of Unix. For Windows, use
one of the special makefiles in win32/ or contrib/vstudio/ . For VMS, use
make_vms.com.
Questions about zlib should be sent to <zlib@gzip.org>, or to Gilles Vollant
<info@winimage.com> for the Windows DLL version. The zlib home page is
http://zlib.net/ . Before reporting a problem, please check this site to
verify that you have the latest version of zlib; otherwise get the latest
version and check whether the problem still exists or not.
PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help.
Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
issue of Dr. Dobb's Journal; a copy of the article is available at
http://marknelson.us/1997/01/01/zlib-engine/ .
The changes made in version 1.2.11 are documented in the file ChangeLog.
Unsupported third party contributions are provided in directory contrib/ .
zlib is available in Java using the java.util.zip package, documented at
http://java.sun.com/developer/technicalArticles/Programming/compression/ .
A Perl interface to zlib written by Paul Marquess <pmqs@cpan.org> is available
at CPAN (Comprehensive Perl Archive Network) sites, including
http://search.cpan.org/~pmqs/IO-Compress-Zlib/ .
A Python interface to zlib written by A.M. Kuchling <amk@amk.ca> is
available in Python 1.5 and later versions, see
http://docs.python.org/library/zlib.html .
zlib is built into tcl: http://wiki.tcl.tk/4610 .
An experimental package to read and write files in .zip format, written on top
of zlib by Gilles Vollant <info@winimage.com>, is available in the
contrib/minizip directory of zlib.
Notes for some targets:
- For Windows DLL versions, please see win32/DLL_FAQ.txt
- For 64-bit Irix, deflate.c must be compiled without any optimization. With
-O, one libpng test fails. The test works in 32 bit mode (with the -n32
compiler flag). The compiler bug has been reported to SGI.
- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
when compiled with cc.
- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is
necessary to get gzprintf working correctly. This is done by configure.
- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
other compilers. Use "make test" to check your compiler.
- gzdopen is not supported on RISCOS or BEOS.
- For PalmOs, see http://palmzlib.sourceforge.net/
Acknowledgments:
The deflate format used by zlib was defined by Phil Katz. The deflate and
zlib specifications were written by L. Peter Deutsch. Thanks to all the
people who reported problems and suggested various improvements in zlib; they
are too numerous to cite here.
Copyright notice:
(C) 1995-2017 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jean-loup Gailly Mark Adler
jloup@gzip.org madler@alumni.caltech.edu
If you use the zlib library in a product, we would appreciate *not* receiving
lengthy legal documents to sign. The sources are provided for free but without
warranty of any kind. The library has been entirely written by Jean-loup
Gailly and Mark Adler; it does not include third-party code.
If you redistribute modified sources, we would appreciate that you include in
the file ChangeLog history information documenting your changes. Please read
the FAQ for more information on the distribution of modified source versions.

View File

@ -1,14 +1,15 @@
/* adler32.c -- compute the Adler-32 checksum of a data stream
* Copyright (C) 1995-2004 Mark Adler
* Copyright (C) 1995-2011, 2016 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#define ZLIB_INTERNAL
#include "zlib.h"
#include "zutil.h"
#define BASE 65521UL /* largest prime smaller than 65536 */
local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
#define BASE 65521U /* largest prime smaller than 65536 */
#define NMAX 5552
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
@ -18,46 +19,51 @@
#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
#define DO16(buf) DO8(buf,0); DO8(buf,8);
/* use NO_DIVIDE if your processor does not do division in hardware */
/* use NO_DIVIDE if your processor does not do division in hardware --
try it both ways to see which is faster */
#ifdef NO_DIVIDE
# define MOD(a) \
/* note that this assumes BASE is 65521, where 65536 % 65521 == 15
(thank you to John Reiser for pointing this out) */
# define CHOP(a) \
do { \
if (a >= (BASE << 16)) a -= (BASE << 16); \
if (a >= (BASE << 15)) a -= (BASE << 15); \
if (a >= (BASE << 14)) a -= (BASE << 14); \
if (a >= (BASE << 13)) a -= (BASE << 13); \
if (a >= (BASE << 12)) a -= (BASE << 12); \
if (a >= (BASE << 11)) a -= (BASE << 11); \
if (a >= (BASE << 10)) a -= (BASE << 10); \
if (a >= (BASE << 9)) a -= (BASE << 9); \
if (a >= (BASE << 8)) a -= (BASE << 8); \
if (a >= (BASE << 7)) a -= (BASE << 7); \
if (a >= (BASE << 6)) a -= (BASE << 6); \
if (a >= (BASE << 5)) a -= (BASE << 5); \
if (a >= (BASE << 4)) a -= (BASE << 4); \
if (a >= (BASE << 3)) a -= (BASE << 3); \
if (a >= (BASE << 2)) a -= (BASE << 2); \
if (a >= (BASE << 1)) a -= (BASE << 1); \
unsigned long tmp = a >> 16; \
a &= 0xffffUL; \
a += (tmp << 4) - tmp; \
} while (0)
# define MOD28(a) \
do { \
CHOP(a); \
if (a >= BASE) a -= BASE; \
} while (0)
# define MOD4(a) \
# define MOD(a) \
do { \
if (a >= (BASE << 4)) a -= (BASE << 4); \
if (a >= (BASE << 3)) a -= (BASE << 3); \
if (a >= (BASE << 2)) a -= (BASE << 2); \
if (a >= (BASE << 1)) a -= (BASE << 1); \
CHOP(a); \
MOD28(a); \
} while (0)
# define MOD63(a) \
do { /* this assumes a is not negative */ \
z_off64_t tmp = a >> 32; \
a &= 0xffffffffL; \
a += (tmp << 8) - (tmp << 5) + tmp; \
tmp = a >> 16; \
a &= 0xffffL; \
a += (tmp << 4) - tmp; \
tmp = a >> 16; \
a &= 0xffffL; \
a += (tmp << 4) - tmp; \
if (a >= BASE) a -= BASE; \
} while (0)
#else
# define MOD(a) a %= BASE
# define MOD4(a) a %= BASE
# define MOD28(a) a %= BASE
# define MOD63(a) a %= BASE
#endif
/* ========================================================================= */
uLong ZEXPORT adler32(adler, buf, len)
uLong ZEXPORT adler32_z(adler, buf, len)
uLong adler;
const Bytef *buf;
uInt len;
z_size_t len;
{
unsigned long sum2;
unsigned n;
@ -89,7 +95,7 @@ uLong ZEXPORT adler32(adler, buf, len)
}
if (adler >= BASE)
adler -= BASE;
MOD4(sum2); /* only added so many BASE's */
MOD28(sum2); /* only added so many BASE's */
return adler | (sum2 << 16);
}
@ -125,25 +131,56 @@ uLong ZEXPORT adler32(adler, buf, len)
}
/* ========================================================================= */
uLong ZEXPORT adler32_combine(adler1, adler2, len2)
uLong ZEXPORT adler32(adler, buf, len)
uLong adler;
const Bytef *buf;
uInt len;
{
return adler32_z(adler, buf, len);
}
/* ========================================================================= */
local uLong adler32_combine_(adler1, adler2, len2)
uLong adler1;
uLong adler2;
z_off_t len2;
z_off64_t len2;
{
unsigned long sum1;
unsigned long sum2;
unsigned rem;
/* for negative len, return invalid adler32 as a clue for debugging */
if (len2 < 0)
return 0xffffffffUL;
/* the derivation of this formula is left as an exercise for the reader */
rem = (unsigned)(len2 % BASE);
MOD63(len2); /* assumes len2 >= 0 */
rem = (unsigned)len2;
sum1 = adler1 & 0xffff;
sum2 = rem * sum1;
MOD(sum2);
sum1 += (adler2 & 0xffff) + BASE - 1;
sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
if (sum1 > BASE) sum1 -= BASE;
if (sum1 > BASE) sum1 -= BASE;
if (sum2 > (BASE << 1)) sum2 -= (BASE << 1);
if (sum2 > BASE) sum2 -= BASE;
if (sum1 >= BASE) sum1 -= BASE;
if (sum1 >= BASE) sum1 -= BASE;
if (sum2 >= ((unsigned long)BASE << 1)) sum2 -= ((unsigned long)BASE << 1);
if (sum2 >= BASE) sum2 -= BASE;
return sum1 | (sum2 << 16);
}
/* ========================================================================= */
uLong ZEXPORT adler32_combine(adler1, adler2, len2)
uLong adler1;
uLong adler2;
z_off_t len2;
{
return adler32_combine_(adler1, adler2, len2);
}
uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
uLong adler1;
uLong adler2;
z_off64_t len2;
{
return adler32_combine_(adler1, adler2, len2);
}

View File

@ -14,8 +14,8 @@ LDFLAGS = -o
LDLIBS = LIB:scppc.a LIB:end.o
RM = delete quiet
OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
zutil.o inflate.o infback.o inftrees.o inffast.o
OBJS = adler32.o compress.o crc32.o gzclose.o gzlib.o gzread.o gzwrite.o \
uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o
TEST_OBJS = example.o minigzip.o
@ -55,7 +55,10 @@ compress.o: zlib.h zconf.h
crc32.o: crc32.h zlib.h zconf.h
deflate.o: deflate.h zutil.h zlib.h zconf.h
example.o: zlib.h zconf.h
gzio.o: zutil.h zlib.h zconf.h
gzclose.o: zlib.h zconf.h gzguts.h
gzlib.o: zlib.h zconf.h gzguts.h
gzread.o: zlib.h zconf.h gzguts.h
gzwrite.o: zlib.h zconf.h gzguts.h
inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h

View File

@ -13,8 +13,8 @@ SCOPTIONS=OPTSCHED OPTINLINE OPTALIAS OPTTIME OPTINLOCAL STRMERGE \
NOICONS PARMS=BOTH NOSTACKCHECK UTILLIB NOVERSION ERRORREXX \
DEF=POSTINC
OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
zutil.o inflate.o infback.o inftrees.o inffast.o
OBJS = adler32.o compress.o crc32.o gzclose.o gzlib.o gzread.o gzwrite.o \
uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o
TEST_OBJS = example.o minigzip.o
@ -54,7 +54,10 @@ compress.o: zlib.h zconf.h
crc32.o: crc32.h zlib.h zconf.h
deflate.o: deflate.h zutil.h zlib.h zconf.h
example.o: zlib.h zconf.h
gzio.o: zutil.h zlib.h zconf.h
gzclose.o: zlib.h zconf.h gzguts.h
gzlib.o: zlib.h zconf.h gzguts.h
gzread.o: zlib.h zconf.h gzguts.h
gzwrite.o: zlib.h zconf.h gzguts.h
inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h

View File

@ -1,5 +1,5 @@
/* compress.c -- compress a memory buffer
* Copyright (C) 1995-2003 Jean-loup Gailly.
* Copyright (C) 1995-2005, 2014, 2016 Jean-loup Gailly, Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@ -28,16 +28,11 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
{
z_stream stream;
int err;
const uInt max = (uInt)-1;
uLong left;
stream.next_in = (Bytef*)source;
stream.avail_in = (uInt)sourceLen;
#ifdef MAXSEG_64K
/* Check for source > 64K on 16-bit machine: */
if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
#endif
stream.next_out = dest;
stream.avail_out = (uInt)*destLen;
if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
left = *destLen;
*destLen = 0;
stream.zalloc = (alloc_func)0;
stream.zfree = (free_func)0;
@ -46,15 +41,26 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
err = deflateInit(&stream, level);
if (err != Z_OK) return err;
err = deflate(&stream, Z_FINISH);
if (err != Z_STREAM_END) {
deflateEnd(&stream);
return err == Z_OK ? Z_BUF_ERROR : err;
}
*destLen = stream.total_out;
stream.next_out = dest;
stream.avail_out = 0;
stream.next_in = (z_const Bytef *)source;
stream.avail_in = 0;
err = deflateEnd(&stream);
return err;
do {
if (stream.avail_out == 0) {
stream.avail_out = left > (uLong)max ? max : (uInt)left;
left -= stream.avail_out;
}
if (stream.avail_in == 0) {
stream.avail_in = sourceLen > (uLong)max ? max : (uInt)sourceLen;
sourceLen -= stream.avail_in;
}
err = deflate(&stream, sourceLen ? Z_NO_FLUSH : Z_FINISH);
} while (err == Z_OK);
*destLen = stream.total_out;
deflateEnd(&stream);
return err == Z_STREAM_END ? Z_OK : err;
}
/* ===========================================================================
@ -75,5 +81,6 @@ int ZEXPORT compress (dest, destLen, source, sourceLen)
uLong ZEXPORT compressBound (sourceLen)
uLong sourceLen;
{
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 11;
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
(sourceLen >> 25) + 13;
}

921
OfficeUtils/src/zlib-1.2.11/configure vendored Normal file
View File

@ -0,0 +1,921 @@
#!/bin/sh
# configure script for zlib.
#
# Normally configure builds both a static and a shared library.
# If you want to build just a static library, use: ./configure --static
#
# To impose specific compiler or flags or install directory, use for example:
# prefix=$HOME CC=cc CFLAGS="-O4" ./configure
# or for csh/tcsh users:
# (setenv prefix $HOME; setenv CC cc; setenv CFLAGS "-O4"; ./configure)
# Incorrect settings of CC or CFLAGS may prevent creating a shared library.
# If you have problems, try without defining CC and CFLAGS before reporting
# an error.
# start off configure.log
echo -------------------- >> configure.log
echo $0 $* >> configure.log
date >> configure.log
# get source directory
SRCDIR=`dirname $0`
if test $SRCDIR = "."; then
ZINC=""
ZINCOUT="-I."
SRCDIR=""
else
ZINC='-include zconf.h'
ZINCOUT='-I. -I$(SRCDIR)'
SRCDIR="$SRCDIR/"
fi
# set command prefix for cross-compilation
if [ -n "${CHOST}" ]; then
uname="`echo "${CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/'`"
CROSS_PREFIX="${CHOST}-"
fi
# destination name for static library
STATICLIB=libz.a
# extract zlib version numbers from zlib.h
VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}zlib.h`
VER3=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < ${SRCDIR}zlib.h`
VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h`
VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h`
# establish commands for library building
if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then
AR=${AR-"${CROSS_PREFIX}ar"}
test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log
else
AR=${AR-"ar"}
test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log
fi
ARFLAGS=${ARFLAGS-"rc"}
if "${CROSS_PREFIX}ranlib" --version >/dev/null 2>/dev/null || test $? -lt 126; then
RANLIB=${RANLIB-"${CROSS_PREFIX}ranlib"}
test -n "${CROSS_PREFIX}" && echo Using ${RANLIB} | tee -a configure.log
else
RANLIB=${RANLIB-"ranlib"}
fi
if "${CROSS_PREFIX}nm" --version >/dev/null 2>/dev/null || test $? -lt 126; then
NM=${NM-"${CROSS_PREFIX}nm"}
test -n "${CROSS_PREFIX}" && echo Using ${NM} | tee -a configure.log
else
NM=${NM-"nm"}
fi
# set defaults before processing command line options
LDCONFIG=${LDCONFIG-"ldconfig"}
LDSHAREDLIBC="${LDSHAREDLIBC--lc}"
ARCHS=
prefix=${prefix-/usr/local}
exec_prefix=${exec_prefix-'${prefix}'}
libdir=${libdir-'${exec_prefix}/lib'}
sharedlibdir=${sharedlibdir-'${libdir}'}
includedir=${includedir-'${prefix}/include'}
mandir=${mandir-'${prefix}/share/man'}
shared_ext='.so'
shared=1
solo=0
cover=0
zprefix=0
zconst=0
build64=0
gcc=0
warn=0
debug=0
old_cc="$CC"
old_cflags="$CFLAGS"
OBJC='$(OBJZ) $(OBJG)'
PIC_OBJC='$(PIC_OBJZ) $(PIC_OBJG)'
# leave this script, optionally in a bad way
leave()
{
if test "$*" != "0"; then
echo "** $0 aborting." | tee -a configure.log
fi
rm -f $test.[co] $test $test$shared_ext $test.gcno ./--version
echo -------------------- >> configure.log
echo >> configure.log
echo >> configure.log
exit $1
}
# process command line options
while test $# -ge 1
do
case "$1" in
-h* | --help)
echo 'usage:' | tee -a configure.log
echo ' configure [--const] [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]' | tee -a configure.log
echo ' [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log
echo ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log
exit 0 ;;
-p*=* | --prefix=*) prefix=`echo $1 | sed 's/.*=//'`; shift ;;
-e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/.*=//'`; shift ;;
-l*=* | --libdir=*) libdir=`echo $1 | sed 's/.*=//'`; shift ;;
--sharedlibdir=*) sharedlibdir=`echo $1 | sed 's/.*=//'`; shift ;;
-i*=* | --includedir=*) includedir=`echo $1 | sed 's/.*=//'`;shift ;;
-u*=* | --uname=*) uname=`echo $1 | sed 's/.*=//'`;shift ;;
-p* | --prefix) prefix="$2"; shift; shift ;;
-e* | --eprefix) exec_prefix="$2"; shift; shift ;;
-l* | --libdir) libdir="$2"; shift; shift ;;
-i* | --includedir) includedir="$2"; shift; shift ;;
-s* | --shared | --enable-shared) shared=1; shift ;;
-t | --static) shared=0; shift ;;
--solo) solo=1; shift ;;
--cover) cover=1; shift ;;
-z* | --zprefix) zprefix=1; shift ;;
-6* | --64) build64=1; shift ;;
-a*=* | --archs=*) ARCHS=`echo $1 | sed 's/.*=//'`; shift ;;
--sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;;
--localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;;
-c* | --const) zconst=1; shift ;;
-w* | --warn) warn=1; shift ;;
-d* | --debug) debug=1; shift ;;
*)
echo "unknown option: $1" | tee -a configure.log
echo "$0 --help for help" | tee -a configure.log
leave 1;;
esac
done
# temporary file name
test=ztest$$
# put arguments in log, also put test file in log if used in arguments
show()
{
case "$*" in
*$test.c*)
echo === $test.c === >> configure.log
cat $test.c >> configure.log
echo === >> configure.log;;
esac
echo $* >> configure.log
}
# check for gcc vs. cc and set compile and link flags based on the system identified by uname
cat > $test.c <<EOF
extern int getchar();
int hello() {return getchar();}
EOF
test -z "$CC" && echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log
cc=${CC-${CROSS_PREFIX}gcc}
cflags=${CFLAGS-"-O3"}
# to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
case "$cc" in
*gcc*) gcc=1 ;;
*clang*) gcc=1 ;;
esac
case `$cc -v 2>&1` in
*gcc*) gcc=1 ;;
*clang*) gcc=1 ;;
esac
show $cc -c $test.c
if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then
echo ... using gcc >> configure.log
CC="$cc"
CFLAGS="${CFLAGS--O3}"
SFLAGS="${CFLAGS--O3} -fPIC"
if test "$ARCHS"; then
CFLAGS="${CFLAGS} ${ARCHS}"
LDFLAGS="${LDFLAGS} ${ARCHS}"
fi
if test $build64 -eq 1; then
CFLAGS="${CFLAGS} -m64"
SFLAGS="${SFLAGS} -m64"
fi
if test "$warn" -eq 1; then
if test "$zconst" -eq 1; then
CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -pedantic -DZLIB_CONST"
else
CFLAGS="${CFLAGS} -Wall -Wextra -pedantic"
fi
fi
if test $debug -eq 1; then
CFLAGS="${CFLAGS} -DZLIB_DEBUG"
SFLAGS="${SFLAGS} -DZLIB_DEBUG"
fi
if test -z "$uname"; then
uname=`(uname -s || echo unknown) 2>/dev/null`
fi
case "$uname" in
Linux* | linux* | GNU | GNU/* | solaris*)
LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"} ;;
*BSD | *bsd* | DragonFly)
LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"}
LDCONFIG="ldconfig -m" ;;
CYGWIN* | Cygwin* | cygwin* | OS/2*)
EXE='.exe' ;;
MINGW* | mingw*)
# temporary bypass
rm -f $test.[co] $test $test$shared_ext
echo "Please use win32/Makefile.gcc instead." | tee -a configure.log
leave 1
LDSHARED=${LDSHARED-"$cc -shared"}
LDSHAREDLIBC=""
EXE='.exe' ;;
QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4
# (alain.bonnefoy@icbt.com)
LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"} ;;
HP-UX*)
LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"}
case `(uname -m || echo unknown) 2>/dev/null` in
ia64)
shared_ext='.so'
SHAREDLIB='libz.so' ;;
*)
shared_ext='.sl'
SHAREDLIB='libz.sl' ;;
esac ;;
Darwin* | darwin*)
shared_ext='.dylib'
SHAREDLIB=libz$shared_ext
SHAREDLIBV=libz.$VER$shared_ext
SHAREDLIBM=libz.$VER1$shared_ext
LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"}
if libtool -V 2>&1 | grep Apple > /dev/null; then
AR="libtool"
else
AR="/usr/bin/libtool"
fi
ARFLAGS="-o" ;;
*) LDSHARED=${LDSHARED-"$cc -shared"} ;;
esac
else
# find system name and corresponding cc options
CC=${CC-cc}
gcc=0
echo ... using $CC >> configure.log
if test -z "$uname"; then
uname=`(uname -sr || echo unknown) 2>/dev/null`
fi
case "$uname" in
HP-UX*) SFLAGS=${CFLAGS-"-O +z"}
CFLAGS=${CFLAGS-"-O"}
# LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"}
LDSHARED=${LDSHARED-"ld -b"}
case `(uname -m || echo unknown) 2>/dev/null` in
ia64)
shared_ext='.so'
SHAREDLIB='libz.so' ;;
*)
shared_ext='.sl'
SHAREDLIB='libz.sl' ;;
esac ;;
IRIX*) SFLAGS=${CFLAGS-"-ansi -O2 -rpath ."}
CFLAGS=${CFLAGS-"-ansi -O2"}
LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;;
OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"}
CFLAGS=${CFLAGS-"-O -std1"}
LDFLAGS="${LDFLAGS} -Wl,-rpath,."
LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"} ;;
OSF1*) SFLAGS=${CFLAGS-"-O -std1"}
CFLAGS=${CFLAGS-"-O -std1"}
LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;;
QNX*) SFLAGS=${CFLAGS-"-4 -O"}
CFLAGS=${CFLAGS-"-4 -O"}
LDSHARED=${LDSHARED-"cc"}
RANLIB=${RANLIB-"true"}
AR="cc"
ARFLAGS="-A" ;;
SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "}
CFLAGS=${CFLAGS-"-O3"}
LDSHARED=${LDSHARED-"cc -dy -KPIC -G"} ;;
SunOS\ 5* | solaris*)
LDSHARED=${LDSHARED-"cc -G -h libz$shared_ext.$VER1"}
SFLAGS=${CFLAGS-"-fast -KPIC"}
CFLAGS=${CFLAGS-"-fast"}
if test $build64 -eq 1; then
# old versions of SunPRO/Workshop/Studio don't support -m64,
# but newer ones do. Check for it.
flag64=`$CC -flags | egrep -- '^-m64'`
if test x"$flag64" != x"" ; then
CFLAGS="${CFLAGS} -m64"
SFLAGS="${SFLAGS} -m64"
else
case `(uname -m || echo unknown) 2>/dev/null` in
i86*)
SFLAGS="$SFLAGS -xarch=amd64"
CFLAGS="$CFLAGS -xarch=amd64" ;;
*)
SFLAGS="$SFLAGS -xarch=v9"
CFLAGS="$CFLAGS -xarch=v9" ;;
esac
fi
fi
if test -n "$ZINC"; then
ZINC='-I- -I. -I$(SRCDIR)'
fi
;;
SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"}
CFLAGS=${CFLAGS-"-O2"}
LDSHARED=${LDSHARED-"ld"} ;;
SunStudio\ 9*) SFLAGS=${CFLAGS-"-fast -xcode=pic32 -xtarget=ultra3 -xarch=v9b"}
CFLAGS=${CFLAGS-"-fast -xtarget=ultra3 -xarch=v9b"}
LDSHARED=${LDSHARED-"cc -xarch=v9b"} ;;
UNIX_System_V\ 4.2.0)
SFLAGS=${CFLAGS-"-KPIC -O"}
CFLAGS=${CFLAGS-"-O"}
LDSHARED=${LDSHARED-"cc -G"} ;;
UNIX_SV\ 4.2MP)
SFLAGS=${CFLAGS-"-Kconform_pic -O"}
CFLAGS=${CFLAGS-"-O"}
LDSHARED=${LDSHARED-"cc -G"} ;;
OpenUNIX\ 5)
SFLAGS=${CFLAGS-"-KPIC -O"}
CFLAGS=${CFLAGS-"-O"}
LDSHARED=${LDSHARED-"cc -G"} ;;
AIX*) # Courtesy of dbakker@arrayasolutions.com
SFLAGS=${CFLAGS-"-O -qmaxmem=8192"}
CFLAGS=${CFLAGS-"-O -qmaxmem=8192"}
LDSHARED=${LDSHARED-"xlc -G"} ;;
# send working options for other systems to zlib@gzip.org
*) SFLAGS=${CFLAGS-"-O"}
CFLAGS=${CFLAGS-"-O"}
LDSHARED=${LDSHARED-"cc -shared"} ;;
esac
fi
# destination names for shared library if not defined above
SHAREDLIB=${SHAREDLIB-"libz$shared_ext"}
SHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"}
SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"}
echo >> configure.log
# define functions for testing compiler and library characteristics and logging the results
cat > $test.c <<EOF
#error error
EOF
if ($CC -c $CFLAGS $test.c) 2>/dev/null; then
try()
{
show $*
test "`( $* ) 2>&1 | tee -a configure.log`" = ""
}
echo - using any output from compiler to indicate an error >> configure.log
else
try()
{
show $*
( $* ) >> configure.log 2>&1
ret=$?
if test $ret -ne 0; then
echo "(exit code "$ret")" >> configure.log
fi
return $ret
}
fi
tryboth()
{
show $*
got=`( $* ) 2>&1`
ret=$?
printf %s "$got" >> configure.log
if test $ret -ne 0; then
return $ret
fi
test "$got" = ""
}
cat > $test.c << EOF
int foo() { return 0; }
EOF
echo "Checking for obsessive-compulsive compiler options..." >> configure.log
if try $CC -c $CFLAGS $test.c; then
:
else
echo "Compiler error reporting is too harsh for $0 (perhaps remove -Werror)." | tee -a configure.log
leave 1
fi
echo >> configure.log
# see if shared library build supported
cat > $test.c <<EOF
extern int getchar();
int hello() {return getchar();}
EOF
if test $shared -eq 1; then
echo Checking for shared library support... | tee -a configure.log
# we must test in two steps (cc then ld), required at least on SunOS 4.x
if try $CC -w -c $SFLAGS $test.c &&
try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then
echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log
elif test -z "$old_cc" -a -z "$old_cflags"; then
echo No shared library support. | tee -a configure.log
shared=0;
else
echo 'No shared library support; try without defining CC and CFLAGS' | tee -a configure.log
shared=0;
fi
fi
if test $shared -eq 0; then
LDSHARED="$CC"
ALL="static"
TEST="all teststatic"
SHAREDLIB=""
SHAREDLIBV=""
SHAREDLIBM=""
echo Building static library $STATICLIB version $VER with $CC. | tee -a configure.log
else
ALL="static shared"
TEST="all teststatic testshared"
fi
# check for underscores in external names for use by assembler code
CPP=${CPP-"$CC -E"}
case $CFLAGS in
*ASMV*)
echo >> configure.log
show "$NM $test.o | grep _hello"
if test "`$NM $test.o | grep _hello | tee -a configure.log`" = ""; then
CPP="$CPP -DNO_UNDERLINE"
echo Checking for underline in external names... No. | tee -a configure.log
else
echo Checking for underline in external names... Yes. | tee -a configure.log
fi ;;
esac
echo >> configure.log
# check for size_t
cat > $test.c <<EOF
#include <stdio.h>
#include <stdlib.h>
size_t dummy = 0;
EOF
if try $CC -c $CFLAGS $test.c; then
echo "Checking for size_t... Yes." | tee -a configure.log
need_sizet=0
else
echo "Checking for size_t... No." | tee -a configure.log
need_sizet=1
fi
echo >> configure.log
# find the size_t integer type, if needed
if test $need_sizet -eq 1; then
cat > $test.c <<EOF
long long dummy = 0;
EOF
if try $CC -c $CFLAGS $test.c; then
echo "Checking for long long... Yes." | tee -a configure.log
cat > $test.c <<EOF
#include <stdio.h>
int main(void) {
if (sizeof(void *) <= sizeof(int)) puts("int");
else if (sizeof(void *) <= sizeof(long)) puts("long");
else puts("z_longlong");
return 0;
}
EOF
else
echo "Checking for long long... No." | tee -a configure.log
cat > $test.c <<EOF
#include <stdio.h>
int main(void) {
if (sizeof(void *) <= sizeof(int)) puts("int");
else puts("long");
return 0;
}
EOF
fi
if try $CC $CFLAGS -o $test $test.c; then
sizet=`./$test`
echo "Checking for a pointer-size integer type..." $sizet"." | tee -a configure.log
else
echo "Failed to find a pointer-size integer type." | tee -a configure.log
leave 1
fi
fi
if test $need_sizet -eq 1; then
CFLAGS="${CFLAGS} -DNO_SIZE_T=${sizet}"
SFLAGS="${SFLAGS} -DNO_SIZE_T=${sizet}"
fi
echo >> configure.log
# check for large file support, and if none, check for fseeko()
cat > $test.c <<EOF
#include <sys/types.h>
off64_t dummy = 0;
EOF
if try $CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c; then
CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1"
SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1"
ALL="${ALL} all64"
TEST="${TEST} test64"
echo "Checking for off64_t... Yes." | tee -a configure.log
echo "Checking for fseeko... Yes." | tee -a configure.log
else
echo "Checking for off64_t... No." | tee -a configure.log
echo >> configure.log
cat > $test.c <<EOF
#include <stdio.h>
int main(void) {
fseeko(NULL, 0, 0);
return 0;
}
EOF
if try $CC $CFLAGS -o $test $test.c; then
echo "Checking for fseeko... Yes." | tee -a configure.log
else
CFLAGS="${CFLAGS} -DNO_FSEEKO"
SFLAGS="${SFLAGS} -DNO_FSEEKO"
echo "Checking for fseeko... No." | tee -a configure.log
fi
fi
echo >> configure.log
# check for strerror() for use by gz* functions
cat > $test.c <<EOF
#include <string.h>
#include <errno.h>
int main() { return strlen(strerror(errno)); }
EOF
if try $CC $CFLAGS -o $test $test.c; then
echo "Checking for strerror... Yes." | tee -a configure.log
else
CFLAGS="${CFLAGS} -DNO_STRERROR"
SFLAGS="${SFLAGS} -DNO_STRERROR"
echo "Checking for strerror... No." | tee -a configure.log
fi
# copy clean zconf.h for subsequent edits
cp -p ${SRCDIR}zconf.h.in zconf.h
echo >> configure.log
# check for unistd.h and save result in zconf.h
cat > $test.c <<EOF
#include <unistd.h>
int main() { return 0; }
EOF
if try $CC -c $CFLAGS $test.c; then
sed < zconf.h "/^#ifdef HAVE_UNISTD_H.* may be/s/def HAVE_UNISTD_H\(.*\) may be/ 1\1 was/" > zconf.temp.h
mv zconf.temp.h zconf.h
echo "Checking for unistd.h... Yes." | tee -a configure.log
else
echo "Checking for unistd.h... No." | tee -a configure.log
fi
echo >> configure.log
# check for stdarg.h and save result in zconf.h
cat > $test.c <<EOF
#include <stdarg.h>
int main() { return 0; }
EOF
if try $CC -c $CFLAGS $test.c; then
sed < zconf.h "/^#ifdef HAVE_STDARG_H.* may be/s/def HAVE_STDARG_H\(.*\) may be/ 1\1 was/" > zconf.temp.h
mv zconf.temp.h zconf.h
echo "Checking for stdarg.h... Yes." | tee -a configure.log
else
echo "Checking for stdarg.h... No." | tee -a configure.log
fi
# if the z_ prefix was requested, save that in zconf.h
if test $zprefix -eq 1; then
sed < zconf.h "/#ifdef Z_PREFIX.* may be/s/def Z_PREFIX\(.*\) may be/ 1\1 was/" > zconf.temp.h
mv zconf.temp.h zconf.h
echo >> configure.log
echo "Using z_ prefix on all symbols." | tee -a configure.log
fi
# if --solo compilation was requested, save that in zconf.h and remove gz stuff from object lists
if test $solo -eq 1; then
sed '/#define ZCONF_H/a\
#define Z_SOLO
' < zconf.h > zconf.temp.h
mv zconf.temp.h zconf.h
OBJC='$(OBJZ)'
PIC_OBJC='$(PIC_OBJZ)'
fi
# if code coverage testing was requested, use older gcc if defined, e.g. "gcc-4.2" on Mac OS X
if test $cover -eq 1; then
CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage"
if test -n "$GCC_CLASSIC"; then
CC=$GCC_CLASSIC
fi
fi
echo >> configure.log
# conduct a series of tests to resolve eight possible cases of using "vs" or "s" printf functions
# (using stdarg or not), with or without "n" (proving size of buffer), and with or without a
# return value. The most secure result is vsnprintf() with a return value. snprintf() with a
# return value is secure as well, but then gzprintf() will be limited to 20 arguments.
cat > $test.c <<EOF
#include <stdio.h>
#include <stdarg.h>
#include "zconf.h"
int main()
{
#ifndef STDC
choke me
#endif
return 0;
}
EOF
if try $CC -c $CFLAGS $test.c; then
echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()." | tee -a configure.log
echo >> configure.log
cat > $test.c <<EOF
#include <stdio.h>
#include <stdarg.h>
int mytest(const char *fmt, ...)
{
char buf[20];
va_list ap;
va_start(ap, fmt);
vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
return 0;
}
int main()
{
return (mytest("Hello%d\n", 1));
}
EOF
if try $CC $CFLAGS -o $test $test.c; then
echo "Checking for vsnprintf() in stdio.h... Yes." | tee -a configure.log
echo >> configure.log
cat >$test.c <<EOF
#include <stdio.h>
#include <stdarg.h>
int mytest(const char *fmt, ...)
{
int n;
char buf[20];
va_list ap;
va_start(ap, fmt);
n = vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
return n;
}
int main()
{
return (mytest("Hello%d\n", 1));
}
EOF
if try $CC -c $CFLAGS $test.c; then
echo "Checking for return value of vsnprintf()... Yes." | tee -a configure.log
else
CFLAGS="$CFLAGS -DHAS_vsnprintf_void"
SFLAGS="$SFLAGS -DHAS_vsnprintf_void"
echo "Checking for return value of vsnprintf()... No." | tee -a configure.log
echo " WARNING: apparently vsnprintf() does not return a value. zlib" | tee -a configure.log
echo " can build but will be open to possible string-format security" | tee -a configure.log
echo " vulnerabilities." | tee -a configure.log
fi
else
CFLAGS="$CFLAGS -DNO_vsnprintf"
SFLAGS="$SFLAGS -DNO_vsnprintf"
echo "Checking for vsnprintf() in stdio.h... No." | tee -a configure.log
echo " WARNING: vsnprintf() not found, falling back to vsprintf(). zlib" | tee -a configure.log
echo " can build but will be open to possible buffer-overflow security" | tee -a configure.log
echo " vulnerabilities." | tee -a configure.log
echo >> configure.log
cat >$test.c <<EOF
#include <stdio.h>
#include <stdarg.h>
int mytest(const char *fmt, ...)
{
int n;
char buf[20];
va_list ap;
va_start(ap, fmt);
n = vsprintf(buf, fmt, ap);
va_end(ap);
return n;
}
int main()
{
return (mytest("Hello%d\n", 1));
}
EOF
if try $CC -c $CFLAGS $test.c; then
echo "Checking for return value of vsprintf()... Yes." | tee -a configure.log
else
CFLAGS="$CFLAGS -DHAS_vsprintf_void"
SFLAGS="$SFLAGS -DHAS_vsprintf_void"
echo "Checking for return value of vsprintf()... No." | tee -a configure.log
echo " WARNING: apparently vsprintf() does not return a value. zlib" | tee -a configure.log
echo " can build but will be open to possible string-format security" | tee -a configure.log
echo " vulnerabilities." | tee -a configure.log
fi
fi
else
echo "Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()." | tee -a configure.log
echo >> configure.log
cat >$test.c <<EOF
#include <stdio.h>
int mytest()
{
char buf[20];
snprintf(buf, sizeof(buf), "%s", "foo");
return 0;
}
int main()
{
return (mytest());
}
EOF
if try $CC $CFLAGS -o $test $test.c; then
echo "Checking for snprintf() in stdio.h... Yes." | tee -a configure.log
echo >> configure.log
cat >$test.c <<EOF
#include <stdio.h>
int mytest()
{
char buf[20];
return snprintf(buf, sizeof(buf), "%s", "foo");
}
int main()
{
return (mytest());
}
EOF
if try $CC -c $CFLAGS $test.c; then
echo "Checking for return value of snprintf()... Yes." | tee -a configure.log
else
CFLAGS="$CFLAGS -DHAS_snprintf_void"
SFLAGS="$SFLAGS -DHAS_snprintf_void"
echo "Checking for return value of snprintf()... No." | tee -a configure.log
echo " WARNING: apparently snprintf() does not return a value. zlib" | tee -a configure.log
echo " can build but will be open to possible string-format security" | tee -a configure.log
echo " vulnerabilities." | tee -a configure.log
fi
else
CFLAGS="$CFLAGS -DNO_snprintf"
SFLAGS="$SFLAGS -DNO_snprintf"
echo "Checking for snprintf() in stdio.h... No." | tee -a configure.log
echo " WARNING: snprintf() not found, falling back to sprintf(). zlib" | tee -a configure.log
echo " can build but will be open to possible buffer-overflow security" | tee -a configure.log
echo " vulnerabilities." | tee -a configure.log
echo >> configure.log
cat >$test.c <<EOF
#include <stdio.h>
int mytest()
{
char buf[20];
return sprintf(buf, "%s", "foo");
}
int main()
{
return (mytest());
}
EOF
if try $CC -c $CFLAGS $test.c; then
echo "Checking for return value of sprintf()... Yes." | tee -a configure.log
else
CFLAGS="$CFLAGS -DHAS_sprintf_void"
SFLAGS="$SFLAGS -DHAS_sprintf_void"
echo "Checking for return value of sprintf()... No." | tee -a configure.log
echo " WARNING: apparently sprintf() does not return a value. zlib" | tee -a configure.log
echo " can build but will be open to possible string-format security" | tee -a configure.log
echo " vulnerabilities." | tee -a configure.log
fi
fi
fi
# see if we can hide zlib internal symbols that are linked between separate source files
if test "$gcc" -eq 1; then
echo >> configure.log
cat > $test.c <<EOF
#define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
int ZLIB_INTERNAL foo;
int main()
{
return 0;
}
EOF
if tryboth $CC -c $CFLAGS $test.c; then
CFLAGS="$CFLAGS -DHAVE_HIDDEN"
SFLAGS="$SFLAGS -DHAVE_HIDDEN"
echo "Checking for attribute(visibility) support... Yes." | tee -a configure.log
else
echo "Checking for attribute(visibility) support... No." | tee -a configure.log
fi
fi
# show the results in the log
echo >> configure.log
echo ALL = $ALL >> configure.log
echo AR = $AR >> configure.log
echo ARFLAGS = $ARFLAGS >> configure.log
echo CC = $CC >> configure.log
echo CFLAGS = $CFLAGS >> configure.log
echo CPP = $CPP >> configure.log
echo EXE = $EXE >> configure.log
echo LDCONFIG = $LDCONFIG >> configure.log
echo LDFLAGS = $LDFLAGS >> configure.log
echo LDSHARED = $LDSHARED >> configure.log
echo LDSHAREDLIBC = $LDSHAREDLIBC >> configure.log
echo OBJC = $OBJC >> configure.log
echo PIC_OBJC = $PIC_OBJC >> configure.log
echo RANLIB = $RANLIB >> configure.log
echo SFLAGS = $SFLAGS >> configure.log
echo SHAREDLIB = $SHAREDLIB >> configure.log
echo SHAREDLIBM = $SHAREDLIBM >> configure.log
echo SHAREDLIBV = $SHAREDLIBV >> configure.log
echo STATICLIB = $STATICLIB >> configure.log
echo TEST = $TEST >> configure.log
echo VER = $VER >> configure.log
echo Z_U4 = $Z_U4 >> configure.log
echo SRCDIR = $SRCDIR >> configure.log
echo exec_prefix = $exec_prefix >> configure.log
echo includedir = $includedir >> configure.log
echo libdir = $libdir >> configure.log
echo mandir = $mandir >> configure.log
echo prefix = $prefix >> configure.log
echo sharedlibdir = $sharedlibdir >> configure.log
echo uname = $uname >> configure.log
# udpate Makefile with the configure results
sed < ${SRCDIR}Makefile.in "
/^CC *=/s#=.*#=$CC#
/^CFLAGS *=/s#=.*#=$CFLAGS#
/^SFLAGS *=/s#=.*#=$SFLAGS#
/^LDFLAGS *=/s#=.*#=$LDFLAGS#
/^LDSHARED *=/s#=.*#=$LDSHARED#
/^CPP *=/s#=.*#=$CPP#
/^STATICLIB *=/s#=.*#=$STATICLIB#
/^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
/^AR *=/s#=.*#=$AR#
/^ARFLAGS *=/s#=.*#=$ARFLAGS#
/^RANLIB *=/s#=.*#=$RANLIB#
/^LDCONFIG *=/s#=.*#=$LDCONFIG#
/^LDSHAREDLIBC *=/s#=.*#=$LDSHAREDLIBC#
/^EXE *=/s#=.*#=$EXE#
/^SRCDIR *=/s#=.*#=$SRCDIR#
/^ZINC *=/s#=.*#=$ZINC#
/^ZINCOUT *=/s#=.*#=$ZINCOUT#
/^prefix *=/s#=.*#=$prefix#
/^exec_prefix *=/s#=.*#=$exec_prefix#
/^libdir *=/s#=.*#=$libdir#
/^sharedlibdir *=/s#=.*#=$sharedlibdir#
/^includedir *=/s#=.*#=$includedir#
/^mandir *=/s#=.*#=$mandir#
/^OBJC *=/s#=.*#= $OBJC#
/^PIC_OBJC *=/s#=.*#= $PIC_OBJC#
/^all: */s#:.*#: $ALL#
/^test: */s#:.*#: $TEST#
" > Makefile
# create zlib.pc with the configure results
sed < ${SRCDIR}zlib.pc.in "
/^CC *=/s#=.*#=$CC#
/^CFLAGS *=/s#=.*#=$CFLAGS#
/^CPP *=/s#=.*#=$CPP#
/^LDSHARED *=/s#=.*#=$LDSHARED#
/^STATICLIB *=/s#=.*#=$STATICLIB#
/^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
/^AR *=/s#=.*#=$AR#
/^ARFLAGS *=/s#=.*#=$ARFLAGS#
/^RANLIB *=/s#=.*#=$RANLIB#
/^EXE *=/s#=.*#=$EXE#
/^prefix *=/s#=.*#=$prefix#
/^exec_prefix *=/s#=.*#=$exec_prefix#
/^libdir *=/s#=.*#=$libdir#
/^sharedlibdir *=/s#=.*#=$sharedlibdir#
/^includedir *=/s#=.*#=$includedir#
/^mandir *=/s#=.*#=$mandir#
/^LDFLAGS *=/s#=.*#=$LDFLAGS#
" | sed -e "
s/\@VERSION\@/$VER/g;
" > zlib.pc
# done
leave 0

View File

@ -8,7 +8,10 @@ ada/ by Dmitriy Anisimkov <anisimkov@yahoo.com>
Support for Ada
See http://zlib-ada.sourceforge.net/
asm586/
amd64/ by Mikhail Teterin <mi@ALDAN.algebra.com>
asm code for AMD64
See patch at http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/96393
asm686/ by Brian Raiter <breadbox@muppetlabs.com>
asm code for Pentium and PPro/PII, using the AT&T (GNU as) syntax
See http://www.muppetlabs.com/~breadbox/software/assembly.html
@ -22,6 +25,10 @@ delphi/ by Cosmin Truta <cosmint@cs.ubbcluj.ro>
dotzlib/ by Henrik Ravn <henrik@ravn.com>
Support for Microsoft .Net and Visual C++ .Net
gcc_gvmat64/by Gilles Vollant <info@winimage.com>
GCC Version of x86 64-bit (AMD64 and Intel EM64t) code for x64
assembler to replace longest_match() and inflate_fast()
infback9/ by Mark Adler <madler@alumni.caltech.edu>
Unsupported diffs to infback to decode the deflate64 format
@ -31,28 +38,27 @@ inflate86/ by Chris Anderson <christop@charm.net>
iostream/ by Kevin Ruland <kevin@rodin.wustl.edu>
A C++ I/O streams interface to the zlib gz* functions
iostream2/ by Tyge Løvset <Tyge.Lovset@cmr.no>
iostream2/ by Tyge Løvset <Tyge.Lovset@cmr.no>
Another C++ I/O streams interface
iostream3/ by Ludwig Schwardt <schwardt@sun.ac.za>
and Kevin Ruland <kevin@rodin.wustl.edu>
Yet another C++ I/O streams interface
masm686/ by Dan Higdon <hdan@kinesoft.com>
and Chuck Walbourn <chuckw@kinesoft.com>
asm code for Pentium Pro/PII, using the MASM syntax
masmx64/ by Gilles Vollant <info@winimage.com>
x86 64-bit (AMD64 and Intel EM64t) code for x64 assembler to
replace longest_match() and inflate_fast()
x86 64-bit (AMD64 and Intel EM64t) code for x64 assembler to
replace longest_match() and inflate_fast(), also masm x86
64-bits translation of Chris Anderson inflate_fast()
masmx86/ by Gilles Vollant <info@winimage.com>
x86 asm code to replace longest_match() and inflate_fast(),
for Visual C++ and MASM
for Visual C++ and MASM (32 bits).
Based on Brian Raiter (asm686) and Chris Anderson (inflate86)
minizip/ by Gilles Vollant <info@winimage.com>
Mini zip and unzip based on zlib
See http://www.winimage.com/zLibDll/unzip.html
Includes Zip64 support by Mathias Svensson <mathias@result42.com>
See http://www.winimage.com/zLibDll/minizip.html
pascal/ by Bob Dellaca <bobdl@xtra.co.nz> et al.
Support for Pascal
@ -69,3 +75,4 @@ untgz/ by Pedro A. Aranda Gutierrez <paag@tid.es>
vstudio/ by Gilles Vollant <info@winimage.com>
Building a minizip-enhanced zlib with Microsoft Visual Studio
Includes vc11 from kreuzerkrieg and vc12 from davispuh

View File

@ -31,7 +31,7 @@ package ZLib.Streams is
Mode : in Flush_Mode := Sync_Flush);
-- Flush the written data to the back stream,
-- all data placed to the compressor is flushing to the Back stream.
-- Should not be used untill necessary, becouse it is decreasing
-- Should not be used until necessary, because it is decreasing
-- compression.
function Read_Total_In (Stream : in Stream_Type) return Count;
@ -97,13 +97,13 @@ private
Rest_Last : Stream_Element_Offset;
-- Buffer for Read operation.
-- We need to have this buffer in the record
-- becouse not all read data from back stream
-- because not all read data from back stream
-- could be processed during the read operation.
Buffer_Size : Stream_Element_Offset;
-- Buffer size for write operation.
-- We do not need to have this buffer
-- in the record becouse all data could be
-- in the record because all data could be
-- processed in the write operation.
Back : Stream_Access;

View File

@ -436,7 +436,7 @@ private
pragma Import (C, inflateBackInit, "inflateBackInit_");
-- I stopped binding the inflateBack routines, becouse realize that
-- I stopped binding the inflateBack routines, because realize that
-- it does not support zlib and gzip headers for now, and have no
-- symmetric deflateBack routines.
-- ZLib-Ada is symmetric regarding deflate/inflate data transformation

View File

@ -0,0 +1,452 @@
/*
* match.S -- optimized version of longest_match()
* based on the similar work by Gilles Vollant, and Brian Raiter, written 1998
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the BSD License. Use by owners of Che Guevarra
* parafernalia is prohibited, where possible, and highly discouraged
* elsewhere.
*/
#ifndef NO_UNDERLINE
# define match_init _match_init
# define longest_match _longest_match
#endif
#define scanend ebx
#define scanendw bx
#define chainlenwmask edx /* high word: current chain len low word: s->wmask */
#define curmatch rsi
#define curmatchd esi
#define windowbestlen r8
#define scanalign r9
#define scanalignd r9d
#define window r10
#define bestlen r11
#define bestlend r11d
#define scanstart r12d
#define scanstartw r12w
#define scan r13
#define nicematch r14d
#define limit r15
#define limitd r15d
#define prev rcx
/*
* The 258 is a "magic number, not a parameter -- changing it
* breaks the hell loose
*/
#define MAX_MATCH (258)
#define MIN_MATCH (3)
#define MIN_LOOKAHEAD (MAX_MATCH + MIN_MATCH + 1)
#define MAX_MATCH_8 ((MAX_MATCH + 7) & ~7)
/* stack frame offsets */
#define LocalVarsSize (112)
#define _chainlenwmask ( 8-LocalVarsSize)(%rsp)
#define _windowbestlen (16-LocalVarsSize)(%rsp)
#define save_r14 (24-LocalVarsSize)(%rsp)
#define save_rsi (32-LocalVarsSize)(%rsp)
#define save_rbx (40-LocalVarsSize)(%rsp)
#define save_r12 (56-LocalVarsSize)(%rsp)
#define save_r13 (64-LocalVarsSize)(%rsp)
#define save_r15 (80-LocalVarsSize)(%rsp)
.globl match_init, longest_match
/*
* On AMD64 the first argument of a function (in our case -- the pointer to
* deflate_state structure) is passed in %rdi, hence our offsets below are
* all off of that.
*/
/* you can check the structure offset by running
#include <stdlib.h>
#include <stdio.h>
#include "deflate.h"
void print_depl()
{
deflate_state ds;
deflate_state *s=&ds;
printf("size pointer=%u\n",(int)sizeof(void*));
printf("#define dsWSize (%3u)(%%rdi)\n",(int)(((char*)&(s->w_size))-((char*)s)));
printf("#define dsWMask (%3u)(%%rdi)\n",(int)(((char*)&(s->w_mask))-((char*)s)));
printf("#define dsWindow (%3u)(%%rdi)\n",(int)(((char*)&(s->window))-((char*)s)));
printf("#define dsPrev (%3u)(%%rdi)\n",(int)(((char*)&(s->prev))-((char*)s)));
printf("#define dsMatchLen (%3u)(%%rdi)\n",(int)(((char*)&(s->match_length))-((char*)s)));
printf("#define dsPrevMatch (%3u)(%%rdi)\n",(int)(((char*)&(s->prev_match))-((char*)s)));
printf("#define dsStrStart (%3u)(%%rdi)\n",(int)(((char*)&(s->strstart))-((char*)s)));
printf("#define dsMatchStart (%3u)(%%rdi)\n",(int)(((char*)&(s->match_start))-((char*)s)));
printf("#define dsLookahead (%3u)(%%rdi)\n",(int)(((char*)&(s->lookahead))-((char*)s)));
printf("#define dsPrevLen (%3u)(%%rdi)\n",(int)(((char*)&(s->prev_length))-((char*)s)));
printf("#define dsMaxChainLen (%3u)(%%rdi)\n",(int)(((char*)&(s->max_chain_length))-((char*)s)));
printf("#define dsGoodMatch (%3u)(%%rdi)\n",(int)(((char*)&(s->good_match))-((char*)s)));
printf("#define dsNiceMatch (%3u)(%%rdi)\n",(int)(((char*)&(s->nice_match))-((char*)s)));
}
*/
/*
to compile for XCode 3.2 on MacOSX x86_64
- run "gcc -g -c -DXCODE_MAC_X64_STRUCTURE amd64-match.S"
*/
#ifndef CURRENT_LINX_XCODE_MAC_X64_STRUCTURE
#define dsWSize ( 68)(%rdi)
#define dsWMask ( 76)(%rdi)
#define dsWindow ( 80)(%rdi)
#define dsPrev ( 96)(%rdi)
#define dsMatchLen (144)(%rdi)
#define dsPrevMatch (148)(%rdi)
#define dsStrStart (156)(%rdi)
#define dsMatchStart (160)(%rdi)
#define dsLookahead (164)(%rdi)
#define dsPrevLen (168)(%rdi)
#define dsMaxChainLen (172)(%rdi)
#define dsGoodMatch (188)(%rdi)
#define dsNiceMatch (192)(%rdi)
#else
#ifndef STRUCT_OFFSET
# define STRUCT_OFFSET (0)
#endif
#define dsWSize ( 56 + STRUCT_OFFSET)(%rdi)
#define dsWMask ( 64 + STRUCT_OFFSET)(%rdi)
#define dsWindow ( 72 + STRUCT_OFFSET)(%rdi)
#define dsPrev ( 88 + STRUCT_OFFSET)(%rdi)
#define dsMatchLen (136 + STRUCT_OFFSET)(%rdi)
#define dsPrevMatch (140 + STRUCT_OFFSET)(%rdi)
#define dsStrStart (148 + STRUCT_OFFSET)(%rdi)
#define dsMatchStart (152 + STRUCT_OFFSET)(%rdi)
#define dsLookahead (156 + STRUCT_OFFSET)(%rdi)
#define dsPrevLen (160 + STRUCT_OFFSET)(%rdi)
#define dsMaxChainLen (164 + STRUCT_OFFSET)(%rdi)
#define dsGoodMatch (180 + STRUCT_OFFSET)(%rdi)
#define dsNiceMatch (184 + STRUCT_OFFSET)(%rdi)
#endif
.text
/* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */
longest_match:
/*
* Retrieve the function arguments. %curmatch will hold cur_match
* throughout the entire function (passed via rsi on amd64).
* rdi will hold the pointer to the deflate_state (first arg on amd64)
*/
mov %rsi, save_rsi
mov %rbx, save_rbx
mov %r12, save_r12
mov %r13, save_r13
mov %r14, save_r14
mov %r15, save_r15
/* uInt wmask = s->w_mask; */
/* unsigned chain_length = s->max_chain_length; */
/* if (s->prev_length >= s->good_match) { */
/* chain_length >>= 2; */
/* } */
movl dsPrevLen, %eax
movl dsGoodMatch, %ebx
cmpl %ebx, %eax
movl dsWMask, %eax
movl dsMaxChainLen, %chainlenwmask
jl LastMatchGood
shrl $2, %chainlenwmask
LastMatchGood:
/* chainlen is decremented once beforehand so that the function can */
/* use the sign flag instead of the zero flag for the exit test. */
/* It is then shifted into the high word, to make room for the wmask */
/* value, which it will always accompany. */
decl %chainlenwmask
shll $16, %chainlenwmask
orl %eax, %chainlenwmask
/* if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; */
movl dsNiceMatch, %eax
movl dsLookahead, %ebx
cmpl %eax, %ebx
jl LookaheadLess
movl %eax, %ebx
LookaheadLess: movl %ebx, %nicematch
/* register Bytef *scan = s->window + s->strstart; */
mov dsWindow, %window
movl dsStrStart, %limitd
lea (%limit, %window), %scan
/* Determine how many bytes the scan ptr is off from being */
/* dword-aligned. */
mov %scan, %scanalign
negl %scanalignd
andl $3, %scanalignd
/* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */
/* s->strstart - (IPos)MAX_DIST(s) : NIL; */
movl dsWSize, %eax
subl $MIN_LOOKAHEAD, %eax
xorl %ecx, %ecx
subl %eax, %limitd
cmovng %ecx, %limitd
/* int best_len = s->prev_length; */
movl dsPrevLen, %bestlend
/* Store the sum of s->window + best_len in %windowbestlen locally, and in memory. */
lea (%window, %bestlen), %windowbestlen
mov %windowbestlen, _windowbestlen
/* register ush scan_start = *(ushf*)scan; */
/* register ush scan_end = *(ushf*)(scan+best_len-1); */
/* Posf *prev = s->prev; */
movzwl (%scan), %scanstart
movzwl -1(%scan, %bestlen), %scanend
mov dsPrev, %prev
/* Jump into the main loop. */
movl %chainlenwmask, _chainlenwmask
jmp LoopEntry
.balign 16
/* do {
* match = s->window + cur_match;
* if (*(ushf*)(match+best_len-1) != scan_end ||
* *(ushf*)match != scan_start) continue;
* [...]
* } while ((cur_match = prev[cur_match & wmask]) > limit
* && --chain_length != 0);
*
* Here is the inner loop of the function. The function will spend the
* majority of its time in this loop, and majority of that time will
* be spent in the first ten instructions.
*/
LookupLoop:
andl %chainlenwmask, %curmatchd
movzwl (%prev, %curmatch, 2), %curmatchd
cmpl %limitd, %curmatchd
jbe LeaveNow
subl $0x00010000, %chainlenwmask
js LeaveNow
LoopEntry: cmpw -1(%windowbestlen, %curmatch), %scanendw
jne LookupLoop
cmpw %scanstartw, (%window, %curmatch)
jne LookupLoop
/* Store the current value of chainlen. */
movl %chainlenwmask, _chainlenwmask
/* %scan is the string under scrutiny, and %prev to the string we */
/* are hoping to match it up with. In actuality, %esi and %edi are */
/* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is */
/* initialized to -(MAX_MATCH_8 - scanalign). */
mov $(-MAX_MATCH_8), %rdx
lea (%curmatch, %window), %windowbestlen
lea MAX_MATCH_8(%windowbestlen, %scanalign), %windowbestlen
lea MAX_MATCH_8(%scan, %scanalign), %prev
/* the prefetching below makes very little difference... */
prefetcht1 (%windowbestlen, %rdx)
prefetcht1 (%prev, %rdx)
/*
* Test the strings for equality, 8 bytes at a time. At the end,
* adjust %rdx so that it is offset to the exact byte that mismatched.
*
* It should be confessed that this loop usually does not represent
* much of the total running time. Replacing it with a more
* straightforward "rep cmpsb" would not drastically degrade
* performance -- unrolling it, for example, makes no difference.
*/
#undef USE_SSE /* works, but is 6-7% slower, than non-SSE... */
LoopCmps:
#ifdef USE_SSE
/* Preload the SSE registers */
movdqu (%windowbestlen, %rdx), %xmm1
movdqu (%prev, %rdx), %xmm2
pcmpeqb %xmm2, %xmm1
movdqu 16(%windowbestlen, %rdx), %xmm3
movdqu 16(%prev, %rdx), %xmm4
pcmpeqb %xmm4, %xmm3
movdqu 32(%windowbestlen, %rdx), %xmm5
movdqu 32(%prev, %rdx), %xmm6
pcmpeqb %xmm6, %xmm5
movdqu 48(%windowbestlen, %rdx), %xmm7
movdqu 48(%prev, %rdx), %xmm8
pcmpeqb %xmm8, %xmm7
/* Check the comparisions' results */
pmovmskb %xmm1, %rax
notw %ax
bsfw %ax, %ax
jnz LeaveLoopCmps
/* this is the only iteration of the loop with a possibility of having
incremented rdx by 0x108 (each loop iteration add 16*4 = 0x40
and (0x40*4)+8=0x108 */
add $8, %rdx
jz LenMaximum
add $8, %rdx
pmovmskb %xmm3, %rax
notw %ax
bsfw %ax, %ax
jnz LeaveLoopCmps
add $16, %rdx
pmovmskb %xmm5, %rax
notw %ax
bsfw %ax, %ax
jnz LeaveLoopCmps
add $16, %rdx
pmovmskb %xmm7, %rax
notw %ax
bsfw %ax, %ax
jnz LeaveLoopCmps
add $16, %rdx
jmp LoopCmps
LeaveLoopCmps: add %rax, %rdx
#else
mov (%windowbestlen, %rdx), %rax
xor (%prev, %rdx), %rax
jnz LeaveLoopCmps
mov 8(%windowbestlen, %rdx), %rax
xor 8(%prev, %rdx), %rax
jnz LeaveLoopCmps8
mov 16(%windowbestlen, %rdx), %rax
xor 16(%prev, %rdx), %rax
jnz LeaveLoopCmps16
add $24, %rdx
jnz LoopCmps
jmp LenMaximum
# if 0
/*
* This three-liner is tantalizingly simple, but bsf is a slow instruction,
* and the complicated alternative down below is quite a bit faster. Sad...
*/
LeaveLoopCmps: bsf %rax, %rax /* find the first non-zero bit */
shrl $3, %eax /* divide by 8 to get the byte */
add %rax, %rdx
# else
LeaveLoopCmps16:
add $8, %rdx
LeaveLoopCmps8:
add $8, %rdx
LeaveLoopCmps: testl $0xFFFFFFFF, %eax /* Check the first 4 bytes */
jnz Check16
add $4, %rdx
shr $32, %rax
Check16: testw $0xFFFF, %ax
jnz LenLower
add $2, %rdx
shrl $16, %eax
LenLower: subb $1, %al
adc $0, %rdx
# endif
#endif
/* Calculate the length of the match. If it is longer than MAX_MATCH, */
/* then automatically accept it as the best possible match and leave. */
lea (%prev, %rdx), %rax
sub %scan, %rax
cmpl $MAX_MATCH, %eax
jge LenMaximum
/* If the length of the match is not longer than the best match we */
/* have so far, then forget it and return to the lookup loop. */
cmpl %bestlend, %eax
jg LongerMatch
mov _windowbestlen, %windowbestlen
mov dsPrev, %prev
movl _chainlenwmask, %edx
jmp LookupLoop
/* s->match_start = cur_match; */
/* best_len = len; */
/* if (len >= nice_match) break; */
/* scan_end = *(ushf*)(scan+best_len-1); */
LongerMatch:
movl %eax, %bestlend
movl %curmatchd, dsMatchStart
cmpl %nicematch, %eax
jge LeaveNow
lea (%window, %bestlen), %windowbestlen
mov %windowbestlen, _windowbestlen
movzwl -1(%scan, %rax), %scanend
mov dsPrev, %prev
movl _chainlenwmask, %chainlenwmask
jmp LookupLoop
/* Accept the current string, with the maximum possible length. */
LenMaximum:
movl $MAX_MATCH, %bestlend
movl %curmatchd, dsMatchStart
/* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */
/* return s->lookahead; */
LeaveNow:
movl dsLookahead, %eax
cmpl %eax, %bestlend
cmovngl %bestlend, %eax
LookaheadRet:
/* Restore the registers and return from whence we came. */
mov save_rsi, %rsi
mov save_rbx, %rbx
mov save_r12, %r12
mov save_r13, %r13
mov save_r14, %r14
mov save_r15, %r15
ret
match_init: ret

View File

@ -32,3 +32,20 @@ then do:
CFLAGS="-O3 -DASMV" ./configure
make OBJA=match.o
Update:
I've been ignoring these assembly routines for years, believing that
gcc's generated code had caught up with it sometime around gcc 2.95
and the major rearchitecting of the Pentium 4. However, I recently
learned that, despite what I believed, this code still has some life
in it. On the Pentium 4 and AMD64 chips, it continues to run about 8%
faster than the code produced by gcc 4.1.
In acknowledgement of its continuing usefulness, I've altered the
license to match that of the rest of zlib. Share and Enjoy!
Brian Raiter
breadbox@muppetlabs.com
April, 2007

View File

@ -1,9 +1,23 @@
/* match.s -- Pentium-Pro-optimized version of longest_match()
* Written for zlib 1.1.2
* Copyright (C) 1998 Brian Raiter <breadbox@muppetlabs.com>
/* match.S -- x86 assembly version of the zlib longest_match() function.
* Optimized for the Intel 686 chips (PPro and later).
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License.
* Copyright (C) 1998, 2007 Brian Raiter <breadbox@muppetlabs.com>
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the author be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
#ifndef NO_UNDERLINE
@ -69,17 +83,25 @@
.text
/* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */
.cfi_sections .debug_frame
longest_match:
.cfi_startproc
/* Save registers that the compiler may be using, and adjust %esp to */
/* make room for our stack frame. */
pushl %ebp
.cfi_def_cfa_offset 8
.cfi_offset ebp, -8
pushl %edi
.cfi_def_cfa_offset 12
pushl %esi
.cfi_def_cfa_offset 16
pushl %ebx
.cfi_def_cfa_offset 20
subl $LocalVarsSize, %esp
.cfi_def_cfa_offset LocalVarsSize+20
/* Retrieve the function arguments. %ecx will hold cur_match */
/* throughout the entire function. %edx will hold the pointer to the */
@ -94,7 +116,7 @@ longest_match:
/* if (s->prev_length >= s->good_match) { */
/* chain_length >>= 2; */
/* } */
movl dsPrevLen(%edx), %eax
movl dsGoodMatch(%edx), %ebx
cmpl %ebx, %eax
@ -322,8 +344,14 @@ LookaheadRet:
/* Restore the stack and return from whence we came. */
addl $LocalVarsSize, %esp
.cfi_def_cfa_offset 20
popl %ebx
.cfi_def_cfa_offset 16
popl %esi
.cfi_def_cfa_offset 12
popl %edi
.cfi_def_cfa_offset 8
popl %ebp
.cfi_def_cfa_offset 4
.cfi_endproc
match_init: ret

View File

@ -1,7 +1,7 @@
/* blast.c
* Copyright (C) 2003 Mark Adler
* Copyright (C) 2003, 2012, 2013 Mark Adler
* For conditions of distribution and use, see copyright notice in blast.h
* version 1.1, 16 Feb 2003
* version 1.3, 24 Aug 2013
*
* blast.c decompresses data compressed by the PKWare Compression Library.
* This function provides functionality similar to the explode() function of
@ -22,8 +22,14 @@
*
* 1.0 12 Feb 2003 - First version
* 1.1 16 Feb 2003 - Fixed distance check for > 4 GB uncompressed data
* 1.2 24 Oct 2012 - Add note about using binary mode in stdio
* - Fix comparisons of differently signed integers
* 1.3 24 Aug 2013 - Return unused input from blast()
* - Fix test code to correctly report unused input
* - Enable the provision of initial input to blast()
*/
#include <stddef.h> /* for NULL */
#include <setjmp.h> /* for setjmp(), longjmp(), and jmp_buf */
#include "blast.h" /* prototype for blast() */
@ -254,7 +260,7 @@ local int construct(struct huffman *h, const unsigned char *rep, int n)
* next, 0 for literals, 1 for length/distance.
*
* - If literals are uncoded, then the next eight bits are the literal, in the
* normal bit order in th stream, i.e. no bit-reversal is needed. Similarly,
* normal bit order in the stream, i.e. no bit-reversal is needed. Similarly,
* no bit reversal is needed for either the length extra bits or the distance
* extra bits.
*
@ -279,7 +285,7 @@ local int decomp(struct state *s)
int dict; /* log2(dictionary size) - 6 */
int symbol; /* decoded symbol, extra bits for distance */
int len; /* length for copy */
int dist; /* distance for copy */
unsigned dist; /* distance for copy */
int copy; /* copy counter */
unsigned char *from, *to; /* copy pointers */
static int virgin = 1; /* build tables once */
@ -374,7 +380,8 @@ local int decomp(struct state *s)
}
/* See comments in blast.h */
int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow)
int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow,
unsigned *left, unsigned char **in)
{
struct state s; /* input/output state */
int err; /* return value */
@ -382,7 +389,12 @@ int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow)
/* initialize input state */
s.infun = infun;
s.inhow = inhow;
s.left = 0;
if (left != NULL && *left) {
s.left = *left;
s.in = *in;
}
else
s.left = 0;
s.bitbuf = 0;
s.bitcnt = 0;
@ -398,6 +410,12 @@ int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow)
else
err = decomp(&s); /* decompress */
/* return unused input */
if (left != NULL)
*left = s.left;
if (in != NULL)
*in = s.left ? s.in : NULL;
/* write any leftover output and update the error code if needed */
if (err != 1 && s.next && s.outfun(s.outhow, s.out, s.next) && err == 0)
err = 1;
@ -427,16 +445,20 @@ local int outf(void *how, unsigned char *buf, unsigned len)
/* Decompress a PKWare Compression Library stream from stdin to stdout */
int main(void)
{
int ret, n;
int ret;
unsigned left;
/* decompress to stdout */
ret = blast(inf, stdin, outf, stdout);
if (ret != 0) fprintf(stderr, "blast error: %d\n", ret);
left = 0;
ret = blast(inf, stdin, outf, stdout, &left, NULL);
if (ret != 0)
fprintf(stderr, "blast error: %d\n", ret);
/* see if there are any leftover bytes */
n = 0;
while (getchar() != EOF) n++;
if (n) fprintf(stderr, "blast warning: %d unused bytes of input\n", n);
/* count any leftover bytes */
while (getchar() != EOF)
left++;
if (left)
fprintf(stderr, "blast warning: %u unused bytes of input\n", left);
/* return blast() error code */
return ret;

View File

@ -1,6 +1,6 @@
/* blast.h -- interface for blast.c
Copyright (C) 2003 Mark Adler
version 1.1, 16 Feb 2003
/* blast.h -- interface for blast.c
Copyright (C) 2003, 2012, 2013 Mark Adler
version 1.3, 24 Aug 2013
This software is provided 'as-is', without any express or implied
warranty. In no event will the author be held liable for any damages
@ -28,6 +28,10 @@
* that library. (Note: PKWare overused the "implode" verb, and the format
* used by their library implode() function is completely different and
* incompatible with the implode compression method supported by PKZIP.)
*
* The binary mode for stdio functions should be used to assure that the
* compressed data is not corrupted when read or written. For example:
* fopen(..., "rb") and fopen(..., "wb").
*/
@ -38,7 +42,8 @@ typedef int (*blast_out)(void *how, unsigned char *buf, unsigned len);
*/
int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow);
int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow,
unsigned *left, unsigned char **in);
/* Decompress input to output using the provided infun() and outfun() calls.
* On success, the return value of blast() is zero. If there is an error in
* the source data, i.e. it is not in the proper format, then a negative value
@ -51,12 +56,19 @@ int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow);
* an input error. (blast() only asks for input if it needs it.) inhow is for
* use by the application to pass an input descriptor to infun(), if desired.
*
* If left and in are not NULL and *left is not zero when blast() is called,
* then the *left bytes are *in are consumed for input before infun() is used.
*
* The output function is invoked: err = outfun(how, buf, len), where the bytes
* to be written are buf[0..len-1]. If err is not zero, then blast() returns
* with an output error. outfun() is always called with len <= 4096. outhow
* is for use by the application to pass an output descriptor to outfun(), if
* desired.
*
* If there is any unused input, *left is set to the number of bytes that were
* read and *in points to them. Otherwise *left is set to zero and *in is set
* to NULL. If left or in are NULL, then they are not set.
*
* The return codes are:
*
* 2: ran out of input before completing decompression

Some files were not shown because too many files have changed in this diff Show More