mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Compare commits
62 Commits
v5.2.7.2
...
v5.2.99.93
| Author | SHA1 | Date | |
|---|---|---|---|
| 24332cca42 | |||
| 55e7777abb | |||
| b7c8bc2769 | |||
| 13900daf08 | |||
| 2feb1ac8e8 | |||
| d872f4220c | |||
| e859821647 | |||
| 18cbd41c84 | |||
| 8985395ef1 | |||
| f4d72572c0 | |||
| bc319bddbf | |||
| 8625e93ac5 | |||
| 1493e4a949 | |||
| 85bf4b8fac | |||
| b1b911b538 | |||
| 2192bff46b | |||
| e4e6acd1bc | |||
| 7418b2327a | |||
| 18d610e3e0 | |||
| 4e81420eed | |||
| e26f836da7 | |||
| 538e477818 | |||
| b212e878c6 | |||
| 05694d13f3 | |||
| 1dd72c99a2 | |||
| 4b73e58693 | |||
| bee4f57dd3 | |||
| 142f9f57a3 | |||
| 28346c4571 | |||
| 9810087ee1 | |||
| 2b8e1456c2 | |||
| 49723e648a | |||
| b0a2104b21 | |||
| e4986f4202 | |||
| bd1dc5a7b6 | |||
| 1ccbe323f4 | |||
| 3811169415 | |||
| 2871769479 | |||
| acdce1edb9 | |||
| 67a40a5fc4 | |||
| 67cd654785 | |||
| 3816162555 | |||
| d8121d1a12 | |||
| a76bf57051 | |||
| 97b92cf75c | |||
| 506de8e9e1 | |||
| 677e3e49e0 | |||
| 02c84d107b | |||
| 49cd76d0f3 | |||
| 26f32dd511 | |||
| 395e54cf76 | |||
| 40476e7555 | |||
| 04f06c23a1 | |||
| a9a635747a | |||
| 4027a0de25 | |||
| f4fa754ce4 | |||
| 7d88a91fcc | |||
| 069b12839f | |||
| aa609336ca | |||
| 452917f213 | |||
| 5b5ccdc9be | |||
| adf7ca65ea |
@ -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"
|
||||
|
||||
@ -217,7 +217,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
unsigned char* m_Data;
|
||||
unsigned char* m_Data;
|
||||
unsigned long m_Size;
|
||||
unsigned long m_Position;
|
||||
bool bMemoryCopy;
|
||||
|
||||
@ -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>";
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -1411,7 +1411,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 +2410,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 +2576,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 +4503,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 +4538,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())
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 = (
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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"
|
||||
|
||||
|
||||
@ -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)
|
||||
};
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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"
|
||||
|
||||
|
||||
60
DesktopEditor/doctrenderer/doctrenderer_android.cpp
Normal file
60
DesktopEditor/doctrenderer/doctrenderer_android.cpp
Normal 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() {}
|
||||
}
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -84,7 +84,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
Aggplus::CImage* GetImage()
|
||||
virtual Aggplus::CImage* GetImage()
|
||||
{
|
||||
return &m_oImage;
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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)",
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
};
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
249
OfficeUtils/src/zlib-1.2.11/CMakeLists.txt
Normal file
249
OfficeUtils/src/zlib-1.2.11/CMakeLists.txt
Normal 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()
|
||||
@ -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),
|
||||
368
OfficeUtils/src/zlib-1.2.11/FAQ
Normal file
368
OfficeUtils/src/zlib-1.2.11/FAQ
Normal 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.
|
||||
68
OfficeUtils/src/zlib-1.2.11/INDEX
Normal file
68
OfficeUtils/src/zlib-1.2.11/INDEX
Normal 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
|
||||
410
OfficeUtils/src/zlib-1.2.11/Makefile.in
Normal file
410
OfficeUtils/src/zlib-1.2.11/Makefile.in
Normal 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
|
||||
115
OfficeUtils/src/zlib-1.2.11/README
Normal file
115
OfficeUtils/src/zlib-1.2.11/README
Normal 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.
|
||||
@ -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);
|
||||
}
|
||||
@ -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
|
||||
@ -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
|
||||
@ -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
921
OfficeUtils/src/zlib-1.2.11/configure
vendored
Normal 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
|
||||
@ -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
|
||||
@ -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;
|
||||
@ -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
|
||||
452
OfficeUtils/src/zlib-1.2.11/contrib/amd64/amd64-match.S
Normal file
452
OfficeUtils/src/zlib-1.2.11/contrib/amd64/amd64-match.S
Normal 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
|
||||
@ -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
|
||||
@ -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
|
||||
@ -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;
|
||||
@ -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
|
||||
@ -152,7 +152,7 @@ procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer;
|
||||
const OutBuf: Pointer; BufSize: Integer);
|
||||
|
||||
const
|
||||
zlib_version = '1.2.3';
|
||||
zlib_version = '1.2.11';
|
||||
|
||||
type
|
||||
EZlibError = class(Exception);
|
||||
@ -18,10 +18,10 @@ LDFLAGS =
|
||||
# variables
|
||||
ZLIB_LIB = zlib.lib
|
||||
|
||||
OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj
|
||||
OBJ2 = inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj
|
||||
OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzio.obj+infback.obj
|
||||
OBJP2 = +inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj
|
||||
OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj
|
||||
OBJ2 = gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj
|
||||
OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzclose.obj+gzlib.obj+gzread.obj
|
||||
OBJP2 = +gzwrite.obj+infback.obj+inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj
|
||||
|
||||
|
||||
# targets
|
||||
@ -38,7 +38,13 @@ crc32.obj: crc32.c zlib.h zconf.h crc32.h
|
||||
|
||||
deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
|
||||
|
||||
gzio.obj: gzio.c zutil.h zlib.h zconf.h
|
||||
gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h
|
||||
|
||||
gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h
|
||||
|
||||
gzread.obj: gzread.c zlib.h zconf.h gzguts.h
|
||||
|
||||
gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h
|
||||
|
||||
infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
|
||||
inffast.h inffixed.h
|
||||
@ -57,9 +63,9 @@ uncompr.obj: uncompr.c zlib.h zconf.h
|
||||
|
||||
zutil.obj: zutil.c zutil.h zlib.h zconf.h
|
||||
|
||||
example.obj: example.c zlib.h zconf.h
|
||||
example.obj: test/example.c zlib.h zconf.h
|
||||
|
||||
minigzip.obj: minigzip.c zlib.h zconf.h
|
||||
minigzip.obj: test/minigzip.c zlib.h zconf.h
|
||||
|
||||
|
||||
# For the sake of the old Borland make,
|
||||
@ -1,33 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<project name="DotZLib" default="build" basedir="./DotZLib">
|
||||
<description>A .Net wrapper library around ZLib1.dll</description>
|
||||
|
||||
<property name="nunit.location" value="c:/program files/NUnit V2.1/bin" />
|
||||
<property name="build.root" value="bin" />
|
||||
|
||||
<property name="debug" value="true" />
|
||||
<property name="nunit" value="true" />
|
||||
|
||||
<property name="build.folder" value="${build.root}/debug/" if="${debug}" />
|
||||
<property name="build.folder" value="${build.root}/release/" unless="${debug}" />
|
||||
|
||||
<target name="clean" description="Remove all generated files">
|
||||
<delete dir="${build.root}" failonerror="false" />
|
||||
</target>
|
||||
|
||||
<target name="build" description="compiles the source code">
|
||||
|
||||
<mkdir dir="${build.folder}" />
|
||||
<csc target="library" output="${build.folder}DotZLib.dll" debug="${debug}">
|
||||
<references basedir="${nunit.location}">
|
||||
<includes if="${nunit}" name="nunit.framework.dll" />
|
||||
</references>
|
||||
<sources>
|
||||
<includes name="*.cs" />
|
||||
<excludes name="UnitTests.cs" unless="${nunit}" />
|
||||
</sources>
|
||||
<arg value="/d:nunit" if="${nunit}" />
|
||||
</csc>
|
||||
</target>
|
||||
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<project name="DotZLib" default="build" basedir="./DotZLib">
|
||||
<description>A .Net wrapper library around ZLib1.dll</description>
|
||||
|
||||
<property name="nunit.location" value="c:/program files/NUnit V2.1/bin" />
|
||||
<property name="build.root" value="bin" />
|
||||
|
||||
<property name="debug" value="true" />
|
||||
<property name="nunit" value="true" />
|
||||
|
||||
<property name="build.folder" value="${build.root}/debug/" if="${debug}" />
|
||||
<property name="build.folder" value="${build.root}/release/" unless="${debug}" />
|
||||
|
||||
<target name="clean" description="Remove all generated files">
|
||||
<delete dir="${build.root}" failonerror="false" />
|
||||
</target>
|
||||
|
||||
<target name="build" description="compiles the source code">
|
||||
|
||||
<mkdir dir="${build.folder}" />
|
||||
<csc target="library" output="${build.folder}DotZLib.dll" debug="${debug}">
|
||||
<references basedir="${nunit.location}">
|
||||
<includes if="${nunit}" name="nunit.framework.dll" />
|
||||
</references>
|
||||
<sources>
|
||||
<includes name="*.cs" />
|
||||
<excludes name="UnitTests.cs" unless="${nunit}" />
|
||||
</sources>
|
||||
<arg value="/d:nunit" if="${nunit}" />
|
||||
</csc>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
Binary file not shown.
@ -1,21 +1,21 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotZLib", "DotZLib\DotZLib.csproj", "{BB1EE0B1-1808-46CB-B786-949D91117FC5}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{BB1EE0B1-1808-46CB-B786-949D91117FC5}.Debug.ActiveCfg = Debug|.NET
|
||||
{BB1EE0B1-1808-46CB-B786-949D91117FC5}.Debug.Build.0 = Debug|.NET
|
||||
{BB1EE0B1-1808-46CB-B786-949D91117FC5}.Release.ActiveCfg = Release|.NET
|
||||
{BB1EE0B1-1808-46CB-B786-949D91117FC5}.Release.Build.0 = Release|.NET
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotZLib", "DotZLib\DotZLib.csproj", "{BB1EE0B1-1808-46CB-B786-949D91117FC5}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{BB1EE0B1-1808-46CB-B786-949D91117FC5}.Debug.ActiveCfg = Debug|.NET
|
||||
{BB1EE0B1-1808-46CB-B786-949D91117FC5}.Debug.Build.0 = Debug|.NET
|
||||
{BB1EE0B1-1808-46CB-B786-949D91117FC5}.Release.ActiveCfg = Release|.NET
|
||||
{BB1EE0B1-1808-46CB-B786-949D91117FC5}.Release.Build.0 = Release|.NET
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@ -1,58 +1,58 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
//
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
//
|
||||
[assembly: AssemblyTitle("DotZLib")]
|
||||
[assembly: AssemblyDescription(".Net bindings for ZLib compression dll 1.2.x")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Henrik Ravn")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("(c) 2004 by Henrik Ravn")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
//
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
//
|
||||
// In order to sign your assembly you must specify a key to use. Refer to the
|
||||
// Microsoft .NET Framework documentation for more information on assembly signing.
|
||||
//
|
||||
// Use the attributes below to control which key is used for signing.
|
||||
//
|
||||
// Notes:
|
||||
// (*) If no key is specified, the assembly is not signed.
|
||||
// (*) KeyName refers to a key that has been installed in the Crypto Service
|
||||
// Provider (CSP) on your machine. KeyFile refers to a file which contains
|
||||
// a key.
|
||||
// (*) If the KeyFile and the KeyName values are both specified, the
|
||||
// following processing occurs:
|
||||
// (1) If the KeyName can be found in the CSP, that key is used.
|
||||
// (2) If the KeyName does not exist and the KeyFile does exist, the key
|
||||
// in the KeyFile is installed into the CSP and used.
|
||||
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
|
||||
// When specifying the KeyFile, the location of the KeyFile should be
|
||||
// relative to the project output directory which is
|
||||
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
|
||||
// located in the project directory, you would specify the AssemblyKeyFile
|
||||
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
|
||||
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
|
||||
// documentation for more information on this.
|
||||
//
|
||||
[assembly: AssemblyDelaySign(false)]
|
||||
[assembly: AssemblyKeyFile("")]
|
||||
[assembly: AssemblyKeyName("")]
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
//
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
//
|
||||
[assembly: AssemblyTitle("DotZLib")]
|
||||
[assembly: AssemblyDescription(".Net bindings for ZLib compression dll 1.2.x")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Henrik Ravn")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("(c) 2004 by Henrik Ravn")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
//
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
//
|
||||
// In order to sign your assembly you must specify a key to use. Refer to the
|
||||
// Microsoft .NET Framework documentation for more information on assembly signing.
|
||||
//
|
||||
// Use the attributes below to control which key is used for signing.
|
||||
//
|
||||
// Notes:
|
||||
// (*) If no key is specified, the assembly is not signed.
|
||||
// (*) KeyName refers to a key that has been installed in the Crypto Service
|
||||
// Provider (CSP) on your machine. KeyFile refers to a file which contains
|
||||
// a key.
|
||||
// (*) If the KeyFile and the KeyName values are both specified, the
|
||||
// following processing occurs:
|
||||
// (1) If the KeyName can be found in the CSP, that key is used.
|
||||
// (2) If the KeyName does not exist and the KeyFile does exist, the key
|
||||
// in the KeyFile is installed into the CSP and used.
|
||||
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
|
||||
// When specifying the KeyFile, the location of the KeyFile should be
|
||||
// relative to the project output directory which is
|
||||
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
|
||||
// located in the project directory, you would specify the AssemblyKeyFile
|
||||
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
|
||||
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
|
||||
// documentation for more information on this.
|
||||
//
|
||||
[assembly: AssemblyDelaySign(false)]
|
||||
[assembly: AssemblyKeyFile("")]
|
||||
[assembly: AssemblyKeyName("")]
|
||||
@ -1,202 +1,202 @@
|
||||
//
|
||||
// © Copyright Henrik Ravn 2004
|
||||
//
|
||||
// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace DotZLib
|
||||
{
|
||||
#region ChecksumGeneratorBase
|
||||
/// <summary>
|
||||
/// Implements the common functionality needed for all <see cref="ChecksumGenerator"/>s
|
||||
/// </summary>
|
||||
/// <example></example>
|
||||
public abstract class ChecksumGeneratorBase : ChecksumGenerator
|
||||
{
|
||||
/// <summary>
|
||||
/// The value of the current checksum
|
||||
/// </summary>
|
||||
protected uint _current;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the checksum generator base - the current checksum is
|
||||
/// set to zero
|
||||
/// </summary>
|
||||
public ChecksumGeneratorBase()
|
||||
{
|
||||
_current = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the checksum generator basewith a specified value
|
||||
/// </summary>
|
||||
/// <param name="initialValue">The value to set the current checksum to</param>
|
||||
public ChecksumGeneratorBase(uint initialValue)
|
||||
{
|
||||
_current = initialValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the current checksum to zero
|
||||
/// </summary>
|
||||
public void Reset() { _current = 0; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current checksum value
|
||||
/// </summary>
|
||||
public uint Value { get { return _current; } }
|
||||
|
||||
/// <summary>
|
||||
/// Updates the current checksum with part of an array of bytes
|
||||
/// </summary>
|
||||
/// <param name="data">The data to update the checksum with</param>
|
||||
/// <param name="offset">Where in <c>data</c> to start updating</param>
|
||||
/// <param name="count">The number of bytes from <c>data</c> to use</param>
|
||||
/// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception>
|
||||
/// <exception cref="NullReferenceException"><c>data</c> is a null reference</exception>
|
||||
/// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception>
|
||||
/// <remarks>All the other <c>Update</c> methods are implmeneted in terms of this one.
|
||||
/// This is therefore the only method a derived class has to implement</remarks>
|
||||
public abstract void Update(byte[] data, int offset, int count);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the current checksum with an array of bytes.
|
||||
/// </summary>
|
||||
/// <param name="data">The data to update the checksum with</param>
|
||||
public void Update(byte[] data)
|
||||
{
|
||||
Update(data, 0, data.Length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the current checksum with the data from a string
|
||||
/// </summary>
|
||||
/// <param name="data">The string to update the checksum with</param>
|
||||
/// <remarks>The characters in the string are converted by the UTF-8 encoding</remarks>
|
||||
public void Update(string data)
|
||||
{
|
||||
Update(Encoding.UTF8.GetBytes(data));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the current checksum with the data from a string, using a specific encoding
|
||||
/// </summary>
|
||||
/// <param name="data">The string to update the checksum with</param>
|
||||
/// <param name="encoding">The encoding to use</param>
|
||||
public void Update(string data, Encoding encoding)
|
||||
{
|
||||
Update(encoding.GetBytes(data));
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region CRC32
|
||||
/// <summary>
|
||||
/// Implements a CRC32 checksum generator
|
||||
/// </summary>
|
||||
public sealed class CRC32Checksum : ChecksumGeneratorBase
|
||||
{
|
||||
#region DLL imports
|
||||
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern uint crc32(uint crc, int data, uint length);
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CRC32 checksum generator
|
||||
/// </summary>
|
||||
public CRC32Checksum() : base() {}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CRC32 checksum generator with a specified value
|
||||
/// </summary>
|
||||
/// <param name="initialValue">The value to set the current checksum to</param>
|
||||
public CRC32Checksum(uint initialValue) : base(initialValue) {}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the current checksum with part of an array of bytes
|
||||
/// </summary>
|
||||
/// <param name="data">The data to update the checksum with</param>
|
||||
/// <param name="offset">Where in <c>data</c> to start updating</param>
|
||||
/// <param name="count">The number of bytes from <c>data</c> to use</param>
|
||||
/// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception>
|
||||
/// <exception cref="NullReferenceException"><c>data</c> is a null reference</exception>
|
||||
/// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception>
|
||||
public override void Update(byte[] data, int offset, int count)
|
||||
{
|
||||
if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();
|
||||
if ((offset+count) > data.Length) throw new ArgumentException();
|
||||
GCHandle hData = GCHandle.Alloc(data, GCHandleType.Pinned);
|
||||
try
|
||||
{
|
||||
_current = crc32(_current, hData.AddrOfPinnedObject().ToInt32()+offset, (uint)count);
|
||||
}
|
||||
finally
|
||||
{
|
||||
hData.Free();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Adler
|
||||
/// <summary>
|
||||
/// Implements a checksum generator that computes the Adler checksum on data
|
||||
/// </summary>
|
||||
public sealed class AdlerChecksum : ChecksumGeneratorBase
|
||||
{
|
||||
#region DLL imports
|
||||
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern uint adler32(uint adler, int data, uint length);
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the Adler checksum generator
|
||||
/// </summary>
|
||||
public AdlerChecksum() : base() {}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the Adler checksum generator with a specified value
|
||||
/// </summary>
|
||||
/// <param name="initialValue">The value to set the current checksum to</param>
|
||||
public AdlerChecksum(uint initialValue) : base(initialValue) {}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the current checksum with part of an array of bytes
|
||||
/// </summary>
|
||||
/// <param name="data">The data to update the checksum with</param>
|
||||
/// <param name="offset">Where in <c>data</c> to start updating</param>
|
||||
/// <param name="count">The number of bytes from <c>data</c> to use</param>
|
||||
/// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception>
|
||||
/// <exception cref="NullReferenceException"><c>data</c> is a null reference</exception>
|
||||
/// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception>
|
||||
public override void Update(byte[] data, int offset, int count)
|
||||
{
|
||||
if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();
|
||||
if ((offset+count) > data.Length) throw new ArgumentException();
|
||||
GCHandle hData = GCHandle.Alloc(data, GCHandleType.Pinned);
|
||||
try
|
||||
{
|
||||
_current = adler32(_current, hData.AddrOfPinnedObject().ToInt32()+offset, (uint)count);
|
||||
}
|
||||
finally
|
||||
{
|
||||
hData.Free();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
// © Copyright Henrik Ravn 2004
|
||||
//
|
||||
// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace DotZLib
|
||||
{
|
||||
#region ChecksumGeneratorBase
|
||||
/// <summary>
|
||||
/// Implements the common functionality needed for all <see cref="ChecksumGenerator"/>s
|
||||
/// </summary>
|
||||
/// <example></example>
|
||||
public abstract class ChecksumGeneratorBase : ChecksumGenerator
|
||||
{
|
||||
/// <summary>
|
||||
/// The value of the current checksum
|
||||
/// </summary>
|
||||
protected uint _current;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the checksum generator base - the current checksum is
|
||||
/// set to zero
|
||||
/// </summary>
|
||||
public ChecksumGeneratorBase()
|
||||
{
|
||||
_current = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the checksum generator basewith a specified value
|
||||
/// </summary>
|
||||
/// <param name="initialValue">The value to set the current checksum to</param>
|
||||
public ChecksumGeneratorBase(uint initialValue)
|
||||
{
|
||||
_current = initialValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the current checksum to zero
|
||||
/// </summary>
|
||||
public void Reset() { _current = 0; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current checksum value
|
||||
/// </summary>
|
||||
public uint Value { get { return _current; } }
|
||||
|
||||
/// <summary>
|
||||
/// Updates the current checksum with part of an array of bytes
|
||||
/// </summary>
|
||||
/// <param name="data">The data to update the checksum with</param>
|
||||
/// <param name="offset">Where in <c>data</c> to start updating</param>
|
||||
/// <param name="count">The number of bytes from <c>data</c> to use</param>
|
||||
/// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception>
|
||||
/// <exception cref="NullReferenceException"><c>data</c> is a null reference</exception>
|
||||
/// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception>
|
||||
/// <remarks>All the other <c>Update</c> methods are implmeneted in terms of this one.
|
||||
/// This is therefore the only method a derived class has to implement</remarks>
|
||||
public abstract void Update(byte[] data, int offset, int count);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the current checksum with an array of bytes.
|
||||
/// </summary>
|
||||
/// <param name="data">The data to update the checksum with</param>
|
||||
public void Update(byte[] data)
|
||||
{
|
||||
Update(data, 0, data.Length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the current checksum with the data from a string
|
||||
/// </summary>
|
||||
/// <param name="data">The string to update the checksum with</param>
|
||||
/// <remarks>The characters in the string are converted by the UTF-8 encoding</remarks>
|
||||
public void Update(string data)
|
||||
{
|
||||
Update(Encoding.UTF8.GetBytes(data));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the current checksum with the data from a string, using a specific encoding
|
||||
/// </summary>
|
||||
/// <param name="data">The string to update the checksum with</param>
|
||||
/// <param name="encoding">The encoding to use</param>
|
||||
public void Update(string data, Encoding encoding)
|
||||
{
|
||||
Update(encoding.GetBytes(data));
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region CRC32
|
||||
/// <summary>
|
||||
/// Implements a CRC32 checksum generator
|
||||
/// </summary>
|
||||
public sealed class CRC32Checksum : ChecksumGeneratorBase
|
||||
{
|
||||
#region DLL imports
|
||||
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern uint crc32(uint crc, int data, uint length);
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CRC32 checksum generator
|
||||
/// </summary>
|
||||
public CRC32Checksum() : base() {}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CRC32 checksum generator with a specified value
|
||||
/// </summary>
|
||||
/// <param name="initialValue">The value to set the current checksum to</param>
|
||||
public CRC32Checksum(uint initialValue) : base(initialValue) {}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the current checksum with part of an array of bytes
|
||||
/// </summary>
|
||||
/// <param name="data">The data to update the checksum with</param>
|
||||
/// <param name="offset">Where in <c>data</c> to start updating</param>
|
||||
/// <param name="count">The number of bytes from <c>data</c> to use</param>
|
||||
/// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception>
|
||||
/// <exception cref="NullReferenceException"><c>data</c> is a null reference</exception>
|
||||
/// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception>
|
||||
public override void Update(byte[] data, int offset, int count)
|
||||
{
|
||||
if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();
|
||||
if ((offset+count) > data.Length) throw new ArgumentException();
|
||||
GCHandle hData = GCHandle.Alloc(data, GCHandleType.Pinned);
|
||||
try
|
||||
{
|
||||
_current = crc32(_current, hData.AddrOfPinnedObject().ToInt32()+offset, (uint)count);
|
||||
}
|
||||
finally
|
||||
{
|
||||
hData.Free();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Adler
|
||||
/// <summary>
|
||||
/// Implements a checksum generator that computes the Adler checksum on data
|
||||
/// </summary>
|
||||
public sealed class AdlerChecksum : ChecksumGeneratorBase
|
||||
{
|
||||
#region DLL imports
|
||||
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern uint adler32(uint adler, int data, uint length);
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the Adler checksum generator
|
||||
/// </summary>
|
||||
public AdlerChecksum() : base() {}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the Adler checksum generator with a specified value
|
||||
/// </summary>
|
||||
/// <param name="initialValue">The value to set the current checksum to</param>
|
||||
public AdlerChecksum(uint initialValue) : base(initialValue) {}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the current checksum with part of an array of bytes
|
||||
/// </summary>
|
||||
/// <param name="data">The data to update the checksum with</param>
|
||||
/// <param name="offset">Where in <c>data</c> to start updating</param>
|
||||
/// <param name="count">The number of bytes from <c>data</c> to use</param>
|
||||
/// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception>
|
||||
/// <exception cref="NullReferenceException"><c>data</c> is a null reference</exception>
|
||||
/// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception>
|
||||
public override void Update(byte[] data, int offset, int count)
|
||||
{
|
||||
if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();
|
||||
if ((offset+count) > data.Length) throw new ArgumentException();
|
||||
GCHandle hData = GCHandle.Alloc(data, GCHandleType.Pinned);
|
||||
try
|
||||
{
|
||||
_current = adler32(_current, hData.AddrOfPinnedObject().ToInt32()+offset, (uint)count);
|
||||
}
|
||||
finally
|
||||
{
|
||||
hData.Free();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
@ -1,83 +1,83 @@
|
||||
//
|
||||
// © Copyright Henrik Ravn 2004
|
||||
//
|
||||
// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace DotZLib
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// This class implements a circular buffer
|
||||
/// </summary>
|
||||
internal class CircularBuffer
|
||||
{
|
||||
#region Private data
|
||||
private int _capacity;
|
||||
private int _head;
|
||||
private int _tail;
|
||||
private int _size;
|
||||
private byte[] _buffer;
|
||||
#endregion
|
||||
|
||||
public CircularBuffer(int capacity)
|
||||
{
|
||||
Debug.Assert( capacity > 0 );
|
||||
_buffer = new byte[capacity];
|
||||
_capacity = capacity;
|
||||
_head = 0;
|
||||
_tail = 0;
|
||||
_size = 0;
|
||||
}
|
||||
|
||||
public int Size { get { return _size; } }
|
||||
|
||||
public int Put(byte[] source, int offset, int count)
|
||||
{
|
||||
Debug.Assert( count > 0 );
|
||||
int trueCount = Math.Min(count, _capacity - Size);
|
||||
for (int i = 0; i < trueCount; ++i)
|
||||
_buffer[(_tail+i) % _capacity] = source[offset+i];
|
||||
_tail += trueCount;
|
||||
_tail %= _capacity;
|
||||
_size += trueCount;
|
||||
return trueCount;
|
||||
}
|
||||
|
||||
public bool Put(byte b)
|
||||
{
|
||||
if (Size == _capacity) // no room
|
||||
return false;
|
||||
_buffer[_tail++] = b;
|
||||
_tail %= _capacity;
|
||||
++_size;
|
||||
return true;
|
||||
}
|
||||
|
||||
public int Get(byte[] destination, int offset, int count)
|
||||
{
|
||||
int trueCount = Math.Min(count,Size);
|
||||
for (int i = 0; i < trueCount; ++i)
|
||||
destination[offset + i] = _buffer[(_head+i) % _capacity];
|
||||
_head += trueCount;
|
||||
_head %= _capacity;
|
||||
_size -= trueCount;
|
||||
return trueCount;
|
||||
}
|
||||
|
||||
public int Get()
|
||||
{
|
||||
if (Size == 0)
|
||||
return -1;
|
||||
|
||||
int result = (int)_buffer[_head++ % _capacity];
|
||||
--_size;
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//
|
||||
// © Copyright Henrik Ravn 2004
|
||||
//
|
||||
// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace DotZLib
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// This class implements a circular buffer
|
||||
/// </summary>
|
||||
internal class CircularBuffer
|
||||
{
|
||||
#region Private data
|
||||
private int _capacity;
|
||||
private int _head;
|
||||
private int _tail;
|
||||
private int _size;
|
||||
private byte[] _buffer;
|
||||
#endregion
|
||||
|
||||
public CircularBuffer(int capacity)
|
||||
{
|
||||
Debug.Assert( capacity > 0 );
|
||||
_buffer = new byte[capacity];
|
||||
_capacity = capacity;
|
||||
_head = 0;
|
||||
_tail = 0;
|
||||
_size = 0;
|
||||
}
|
||||
|
||||
public int Size { get { return _size; } }
|
||||
|
||||
public int Put(byte[] source, int offset, int count)
|
||||
{
|
||||
Debug.Assert( count > 0 );
|
||||
int trueCount = Math.Min(count, _capacity - Size);
|
||||
for (int i = 0; i < trueCount; ++i)
|
||||
_buffer[(_tail+i) % _capacity] = source[offset+i];
|
||||
_tail += trueCount;
|
||||
_tail %= _capacity;
|
||||
_size += trueCount;
|
||||
return trueCount;
|
||||
}
|
||||
|
||||
public bool Put(byte b)
|
||||
{
|
||||
if (Size == _capacity) // no room
|
||||
return false;
|
||||
_buffer[_tail++] = b;
|
||||
_tail %= _capacity;
|
||||
++_size;
|
||||
return true;
|
||||
}
|
||||
|
||||
public int Get(byte[] destination, int offset, int count)
|
||||
{
|
||||
int trueCount = Math.Min(count,Size);
|
||||
for (int i = 0; i < trueCount; ++i)
|
||||
destination[offset + i] = _buffer[(_head+i) % _capacity];
|
||||
_head += trueCount;
|
||||
_head %= _capacity;
|
||||
_size -= trueCount;
|
||||
return trueCount;
|
||||
}
|
||||
|
||||
public int Get()
|
||||
{
|
||||
if (Size == 0)
|
||||
return -1;
|
||||
|
||||
int result = (int)_buffer[_head++ % _capacity];
|
||||
--_size;
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,198 +1,198 @@
|
||||
//
|
||||
// © Copyright Henrik Ravn 2004
|
||||
//
|
||||
// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace DotZLib
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements the common functionality needed for all <see cref="Codec"/>s
|
||||
/// </summary>
|
||||
public abstract class CodecBase : Codec, IDisposable
|
||||
{
|
||||
|
||||
#region Data members
|
||||
|
||||
/// <summary>
|
||||
/// Instance of the internal zlib buffer structure that is
|
||||
/// passed to all functions in the zlib dll
|
||||
/// </summary>
|
||||
internal ZStream _ztream = new ZStream();
|
||||
|
||||
/// <summary>
|
||||
/// True if the object instance has been disposed, false otherwise
|
||||
/// </summary>
|
||||
protected bool _isDisposed = false;
|
||||
|
||||
/// <summary>
|
||||
/// The size of the internal buffers
|
||||
/// </summary>
|
||||
protected const int kBufferSize = 16384;
|
||||
|
||||
private byte[] _outBuffer = new byte[kBufferSize];
|
||||
private byte[] _inBuffer = new byte[kBufferSize];
|
||||
|
||||
private GCHandle _hInput;
|
||||
private GCHandle _hOutput;
|
||||
|
||||
private uint _checksum = 0;
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <c>CodeBase</c> class.
|
||||
/// </summary>
|
||||
public CodecBase()
|
||||
{
|
||||
try
|
||||
{
|
||||
_hInput = GCHandle.Alloc(_inBuffer, GCHandleType.Pinned);
|
||||
_hOutput = GCHandle.Alloc(_outBuffer, GCHandleType.Pinned);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
CleanUp(false);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region Codec Members
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when more processed data are available.
|
||||
/// </summary>
|
||||
public event DataAvailableHandler DataAvailable;
|
||||
|
||||
/// <summary>
|
||||
/// Fires the <see cref="DataAvailable"/> event
|
||||
/// </summary>
|
||||
protected void OnDataAvailable()
|
||||
{
|
||||
if (_ztream.total_out > 0)
|
||||
{
|
||||
if (DataAvailable != null)
|
||||
DataAvailable( _outBuffer, 0, (int)_ztream.total_out);
|
||||
resetOutput();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds more data to the codec to be processed.
|
||||
/// </summary>
|
||||
/// <param name="data">Byte array containing the data to be added to the codec</param>
|
||||
/// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>
|
||||
public void Add(byte[] data)
|
||||
{
|
||||
Add(data,0,data.Length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds more data to the codec to be processed.
|
||||
/// </summary>
|
||||
/// <param name="data">Byte array containing the data to be added to the codec</param>
|
||||
/// <param name="offset">The index of the first byte to add from <c>data</c></param>
|
||||
/// <param name="count">The number of bytes to add</param>
|
||||
/// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>
|
||||
/// <remarks>This must be implemented by a derived class</remarks>
|
||||
public abstract void Add(byte[] data, int offset, int count);
|
||||
|
||||
/// <summary>
|
||||
/// Finishes up any pending data that needs to be processed and handled.
|
||||
/// </summary>
|
||||
/// <remarks>This must be implemented by a derived class</remarks>
|
||||
public abstract void Finish();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the checksum of the data that has been added so far
|
||||
/// </summary>
|
||||
public uint Checksum { get { return _checksum; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Destructor & IDisposable stuff
|
||||
|
||||
/// <summary>
|
||||
/// Destroys this instance
|
||||
/// </summary>
|
||||
~CodecBase()
|
||||
{
|
||||
CleanUp(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Releases any unmanaged resources and calls the <see cref="CleanUp()"/> method of the derived class
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
CleanUp(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs any codec specific cleanup
|
||||
/// </summary>
|
||||
/// <remarks>This must be implemented by a derived class</remarks>
|
||||
protected abstract void CleanUp();
|
||||
|
||||
// performs the release of the handles and calls the dereived CleanUp()
|
||||
private void CleanUp(bool isDisposing)
|
||||
{
|
||||
if (!_isDisposed)
|
||||
{
|
||||
CleanUp();
|
||||
if (_hInput.IsAllocated)
|
||||
_hInput.Free();
|
||||
if (_hOutput.IsAllocated)
|
||||
_hOutput.Free();
|
||||
|
||||
_isDisposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Helper methods
|
||||
|
||||
/// <summary>
|
||||
/// Copies a number of bytes to the internal codec buffer - ready for proccesing
|
||||
/// </summary>
|
||||
/// <param name="data">The byte array that contains the data to copy</param>
|
||||
/// <param name="startIndex">The index of the first byte to copy</param>
|
||||
/// <param name="count">The number of bytes to copy from <c>data</c></param>
|
||||
protected void copyInput(byte[] data, int startIndex, int count)
|
||||
{
|
||||
Array.Copy(data, startIndex, _inBuffer,0, count);
|
||||
_ztream.next_in = _hInput.AddrOfPinnedObject();
|
||||
_ztream.total_in = 0;
|
||||
_ztream.avail_in = (uint)count;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the internal output buffers to a known state - ready for processing
|
||||
/// </summary>
|
||||
protected void resetOutput()
|
||||
{
|
||||
_ztream.total_out = 0;
|
||||
_ztream.avail_out = kBufferSize;
|
||||
_ztream.next_out = _hOutput.AddrOfPinnedObject();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the running checksum property
|
||||
/// </summary>
|
||||
/// <param name="newSum">The new checksum value</param>
|
||||
protected void setChecksum(uint newSum)
|
||||
{
|
||||
_checksum = newSum;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
//
|
||||
// © Copyright Henrik Ravn 2004
|
||||
//
|
||||
// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace DotZLib
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements the common functionality needed for all <see cref="Codec"/>s
|
||||
/// </summary>
|
||||
public abstract class CodecBase : Codec, IDisposable
|
||||
{
|
||||
|
||||
#region Data members
|
||||
|
||||
/// <summary>
|
||||
/// Instance of the internal zlib buffer structure that is
|
||||
/// passed to all functions in the zlib dll
|
||||
/// </summary>
|
||||
internal ZStream _ztream = new ZStream();
|
||||
|
||||
/// <summary>
|
||||
/// True if the object instance has been disposed, false otherwise
|
||||
/// </summary>
|
||||
protected bool _isDisposed = false;
|
||||
|
||||
/// <summary>
|
||||
/// The size of the internal buffers
|
||||
/// </summary>
|
||||
protected const int kBufferSize = 16384;
|
||||
|
||||
private byte[] _outBuffer = new byte[kBufferSize];
|
||||
private byte[] _inBuffer = new byte[kBufferSize];
|
||||
|
||||
private GCHandle _hInput;
|
||||
private GCHandle _hOutput;
|
||||
|
||||
private uint _checksum = 0;
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <c>CodeBase</c> class.
|
||||
/// </summary>
|
||||
public CodecBase()
|
||||
{
|
||||
try
|
||||
{
|
||||
_hInput = GCHandle.Alloc(_inBuffer, GCHandleType.Pinned);
|
||||
_hOutput = GCHandle.Alloc(_outBuffer, GCHandleType.Pinned);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
CleanUp(false);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region Codec Members
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when more processed data are available.
|
||||
/// </summary>
|
||||
public event DataAvailableHandler DataAvailable;
|
||||
|
||||
/// <summary>
|
||||
/// Fires the <see cref="DataAvailable"/> event
|
||||
/// </summary>
|
||||
protected void OnDataAvailable()
|
||||
{
|
||||
if (_ztream.total_out > 0)
|
||||
{
|
||||
if (DataAvailable != null)
|
||||
DataAvailable( _outBuffer, 0, (int)_ztream.total_out);
|
||||
resetOutput();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds more data to the codec to be processed.
|
||||
/// </summary>
|
||||
/// <param name="data">Byte array containing the data to be added to the codec</param>
|
||||
/// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>
|
||||
public void Add(byte[] data)
|
||||
{
|
||||
Add(data,0,data.Length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds more data to the codec to be processed.
|
||||
/// </summary>
|
||||
/// <param name="data">Byte array containing the data to be added to the codec</param>
|
||||
/// <param name="offset">The index of the first byte to add from <c>data</c></param>
|
||||
/// <param name="count">The number of bytes to add</param>
|
||||
/// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>
|
||||
/// <remarks>This must be implemented by a derived class</remarks>
|
||||
public abstract void Add(byte[] data, int offset, int count);
|
||||
|
||||
/// <summary>
|
||||
/// Finishes up any pending data that needs to be processed and handled.
|
||||
/// </summary>
|
||||
/// <remarks>This must be implemented by a derived class</remarks>
|
||||
public abstract void Finish();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the checksum of the data that has been added so far
|
||||
/// </summary>
|
||||
public uint Checksum { get { return _checksum; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Destructor & IDisposable stuff
|
||||
|
||||
/// <summary>
|
||||
/// Destroys this instance
|
||||
/// </summary>
|
||||
~CodecBase()
|
||||
{
|
||||
CleanUp(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Releases any unmanaged resources and calls the <see cref="CleanUp()"/> method of the derived class
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
CleanUp(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs any codec specific cleanup
|
||||
/// </summary>
|
||||
/// <remarks>This must be implemented by a derived class</remarks>
|
||||
protected abstract void CleanUp();
|
||||
|
||||
// performs the release of the handles and calls the dereived CleanUp()
|
||||
private void CleanUp(bool isDisposing)
|
||||
{
|
||||
if (!_isDisposed)
|
||||
{
|
||||
CleanUp();
|
||||
if (_hInput.IsAllocated)
|
||||
_hInput.Free();
|
||||
if (_hOutput.IsAllocated)
|
||||
_hOutput.Free();
|
||||
|
||||
_isDisposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Helper methods
|
||||
|
||||
/// <summary>
|
||||
/// Copies a number of bytes to the internal codec buffer - ready for proccesing
|
||||
/// </summary>
|
||||
/// <param name="data">The byte array that contains the data to copy</param>
|
||||
/// <param name="startIndex">The index of the first byte to copy</param>
|
||||
/// <param name="count">The number of bytes to copy from <c>data</c></param>
|
||||
protected void copyInput(byte[] data, int startIndex, int count)
|
||||
{
|
||||
Array.Copy(data, startIndex, _inBuffer,0, count);
|
||||
_ztream.next_in = _hInput.AddrOfPinnedObject();
|
||||
_ztream.total_in = 0;
|
||||
_ztream.avail_in = (uint)count;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the internal output buffers to a known state - ready for processing
|
||||
/// </summary>
|
||||
protected void resetOutput()
|
||||
{
|
||||
_ztream.total_out = 0;
|
||||
_ztream.avail_out = kBufferSize;
|
||||
_ztream.next_out = _hOutput.AddrOfPinnedObject();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the running checksum property
|
||||
/// </summary>
|
||||
/// <param name="newSum">The new checksum value</param>
|
||||
protected void setChecksum(uint newSum)
|
||||
{
|
||||
_checksum = newSum;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,106 +1,106 @@
|
||||
//
|
||||
// © Copyright Henrik Ravn 2004
|
||||
//
|
||||
// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace DotZLib
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Implements a data compressor, using the deflate algorithm in the ZLib dll
|
||||
/// </summary>
|
||||
public sealed class Deflater : CodecBase
|
||||
{
|
||||
#region Dll imports
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Ansi)]
|
||||
private static extern int deflateInit_(ref ZStream sz, int level, string vs, int size);
|
||||
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern int deflate(ref ZStream sz, int flush);
|
||||
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern int deflateReset(ref ZStream sz);
|
||||
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern int deflateEnd(ref ZStream sz);
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Constructs an new instance of the <c>Deflater</c>
|
||||
/// </summary>
|
||||
/// <param name="level">The compression level to use for this <c>Deflater</c></param>
|
||||
public Deflater(CompressLevel level) : base()
|
||||
{
|
||||
int retval = deflateInit_(ref _ztream, (int)level, Info.Version, Marshal.SizeOf(_ztream));
|
||||
if (retval != 0)
|
||||
throw new ZLibException(retval, "Could not initialize deflater");
|
||||
|
||||
resetOutput();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds more data to the codec to be processed.
|
||||
/// </summary>
|
||||
/// <param name="data">Byte array containing the data to be added to the codec</param>
|
||||
/// <param name="offset">The index of the first byte to add from <c>data</c></param>
|
||||
/// <param name="count">The number of bytes to add</param>
|
||||
/// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>
|
||||
public override void Add(byte[] data, int offset, int count)
|
||||
{
|
||||
if (data == null) throw new ArgumentNullException();
|
||||
if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();
|
||||
if ((offset+count) > data.Length) throw new ArgumentException();
|
||||
|
||||
int total = count;
|
||||
int inputIndex = offset;
|
||||
int err = 0;
|
||||
|
||||
while (err >= 0 && inputIndex < total)
|
||||
{
|
||||
copyInput(data, inputIndex, Math.Min(total - inputIndex, kBufferSize));
|
||||
while (err >= 0 && _ztream.avail_in > 0)
|
||||
{
|
||||
err = deflate(ref _ztream, (int)FlushTypes.None);
|
||||
if (err == 0)
|
||||
while (_ztream.avail_out == 0)
|
||||
{
|
||||
OnDataAvailable();
|
||||
err = deflate(ref _ztream, (int)FlushTypes.None);
|
||||
}
|
||||
inputIndex += (int)_ztream.total_in;
|
||||
}
|
||||
}
|
||||
setChecksum( _ztream.adler );
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Finishes up any pending data that needs to be processed and handled.
|
||||
/// </summary>
|
||||
public override void Finish()
|
||||
{
|
||||
int err;
|
||||
do
|
||||
{
|
||||
err = deflate(ref _ztream, (int)FlushTypes.Finish);
|
||||
OnDataAvailable();
|
||||
}
|
||||
while (err == 0);
|
||||
setChecksum( _ztream.adler );
|
||||
deflateReset(ref _ztream);
|
||||
resetOutput();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Closes the internal zlib deflate stream
|
||||
/// </summary>
|
||||
protected override void CleanUp() { deflateEnd(ref _ztream); }
|
||||
|
||||
}
|
||||
}
|
||||
//
|
||||
// © Copyright Henrik Ravn 2004
|
||||
//
|
||||
// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace DotZLib
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Implements a data compressor, using the deflate algorithm in the ZLib dll
|
||||
/// </summary>
|
||||
public sealed class Deflater : CodecBase
|
||||
{
|
||||
#region Dll imports
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Ansi)]
|
||||
private static extern int deflateInit_(ref ZStream sz, int level, string vs, int size);
|
||||
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern int deflate(ref ZStream sz, int flush);
|
||||
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern int deflateReset(ref ZStream sz);
|
||||
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern int deflateEnd(ref ZStream sz);
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Constructs an new instance of the <c>Deflater</c>
|
||||
/// </summary>
|
||||
/// <param name="level">The compression level to use for this <c>Deflater</c></param>
|
||||
public Deflater(CompressLevel level) : base()
|
||||
{
|
||||
int retval = deflateInit_(ref _ztream, (int)level, Info.Version, Marshal.SizeOf(_ztream));
|
||||
if (retval != 0)
|
||||
throw new ZLibException(retval, "Could not initialize deflater");
|
||||
|
||||
resetOutput();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds more data to the codec to be processed.
|
||||
/// </summary>
|
||||
/// <param name="data">Byte array containing the data to be added to the codec</param>
|
||||
/// <param name="offset">The index of the first byte to add from <c>data</c></param>
|
||||
/// <param name="count">The number of bytes to add</param>
|
||||
/// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>
|
||||
public override void Add(byte[] data, int offset, int count)
|
||||
{
|
||||
if (data == null) throw new ArgumentNullException();
|
||||
if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();
|
||||
if ((offset+count) > data.Length) throw new ArgumentException();
|
||||
|
||||
int total = count;
|
||||
int inputIndex = offset;
|
||||
int err = 0;
|
||||
|
||||
while (err >= 0 && inputIndex < total)
|
||||
{
|
||||
copyInput(data, inputIndex, Math.Min(total - inputIndex, kBufferSize));
|
||||
while (err >= 0 && _ztream.avail_in > 0)
|
||||
{
|
||||
err = deflate(ref _ztream, (int)FlushTypes.None);
|
||||
if (err == 0)
|
||||
while (_ztream.avail_out == 0)
|
||||
{
|
||||
OnDataAvailable();
|
||||
err = deflate(ref _ztream, (int)FlushTypes.None);
|
||||
}
|
||||
inputIndex += (int)_ztream.total_in;
|
||||
}
|
||||
}
|
||||
setChecksum( _ztream.adler );
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Finishes up any pending data that needs to be processed and handled.
|
||||
/// </summary>
|
||||
public override void Finish()
|
||||
{
|
||||
int err;
|
||||
do
|
||||
{
|
||||
err = deflate(ref _ztream, (int)FlushTypes.Finish);
|
||||
OnDataAvailable();
|
||||
}
|
||||
while (err == 0);
|
||||
setChecksum( _ztream.adler );
|
||||
deflateReset(ref _ztream);
|
||||
resetOutput();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Closes the internal zlib deflate stream
|
||||
/// </summary>
|
||||
protected override void CleanUp() { deflateEnd(ref _ztream); }
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,288 +1,288 @@
|
||||
//
|
||||
// © Copyright Henrik Ravn 2004
|
||||
//
|
||||
// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace DotZLib
|
||||
{
|
||||
|
||||
#region Internal types
|
||||
|
||||
/// <summary>
|
||||
/// Defines constants for the various flush types used with zlib
|
||||
/// </summary>
|
||||
internal enum FlushTypes
|
||||
{
|
||||
None, Partial, Sync, Full, Finish, Block
|
||||
}
|
||||
|
||||
#region ZStream structure
|
||||
// internal mapping of the zlib zstream structure for marshalling
|
||||
[StructLayoutAttribute(LayoutKind.Sequential, Pack=4, Size=0, CharSet=CharSet.Ansi)]
|
||||
internal struct ZStream
|
||||
{
|
||||
public IntPtr next_in;
|
||||
public uint avail_in;
|
||||
public uint total_in;
|
||||
|
||||
public IntPtr next_out;
|
||||
public uint avail_out;
|
||||
public uint total_out;
|
||||
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
string msg;
|
||||
uint state;
|
||||
|
||||
uint zalloc;
|
||||
uint zfree;
|
||||
uint opaque;
|
||||
|
||||
int data_type;
|
||||
public uint adler;
|
||||
uint reserved;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public enums
|
||||
/// <summary>
|
||||
/// Defines constants for the available compression levels in zlib
|
||||
/// </summary>
|
||||
public enum CompressLevel : int
|
||||
{
|
||||
/// <summary>
|
||||
/// The default compression level with a reasonable compromise between compression and speed
|
||||
/// </summary>
|
||||
Default = -1,
|
||||
/// <summary>
|
||||
/// No compression at all. The data are passed straight through.
|
||||
/// </summary>
|
||||
None = 0,
|
||||
/// <summary>
|
||||
/// The maximum compression rate available.
|
||||
/// </summary>
|
||||
Best = 9,
|
||||
/// <summary>
|
||||
/// The fastest available compression level.
|
||||
/// </summary>
|
||||
Fastest = 1
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Exception classes
|
||||
/// <summary>
|
||||
/// The exception that is thrown when an error occurs on the zlib dll
|
||||
/// </summary>
|
||||
public class ZLibException : ApplicationException
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ZLibException"/> class with a specified
|
||||
/// error message and error code
|
||||
/// </summary>
|
||||
/// <param name="errorCode">The zlib error code that caused the exception</param>
|
||||
/// <param name="msg">A message that (hopefully) describes the error</param>
|
||||
public ZLibException(int errorCode, string msg) : base(String.Format("ZLib error {0} {1}", errorCode, msg))
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ZLibException"/> class with a specified
|
||||
/// error code
|
||||
/// </summary>
|
||||
/// <param name="errorCode">The zlib error code that caused the exception</param>
|
||||
public ZLibException(int errorCode) : base(String.Format("ZLib error {0}", errorCode))
|
||||
{
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Interfaces
|
||||
|
||||
/// <summary>
|
||||
/// Declares methods and properties that enables a running checksum to be calculated
|
||||
/// </summary>
|
||||
public interface ChecksumGenerator
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the current value of the checksum
|
||||
/// </summary>
|
||||
uint Value { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Clears the current checksum to 0
|
||||
/// </summary>
|
||||
void Reset();
|
||||
|
||||
/// <summary>
|
||||
/// Updates the current checksum with an array of bytes
|
||||
/// </summary>
|
||||
/// <param name="data">The data to update the checksum with</param>
|
||||
void Update(byte[] data);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the current checksum with part of an array of bytes
|
||||
/// </summary>
|
||||
/// <param name="data">The data to update the checksum with</param>
|
||||
/// <param name="offset">Where in <c>data</c> to start updating</param>
|
||||
/// <param name="count">The number of bytes from <c>data</c> to use</param>
|
||||
/// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception>
|
||||
/// <exception cref="ArgumentNullException"><c>data</c> is a null reference</exception>
|
||||
/// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception>
|
||||
void Update(byte[] data, int offset, int count);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the current checksum with the data from a string
|
||||
/// </summary>
|
||||
/// <param name="data">The string to update the checksum with</param>
|
||||
/// <remarks>The characters in the string are converted by the UTF-8 encoding</remarks>
|
||||
void Update(string data);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the current checksum with the data from a string, using a specific encoding
|
||||
/// </summary>
|
||||
/// <param name="data">The string to update the checksum with</param>
|
||||
/// <param name="encoding">The encoding to use</param>
|
||||
void Update(string data, Encoding encoding);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Represents the method that will be called from a codec when new data
|
||||
/// are available.
|
||||
/// </summary>
|
||||
/// <paramref name="data">The byte array containing the processed data</paramref>
|
||||
/// <paramref name="startIndex">The index of the first processed byte in <c>data</c></paramref>
|
||||
/// <paramref name="count">The number of processed bytes available</paramref>
|
||||
/// <remarks>On return from this method, the data may be overwritten, so grab it while you can.
|
||||
/// You cannot assume that startIndex will be zero.
|
||||
/// </remarks>
|
||||
public delegate void DataAvailableHandler(byte[] data, int startIndex, int count);
|
||||
|
||||
/// <summary>
|
||||
/// Declares methods and events for implementing compressors/decompressors
|
||||
/// </summary>
|
||||
public interface Codec
|
||||
{
|
||||
/// <summary>
|
||||
/// Occurs when more processed data are available.
|
||||
/// </summary>
|
||||
event DataAvailableHandler DataAvailable;
|
||||
|
||||
/// <summary>
|
||||
/// Adds more data to the codec to be processed.
|
||||
/// </summary>
|
||||
/// <param name="data">Byte array containing the data to be added to the codec</param>
|
||||
/// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>
|
||||
void Add(byte[] data);
|
||||
|
||||
/// <summary>
|
||||
/// Adds more data to the codec to be processed.
|
||||
/// </summary>
|
||||
/// <param name="data">Byte array containing the data to be added to the codec</param>
|
||||
/// <param name="offset">The index of the first byte to add from <c>data</c></param>
|
||||
/// <param name="count">The number of bytes to add</param>
|
||||
/// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>
|
||||
void Add(byte[] data, int offset, int count);
|
||||
|
||||
/// <summary>
|
||||
/// Finishes up any pending data that needs to be processed and handled.
|
||||
/// </summary>
|
||||
void Finish();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the checksum of the data that has been added so far
|
||||
/// </summary>
|
||||
uint Checksum { get; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Classes
|
||||
/// <summary>
|
||||
/// Encapsulates general information about the ZLib library
|
||||
/// </summary>
|
||||
public class Info
|
||||
{
|
||||
#region DLL imports
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern uint zlibCompileFlags();
|
||||
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern string zlibVersion();
|
||||
#endregion
|
||||
|
||||
#region Private stuff
|
||||
private uint _flags;
|
||||
|
||||
// helper function that unpacks a bitsize mask
|
||||
private static int bitSize(uint bits)
|
||||
{
|
||||
switch (bits)
|
||||
{
|
||||
case 0: return 16;
|
||||
case 1: return 32;
|
||||
case 2: return 64;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Constructs an instance of the <c>Info</c> class.
|
||||
/// </summary>
|
||||
public Info()
|
||||
{
|
||||
_flags = zlibCompileFlags();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// True if the library is compiled with debug info
|
||||
/// </summary>
|
||||
public bool HasDebugInfo { get { return 0 != (_flags & 0x100); } }
|
||||
|
||||
/// <summary>
|
||||
/// True if the library is compiled with assembly optimizations
|
||||
/// </summary>
|
||||
public bool UsesAssemblyCode { get { return 0 != (_flags & 0x200); } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the size of the unsigned int that was compiled into Zlib
|
||||
/// </summary>
|
||||
public int SizeOfUInt { get { return bitSize(_flags & 3); } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the size of the unsigned long that was compiled into Zlib
|
||||
/// </summary>
|
||||
public int SizeOfULong { get { return bitSize((_flags >> 2) & 3); } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the size of the pointers that were compiled into Zlib
|
||||
/// </summary>
|
||||
public int SizeOfPointer { get { return bitSize((_flags >> 4) & 3); } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the size of the z_off_t type that was compiled into Zlib
|
||||
/// </summary>
|
||||
public int SizeOfOffset { get { return bitSize((_flags >> 6) & 3); } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the version of ZLib as a string, e.g. "1.2.1"
|
||||
/// </summary>
|
||||
public static string Version { get { return zlibVersion(); } }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
//
|
||||
// © Copyright Henrik Ravn 2004
|
||||
//
|
||||
// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace DotZLib
|
||||
{
|
||||
|
||||
#region Internal types
|
||||
|
||||
/// <summary>
|
||||
/// Defines constants for the various flush types used with zlib
|
||||
/// </summary>
|
||||
internal enum FlushTypes
|
||||
{
|
||||
None, Partial, Sync, Full, Finish, Block
|
||||
}
|
||||
|
||||
#region ZStream structure
|
||||
// internal mapping of the zlib zstream structure for marshalling
|
||||
[StructLayoutAttribute(LayoutKind.Sequential, Pack=4, Size=0, CharSet=CharSet.Ansi)]
|
||||
internal struct ZStream
|
||||
{
|
||||
public IntPtr next_in;
|
||||
public uint avail_in;
|
||||
public uint total_in;
|
||||
|
||||
public IntPtr next_out;
|
||||
public uint avail_out;
|
||||
public uint total_out;
|
||||
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
string msg;
|
||||
uint state;
|
||||
|
||||
uint zalloc;
|
||||
uint zfree;
|
||||
uint opaque;
|
||||
|
||||
int data_type;
|
||||
public uint adler;
|
||||
uint reserved;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public enums
|
||||
/// <summary>
|
||||
/// Defines constants for the available compression levels in zlib
|
||||
/// </summary>
|
||||
public enum CompressLevel : int
|
||||
{
|
||||
/// <summary>
|
||||
/// The default compression level with a reasonable compromise between compression and speed
|
||||
/// </summary>
|
||||
Default = -1,
|
||||
/// <summary>
|
||||
/// No compression at all. The data are passed straight through.
|
||||
/// </summary>
|
||||
None = 0,
|
||||
/// <summary>
|
||||
/// The maximum compression rate available.
|
||||
/// </summary>
|
||||
Best = 9,
|
||||
/// <summary>
|
||||
/// The fastest available compression level.
|
||||
/// </summary>
|
||||
Fastest = 1
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Exception classes
|
||||
/// <summary>
|
||||
/// The exception that is thrown when an error occurs on the zlib dll
|
||||
/// </summary>
|
||||
public class ZLibException : ApplicationException
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ZLibException"/> class with a specified
|
||||
/// error message and error code
|
||||
/// </summary>
|
||||
/// <param name="errorCode">The zlib error code that caused the exception</param>
|
||||
/// <param name="msg">A message that (hopefully) describes the error</param>
|
||||
public ZLibException(int errorCode, string msg) : base(String.Format("ZLib error {0} {1}", errorCode, msg))
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ZLibException"/> class with a specified
|
||||
/// error code
|
||||
/// </summary>
|
||||
/// <param name="errorCode">The zlib error code that caused the exception</param>
|
||||
public ZLibException(int errorCode) : base(String.Format("ZLib error {0}", errorCode))
|
||||
{
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Interfaces
|
||||
|
||||
/// <summary>
|
||||
/// Declares methods and properties that enables a running checksum to be calculated
|
||||
/// </summary>
|
||||
public interface ChecksumGenerator
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the current value of the checksum
|
||||
/// </summary>
|
||||
uint Value { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Clears the current checksum to 0
|
||||
/// </summary>
|
||||
void Reset();
|
||||
|
||||
/// <summary>
|
||||
/// Updates the current checksum with an array of bytes
|
||||
/// </summary>
|
||||
/// <param name="data">The data to update the checksum with</param>
|
||||
void Update(byte[] data);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the current checksum with part of an array of bytes
|
||||
/// </summary>
|
||||
/// <param name="data">The data to update the checksum with</param>
|
||||
/// <param name="offset">Where in <c>data</c> to start updating</param>
|
||||
/// <param name="count">The number of bytes from <c>data</c> to use</param>
|
||||
/// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception>
|
||||
/// <exception cref="ArgumentNullException"><c>data</c> is a null reference</exception>
|
||||
/// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception>
|
||||
void Update(byte[] data, int offset, int count);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the current checksum with the data from a string
|
||||
/// </summary>
|
||||
/// <param name="data">The string to update the checksum with</param>
|
||||
/// <remarks>The characters in the string are converted by the UTF-8 encoding</remarks>
|
||||
void Update(string data);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the current checksum with the data from a string, using a specific encoding
|
||||
/// </summary>
|
||||
/// <param name="data">The string to update the checksum with</param>
|
||||
/// <param name="encoding">The encoding to use</param>
|
||||
void Update(string data, Encoding encoding);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Represents the method that will be called from a codec when new data
|
||||
/// are available.
|
||||
/// </summary>
|
||||
/// <paramref name="data">The byte array containing the processed data</paramref>
|
||||
/// <paramref name="startIndex">The index of the first processed byte in <c>data</c></paramref>
|
||||
/// <paramref name="count">The number of processed bytes available</paramref>
|
||||
/// <remarks>On return from this method, the data may be overwritten, so grab it while you can.
|
||||
/// You cannot assume that startIndex will be zero.
|
||||
/// </remarks>
|
||||
public delegate void DataAvailableHandler(byte[] data, int startIndex, int count);
|
||||
|
||||
/// <summary>
|
||||
/// Declares methods and events for implementing compressors/decompressors
|
||||
/// </summary>
|
||||
public interface Codec
|
||||
{
|
||||
/// <summary>
|
||||
/// Occurs when more processed data are available.
|
||||
/// </summary>
|
||||
event DataAvailableHandler DataAvailable;
|
||||
|
||||
/// <summary>
|
||||
/// Adds more data to the codec to be processed.
|
||||
/// </summary>
|
||||
/// <param name="data">Byte array containing the data to be added to the codec</param>
|
||||
/// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>
|
||||
void Add(byte[] data);
|
||||
|
||||
/// <summary>
|
||||
/// Adds more data to the codec to be processed.
|
||||
/// </summary>
|
||||
/// <param name="data">Byte array containing the data to be added to the codec</param>
|
||||
/// <param name="offset">The index of the first byte to add from <c>data</c></param>
|
||||
/// <param name="count">The number of bytes to add</param>
|
||||
/// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>
|
||||
void Add(byte[] data, int offset, int count);
|
||||
|
||||
/// <summary>
|
||||
/// Finishes up any pending data that needs to be processed and handled.
|
||||
/// </summary>
|
||||
void Finish();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the checksum of the data that has been added so far
|
||||
/// </summary>
|
||||
uint Checksum { get; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Classes
|
||||
/// <summary>
|
||||
/// Encapsulates general information about the ZLib library
|
||||
/// </summary>
|
||||
public class Info
|
||||
{
|
||||
#region DLL imports
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern uint zlibCompileFlags();
|
||||
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern string zlibVersion();
|
||||
#endregion
|
||||
|
||||
#region Private stuff
|
||||
private uint _flags;
|
||||
|
||||
// helper function that unpacks a bitsize mask
|
||||
private static int bitSize(uint bits)
|
||||
{
|
||||
switch (bits)
|
||||
{
|
||||
case 0: return 16;
|
||||
case 1: return 32;
|
||||
case 2: return 64;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Constructs an instance of the <c>Info</c> class.
|
||||
/// </summary>
|
||||
public Info()
|
||||
{
|
||||
_flags = zlibCompileFlags();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// True if the library is compiled with debug info
|
||||
/// </summary>
|
||||
public bool HasDebugInfo { get { return 0 != (_flags & 0x100); } }
|
||||
|
||||
/// <summary>
|
||||
/// True if the library is compiled with assembly optimizations
|
||||
/// </summary>
|
||||
public bool UsesAssemblyCode { get { return 0 != (_flags & 0x200); } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the size of the unsigned int that was compiled into Zlib
|
||||
/// </summary>
|
||||
public int SizeOfUInt { get { return bitSize(_flags & 3); } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the size of the unsigned long that was compiled into Zlib
|
||||
/// </summary>
|
||||
public int SizeOfULong { get { return bitSize((_flags >> 2) & 3); } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the size of the pointers that were compiled into Zlib
|
||||
/// </summary>
|
||||
public int SizeOfPointer { get { return bitSize((_flags >> 4) & 3); } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the size of the z_off_t type that was compiled into Zlib
|
||||
/// </summary>
|
||||
public int SizeOfOffset { get { return bitSize((_flags >> 6) & 3); } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the version of ZLib as a string, e.g. "1.2.1"
|
||||
/// </summary>
|
||||
public static string Version { get { return zlibVersion(); } }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
@ -1,141 +1,141 @@
|
||||
<VisualStudioProject>
|
||||
<CSHARP
|
||||
ProjectType = "Local"
|
||||
ProductVersion = "7.10.3077"
|
||||
SchemaVersion = "2.0"
|
||||
ProjectGuid = "{BB1EE0B1-1808-46CB-B786-949D91117FC5}"
|
||||
>
|
||||
<Build>
|
||||
<Settings
|
||||
ApplicationIcon = ""
|
||||
AssemblyKeyContainerName = ""
|
||||
AssemblyName = "DotZLib"
|
||||
AssemblyOriginatorKeyFile = ""
|
||||
DefaultClientScript = "JScript"
|
||||
DefaultHTMLPageLayout = "Grid"
|
||||
DefaultTargetSchema = "IE50"
|
||||
DelaySign = "false"
|
||||
OutputType = "Library"
|
||||
PreBuildEvent = ""
|
||||
PostBuildEvent = ""
|
||||
RootNamespace = "DotZLib"
|
||||
RunPostBuildEvent = "OnBuildSuccess"
|
||||
StartupObject = ""
|
||||
>
|
||||
<Config
|
||||
Name = "Debug"
|
||||
AllowUnsafeBlocks = "false"
|
||||
BaseAddress = "285212672"
|
||||
CheckForOverflowUnderflow = "false"
|
||||
ConfigurationOverrideFile = ""
|
||||
DefineConstants = "DEBUG;TRACE"
|
||||
DocumentationFile = "docs\DotZLib.xml"
|
||||
DebugSymbols = "true"
|
||||
FileAlignment = "4096"
|
||||
IncrementalBuild = "false"
|
||||
NoStdLib = "false"
|
||||
NoWarn = "1591"
|
||||
Optimize = "false"
|
||||
OutputPath = "bin\Debug\"
|
||||
RegisterForComInterop = "false"
|
||||
RemoveIntegerChecks = "false"
|
||||
TreatWarningsAsErrors = "false"
|
||||
WarningLevel = "4"
|
||||
/>
|
||||
<Config
|
||||
Name = "Release"
|
||||
AllowUnsafeBlocks = "false"
|
||||
BaseAddress = "285212672"
|
||||
CheckForOverflowUnderflow = "false"
|
||||
ConfigurationOverrideFile = ""
|
||||
DefineConstants = "TRACE"
|
||||
DocumentationFile = "docs\DotZLib.xml"
|
||||
DebugSymbols = "false"
|
||||
FileAlignment = "4096"
|
||||
IncrementalBuild = "false"
|
||||
NoStdLib = "false"
|
||||
NoWarn = ""
|
||||
Optimize = "true"
|
||||
OutputPath = "bin\Release\"
|
||||
RegisterForComInterop = "false"
|
||||
RemoveIntegerChecks = "false"
|
||||
TreatWarningsAsErrors = "false"
|
||||
WarningLevel = "4"
|
||||
/>
|
||||
</Settings>
|
||||
<References>
|
||||
<Reference
|
||||
Name = "System"
|
||||
AssemblyName = "System"
|
||||
HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Data"
|
||||
AssemblyName = "System.Data"
|
||||
HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.XML"
|
||||
AssemblyName = "System.Xml"
|
||||
HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "nunit.framework"
|
||||
AssemblyName = "nunit.framework"
|
||||
HintPath = "E:\apps\NUnit V2.1\\bin\nunit.framework.dll"
|
||||
AssemblyFolderKey = "hklm\dn\nunit.framework"
|
||||
/>
|
||||
</References>
|
||||
</Build>
|
||||
<Files>
|
||||
<Include>
|
||||
<File
|
||||
RelPath = "AssemblyInfo.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "ChecksumImpl.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "CircularBuffer.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "CodecBase.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Deflater.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "DotZLib.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "GZipStream.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Inflater.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "UnitTests.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
</Include>
|
||||
</Files>
|
||||
</CSHARP>
|
||||
</VisualStudioProject>
|
||||
|
||||
<VisualStudioProject>
|
||||
<CSHARP
|
||||
ProjectType = "Local"
|
||||
ProductVersion = "7.10.3077"
|
||||
SchemaVersion = "2.0"
|
||||
ProjectGuid = "{BB1EE0B1-1808-46CB-B786-949D91117FC5}"
|
||||
>
|
||||
<Build>
|
||||
<Settings
|
||||
ApplicationIcon = ""
|
||||
AssemblyKeyContainerName = ""
|
||||
AssemblyName = "DotZLib"
|
||||
AssemblyOriginatorKeyFile = ""
|
||||
DefaultClientScript = "JScript"
|
||||
DefaultHTMLPageLayout = "Grid"
|
||||
DefaultTargetSchema = "IE50"
|
||||
DelaySign = "false"
|
||||
OutputType = "Library"
|
||||
PreBuildEvent = ""
|
||||
PostBuildEvent = ""
|
||||
RootNamespace = "DotZLib"
|
||||
RunPostBuildEvent = "OnBuildSuccess"
|
||||
StartupObject = ""
|
||||
>
|
||||
<Config
|
||||
Name = "Debug"
|
||||
AllowUnsafeBlocks = "false"
|
||||
BaseAddress = "285212672"
|
||||
CheckForOverflowUnderflow = "false"
|
||||
ConfigurationOverrideFile = ""
|
||||
DefineConstants = "DEBUG;TRACE"
|
||||
DocumentationFile = "docs\DotZLib.xml"
|
||||
DebugSymbols = "true"
|
||||
FileAlignment = "4096"
|
||||
IncrementalBuild = "false"
|
||||
NoStdLib = "false"
|
||||
NoWarn = "1591"
|
||||
Optimize = "false"
|
||||
OutputPath = "bin\Debug\"
|
||||
RegisterForComInterop = "false"
|
||||
RemoveIntegerChecks = "false"
|
||||
TreatWarningsAsErrors = "false"
|
||||
WarningLevel = "4"
|
||||
/>
|
||||
<Config
|
||||
Name = "Release"
|
||||
AllowUnsafeBlocks = "false"
|
||||
BaseAddress = "285212672"
|
||||
CheckForOverflowUnderflow = "false"
|
||||
ConfigurationOverrideFile = ""
|
||||
DefineConstants = "TRACE"
|
||||
DocumentationFile = "docs\DotZLib.xml"
|
||||
DebugSymbols = "false"
|
||||
FileAlignment = "4096"
|
||||
IncrementalBuild = "false"
|
||||
NoStdLib = "false"
|
||||
NoWarn = ""
|
||||
Optimize = "true"
|
||||
OutputPath = "bin\Release\"
|
||||
RegisterForComInterop = "false"
|
||||
RemoveIntegerChecks = "false"
|
||||
TreatWarningsAsErrors = "false"
|
||||
WarningLevel = "4"
|
||||
/>
|
||||
</Settings>
|
||||
<References>
|
||||
<Reference
|
||||
Name = "System"
|
||||
AssemblyName = "System"
|
||||
HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Data"
|
||||
AssemblyName = "System.Data"
|
||||
HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.XML"
|
||||
AssemblyName = "System.Xml"
|
||||
HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "nunit.framework"
|
||||
AssemblyName = "nunit.framework"
|
||||
HintPath = "E:\apps\NUnit V2.1\\bin\nunit.framework.dll"
|
||||
AssemblyFolderKey = "hklm\dn\nunit.framework"
|
||||
/>
|
||||
</References>
|
||||
</Build>
|
||||
<Files>
|
||||
<Include>
|
||||
<File
|
||||
RelPath = "AssemblyInfo.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "ChecksumImpl.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "CircularBuffer.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "CodecBase.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Deflater.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "DotZLib.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "GZipStream.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Inflater.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "UnitTests.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
</Include>
|
||||
</Files>
|
||||
</CSHARP>
|
||||
</VisualStudioProject>
|
||||
|
||||
@ -1,301 +1,301 @@
|
||||
//
|
||||
// © Copyright Henrik Ravn 2004
|
||||
//
|
||||
// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace DotZLib
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements a compressed <see cref="Stream"/>, in GZip (.gz) format.
|
||||
/// </summary>
|
||||
public class GZipStream : Stream, IDisposable
|
||||
{
|
||||
#region Dll Imports
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Ansi)]
|
||||
private static extern IntPtr gzopen(string name, string mode);
|
||||
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern int gzclose(IntPtr gzFile);
|
||||
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern int gzwrite(IntPtr gzFile, int data, int length);
|
||||
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern int gzread(IntPtr gzFile, int data, int length);
|
||||
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern int gzgetc(IntPtr gzFile);
|
||||
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern int gzputc(IntPtr gzFile, int c);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private data
|
||||
private IntPtr _gzFile;
|
||||
private bool _isDisposed = false;
|
||||
private bool _isWriting;
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
/// <summary>
|
||||
/// Creates a new file as a writeable GZipStream
|
||||
/// </summary>
|
||||
/// <param name="fileName">The name of the compressed file to create</param>
|
||||
/// <param name="level">The compression level to use when adding data</param>
|
||||
/// <exception cref="ZLibException">If an error occurred in the internal zlib function</exception>
|
||||
public GZipStream(string fileName, CompressLevel level)
|
||||
{
|
||||
_isWriting = true;
|
||||
_gzFile = gzopen(fileName, String.Format("wb{0}", (int)level));
|
||||
if (_gzFile == IntPtr.Zero)
|
||||
throw new ZLibException(-1, "Could not open " + fileName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens an existing file as a readable GZipStream
|
||||
/// </summary>
|
||||
/// <param name="fileName">The name of the file to open</param>
|
||||
/// <exception cref="ZLibException">If an error occurred in the internal zlib function</exception>
|
||||
public GZipStream(string fileName)
|
||||
{
|
||||
_isWriting = false;
|
||||
_gzFile = gzopen(fileName, "rb");
|
||||
if (_gzFile == IntPtr.Zero)
|
||||
throw new ZLibException(-1, "Could not open " + fileName);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Access properties
|
||||
/// <summary>
|
||||
/// Returns true of this stream can be read from, false otherwise
|
||||
/// </summary>
|
||||
public override bool CanRead
|
||||
{
|
||||
get
|
||||
{
|
||||
return !_isWriting;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns false.
|
||||
/// </summary>
|
||||
public override bool CanSeek
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this tsream is writeable, false otherwise
|
||||
/// </summary>
|
||||
public override bool CanWrite
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isWriting;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Destructor & IDispose stuff
|
||||
|
||||
/// <summary>
|
||||
/// Destroys this instance
|
||||
/// </summary>
|
||||
~GZipStream()
|
||||
{
|
||||
cleanUp(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Closes the external file handle
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
cleanUp(true);
|
||||
}
|
||||
|
||||
// Does the actual closing of the file handle.
|
||||
private void cleanUp(bool isDisposing)
|
||||
{
|
||||
if (!_isDisposed)
|
||||
{
|
||||
gzclose(_gzFile);
|
||||
_isDisposed = true;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Basic reading and writing
|
||||
/// <summary>
|
||||
/// Attempts to read a number of bytes from the stream.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The destination data buffer</param>
|
||||
/// <param name="offset">The index of the first destination byte in <c>buffer</c></param>
|
||||
/// <param name="count">The number of bytes requested</param>
|
||||
/// <returns>The number of bytes read</returns>
|
||||
/// <exception cref="ArgumentNullException">If <c>buffer</c> is null</exception>
|
||||
/// <exception cref="ArgumentOutOfRangeException">If <c>count</c> or <c>offset</c> are negative</exception>
|
||||
/// <exception cref="ArgumentException">If <c>offset</c> + <c>count</c> is > buffer.Length</exception>
|
||||
/// <exception cref="NotSupportedException">If this stream is not readable.</exception>
|
||||
/// <exception cref="ObjectDisposedException">If this stream has been disposed.</exception>
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (!CanRead) throw new NotSupportedException();
|
||||
if (buffer == null) throw new ArgumentNullException();
|
||||
if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();
|
||||
if ((offset+count) > buffer.Length) throw new ArgumentException();
|
||||
if (_isDisposed) throw new ObjectDisposedException("GZipStream");
|
||||
|
||||
GCHandle h = GCHandle.Alloc(buffer, GCHandleType.Pinned);
|
||||
int result;
|
||||
try
|
||||
{
|
||||
result = gzread(_gzFile, h.AddrOfPinnedObject().ToInt32() + offset, count);
|
||||
if (result < 0)
|
||||
throw new IOException();
|
||||
}
|
||||
finally
|
||||
{
|
||||
h.Free();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to read a single byte from the stream.
|
||||
/// </summary>
|
||||
/// <returns>The byte that was read, or -1 in case of error or End-Of-File</returns>
|
||||
public override int ReadByte()
|
||||
{
|
||||
if (!CanRead) throw new NotSupportedException();
|
||||
if (_isDisposed) throw new ObjectDisposedException("GZipStream");
|
||||
return gzgetc(_gzFile);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes a number of bytes to the stream
|
||||
/// </summary>
|
||||
/// <param name="buffer"></param>
|
||||
/// <param name="offset"></param>
|
||||
/// <param name="count"></param>
|
||||
/// <exception cref="ArgumentNullException">If <c>buffer</c> is null</exception>
|
||||
/// <exception cref="ArgumentOutOfRangeException">If <c>count</c> or <c>offset</c> are negative</exception>
|
||||
/// <exception cref="ArgumentException">If <c>offset</c> + <c>count</c> is > buffer.Length</exception>
|
||||
/// <exception cref="NotSupportedException">If this stream is not writeable.</exception>
|
||||
/// <exception cref="ObjectDisposedException">If this stream has been disposed.</exception>
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (!CanWrite) throw new NotSupportedException();
|
||||
if (buffer == null) throw new ArgumentNullException();
|
||||
if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();
|
||||
if ((offset+count) > buffer.Length) throw new ArgumentException();
|
||||
if (_isDisposed) throw new ObjectDisposedException("GZipStream");
|
||||
|
||||
GCHandle h = GCHandle.Alloc(buffer, GCHandleType.Pinned);
|
||||
try
|
||||
{
|
||||
int result = gzwrite(_gzFile, h.AddrOfPinnedObject().ToInt32() + offset, count);
|
||||
if (result < 0)
|
||||
throw new IOException();
|
||||
}
|
||||
finally
|
||||
{
|
||||
h.Free();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes a single byte to the stream
|
||||
/// </summary>
|
||||
/// <param name="value">The byte to add to the stream.</param>
|
||||
/// <exception cref="NotSupportedException">If this stream is not writeable.</exception>
|
||||
/// <exception cref="ObjectDisposedException">If this stream has been disposed.</exception>
|
||||
public override void WriteByte(byte value)
|
||||
{
|
||||
if (!CanWrite) throw new NotSupportedException();
|
||||
if (_isDisposed) throw new ObjectDisposedException("GZipStream");
|
||||
|
||||
int result = gzputc(_gzFile, (int)value);
|
||||
if (result < 0)
|
||||
throw new IOException();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Position & length stuff
|
||||
/// <summary>
|
||||
/// Not supported.
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <exception cref="NotSupportedException">Always thrown</exception>
|
||||
public override void SetLength(long value)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not suppported.
|
||||
/// </summary>
|
||||
/// <param name="offset"></param>
|
||||
/// <param name="origin"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotSupportedException">Always thrown</exception>
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Flushes the <c>GZipStream</c>.
|
||||
/// </summary>
|
||||
/// <remarks>In this implementation, this method does nothing. This is because excessive
|
||||
/// flushing may degrade the achievable compression rates.</remarks>
|
||||
public override void Flush()
|
||||
{
|
||||
// left empty on purpose
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets/sets the current position in the <c>GZipStream</c>. Not suppported.
|
||||
/// </summary>
|
||||
/// <remarks>In this implementation this property is not supported</remarks>
|
||||
/// <exception cref="NotSupportedException">Always thrown</exception>
|
||||
public override long Position
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
set
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the size of the stream. Not suppported.
|
||||
/// </summary>
|
||||
/// <remarks>In this implementation this property is not supported</remarks>
|
||||
/// <exception cref="NotSupportedException">Always thrown</exception>
|
||||
public override long Length
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
//
|
||||
// © Copyright Henrik Ravn 2004
|
||||
//
|
||||
// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace DotZLib
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements a compressed <see cref="Stream"/>, in GZip (.gz) format.
|
||||
/// </summary>
|
||||
public class GZipStream : Stream, IDisposable
|
||||
{
|
||||
#region Dll Imports
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Ansi)]
|
||||
private static extern IntPtr gzopen(string name, string mode);
|
||||
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern int gzclose(IntPtr gzFile);
|
||||
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern int gzwrite(IntPtr gzFile, int data, int length);
|
||||
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern int gzread(IntPtr gzFile, int data, int length);
|
||||
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern int gzgetc(IntPtr gzFile);
|
||||
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern int gzputc(IntPtr gzFile, int c);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private data
|
||||
private IntPtr _gzFile;
|
||||
private bool _isDisposed = false;
|
||||
private bool _isWriting;
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
/// <summary>
|
||||
/// Creates a new file as a writeable GZipStream
|
||||
/// </summary>
|
||||
/// <param name="fileName">The name of the compressed file to create</param>
|
||||
/// <param name="level">The compression level to use when adding data</param>
|
||||
/// <exception cref="ZLibException">If an error occurred in the internal zlib function</exception>
|
||||
public GZipStream(string fileName, CompressLevel level)
|
||||
{
|
||||
_isWriting = true;
|
||||
_gzFile = gzopen(fileName, String.Format("wb{0}", (int)level));
|
||||
if (_gzFile == IntPtr.Zero)
|
||||
throw new ZLibException(-1, "Could not open " + fileName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens an existing file as a readable GZipStream
|
||||
/// </summary>
|
||||
/// <param name="fileName">The name of the file to open</param>
|
||||
/// <exception cref="ZLibException">If an error occurred in the internal zlib function</exception>
|
||||
public GZipStream(string fileName)
|
||||
{
|
||||
_isWriting = false;
|
||||
_gzFile = gzopen(fileName, "rb");
|
||||
if (_gzFile == IntPtr.Zero)
|
||||
throw new ZLibException(-1, "Could not open " + fileName);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Access properties
|
||||
/// <summary>
|
||||
/// Returns true of this stream can be read from, false otherwise
|
||||
/// </summary>
|
||||
public override bool CanRead
|
||||
{
|
||||
get
|
||||
{
|
||||
return !_isWriting;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns false.
|
||||
/// </summary>
|
||||
public override bool CanSeek
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this tsream is writeable, false otherwise
|
||||
/// </summary>
|
||||
public override bool CanWrite
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isWriting;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Destructor & IDispose stuff
|
||||
|
||||
/// <summary>
|
||||
/// Destroys this instance
|
||||
/// </summary>
|
||||
~GZipStream()
|
||||
{
|
||||
cleanUp(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Closes the external file handle
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
cleanUp(true);
|
||||
}
|
||||
|
||||
// Does the actual closing of the file handle.
|
||||
private void cleanUp(bool isDisposing)
|
||||
{
|
||||
if (!_isDisposed)
|
||||
{
|
||||
gzclose(_gzFile);
|
||||
_isDisposed = true;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Basic reading and writing
|
||||
/// <summary>
|
||||
/// Attempts to read a number of bytes from the stream.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The destination data buffer</param>
|
||||
/// <param name="offset">The index of the first destination byte in <c>buffer</c></param>
|
||||
/// <param name="count">The number of bytes requested</param>
|
||||
/// <returns>The number of bytes read</returns>
|
||||
/// <exception cref="ArgumentNullException">If <c>buffer</c> is null</exception>
|
||||
/// <exception cref="ArgumentOutOfRangeException">If <c>count</c> or <c>offset</c> are negative</exception>
|
||||
/// <exception cref="ArgumentException">If <c>offset</c> + <c>count</c> is > buffer.Length</exception>
|
||||
/// <exception cref="NotSupportedException">If this stream is not readable.</exception>
|
||||
/// <exception cref="ObjectDisposedException">If this stream has been disposed.</exception>
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (!CanRead) throw new NotSupportedException();
|
||||
if (buffer == null) throw new ArgumentNullException();
|
||||
if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();
|
||||
if ((offset+count) > buffer.Length) throw new ArgumentException();
|
||||
if (_isDisposed) throw new ObjectDisposedException("GZipStream");
|
||||
|
||||
GCHandle h = GCHandle.Alloc(buffer, GCHandleType.Pinned);
|
||||
int result;
|
||||
try
|
||||
{
|
||||
result = gzread(_gzFile, h.AddrOfPinnedObject().ToInt32() + offset, count);
|
||||
if (result < 0)
|
||||
throw new IOException();
|
||||
}
|
||||
finally
|
||||
{
|
||||
h.Free();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to read a single byte from the stream.
|
||||
/// </summary>
|
||||
/// <returns>The byte that was read, or -1 in case of error or End-Of-File</returns>
|
||||
public override int ReadByte()
|
||||
{
|
||||
if (!CanRead) throw new NotSupportedException();
|
||||
if (_isDisposed) throw new ObjectDisposedException("GZipStream");
|
||||
return gzgetc(_gzFile);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes a number of bytes to the stream
|
||||
/// </summary>
|
||||
/// <param name="buffer"></param>
|
||||
/// <param name="offset"></param>
|
||||
/// <param name="count"></param>
|
||||
/// <exception cref="ArgumentNullException">If <c>buffer</c> is null</exception>
|
||||
/// <exception cref="ArgumentOutOfRangeException">If <c>count</c> or <c>offset</c> are negative</exception>
|
||||
/// <exception cref="ArgumentException">If <c>offset</c> + <c>count</c> is > buffer.Length</exception>
|
||||
/// <exception cref="NotSupportedException">If this stream is not writeable.</exception>
|
||||
/// <exception cref="ObjectDisposedException">If this stream has been disposed.</exception>
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (!CanWrite) throw new NotSupportedException();
|
||||
if (buffer == null) throw new ArgumentNullException();
|
||||
if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();
|
||||
if ((offset+count) > buffer.Length) throw new ArgumentException();
|
||||
if (_isDisposed) throw new ObjectDisposedException("GZipStream");
|
||||
|
||||
GCHandle h = GCHandle.Alloc(buffer, GCHandleType.Pinned);
|
||||
try
|
||||
{
|
||||
int result = gzwrite(_gzFile, h.AddrOfPinnedObject().ToInt32() + offset, count);
|
||||
if (result < 0)
|
||||
throw new IOException();
|
||||
}
|
||||
finally
|
||||
{
|
||||
h.Free();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes a single byte to the stream
|
||||
/// </summary>
|
||||
/// <param name="value">The byte to add to the stream.</param>
|
||||
/// <exception cref="NotSupportedException">If this stream is not writeable.</exception>
|
||||
/// <exception cref="ObjectDisposedException">If this stream has been disposed.</exception>
|
||||
public override void WriteByte(byte value)
|
||||
{
|
||||
if (!CanWrite) throw new NotSupportedException();
|
||||
if (_isDisposed) throw new ObjectDisposedException("GZipStream");
|
||||
|
||||
int result = gzputc(_gzFile, (int)value);
|
||||
if (result < 0)
|
||||
throw new IOException();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Position & length stuff
|
||||
/// <summary>
|
||||
/// Not supported.
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <exception cref="NotSupportedException">Always thrown</exception>
|
||||
public override void SetLength(long value)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not suppported.
|
||||
/// </summary>
|
||||
/// <param name="offset"></param>
|
||||
/// <param name="origin"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotSupportedException">Always thrown</exception>
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Flushes the <c>GZipStream</c>.
|
||||
/// </summary>
|
||||
/// <remarks>In this implementation, this method does nothing. This is because excessive
|
||||
/// flushing may degrade the achievable compression rates.</remarks>
|
||||
public override void Flush()
|
||||
{
|
||||
// left empty on purpose
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets/sets the current position in the <c>GZipStream</c>. Not suppported.
|
||||
/// </summary>
|
||||
/// <remarks>In this implementation this property is not supported</remarks>
|
||||
/// <exception cref="NotSupportedException">Always thrown</exception>
|
||||
public override long Position
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
set
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the size of the stream. Not suppported.
|
||||
/// </summary>
|
||||
/// <remarks>In this implementation this property is not supported</remarks>
|
||||
/// <exception cref="NotSupportedException">Always thrown</exception>
|
||||
public override long Length
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -1,105 +1,105 @@
|
||||
//
|
||||
// © Copyright Henrik Ravn 2004
|
||||
//
|
||||
// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace DotZLib
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Implements a data decompressor, using the inflate algorithm in the ZLib dll
|
||||
/// </summary>
|
||||
public class Inflater : CodecBase
|
||||
{
|
||||
#region Dll imports
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Ansi)]
|
||||
private static extern int inflateInit_(ref ZStream sz, string vs, int size);
|
||||
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern int inflate(ref ZStream sz, int flush);
|
||||
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern int inflateReset(ref ZStream sz);
|
||||
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern int inflateEnd(ref ZStream sz);
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Constructs an new instance of the <c>Inflater</c>
|
||||
/// </summary>
|
||||
public Inflater() : base()
|
||||
{
|
||||
int retval = inflateInit_(ref _ztream, Info.Version, Marshal.SizeOf(_ztream));
|
||||
if (retval != 0)
|
||||
throw new ZLibException(retval, "Could not initialize inflater");
|
||||
|
||||
resetOutput();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Adds more data to the codec to be processed.
|
||||
/// </summary>
|
||||
/// <param name="data">Byte array containing the data to be added to the codec</param>
|
||||
/// <param name="offset">The index of the first byte to add from <c>data</c></param>
|
||||
/// <param name="count">The number of bytes to add</param>
|
||||
/// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>
|
||||
public override void Add(byte[] data, int offset, int count)
|
||||
{
|
||||
if (data == null) throw new ArgumentNullException();
|
||||
if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();
|
||||
if ((offset+count) > data.Length) throw new ArgumentException();
|
||||
|
||||
int total = count;
|
||||
int inputIndex = offset;
|
||||
int err = 0;
|
||||
|
||||
while (err >= 0 && inputIndex < total)
|
||||
{
|
||||
copyInput(data, inputIndex, Math.Min(total - inputIndex, kBufferSize));
|
||||
err = inflate(ref _ztream, (int)FlushTypes.None);
|
||||
if (err == 0)
|
||||
while (_ztream.avail_out == 0)
|
||||
{
|
||||
OnDataAvailable();
|
||||
err = inflate(ref _ztream, (int)FlushTypes.None);
|
||||
}
|
||||
|
||||
inputIndex += (int)_ztream.total_in;
|
||||
}
|
||||
setChecksum( _ztream.adler );
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Finishes up any pending data that needs to be processed and handled.
|
||||
/// </summary>
|
||||
public override void Finish()
|
||||
{
|
||||
int err;
|
||||
do
|
||||
{
|
||||
err = inflate(ref _ztream, (int)FlushTypes.Finish);
|
||||
OnDataAvailable();
|
||||
}
|
||||
while (err == 0);
|
||||
setChecksum( _ztream.adler );
|
||||
inflateReset(ref _ztream);
|
||||
resetOutput();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Closes the internal zlib inflate stream
|
||||
/// </summary>
|
||||
protected override void CleanUp() { inflateEnd(ref _ztream); }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
//
|
||||
// © Copyright Henrik Ravn 2004
|
||||
//
|
||||
// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace DotZLib
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Implements a data decompressor, using the inflate algorithm in the ZLib dll
|
||||
/// </summary>
|
||||
public class Inflater : CodecBase
|
||||
{
|
||||
#region Dll imports
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Ansi)]
|
||||
private static extern int inflateInit_(ref ZStream sz, string vs, int size);
|
||||
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern int inflate(ref ZStream sz, int flush);
|
||||
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern int inflateReset(ref ZStream sz);
|
||||
|
||||
[DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
|
||||
private static extern int inflateEnd(ref ZStream sz);
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Constructs an new instance of the <c>Inflater</c>
|
||||
/// </summary>
|
||||
public Inflater() : base()
|
||||
{
|
||||
int retval = inflateInit_(ref _ztream, Info.Version, Marshal.SizeOf(_ztream));
|
||||
if (retval != 0)
|
||||
throw new ZLibException(retval, "Could not initialize inflater");
|
||||
|
||||
resetOutput();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Adds more data to the codec to be processed.
|
||||
/// </summary>
|
||||
/// <param name="data">Byte array containing the data to be added to the codec</param>
|
||||
/// <param name="offset">The index of the first byte to add from <c>data</c></param>
|
||||
/// <param name="count">The number of bytes to add</param>
|
||||
/// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>
|
||||
public override void Add(byte[] data, int offset, int count)
|
||||
{
|
||||
if (data == null) throw new ArgumentNullException();
|
||||
if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();
|
||||
if ((offset+count) > data.Length) throw new ArgumentException();
|
||||
|
||||
int total = count;
|
||||
int inputIndex = offset;
|
||||
int err = 0;
|
||||
|
||||
while (err >= 0 && inputIndex < total)
|
||||
{
|
||||
copyInput(data, inputIndex, Math.Min(total - inputIndex, kBufferSize));
|
||||
err = inflate(ref _ztream, (int)FlushTypes.None);
|
||||
if (err == 0)
|
||||
while (_ztream.avail_out == 0)
|
||||
{
|
||||
OnDataAvailable();
|
||||
err = inflate(ref _ztream, (int)FlushTypes.None);
|
||||
}
|
||||
|
||||
inputIndex += (int)_ztream.total_in;
|
||||
}
|
||||
setChecksum( _ztream.adler );
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Finishes up any pending data that needs to be processed and handled.
|
||||
/// </summary>
|
||||
public override void Finish()
|
||||
{
|
||||
int err;
|
||||
do
|
||||
{
|
||||
err = inflate(ref _ztream, (int)FlushTypes.Finish);
|
||||
OnDataAvailable();
|
||||
}
|
||||
while (err == 0);
|
||||
setChecksum( _ztream.adler );
|
||||
inflateReset(ref _ztream);
|
||||
resetOutput();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Closes the internal zlib inflate stream
|
||||
/// </summary>
|
||||
protected override void CleanUp() { inflateEnd(ref _ztream); }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,274 +1,274 @@
|
||||
//
|
||||
// © Copyright Henrik Ravn 2004
|
||||
//
|
||||
// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
|
||||
// uncomment the define below to include unit tests
|
||||
//#define nunit
|
||||
#if nunit
|
||||
using NUnit.Framework;
|
||||
|
||||
// Unit tests for the DotZLib class library
|
||||
// ----------------------------------------
|
||||
//
|
||||
// Use this with NUnit 2 from http://www.nunit.org
|
||||
//
|
||||
|
||||
namespace DotZLibTests
|
||||
{
|
||||
using DotZLib;
|
||||
|
||||
// helper methods
|
||||
internal class Utils
|
||||
{
|
||||
public static bool byteArrEqual( byte[] lhs, byte[] rhs )
|
||||
{
|
||||
if (lhs.Length != rhs.Length)
|
||||
return false;
|
||||
for (int i = lhs.Length-1; i >= 0; --i)
|
||||
if (lhs[i] != rhs[i])
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
[TestFixture]
|
||||
public class CircBufferTests
|
||||
{
|
||||
#region Circular buffer tests
|
||||
[Test]
|
||||
public void SinglePutGet()
|
||||
{
|
||||
CircularBuffer buf = new CircularBuffer(10);
|
||||
Assert.AreEqual( 0, buf.Size );
|
||||
Assert.AreEqual( -1, buf.Get() );
|
||||
|
||||
Assert.IsTrue(buf.Put( 1 ));
|
||||
Assert.AreEqual( 1, buf.Size );
|
||||
Assert.AreEqual( 1, buf.Get() );
|
||||
Assert.AreEqual( 0, buf.Size );
|
||||
Assert.AreEqual( -1, buf.Get() );
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void BlockPutGet()
|
||||
{
|
||||
CircularBuffer buf = new CircularBuffer(10);
|
||||
byte[] arr = {1,2,3,4,5,6,7,8,9,10};
|
||||
Assert.AreEqual( 10, buf.Put(arr,0,10) );
|
||||
Assert.AreEqual( 10, buf.Size );
|
||||
Assert.IsFalse( buf.Put(11) );
|
||||
Assert.AreEqual( 1, buf.Get() );
|
||||
Assert.IsTrue( buf.Put(11) );
|
||||
|
||||
byte[] arr2 = (byte[])arr.Clone();
|
||||
Assert.AreEqual( 9, buf.Get(arr2,1,9) );
|
||||
Assert.IsTrue( Utils.byteArrEqual(arr,arr2) );
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
[TestFixture]
|
||||
public class ChecksumTests
|
||||
{
|
||||
#region CRC32 Tests
|
||||
[Test]
|
||||
public void CRC32_Null()
|
||||
{
|
||||
CRC32Checksum crc32 = new CRC32Checksum();
|
||||
Assert.AreEqual( 0, crc32.Value );
|
||||
|
||||
crc32 = new CRC32Checksum(1);
|
||||
Assert.AreEqual( 1, crc32.Value );
|
||||
|
||||
crc32 = new CRC32Checksum(556);
|
||||
Assert.AreEqual( 556, crc32.Value );
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CRC32_Data()
|
||||
{
|
||||
CRC32Checksum crc32 = new CRC32Checksum();
|
||||
byte[] data = { 1,2,3,4,5,6,7 };
|
||||
crc32.Update(data);
|
||||
Assert.AreEqual( 0x70e46888, crc32.Value );
|
||||
|
||||
crc32 = new CRC32Checksum();
|
||||
crc32.Update("penguin");
|
||||
Assert.AreEqual( 0x0e5c1a120, crc32.Value );
|
||||
|
||||
crc32 = new CRC32Checksum(1);
|
||||
crc32.Update("penguin");
|
||||
Assert.AreEqual(0x43b6aa94, crc32.Value);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Adler tests
|
||||
|
||||
[Test]
|
||||
public void Adler_Null()
|
||||
{
|
||||
AdlerChecksum adler = new AdlerChecksum();
|
||||
Assert.AreEqual(0, adler.Value);
|
||||
|
||||
adler = new AdlerChecksum(1);
|
||||
Assert.AreEqual( 1, adler.Value );
|
||||
|
||||
adler = new AdlerChecksum(556);
|
||||
Assert.AreEqual( 556, adler.Value );
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Adler_Data()
|
||||
{
|
||||
AdlerChecksum adler = new AdlerChecksum(1);
|
||||
byte[] data = { 1,2,3,4,5,6,7 };
|
||||
adler.Update(data);
|
||||
Assert.AreEqual( 0x5b001d, adler.Value );
|
||||
|
||||
adler = new AdlerChecksum();
|
||||
adler.Update("penguin");
|
||||
Assert.AreEqual(0x0bcf02f6, adler.Value );
|
||||
|
||||
adler = new AdlerChecksum(1);
|
||||
adler.Update("penguin");
|
||||
Assert.AreEqual(0x0bd602f7, adler.Value);
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
[TestFixture]
|
||||
public class InfoTests
|
||||
{
|
||||
#region Info tests
|
||||
[Test]
|
||||
public void Info_Version()
|
||||
{
|
||||
Info info = new Info();
|
||||
Assert.AreEqual("1.2.3", Info.Version);
|
||||
Assert.AreEqual(32, info.SizeOfUInt);
|
||||
Assert.AreEqual(32, info.SizeOfULong);
|
||||
Assert.AreEqual(32, info.SizeOfPointer);
|
||||
Assert.AreEqual(32, info.SizeOfOffset);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
[TestFixture]
|
||||
public class DeflateInflateTests
|
||||
{
|
||||
#region Deflate tests
|
||||
[Test]
|
||||
public void Deflate_Init()
|
||||
{
|
||||
using (Deflater def = new Deflater(CompressLevel.Default))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList compressedData = new ArrayList();
|
||||
private uint adler1;
|
||||
|
||||
private ArrayList uncompressedData = new ArrayList();
|
||||
private uint adler2;
|
||||
|
||||
public void CDataAvail(byte[] data, int startIndex, int count)
|
||||
{
|
||||
for (int i = 0; i < count; ++i)
|
||||
compressedData.Add(data[i+startIndex]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Deflate_Compress()
|
||||
{
|
||||
compressedData.Clear();
|
||||
|
||||
byte[] testData = new byte[35000];
|
||||
for (int i = 0; i < testData.Length; ++i)
|
||||
testData[i] = 5;
|
||||
|
||||
using (Deflater def = new Deflater((CompressLevel)5))
|
||||
{
|
||||
def.DataAvailable += new DataAvailableHandler(CDataAvail);
|
||||
def.Add(testData);
|
||||
def.Finish();
|
||||
adler1 = def.Checksum;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Inflate tests
|
||||
[Test]
|
||||
public void Inflate_Init()
|
||||
{
|
||||
using (Inflater inf = new Inflater())
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private void DDataAvail(byte[] data, int startIndex, int count)
|
||||
{
|
||||
for (int i = 0; i < count; ++i)
|
||||
uncompressedData.Add(data[i+startIndex]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Inflate_Expand()
|
||||
{
|
||||
uncompressedData.Clear();
|
||||
|
||||
using (Inflater inf = new Inflater())
|
||||
{
|
||||
inf.DataAvailable += new DataAvailableHandler(DDataAvail);
|
||||
inf.Add((byte[])compressedData.ToArray(typeof(byte)));
|
||||
inf.Finish();
|
||||
adler2 = inf.Checksum;
|
||||
}
|
||||
Assert.AreEqual( adler1, adler2 );
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
[TestFixture]
|
||||
public class GZipStreamTests
|
||||
{
|
||||
#region GZipStream test
|
||||
[Test]
|
||||
public void GZipStream_WriteRead()
|
||||
{
|
||||
using (GZipStream gzOut = new GZipStream("gzstream.gz", CompressLevel.Best))
|
||||
{
|
||||
BinaryWriter writer = new BinaryWriter(gzOut);
|
||||
writer.Write("hi there");
|
||||
writer.Write(Math.PI);
|
||||
writer.Write(42);
|
||||
}
|
||||
|
||||
using (GZipStream gzIn = new GZipStream("gzstream.gz"))
|
||||
{
|
||||
BinaryReader reader = new BinaryReader(gzIn);
|
||||
string s = reader.ReadString();
|
||||
Assert.AreEqual("hi there",s);
|
||||
double d = reader.ReadDouble();
|
||||
Assert.AreEqual(Math.PI, d);
|
||||
int i = reader.ReadInt32();
|
||||
Assert.AreEqual(42,i);
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
//
|
||||
// © Copyright Henrik Ravn 2004
|
||||
//
|
||||
// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
|
||||
// uncomment the define below to include unit tests
|
||||
//#define nunit
|
||||
#if nunit
|
||||
using NUnit.Framework;
|
||||
|
||||
// Unit tests for the DotZLib class library
|
||||
// ----------------------------------------
|
||||
//
|
||||
// Use this with NUnit 2 from http://www.nunit.org
|
||||
//
|
||||
|
||||
namespace DotZLibTests
|
||||
{
|
||||
using DotZLib;
|
||||
|
||||
// helper methods
|
||||
internal class Utils
|
||||
{
|
||||
public static bool byteArrEqual( byte[] lhs, byte[] rhs )
|
||||
{
|
||||
if (lhs.Length != rhs.Length)
|
||||
return false;
|
||||
for (int i = lhs.Length-1; i >= 0; --i)
|
||||
if (lhs[i] != rhs[i])
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
[TestFixture]
|
||||
public class CircBufferTests
|
||||
{
|
||||
#region Circular buffer tests
|
||||
[Test]
|
||||
public void SinglePutGet()
|
||||
{
|
||||
CircularBuffer buf = new CircularBuffer(10);
|
||||
Assert.AreEqual( 0, buf.Size );
|
||||
Assert.AreEqual( -1, buf.Get() );
|
||||
|
||||
Assert.IsTrue(buf.Put( 1 ));
|
||||
Assert.AreEqual( 1, buf.Size );
|
||||
Assert.AreEqual( 1, buf.Get() );
|
||||
Assert.AreEqual( 0, buf.Size );
|
||||
Assert.AreEqual( -1, buf.Get() );
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void BlockPutGet()
|
||||
{
|
||||
CircularBuffer buf = new CircularBuffer(10);
|
||||
byte[] arr = {1,2,3,4,5,6,7,8,9,10};
|
||||
Assert.AreEqual( 10, buf.Put(arr,0,10) );
|
||||
Assert.AreEqual( 10, buf.Size );
|
||||
Assert.IsFalse( buf.Put(11) );
|
||||
Assert.AreEqual( 1, buf.Get() );
|
||||
Assert.IsTrue( buf.Put(11) );
|
||||
|
||||
byte[] arr2 = (byte[])arr.Clone();
|
||||
Assert.AreEqual( 9, buf.Get(arr2,1,9) );
|
||||
Assert.IsTrue( Utils.byteArrEqual(arr,arr2) );
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
[TestFixture]
|
||||
public class ChecksumTests
|
||||
{
|
||||
#region CRC32 Tests
|
||||
[Test]
|
||||
public void CRC32_Null()
|
||||
{
|
||||
CRC32Checksum crc32 = new CRC32Checksum();
|
||||
Assert.AreEqual( 0, crc32.Value );
|
||||
|
||||
crc32 = new CRC32Checksum(1);
|
||||
Assert.AreEqual( 1, crc32.Value );
|
||||
|
||||
crc32 = new CRC32Checksum(556);
|
||||
Assert.AreEqual( 556, crc32.Value );
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CRC32_Data()
|
||||
{
|
||||
CRC32Checksum crc32 = new CRC32Checksum();
|
||||
byte[] data = { 1,2,3,4,5,6,7 };
|
||||
crc32.Update(data);
|
||||
Assert.AreEqual( 0x70e46888, crc32.Value );
|
||||
|
||||
crc32 = new CRC32Checksum();
|
||||
crc32.Update("penguin");
|
||||
Assert.AreEqual( 0x0e5c1a120, crc32.Value );
|
||||
|
||||
crc32 = new CRC32Checksum(1);
|
||||
crc32.Update("penguin");
|
||||
Assert.AreEqual(0x43b6aa94, crc32.Value);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Adler tests
|
||||
|
||||
[Test]
|
||||
public void Adler_Null()
|
||||
{
|
||||
AdlerChecksum adler = new AdlerChecksum();
|
||||
Assert.AreEqual(0, adler.Value);
|
||||
|
||||
adler = new AdlerChecksum(1);
|
||||
Assert.AreEqual( 1, adler.Value );
|
||||
|
||||
adler = new AdlerChecksum(556);
|
||||
Assert.AreEqual( 556, adler.Value );
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Adler_Data()
|
||||
{
|
||||
AdlerChecksum adler = new AdlerChecksum(1);
|
||||
byte[] data = { 1,2,3,4,5,6,7 };
|
||||
adler.Update(data);
|
||||
Assert.AreEqual( 0x5b001d, adler.Value );
|
||||
|
||||
adler = new AdlerChecksum();
|
||||
adler.Update("penguin");
|
||||
Assert.AreEqual(0x0bcf02f6, adler.Value );
|
||||
|
||||
adler = new AdlerChecksum(1);
|
||||
adler.Update("penguin");
|
||||
Assert.AreEqual(0x0bd602f7, adler.Value);
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
[TestFixture]
|
||||
public class InfoTests
|
||||
{
|
||||
#region Info tests
|
||||
[Test]
|
||||
public void Info_Version()
|
||||
{
|
||||
Info info = new Info();
|
||||
Assert.AreEqual("1.2.11", Info.Version);
|
||||
Assert.AreEqual(32, info.SizeOfUInt);
|
||||
Assert.AreEqual(32, info.SizeOfULong);
|
||||
Assert.AreEqual(32, info.SizeOfPointer);
|
||||
Assert.AreEqual(32, info.SizeOfOffset);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
[TestFixture]
|
||||
public class DeflateInflateTests
|
||||
{
|
||||
#region Deflate tests
|
||||
[Test]
|
||||
public void Deflate_Init()
|
||||
{
|
||||
using (Deflater def = new Deflater(CompressLevel.Default))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList compressedData = new ArrayList();
|
||||
private uint adler1;
|
||||
|
||||
private ArrayList uncompressedData = new ArrayList();
|
||||
private uint adler2;
|
||||
|
||||
public void CDataAvail(byte[] data, int startIndex, int count)
|
||||
{
|
||||
for (int i = 0; i < count; ++i)
|
||||
compressedData.Add(data[i+startIndex]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Deflate_Compress()
|
||||
{
|
||||
compressedData.Clear();
|
||||
|
||||
byte[] testData = new byte[35000];
|
||||
for (int i = 0; i < testData.Length; ++i)
|
||||
testData[i] = 5;
|
||||
|
||||
using (Deflater def = new Deflater((CompressLevel)5))
|
||||
{
|
||||
def.DataAvailable += new DataAvailableHandler(CDataAvail);
|
||||
def.Add(testData);
|
||||
def.Finish();
|
||||
adler1 = def.Checksum;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Inflate tests
|
||||
[Test]
|
||||
public void Inflate_Init()
|
||||
{
|
||||
using (Inflater inf = new Inflater())
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private void DDataAvail(byte[] data, int startIndex, int count)
|
||||
{
|
||||
for (int i = 0; i < count; ++i)
|
||||
uncompressedData.Add(data[i+startIndex]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Inflate_Expand()
|
||||
{
|
||||
uncompressedData.Clear();
|
||||
|
||||
using (Inflater inf = new Inflater())
|
||||
{
|
||||
inf.DataAvailable += new DataAvailableHandler(DDataAvail);
|
||||
inf.Add((byte[])compressedData.ToArray(typeof(byte)));
|
||||
inf.Finish();
|
||||
adler2 = inf.Checksum;
|
||||
}
|
||||
Assert.AreEqual( adler1, adler2 );
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
[TestFixture]
|
||||
public class GZipStreamTests
|
||||
{
|
||||
#region GZipStream test
|
||||
[Test]
|
||||
public void GZipStream_WriteRead()
|
||||
{
|
||||
using (GZipStream gzOut = new GZipStream("gzstream.gz", CompressLevel.Best))
|
||||
{
|
||||
BinaryWriter writer = new BinaryWriter(gzOut);
|
||||
writer.Write("hi there");
|
||||
writer.Write(Math.PI);
|
||||
writer.Write(42);
|
||||
}
|
||||
|
||||
using (GZipStream gzIn = new GZipStream("gzstream.gz"))
|
||||
{
|
||||
BinaryReader reader = new BinaryReader(gzIn);
|
||||
string s = reader.ReadString();
|
||||
Assert.AreEqual("hi there",s);
|
||||
double d = reader.ReadDouble();
|
||||
Assert.AreEqual(Math.PI, d);
|
||||
int i = reader.ReadInt32();
|
||||
Assert.AreEqual(42,i);
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -1,23 +1,23 @@
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
@ -1,58 +1,58 @@
|
||||
This directory contains a .Net wrapper class library for the ZLib1.dll
|
||||
|
||||
The wrapper includes support for inflating/deflating memory buffers,
|
||||
.Net streaming wrappers for the gz streams part of zlib, and wrappers
|
||||
for the checksum parts of zlib. See DotZLib/UnitTests.cs for examples.
|
||||
|
||||
Directory structure:
|
||||
--------------------
|
||||
|
||||
LICENSE_1_0.txt - License file.
|
||||
readme.txt - This file.
|
||||
DotZLib.chm - Class library documentation
|
||||
DotZLib.build - NAnt build file
|
||||
DotZLib.sln - Microsoft Visual Studio 2003 solution file
|
||||
|
||||
DotZLib\*.cs - Source files for the class library
|
||||
|
||||
Unit tests:
|
||||
-----------
|
||||
The file DotZLib/UnitTests.cs contains unit tests for use with NUnit 2.1 or higher.
|
||||
To include unit tests in the build, define nunit before building.
|
||||
|
||||
|
||||
Build instructions:
|
||||
-------------------
|
||||
|
||||
1. Using Visual Studio.Net 2003:
|
||||
Open DotZLib.sln in VS.Net and build from there. Output file (DotZLib.dll)
|
||||
will be found ./DotZLib/bin/release or ./DotZLib/bin/debug, depending on
|
||||
you are building the release or debug version of the library. Check
|
||||
DotZLib/UnitTests.cs for instructions on how to include unit tests in the
|
||||
build.
|
||||
|
||||
2. Using NAnt:
|
||||
Open a command prompt with access to the build environment and run nant
|
||||
in the same directory as the DotZLib.build file.
|
||||
You can define 2 properties on the nant command-line to control the build:
|
||||
debug={true|false} to toggle between release/debug builds (default=true).
|
||||
nunit={true|false} to include or esclude unit tests (default=true).
|
||||
Also the target clean will remove binaries.
|
||||
Output file (DotZLib.dll) will be found in either ./DotZLib/bin/release
|
||||
or ./DotZLib/bin/debug, depending on whether you are building the release
|
||||
or debug version of the library.
|
||||
|
||||
Examples:
|
||||
nant -D:debug=false -D:nunit=false
|
||||
will build a release mode version of the library without unit tests.
|
||||
nant
|
||||
will build a debug version of the library with unit tests
|
||||
nant clean
|
||||
will remove all previously built files.
|
||||
|
||||
|
||||
---------------------------------
|
||||
Copyright (c) Henrik Ravn 2004
|
||||
|
||||
Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
This directory contains a .Net wrapper class library for the ZLib1.dll
|
||||
|
||||
The wrapper includes support for inflating/deflating memory buffers,
|
||||
.Net streaming wrappers for the gz streams part of zlib, and wrappers
|
||||
for the checksum parts of zlib. See DotZLib/UnitTests.cs for examples.
|
||||
|
||||
Directory structure:
|
||||
--------------------
|
||||
|
||||
LICENSE_1_0.txt - License file.
|
||||
readme.txt - This file.
|
||||
DotZLib.chm - Class library documentation
|
||||
DotZLib.build - NAnt build file
|
||||
DotZLib.sln - Microsoft Visual Studio 2003 solution file
|
||||
|
||||
DotZLib\*.cs - Source files for the class library
|
||||
|
||||
Unit tests:
|
||||
-----------
|
||||
The file DotZLib/UnitTests.cs contains unit tests for use with NUnit 2.1 or higher.
|
||||
To include unit tests in the build, define nunit before building.
|
||||
|
||||
|
||||
Build instructions:
|
||||
-------------------
|
||||
|
||||
1. Using Visual Studio.Net 2003:
|
||||
Open DotZLib.sln in VS.Net and build from there. Output file (DotZLib.dll)
|
||||
will be found ./DotZLib/bin/release or ./DotZLib/bin/debug, depending on
|
||||
you are building the release or debug version of the library. Check
|
||||
DotZLib/UnitTests.cs for instructions on how to include unit tests in the
|
||||
build.
|
||||
|
||||
2. Using NAnt:
|
||||
Open a command prompt with access to the build environment and run nant
|
||||
in the same directory as the DotZLib.build file.
|
||||
You can define 2 properties on the nant command-line to control the build:
|
||||
debug={true|false} to toggle between release/debug builds (default=true).
|
||||
nunit={true|false} to include or esclude unit tests (default=true).
|
||||
Also the target clean will remove binaries.
|
||||
Output file (DotZLib.dll) will be found in either ./DotZLib/bin/release
|
||||
or ./DotZLib/bin/debug, depending on whether you are building the release
|
||||
or debug version of the library.
|
||||
|
||||
Examples:
|
||||
nant -D:debug=false -D:nunit=false
|
||||
will build a release mode version of the library without unit tests.
|
||||
nant
|
||||
will build a debug version of the library with unit tests
|
||||
nant clean
|
||||
will remove all previously built files.
|
||||
|
||||
|
||||
---------------------------------
|
||||
Copyright (c) Henrik Ravn 2004
|
||||
|
||||
Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
574
OfficeUtils/src/zlib-1.2.11/contrib/gcc_gvmat64/gvmat64.S
Normal file
574
OfficeUtils/src/zlib-1.2.11/contrib/gcc_gvmat64/gvmat64.S
Normal file
@ -0,0 +1,574 @@
|
||||
/*
|
||||
;uInt longest_match_x64(
|
||||
; deflate_state *s,
|
||||
; IPos cur_match); // current match
|
||||
|
||||
; gvmat64.S -- Asm portion of the optimized longest_match for 32 bits x86_64
|
||||
; (AMD64 on Athlon 64, Opteron, Phenom
|
||||
; and Intel EM64T on Pentium 4 with EM64T, Pentium D, Core 2 Duo, Core I5/I7)
|
||||
; this file is translation from gvmat64.asm to GCC 4.x (for Linux, Mac XCode)
|
||||
; Copyright (C) 1995-2010 Jean-loup Gailly, Brian Raiter and Gilles Vollant.
|
||||
;
|
||||
; File written by Gilles Vollant, by converting to assembly the longest_match
|
||||
; from Jean-loup Gailly in deflate.c of zLib and infoZip zip.
|
||||
; and by taking inspiration on asm686 with masm, optimised assembly code
|
||||
; from Brian Raiter, written 1998
|
||||
;
|
||||
; 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.
|
||||
;
|
||||
; http://www.zlib.net
|
||||
; http://www.winimage.com/zLibDll
|
||||
; http://www.muppetlabs.com/~breadbox/software/assembly.html
|
||||
;
|
||||
; to compile this file for zLib, I use option:
|
||||
; gcc -c -arch x86_64 gvmat64.S
|
||||
|
||||
|
||||
;uInt longest_match(s, cur_match)
|
||||
; deflate_state *s;
|
||||
; IPos cur_match; // current match /
|
||||
;
|
||||
; with XCode for Mac, I had strange error with some jump on intel syntax
|
||||
; this is why BEFORE_JMP and AFTER_JMP are used
|
||||
*/
|
||||
|
||||
|
||||
#define BEFORE_JMP .att_syntax
|
||||
#define AFTER_JMP .intel_syntax noprefix
|
||||
|
||||
#ifndef NO_UNDERLINE
|
||||
# define match_init _match_init
|
||||
# define longest_match _longest_match
|
||||
#endif
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
.globl match_init, longest_match
|
||||
.text
|
||||
longest_match:
|
||||
|
||||
|
||||
|
||||
#define LocalVarsSize 96
|
||||
/*
|
||||
; register used : rax,rbx,rcx,rdx,rsi,rdi,r8,r9,r10,r11,r12
|
||||
; free register : r14,r15
|
||||
; register can be saved : rsp
|
||||
*/
|
||||
|
||||
#define chainlenwmask (rsp + 8 - LocalVarsSize)
|
||||
#define nicematch (rsp + 16 - LocalVarsSize)
|
||||
|
||||
#define save_rdi (rsp + 24 - LocalVarsSize)
|
||||
#define save_rsi (rsp + 32 - LocalVarsSize)
|
||||
#define save_rbx (rsp + 40 - LocalVarsSize)
|
||||
#define save_rbp (rsp + 48 - LocalVarsSize)
|
||||
#define save_r12 (rsp + 56 - LocalVarsSize)
|
||||
#define save_r13 (rsp + 64 - LocalVarsSize)
|
||||
#define save_r14 (rsp + 72 - LocalVarsSize)
|
||||
#define save_r15 (rsp + 80 - LocalVarsSize)
|
||||
|
||||
|
||||
/*
|
||||
; all the +4 offsets are due to the addition of pending_buf_size (in zlib
|
||||
; in the deflate_state structure since the asm code was first written
|
||||
; (if you compile with zlib 1.0.4 or older, remove the +4).
|
||||
; Note : these value are good with a 8 bytes boundary pack structure
|
||||
*/
|
||||
|
||||
#define MAX_MATCH 258
|
||||
#define MIN_MATCH 3
|
||||
#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
|
||||
|
||||
/*
|
||||
;;; Offsets for fields in the deflate_state structure. These numbers
|
||||
;;; are calculated from the definition of deflate_state, with the
|
||||
;;; assumption that the compiler will dword-align the fields. (Thus,
|
||||
;;; changing the definition of deflate_state could easily cause this
|
||||
;;; program to crash horribly, without so much as a warning at
|
||||
;;; compile time. Sigh.)
|
||||
|
||||
; all the +zlib1222add offsets are due to the addition of fields
|
||||
; in zlib in the deflate_state structure since the asm code was first written
|
||||
; (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)").
|
||||
; (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0").
|
||||
; if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8").
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* 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 %u\n",(int)(((char*)&(s->w_size))-((char*)s)));
|
||||
printf("#define dsWMask %u\n",(int)(((char*)&(s->w_mask))-((char*)s)));
|
||||
printf("#define dsWindow %u\n",(int)(((char*)&(s->window))-((char*)s)));
|
||||
printf("#define dsPrev %u\n",(int)(((char*)&(s->prev))-((char*)s)));
|
||||
printf("#define dsMatchLen %u\n",(int)(((char*)&(s->match_length))-((char*)s)));
|
||||
printf("#define dsPrevMatch %u\n",(int)(((char*)&(s->prev_match))-((char*)s)));
|
||||
printf("#define dsStrStart %u\n",(int)(((char*)&(s->strstart))-((char*)s)));
|
||||
printf("#define dsMatchStart %u\n",(int)(((char*)&(s->match_start))-((char*)s)));
|
||||
printf("#define dsLookahead %u\n",(int)(((char*)&(s->lookahead))-((char*)s)));
|
||||
printf("#define dsPrevLen %u\n",(int)(((char*)&(s->prev_length))-((char*)s)));
|
||||
printf("#define dsMaxChainLen %u\n",(int)(((char*)&(s->max_chain_length))-((char*)s)));
|
||||
printf("#define dsGoodMatch %u\n",(int)(((char*)&(s->good_match))-((char*)s)));
|
||||
printf("#define dsNiceMatch %u\n",(int)(((char*)&(s->nice_match))-((char*)s)));
|
||||
}
|
||||
*/
|
||||
|
||||
#define dsWSize 68
|
||||
#define dsWMask 76
|
||||
#define dsWindow 80
|
||||
#define dsPrev 96
|
||||
#define dsMatchLen 144
|
||||
#define dsPrevMatch 148
|
||||
#define dsStrStart 156
|
||||
#define dsMatchStart 160
|
||||
#define dsLookahead 164
|
||||
#define dsPrevLen 168
|
||||
#define dsMaxChainLen 172
|
||||
#define dsGoodMatch 188
|
||||
#define dsNiceMatch 192
|
||||
|
||||
#define window_size [ rcx + dsWSize]
|
||||
#define WMask [ rcx + dsWMask]
|
||||
#define window_ad [ rcx + dsWindow]
|
||||
#define prev_ad [ rcx + dsPrev]
|
||||
#define strstart [ rcx + dsStrStart]
|
||||
#define match_start [ rcx + dsMatchStart]
|
||||
#define Lookahead [ rcx + dsLookahead] //; 0ffffffffh on infozip
|
||||
#define prev_length [ rcx + dsPrevLen]
|
||||
#define max_chain_length [ rcx + dsMaxChainLen]
|
||||
#define good_match [ rcx + dsGoodMatch]
|
||||
#define nice_match [ rcx + dsNiceMatch]
|
||||
|
||||
/*
|
||||
; windows:
|
||||
; parameter 1 in rcx(deflate state s), param 2 in rdx (cur match)
|
||||
|
||||
; see http://weblogs.asp.net/oldnewthing/archive/2004/01/14/58579.aspx and
|
||||
; http://msdn.microsoft.com/library/en-us/kmarch/hh/kmarch/64bitAMD_8e951dd2-ee77-4728-8702-55ce4b5dd24a.xml.asp
|
||||
;
|
||||
; All registers must be preserved across the call, except for
|
||||
; rax, rcx, rdx, r8, r9, r10, and r11, which are scratch.
|
||||
|
||||
;
|
||||
; gcc on macosx-linux:
|
||||
; see http://www.x86-64.org/documentation/abi-0.99.pdf
|
||||
; param 1 in rdi, param 2 in rsi
|
||||
; rbx, rsp, rbp, r12 to r15 must be preserved
|
||||
|
||||
;;; Save registers that the compiler may be using, and adjust esp to
|
||||
;;; make room for our stack frame.
|
||||
|
||||
|
||||
;;; Retrieve the function arguments. r8d will hold cur_match
|
||||
;;; throughout the entire function. edx will hold the pointer to the
|
||||
;;; deflate_state structure during the function's setup (before
|
||||
;;; entering the main loop.
|
||||
|
||||
; ms: parameter 1 in rcx (deflate_state* s), param 2 in edx -> r8 (cur match)
|
||||
; mac: param 1 in rdi, param 2 rsi
|
||||
; this clear high 32 bits of r8, which can be garbage in both r8 and rdx
|
||||
*/
|
||||
mov [save_rbx],rbx
|
||||
mov [save_rbp],rbp
|
||||
|
||||
|
||||
mov rcx,rdi
|
||||
|
||||
mov r8d,esi
|
||||
|
||||
|
||||
mov [save_r12],r12
|
||||
mov [save_r13],r13
|
||||
mov [save_r14],r14
|
||||
mov [save_r15],r15
|
||||
|
||||
|
||||
//;;; uInt wmask = s->w_mask;
|
||||
//;;; unsigned chain_length = s->max_chain_length;
|
||||
//;;; if (s->prev_length >= s->good_match) {
|
||||
//;;; chain_length >>= 2;
|
||||
//;;; }
|
||||
|
||||
|
||||
mov edi, prev_length
|
||||
mov esi, good_match
|
||||
mov eax, WMask
|
||||
mov ebx, max_chain_length
|
||||
cmp edi, esi
|
||||
jl LastMatchGood
|
||||
shr ebx, 2
|
||||
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.
|
||||
|
||||
dec ebx
|
||||
shl ebx, 16
|
||||
or ebx, eax
|
||||
|
||||
//;;; on zlib only
|
||||
//;;; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
|
||||
|
||||
|
||||
|
||||
mov eax, nice_match
|
||||
mov [chainlenwmask], ebx
|
||||
mov r10d, Lookahead
|
||||
cmp r10d, eax
|
||||
cmovnl r10d, eax
|
||||
mov [nicematch],r10d
|
||||
|
||||
|
||||
|
||||
//;;; register Bytef *scan = s->window + s->strstart;
|
||||
mov r10, window_ad
|
||||
mov ebp, strstart
|
||||
lea r13, [r10 + rbp]
|
||||
|
||||
//;;; Determine how many bytes the scan ptr is off from being
|
||||
//;;; dword-aligned.
|
||||
|
||||
mov r9,r13
|
||||
neg r13
|
||||
and r13,3
|
||||
|
||||
//;;; IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
|
||||
//;;; s->strstart - (IPos)MAX_DIST(s) : NIL;
|
||||
|
||||
|
||||
mov eax, window_size
|
||||
sub eax, MIN_LOOKAHEAD
|
||||
|
||||
|
||||
xor edi,edi
|
||||
sub ebp, eax
|
||||
|
||||
mov r11d, prev_length
|
||||
|
||||
cmovng ebp,edi
|
||||
|
||||
//;;; int best_len = s->prev_length;
|
||||
|
||||
|
||||
//;;; Store the sum of s->window + best_len in esi locally, and in esi.
|
||||
|
||||
lea rsi,[r10+r11]
|
||||
|
||||
//;;; register ush scan_start = *(ushf*)scan;
|
||||
//;;; register ush scan_end = *(ushf*)(scan+best_len-1);
|
||||
//;;; Posf *prev = s->prev;
|
||||
|
||||
movzx r12d,word ptr [r9]
|
||||
movzx ebx, word ptr [r9 + r11 - 1]
|
||||
|
||||
mov rdi, prev_ad
|
||||
|
||||
//;;; Jump into the main loop.
|
||||
|
||||
mov edx, [chainlenwmask]
|
||||
|
||||
cmp bx,word ptr [rsi + r8 - 1]
|
||||
jz LookupLoopIsZero
|
||||
|
||||
|
||||
|
||||
LookupLoop1:
|
||||
and r8d, edx
|
||||
|
||||
movzx r8d, word ptr [rdi + r8*2]
|
||||
cmp r8d, ebp
|
||||
jbe LeaveNow
|
||||
|
||||
|
||||
|
||||
sub edx, 0x00010000
|
||||
BEFORE_JMP
|
||||
js LeaveNow
|
||||
AFTER_JMP
|
||||
|
||||
LoopEntry1:
|
||||
cmp bx,word ptr [rsi + r8 - 1]
|
||||
BEFORE_JMP
|
||||
jz LookupLoopIsZero
|
||||
AFTER_JMP
|
||||
|
||||
LookupLoop2:
|
||||
and r8d, edx
|
||||
|
||||
movzx r8d, word ptr [rdi + r8*2]
|
||||
cmp r8d, ebp
|
||||
BEFORE_JMP
|
||||
jbe LeaveNow
|
||||
AFTER_JMP
|
||||
sub edx, 0x00010000
|
||||
BEFORE_JMP
|
||||
js LeaveNow
|
||||
AFTER_JMP
|
||||
|
||||
LoopEntry2:
|
||||
cmp bx,word ptr [rsi + r8 - 1]
|
||||
BEFORE_JMP
|
||||
jz LookupLoopIsZero
|
||||
AFTER_JMP
|
||||
|
||||
LookupLoop4:
|
||||
and r8d, edx
|
||||
|
||||
movzx r8d, word ptr [rdi + r8*2]
|
||||
cmp r8d, ebp
|
||||
BEFORE_JMP
|
||||
jbe LeaveNow
|
||||
AFTER_JMP
|
||||
sub edx, 0x00010000
|
||||
BEFORE_JMP
|
||||
js LeaveNow
|
||||
AFTER_JMP
|
||||
|
||||
LoopEntry4:
|
||||
|
||||
cmp bx,word ptr [rsi + r8 - 1]
|
||||
BEFORE_JMP
|
||||
jnz LookupLoop1
|
||||
jmp LookupLoopIsZero
|
||||
AFTER_JMP
|
||||
/*
|
||||
;;; 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.
|
||||
;;;
|
||||
;;; Within this loop:
|
||||
;;; ebx = scanend
|
||||
;;; r8d = curmatch
|
||||
;;; edx = chainlenwmask - i.e., ((chainlen << 16) | wmask)
|
||||
;;; esi = windowbestlen - i.e., (window + bestlen)
|
||||
;;; edi = prev
|
||||
;;; ebp = limit
|
||||
*/
|
||||
.balign 16
|
||||
LookupLoop:
|
||||
and r8d, edx
|
||||
|
||||
movzx r8d, word ptr [rdi + r8*2]
|
||||
cmp r8d, ebp
|
||||
BEFORE_JMP
|
||||
jbe LeaveNow
|
||||
AFTER_JMP
|
||||
sub edx, 0x00010000
|
||||
BEFORE_JMP
|
||||
js LeaveNow
|
||||
AFTER_JMP
|
||||
|
||||
LoopEntry:
|
||||
|
||||
cmp bx,word ptr [rsi + r8 - 1]
|
||||
BEFORE_JMP
|
||||
jnz LookupLoop1
|
||||
AFTER_JMP
|
||||
LookupLoopIsZero:
|
||||
cmp r12w, word ptr [r10 + r8]
|
||||
BEFORE_JMP
|
||||
jnz LookupLoop1
|
||||
AFTER_JMP
|
||||
|
||||
|
||||
//;;; Store the current value of chainlen.
|
||||
mov [chainlenwmask], edx
|
||||
/*
|
||||
;;; Point edi to the string under scrutiny, and esi 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).
|
||||
*/
|
||||
lea rsi,[r8+r10]
|
||||
mov rdx, 0xfffffffffffffef8 //; -(MAX_MATCH_8)
|
||||
lea rsi, [rsi + r13 + 0x0108] //;MAX_MATCH_8]
|
||||
lea rdi, [r9 + r13 + 0x0108] //;MAX_MATCH_8]
|
||||
|
||||
prefetcht1 [rsi+rdx]
|
||||
prefetcht1 [rdi+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.
|
||||
;;;
|
||||
;;; We already know at this point that the first three bytes of the
|
||||
;;; strings match each other, and they can be safely passed over before
|
||||
;;; starting the compare loop. So what this code does is skip over 0-3
|
||||
;;; bytes, as much as necessary in order to dword-align the edi
|
||||
;;; pointer. (rsi will still be misaligned three times out of four.)
|
||||
;;;
|
||||
;;; 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.
|
||||
*/
|
||||
|
||||
LoopCmps:
|
||||
mov rax, [rsi + rdx]
|
||||
xor rax, [rdi + rdx]
|
||||
jnz LeaveLoopCmps
|
||||
|
||||
mov rax, [rsi + rdx + 8]
|
||||
xor rax, [rdi + rdx + 8]
|
||||
jnz LeaveLoopCmps8
|
||||
|
||||
|
||||
mov rax, [rsi + rdx + 8+8]
|
||||
xor rax, [rdi + rdx + 8+8]
|
||||
jnz LeaveLoopCmps16
|
||||
|
||||
add rdx,8+8+8
|
||||
|
||||
BEFORE_JMP
|
||||
jnz LoopCmps
|
||||
jmp LenMaximum
|
||||
AFTER_JMP
|
||||
|
||||
LeaveLoopCmps16: add rdx,8
|
||||
LeaveLoopCmps8: add rdx,8
|
||||
LeaveLoopCmps:
|
||||
|
||||
test eax, 0x0000FFFF
|
||||
jnz LenLower
|
||||
|
||||
test eax,0xffffffff
|
||||
|
||||
jnz LenLower32
|
||||
|
||||
add rdx,4
|
||||
shr rax,32
|
||||
or ax,ax
|
||||
BEFORE_JMP
|
||||
jnz LenLower
|
||||
AFTER_JMP
|
||||
|
||||
LenLower32:
|
||||
shr eax,16
|
||||
add rdx,2
|
||||
|
||||
LenLower:
|
||||
sub al, 1
|
||||
adc rdx, 0
|
||||
//;;; 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 rax, [rdi + rdx]
|
||||
sub rax, r9
|
||||
cmp eax, MAX_MATCH
|
||||
BEFORE_JMP
|
||||
jge LenMaximum
|
||||
AFTER_JMP
|
||||
/*
|
||||
;;; 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.
|
||||
;///////////////////////////////////
|
||||
*/
|
||||
cmp eax, r11d
|
||||
jg LongerMatch
|
||||
|
||||
lea rsi,[r10+r11]
|
||||
|
||||
mov rdi, prev_ad
|
||||
mov edx, [chainlenwmask]
|
||||
BEFORE_JMP
|
||||
jmp LookupLoop
|
||||
AFTER_JMP
|
||||
/*
|
||||
;;; s->match_start = cur_match;
|
||||
;;; best_len = len;
|
||||
;;; if (len >= nice_match) break;
|
||||
;;; scan_end = *(ushf*)(scan+best_len-1);
|
||||
*/
|
||||
LongerMatch:
|
||||
mov r11d, eax
|
||||
mov match_start, r8d
|
||||
cmp eax, [nicematch]
|
||||
BEFORE_JMP
|
||||
jge LeaveNow
|
||||
AFTER_JMP
|
||||
|
||||
lea rsi,[r10+rax]
|
||||
|
||||
movzx ebx, word ptr [r9 + rax - 1]
|
||||
mov rdi, prev_ad
|
||||
mov edx, [chainlenwmask]
|
||||
BEFORE_JMP
|
||||
jmp LookupLoop
|
||||
AFTER_JMP
|
||||
|
||||
//;;; Accept the current string, with the maximum possible length.
|
||||
|
||||
LenMaximum:
|
||||
mov r11d,MAX_MATCH
|
||||
mov match_start, r8d
|
||||
|
||||
//;;; if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
|
||||
//;;; return s->lookahead;
|
||||
|
||||
LeaveNow:
|
||||
mov eax, Lookahead
|
||||
cmp r11d, eax
|
||||
cmovng eax, r11d
|
||||
|
||||
|
||||
|
||||
//;;; Restore the stack and return from whence we came.
|
||||
|
||||
|
||||
// mov rsi,[save_rsi]
|
||||
// mov rdi,[save_rdi]
|
||||
mov rbx,[save_rbx]
|
||||
mov rbp,[save_rbp]
|
||||
mov r12,[save_r12]
|
||||
mov r13,[save_r13]
|
||||
mov r14,[save_r14]
|
||||
mov r15,[save_r15]
|
||||
|
||||
|
||||
ret 0
|
||||
//; please don't remove this string !
|
||||
//; Your can freely use gvmat64 in any free or commercial app
|
||||
//; but it is far better don't remove the string in the binary!
|
||||
// db 0dh,0ah,"asm686 with masm, optimised assembly code from Brian Raiter, written 1998, converted to amd 64 by Gilles Vollant 2005",0dh,0ah,0
|
||||
|
||||
|
||||
match_init:
|
||||
ret 0
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* infback9.c -- inflate deflate64 data using a call-back interface
|
||||
* Copyright (C) 1995-2003 Mark Adler
|
||||
* Copyright (C) 1995-2008 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
@ -222,14 +222,13 @@ out_func out;
|
||||
void FAR *out_desc;
|
||||
{
|
||||
struct inflate_state FAR *state;
|
||||
unsigned char FAR *next; /* next input */
|
||||
z_const unsigned char FAR *next; /* next input */
|
||||
unsigned char FAR *put; /* next output */
|
||||
unsigned have; /* available input */
|
||||
unsigned long left; /* available output */
|
||||
inflate_mode mode; /* current inflate mode */
|
||||
int lastblock; /* true if processing last block */
|
||||
int wrap; /* true if the window has wrapped */
|
||||
unsigned long write; /* window write index */
|
||||
unsigned char FAR *window; /* allocated sliding window, if needed */
|
||||
unsigned long hold; /* bit buffer */
|
||||
unsigned bits; /* bits in bit buffer */
|
||||
@ -242,7 +241,7 @@ void FAR *out_desc;
|
||||
code const FAR *distcode; /* starting table for distance codes */
|
||||
unsigned lenbits; /* index bits for lencode */
|
||||
unsigned distbits; /* index bits for distcode */
|
||||
code this; /* current decoding table entry */
|
||||
code here; /* current decoding table entry */
|
||||
code last; /* parent table entry */
|
||||
unsigned len; /* length to copy for repeats, bits to drop */
|
||||
int ret; /* return code */
|
||||
@ -259,7 +258,6 @@ void FAR *out_desc;
|
||||
strm->msg = Z_NULL;
|
||||
mode = TYPE;
|
||||
lastblock = 0;
|
||||
write = 0;
|
||||
wrap = 0;
|
||||
window = state->window;
|
||||
next = strm->next_in;
|
||||
@ -384,19 +382,19 @@ void FAR *out_desc;
|
||||
state->have = 0;
|
||||
while (state->have < state->nlen + state->ndist) {
|
||||
for (;;) {
|
||||
this = lencode[BITS(lenbits)];
|
||||
if ((unsigned)(this.bits) <= bits) break;
|
||||
here = lencode[BITS(lenbits)];
|
||||
if ((unsigned)(here.bits) <= bits) break;
|
||||
PULLBYTE();
|
||||
}
|
||||
if (this.val < 16) {
|
||||
NEEDBITS(this.bits);
|
||||
DROPBITS(this.bits);
|
||||
state->lens[state->have++] = this.val;
|
||||
if (here.val < 16) {
|
||||
NEEDBITS(here.bits);
|
||||
DROPBITS(here.bits);
|
||||
state->lens[state->have++] = here.val;
|
||||
}
|
||||
else {
|
||||
if (this.val == 16) {
|
||||
NEEDBITS(this.bits + 2);
|
||||
DROPBITS(this.bits);
|
||||
if (here.val == 16) {
|
||||
NEEDBITS(here.bits + 2);
|
||||
DROPBITS(here.bits);
|
||||
if (state->have == 0) {
|
||||
strm->msg = (char *)"invalid bit length repeat";
|
||||
mode = BAD;
|
||||
@ -406,16 +404,16 @@ void FAR *out_desc;
|
||||
copy = 3 + BITS(2);
|
||||
DROPBITS(2);
|
||||
}
|
||||
else if (this.val == 17) {
|
||||
NEEDBITS(this.bits + 3);
|
||||
DROPBITS(this.bits);
|
||||
else if (here.val == 17) {
|
||||
NEEDBITS(here.bits + 3);
|
||||
DROPBITS(here.bits);
|
||||
len = 0;
|
||||
copy = 3 + BITS(3);
|
||||
DROPBITS(3);
|
||||
}
|
||||
else {
|
||||
NEEDBITS(this.bits + 7);
|
||||
DROPBITS(this.bits);
|
||||
NEEDBITS(here.bits + 7);
|
||||
DROPBITS(here.bits);
|
||||
len = 0;
|
||||
copy = 11 + BITS(7);
|
||||
DROPBITS(7);
|
||||
@ -433,7 +431,16 @@ void FAR *out_desc;
|
||||
/* handle error breaks in while */
|
||||
if (mode == BAD) break;
|
||||
|
||||
/* build code tables */
|
||||
/* check for end-of-block code (better have one) */
|
||||
if (state->lens[256] == 0) {
|
||||
strm->msg = (char *)"invalid code -- missing end-of-block";
|
||||
mode = BAD;
|
||||
break;
|
||||
}
|
||||
|
||||
/* build code tables -- note: do not change the lenbits or distbits
|
||||
values here (9 and 6) without reading the comments in inftree9.h
|
||||
concerning the ENOUGH constants, which depend on those values */
|
||||
state->next = state->codes;
|
||||
lencode = (code const FAR *)(state->next);
|
||||
lenbits = 9;
|
||||
@ -460,28 +467,28 @@ void FAR *out_desc;
|
||||
case LEN:
|
||||
/* get a literal, length, or end-of-block code */
|
||||
for (;;) {
|
||||
this = lencode[BITS(lenbits)];
|
||||
if ((unsigned)(this.bits) <= bits) break;
|
||||
here = lencode[BITS(lenbits)];
|
||||
if ((unsigned)(here.bits) <= bits) break;
|
||||
PULLBYTE();
|
||||
}
|
||||
if (this.op && (this.op & 0xf0) == 0) {
|
||||
last = this;
|
||||
if (here.op && (here.op & 0xf0) == 0) {
|
||||
last = here;
|
||||
for (;;) {
|
||||
this = lencode[last.val +
|
||||
here = lencode[last.val +
|
||||
(BITS(last.bits + last.op) >> last.bits)];
|
||||
if ((unsigned)(last.bits + this.bits) <= bits) break;
|
||||
if ((unsigned)(last.bits + here.bits) <= bits) break;
|
||||
PULLBYTE();
|
||||
}
|
||||
DROPBITS(last.bits);
|
||||
}
|
||||
DROPBITS(this.bits);
|
||||
length = (unsigned)this.val;
|
||||
DROPBITS(here.bits);
|
||||
length = (unsigned)here.val;
|
||||
|
||||
/* process literal */
|
||||
if (this.op == 0) {
|
||||
Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
|
||||
if (here.op == 0) {
|
||||
Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
|
||||
"inflate: literal '%c'\n" :
|
||||
"inflate: literal 0x%02x\n", this.val));
|
||||
"inflate: literal 0x%02x\n", here.val));
|
||||
ROOM();
|
||||
*put++ = (unsigned char)(length);
|
||||
left--;
|
||||
@ -490,21 +497,21 @@ void FAR *out_desc;
|
||||
}
|
||||
|
||||
/* process end of block */
|
||||
if (this.op & 32) {
|
||||
if (here.op & 32) {
|
||||
Tracevv((stderr, "inflate: end of block\n"));
|
||||
mode = TYPE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* invalid code */
|
||||
if (this.op & 64) {
|
||||
if (here.op & 64) {
|
||||
strm->msg = (char *)"invalid literal/length code";
|
||||
mode = BAD;
|
||||
break;
|
||||
}
|
||||
|
||||
/* length code -- get extra bits, if any */
|
||||
extra = (unsigned)(this.op) & 31;
|
||||
extra = (unsigned)(here.op) & 31;
|
||||
if (extra != 0) {
|
||||
NEEDBITS(extra);
|
||||
length += BITS(extra);
|
||||
@ -514,30 +521,30 @@ void FAR *out_desc;
|
||||
|
||||
/* get distance code */
|
||||
for (;;) {
|
||||
this = distcode[BITS(distbits)];
|
||||
if ((unsigned)(this.bits) <= bits) break;
|
||||
here = distcode[BITS(distbits)];
|
||||
if ((unsigned)(here.bits) <= bits) break;
|
||||
PULLBYTE();
|
||||
}
|
||||
if ((this.op & 0xf0) == 0) {
|
||||
last = this;
|
||||
if ((here.op & 0xf0) == 0) {
|
||||
last = here;
|
||||
for (;;) {
|
||||
this = distcode[last.val +
|
||||
here = distcode[last.val +
|
||||
(BITS(last.bits + last.op) >> last.bits)];
|
||||
if ((unsigned)(last.bits + this.bits) <= bits) break;
|
||||
if ((unsigned)(last.bits + here.bits) <= bits) break;
|
||||
PULLBYTE();
|
||||
}
|
||||
DROPBITS(last.bits);
|
||||
}
|
||||
DROPBITS(this.bits);
|
||||
if (this.op & 64) {
|
||||
DROPBITS(here.bits);
|
||||
if (here.op & 64) {
|
||||
strm->msg = (char *)"invalid distance code";
|
||||
mode = BAD;
|
||||
break;
|
||||
}
|
||||
offset = (unsigned)this.val;
|
||||
offset = (unsigned)here.val;
|
||||
|
||||
/* get distance extra bits, if any */
|
||||
extra = (unsigned)(this.op) & 15;
|
||||
extra = (unsigned)(here.op) & 15;
|
||||
if (extra != 0) {
|
||||
NEEDBITS(extra);
|
||||
offset += BITS(extra);
|
||||
@ -1,4 +1,4 @@
|
||||
/* infback9.h -- header for using inflateBack9 functions
|
||||
/* infback9.h -- header for using inflateBack9 functions
|
||||
* Copyright (C) 2003 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
@ -1,4 +1,4 @@
|
||||
/* inffix9.h -- table for decoding deflate64 fixed codes
|
||||
/* inffix9.h -- table for decoding deflate64 fixed codes
|
||||
* Generated automatically by makefixed9().
|
||||
*/
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/* inflate9.h -- internal inflate state definition
|
||||
/* inflate9.h -- internal inflate state definition
|
||||
* Copyright (C) 1995-2003 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user