summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-10-05 23:12:40 +0200
committerEike Rathke <erack@redhat.com>2013-10-15 17:31:14 +0000
commit5b98ed53008ee715b992a99afd8db5cfd10781b6 (patch)
tree5161313aff06d2e8c0d9a43e7b659108e0a1a497
parent911486c4624bdf45f3fb13ef705017475c6554b9 (diff)
fdo#64400: DXF import filter: fix OUString handling
The DXF import filter stores all strings read from the file in char[DXF_MAX_STRING_LEN+1] arrays, and then calls OUString constructor with that which then asserts because the string is actually shorter than the size of the array... avoid that by converting from char* to OString. Actually this also fixes the actual bug: the weird lines in the exported PDF were tiny Text elements from the document, repeated. (cherry picked from commit 96852a89da058084b2acf5ff706d9679b127b29a) Conflicts: filter/source/graphicfilter/idxf/dxf2mtf.cxx filter/source/graphicfilter/idxf/dxfblkrd.hxx filter/source/graphicfilter/idxf/dxfentrd.hxx filter/source/graphicfilter/idxf/dxftblrd.hxx Change-Id: I93c52788f88fe5d21968d450d029ed5db101d88b Reviewed-on: https://gerrit.libreoffice.org/6152 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit ac48e8c589233962bc68644b30bb184c3b0ee321) Reviewed-on: https://gerrit.libreoffice.org/6217 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk> Reviewed-by: Eike Rathke <erack@redhat.com>
-rw-r--r--filter/source/graphicfilter/idxf/dxf2mtf.cxx56
-rw-r--r--filter/source/graphicfilter/idxf/dxf2mtf.hxx2
-rw-r--r--filter/source/graphicfilter/idxf/dxfblkrd.cxx16
-rw-r--r--filter/source/graphicfilter/idxf/dxfblkrd.hxx8
-rw-r--r--filter/source/graphicfilter/idxf/dxfentrd.cxx56
-rw-r--r--filter/source/graphicfilter/idxf/dxfentrd.hxx28
-rw-r--r--filter/source/graphicfilter/idxf/dxfreprd.cxx4
-rw-r--r--filter/source/graphicfilter/idxf/dxftblrd.cxx44
-rw-r--r--filter/source/graphicfilter/idxf/dxftblrd.hxx22
9 files changed, 110 insertions, 126 deletions
diff --git a/filter/source/graphicfilter/idxf/dxf2mtf.cxx b/filter/source/graphicfilter/idxf/dxf2mtf.cxx
index c22e0a4b4b7e..e4e9f1782c00 100644
--- a/filter/source/graphicfilter/idxf/dxf2mtf.cxx
+++ b/filter/source/graphicfilter/idxf/dxf2mtf.cxx
@@ -52,9 +52,10 @@ long DXF2GDIMetaFile::GetEntityColor(const DXFBasicEntity & rE)
nColor=rE.nColor;
if (nColor==256) {
- if (rE.sLayer[0]=='0' && rE.sLayer[1]==0) nColor=nParentLayerColor;
- else {
- pLayer=pDXF->aTables.SearchLayer(rE.sLayer);
+ if (rE.m_sLayer.getLength() < 2) {
+ nColor=nParentLayerColor;
+ } else {
+ pLayer=pDXF->aTables.SearchLayer(rE.m_sLayer);
if (pLayer!=NULL) nColor=pLayer->nColor;
else nColor=nParentLayerColor;
}
@@ -63,12 +64,12 @@ long DXF2GDIMetaFile::GetEntityColor(const DXFBasicEntity & rE)
return nColor;
}
-DXFLineInfo DXF2GDIMetaFile::LTypeToDXFLineInfo(const char * sLineType)
+DXFLineInfo DXF2GDIMetaFile::LTypeToDXFLineInfo(OString const& rLineType)
{
const DXFLType * pLT;
DXFLineInfo aDXFLineInfo;
- pLT=pDXF->aTables.SearchLType(sLineType);
+ pLT = pDXF->aTables.SearchLType(rLineType);
if (pLT==NULL || pLT->nDashCount == 0) {
aDXFLineInfo.eStyle = LINE_SOLID;
}
@@ -125,18 +126,23 @@ DXFLineInfo DXF2GDIMetaFile::GetEntityDXFLineInfo(const DXFBasicEntity & rE)
aDXFLineInfo.fDotLen = 0;
aDXFLineInfo.fDistance = 0;
- if (strcmp(rE.sLineType,"BYLAYER")==0) {
- if (rE.sLayer[0]=='0' && rE.sLayer[1]==0) aDXFLineInfo=aParentLayerDXFLineInfo;
- else {
- pLayer=pDXF->aTables.SearchLayer(rE.sLayer);
- if (pLayer!=NULL) aDXFLineInfo=LTypeToDXFLineInfo(pLayer->sLineType);
+ if (rE.m_sLineType == "BYLAYER") {
+ if (rE.m_sLayer.getLength() < 2) {
+ aDXFLineInfo=aParentLayerDXFLineInfo;
+ } else {
+ pLayer=pDXF->aTables.SearchLayer(rE.m_sLayer);
+ if (pLayer!=NULL) {
+ aDXFLineInfo = LTypeToDXFLineInfo(pLayer->m_sLineType);
+ }
else aDXFLineInfo=aParentLayerDXFLineInfo;
}
}
- else if (strcmp(rE.sLineType,"BYBLOCK")==0) {
+ else if (rE.m_sLineType == "BYBLOCK") {
aDXFLineInfo=aBlockDXFLineInfo;
}
- else aDXFLineInfo=LTypeToDXFLineInfo(rE.sLineType);
+ else {
+ aDXFLineInfo = LTypeToDXFLineInfo(rE.m_sLineType);
+ }
return aDXFLineInfo;
}
@@ -415,7 +421,6 @@ void DXF2GDIMetaFile::DrawTextEntity(const DXFTextEntity & rE, const DXFTransfor
double fA;
sal_uInt16 nHeight;
short nAng;
- rtl::OString aStr( rE.sText );
DXFTransform aT( DXFTransform(rE.fXScale,rE.fHeight,1.0,rE.fRotAngle,rE.aP0), rTransform );
aT.TransDir(DXFVector(0,1,0),aV);
nHeight=(sal_uInt16)(aV.Abs()+0.5);
@@ -424,7 +429,8 @@ void DXF2GDIMetaFile::DrawTextEntity(const DXFTextEntity & rE, const DXFTransfor
aT.TransDir(DXFVector(1,0,0),aV);
if ( SetFontAttribute( rE,nAng, nHeight, aV. Abs() ) )
{
- rtl::OUString aUString(rtl::OStringToOUString(aStr, pDXF->getTextEncoding()));
+ rtl::OUString const aUString(
+ rtl::OStringToOUString(rE.m_sText, pDXF->getTextEncoding()));
aT.Transform( DXFVector( 0, 0, 0 ), aPt );
pVirDev->DrawText( aPt, aUString );
}
@@ -434,7 +440,7 @@ void DXF2GDIMetaFile::DrawTextEntity(const DXFTextEntity & rE, const DXFTransfor
void DXF2GDIMetaFile::DrawInsertEntity(const DXFInsertEntity & rE, const DXFTransform & rTransform)
{
const DXFBlock * pB;
- pB=pDXF->aBlocks.Search(rE.sName);
+ pB=pDXF->aBlocks.Search(rE.m_sName);
if (pB!=NULL) {
DXFTransform aDXFTransform1(1.0,1.0,1.0,DXFVector(0.0,0.0,0.0)-pB->aBasePoint);
DXFTransform aDXFTransform2(rE.fXScale,rE.fYScale,rE.fZScale,rE.fRotAngle,rE.aP0);
@@ -450,11 +456,11 @@ void DXF2GDIMetaFile::DrawInsertEntity(const DXFInsertEntity & rE, const DXFTran
aSavedParentLayerDXFLineInfo=aParentLayerDXFLineInfo;
nBlockColor=GetEntityColor(rE);
aBlockDXFLineInfo=GetEntityDXFLineInfo(rE);
- if (rE.sLayer[0]!='0' || rE.sLayer[1]!=0) {
- DXFLayer * pLayer=pDXF->aTables.SearchLayer(rE.sLayer);
+ if (rE.m_sLayer.getLength() > 1) {
+ DXFLayer * pLayer=pDXF->aTables.SearchLayer(rE.m_sLayer);
if (pLayer!=NULL) {
nParentLayerColor=pLayer->nColor;
- aParentLayerDXFLineInfo=LTypeToDXFLineInfo(pLayer->sLineType);
+ aParentLayerDXFLineInfo = LTypeToDXFLineInfo(pLayer->m_sLineType);
}
}
DrawEntities(*pB,aT);
@@ -474,7 +480,6 @@ void DXF2GDIMetaFile::DrawAttribEntity(const DXFAttribEntity & rE, const DXFTran
double fA;
sal_uInt16 nHeight;
short nAng;
- rtl::OString aStr( rE.sText );
DXFTransform aT( DXFTransform( rE.fXScale, rE.fHeight, 1.0, rE.fRotAngle, rE.aP0 ), rTransform );
aT.TransDir(DXFVector(0,1,0),aV);
nHeight=(sal_uInt16)(aV.Abs()+0.5);
@@ -483,7 +488,8 @@ void DXF2GDIMetaFile::DrawAttribEntity(const DXFAttribEntity & rE, const DXFTran
aT.TransDir(DXFVector(1,0,0),aV);
if (SetFontAttribute(rE,nAng,nHeight,aV.Abs()))
{
- rtl::OUString aUString(rtl::OStringToOUString(aStr, pDXF->getTextEncoding()));
+ rtl::OUString const aUString(
+ rtl::OStringToOUString(rE.m_sText, pDXF->getTextEncoding()));
aT.Transform( DXFVector( 0, 0, 0 ), aPt );
pVirDev->DrawText( aPt, aUString );
}
@@ -645,7 +651,7 @@ void DXF2GDIMetaFile::Draw3DFaceEntity(const DXF3DFaceEntity & rE, const DXFTran
void DXF2GDIMetaFile::DrawDimensionEntity(const DXFDimensionEntity & rE, const DXFTransform & rTransform)
{
const DXFBlock * pB;
- pB=pDXF->aBlocks.Search(rE.sPseudoBlock);
+ pB=pDXF->aBlocks.Search(rE.m_sPseudoBlock);
if (pB!=NULL) {
DXFTransform aT(
DXFTransform(1.0,1.0,1.0,DXFVector(0.0,0.0,0.0)-pB->aBasePoint),
@@ -659,11 +665,11 @@ void DXF2GDIMetaFile::DrawDimensionEntity(const DXFDimensionEntity & rE, const D
aSavedParentLayerDXFLineInfo=aParentLayerDXFLineInfo;
nBlockColor=GetEntityColor(rE);
aBlockDXFLineInfo=GetEntityDXFLineInfo(rE);
- if (rE.sLayer[0]!='0' || rE.sLayer[1]!=0) {
- DXFLayer * pLayer=pDXF->aTables.SearchLayer(rE.sLayer);
+ if (rE.m_sLayer.getLength() > 1) {
+ DXFLayer * pLayer=pDXF->aTables.SearchLayer(rE.m_sLayer);
if (pLayer!=NULL) {
nParentLayerColor=pLayer->nColor;
- aParentLayerDXFLineInfo=LTypeToDXFLineInfo(pLayer->sLineType);
+ aParentLayerDXFLineInfo = LTypeToDXFLineInfo(pLayer->m_sLineType);
}
}
DrawEntities(*pB,aT);
@@ -787,7 +793,7 @@ sal_Bool DXF2GDIMetaFile::Convert(const DXFRepresentation & rDXF, GDIMetaFile &
pLayer=pDXF->aTables.SearchLayer("0");
if (pLayer!=NULL) {
nParentLayerColor=pLayer->nColor & 0xff;
- aParentLayerDXFLineInfo=LTypeToDXFLineInfo(pLayer->sLineType);
+ aParentLayerDXFLineInfo = LTypeToDXFLineInfo(pLayer->m_sLineType);
}
else {
nParentLayerColor=7;
diff --git a/filter/source/graphicfilter/idxf/dxf2mtf.hxx b/filter/source/graphicfilter/idxf/dxf2mtf.hxx
index b767cb0a263c..0a5657276b86 100644
--- a/filter/source/graphicfilter/idxf/dxf2mtf.hxx
+++ b/filter/source/graphicfilter/idxf/dxf2mtf.hxx
@@ -60,7 +60,7 @@ private:
long GetEntityColor(const DXFBasicEntity & rE);
- DXFLineInfo LTypeToDXFLineInfo(const char * sLineType);
+ DXFLineInfo LTypeToDXFLineInfo(OString const& rLineType);
DXFLineInfo GetEntityDXFLineInfo(const DXFBasicEntity & rE);
diff --git a/filter/source/graphicfilter/idxf/dxfblkrd.cxx b/filter/source/graphicfilter/idxf/dxfblkrd.cxx
index 3f06268e9ab2..bb52fe42aebe 100644
--- a/filter/source/graphicfilter/idxf/dxfblkrd.cxx
+++ b/filter/source/graphicfilter/idxf/dxfblkrd.cxx
@@ -40,25 +40,25 @@ DXFBlock::~DXFBlock()
void DXFBlock::Read(DXFGroupReader & rDGR)
{
- sName[0]=0;
- sAlsoName[0]=0;
+ m_sName = "";
+ m_sAlsoName = "";
aBasePoint.fx=0.0;
aBasePoint.fy=0.0;
aBasePoint.fz=0.0;
nFlags=0;
- sXRef[0]=0;
+ m_sXRef = "";
while (rDGR.Read()!=0)
{
switch (rDGR.GetG())
{
- case 2: strncpy( sName, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
- case 3: strncpy( sAlsoName, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 2: m_sName = OString(rDGR.GetS()); break;
+ case 3: m_sAlsoName = OString(rDGR.GetS()); break;
case 70: nFlags=rDGR.GetI(); break;
case 10: aBasePoint.fx=rDGR.GetF(); break;
case 20: aBasePoint.fy=rDGR.GetF(); break;
case 30: aBasePoint.fz=rDGR.GetF(); break;
- case 1: strncpy( sXRef, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 1: m_sXRef = OString(rDGR.GetS()); break;
}
}
DXFEntities::Read(rDGR);
@@ -104,11 +104,11 @@ void DXFBlocks::Read(DXFGroupReader & rDGR)
}
-DXFBlock * DXFBlocks::Search(const char * sName) const
+DXFBlock * DXFBlocks::Search(OString const& rName) const
{
DXFBlock * pB;
for (pB=pFirst; pB!=NULL; pB=pB->pSucc) {
- if (strcmp(sName,pB->sName)==0) break;
+ if (rName == pB->m_sName) break;
}
return pB;
}
diff --git a/filter/source/graphicfilter/idxf/dxfblkrd.hxx b/filter/source/graphicfilter/idxf/dxfblkrd.hxx
index bb687dc75f22..43bf631a3d64 100644
--- a/filter/source/graphicfilter/idxf/dxfblkrd.hxx
+++ b/filter/source/graphicfilter/idxf/dxfblkrd.hxx
@@ -34,11 +34,11 @@ public:
// Zeiger auf naechsten Block in der Liste DXFBlocks::pFirst
// Eigenschaften des Blocks, durch Gruppencodes kommentiert:
- char sName[DXF_MAX_STRING_LEN+1]; // 2
- char sAlsoName[DXF_MAX_STRING_LEN+1]; // 3
+ OString m_sName; // 2
+ OString m_sAlsoName; // 3
long nFlags; // 70
DXFVector aBasePoint; // 10,20,30
- char sXRef[DXF_MAX_STRING_LEN+1]; // 1
+ OString m_sXRef; // 1
DXFBlock();
~DXFBlock();
@@ -66,7 +66,7 @@ public:
void Read(DXFGroupReader & rDGR);
// Liesst alle Bloecke per rDGR bis zu einem ENDSEC oder EOF.
- DXFBlock * Search(const char * sName) const;
+ DXFBlock * Search(OString const& rName) const;
// Sucht einen Block mit dem Namen, liefert NULL bei Misserfolg.
void Clear();
diff --git a/filter/source/graphicfilter/idxf/dxfentrd.cxx b/filter/source/graphicfilter/idxf/dxfentrd.cxx
index 7f77a0878c68..910ba3d6bb4f 100644
--- a/filter/source/graphicfilter/idxf/dxfentrd.cxx
+++ b/filter/source/graphicfilter/idxf/dxfentrd.cxx
@@ -24,11 +24,11 @@
//--------------------------DXFBasicEntity--------------------------------------
DXFBasicEntity::DXFBasicEntity(DXFEntityType eThisType)
+ : m_sLayer("0")
+ , m_sLineType("BYLAYER")
{
eType=eThisType;
pSucc=NULL;
- strncpy(sLayer,"0", 2 );
- strncpy(sLineType,"BYLAYER", 8 );
fElevation=0;
fThickness=0;
nColor=256;
@@ -47,8 +47,8 @@ void DXFBasicEntity::EvaluateGroup(DXFGroupReader & rDGR)
{
switch (rDGR.GetG())
{
- case 8: strncpy( sLayer, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
- case 6: strncpy( sLineType, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 8: m_sLayer = OString(rDGR.GetS()); break;
+ case 6: m_sLineType = OString(rDGR.GetS()); break;
case 38: fElevation=rDGR.GetF(); break;
case 39: fThickness=rDGR.GetF(); break;
case 62: nColor=rDGR.GetI(); break;
@@ -190,14 +190,14 @@ void DXFSolidEntity::EvaluateGroup(DXFGroupReader & rDGR)
//--------------------------DXFTextEntity---------------------------------------
-DXFTextEntity::DXFTextEntity() : DXFBasicEntity(DXF_TEXT)
+DXFTextEntity::DXFTextEntity()
+ : DXFBasicEntity(DXF_TEXT)
+ , m_sStyle("STANDARD")
{
fHeight=1.0;
- sText[0]=0;
fRotAngle=0.0;
fXScale=1.0;
fOblAngle=0.0;
- strncpy( sStyle, "STANDARD", 9 );
nGenFlags=0;
nHorzJust=0;
nVertJust=0;
@@ -210,11 +210,11 @@ void DXFTextEntity::EvaluateGroup(DXFGroupReader & rDGR)
case 20: aP0.fy=rDGR.GetF(); break;
case 30: aP0.fz=rDGR.GetF(); break;
case 40: fHeight=rDGR.GetF(); break;
- case 1: strncpy( sText, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 1: m_sText = OString(rDGR.GetS()); break;
case 50: fRotAngle=rDGR.GetF(); break;
case 41: fXScale=rDGR.GetF(); break;
case 42: fOblAngle=rDGR.GetF(); break;
- case 7: strncpy( sStyle, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 7: m_sStyle = OString(rDGR.GetS()); break;
case 71: nGenFlags=rDGR.GetI(); break;
case 72: nHorzJust=rDGR.GetI(); break;
case 73: nVertJust=rDGR.GetI(); break;
@@ -230,7 +230,6 @@ void DXFTextEntity::EvaluateGroup(DXFGroupReader & rDGR)
DXFShapeEntity::DXFShapeEntity() : DXFBasicEntity(DXF_SHAPE)
{
fSize=1.0;
- sName[0]=0;
fRotAngle=0;
fXScale=1.0;
fOblAngle=0;
@@ -243,7 +242,7 @@ void DXFShapeEntity::EvaluateGroup(DXFGroupReader & rDGR)
case 20: aP0.fy=rDGR.GetF(); break;
case 30: aP0.fz=rDGR.GetF(); break;
case 40: fSize=rDGR.GetF(); break;
- case 2: strncpy( sName, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 2: m_sName = OString(rDGR.GetS()); break;
case 50: fRotAngle=rDGR.GetF(); break;
case 41: fXScale=rDGR.GetF(); break;
case 51: fOblAngle=rDGR.GetF(); break;
@@ -256,7 +255,6 @@ void DXFShapeEntity::EvaluateGroup(DXFGroupReader & rDGR)
DXFInsertEntity::DXFInsertEntity() : DXFBasicEntity(DXF_INSERT)
{
nAttrFlag=0;
- sName[0]=0;
fXScale=1.0;
fYScale=1.0;
fZScale=1.0;
@@ -271,7 +269,7 @@ void DXFInsertEntity::EvaluateGroup(DXFGroupReader & rDGR)
{
switch (rDGR.GetG()) {
case 66: nAttrFlag=rDGR.GetI(); break;
- case 2: strncpy( sName, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 2: m_sName = OString(rDGR.GetS()); break;
case 10: aP0.fx=rDGR.GetF(); break;
case 20: aP0.fy=rDGR.GetF(); break;
case 30: aP0.fz=rDGR.GetF(); break;
@@ -289,18 +287,16 @@ void DXFInsertEntity::EvaluateGroup(DXFGroupReader & rDGR)
//--------------------------DXFAttDefEntity-------------------------------------
-DXFAttDefEntity::DXFAttDefEntity() : DXFBasicEntity(DXF_ATTDEF)
+DXFAttDefEntity::DXFAttDefEntity()
+ : DXFBasicEntity(DXF_ATTDEF)
+ , m_sStyle("STANDARD")
{
fHeight=1.0;
- sDefVal[0]=0;
- sPrompt[0]=0;
- sTagStr[0]=0;
nAttrFlags=0;
nFieldLen=0;
fRotAngle=0.0;
fXScale=1.0;
fOblAngle=0.0;
- strncpy( sStyle, "STANDARD", 9 );
nGenFlags=0;
nHorzJust=0;
nVertJust=0;
@@ -313,15 +309,15 @@ void DXFAttDefEntity::EvaluateGroup(DXFGroupReader & rDGR)
case 20: aP0.fy=rDGR.GetF(); break;
case 30: aP0.fz=rDGR.GetF(); break;
case 40: fHeight=rDGR.GetF(); break;
- case 1: strncpy( sDefVal, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
- case 3: strncpy( sPrompt, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
- case 2: strncpy( sTagStr, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 1: m_sDefVal = OString(rDGR.GetS()); break;
+ case 3: m_sPrompt = OString(rDGR.GetS()); break;
+ case 2: m_sTagStr = OString(rDGR.GetS()); break;
case 70: nAttrFlags=rDGR.GetI(); break;
case 73: nFieldLen=rDGR.GetI(); break;
case 50: fRotAngle=rDGR.GetF(); break;
case 41: fXScale=rDGR.GetF(); break;
case 51: fOblAngle=rDGR.GetF(); break;
- case 7: strncpy( sStyle, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 7: m_sStyle = OString(rDGR.GetS()); break;
case 71: nGenFlags=rDGR.GetI(); break;
case 72: nHorzJust=rDGR.GetI(); break;
case 74: nVertJust=rDGR.GetI(); break;
@@ -334,17 +330,16 @@ void DXFAttDefEntity::EvaluateGroup(DXFGroupReader & rDGR)
//--------------------------DXFAttribEntity-------------------------------------
-DXFAttribEntity::DXFAttribEntity() : DXFBasicEntity(DXF_ATTRIB)
+DXFAttribEntity::DXFAttribEntity()
+ : DXFBasicEntity(DXF_ATTRIB)
+ , m_sStyle("STANDARD")
{
fHeight=1.0;
- sText[0]=0;
- sTagStr[0]=0;
nAttrFlags=0;
nFieldLen=0;
fRotAngle=0.0;
fXScale=1.0;
fOblAngle=0.0;
- strncpy( sStyle, "STANDARD", 9 );
nGenFlags=0;
nHorzJust=0;
nVertJust=0;
@@ -357,14 +352,14 @@ void DXFAttribEntity::EvaluateGroup(DXFGroupReader & rDGR)
case 20: aP0.fy=rDGR.GetF(); break;
case 30: aP0.fz=rDGR.GetF(); break;
case 40: fHeight=rDGR.GetF(); break;
- case 1: strncpy( sText, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
- case 2: strncpy( sTagStr, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 1: m_sText = OString(rDGR.GetS()); break;
+ case 2: m_sTagStr = OString(rDGR.GetS()); break;
case 70: nAttrFlags=rDGR.GetI(); break;
case 73: nFieldLen=rDGR.GetI(); break;
case 50: fRotAngle=rDGR.GetF(); break;
case 41: fXScale=rDGR.GetF(); break;
case 51: fOblAngle=rDGR.GetF(); break;
- case 7: strncpy( sStyle, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 7: m_sStyle = OString(rDGR.GetS()); break;
case 71: nGenFlags=rDGR.GetI(); break;
case 72: nHorzJust=rDGR.GetI(); break;
case 74: nVertJust=rDGR.GetI(); break;
@@ -790,13 +785,12 @@ void DXF3DFaceEntity::EvaluateGroup(DXFGroupReader & rDGR)
DXFDimensionEntity::DXFDimensionEntity() : DXFBasicEntity(DXF_DIMENSION)
{
- sPseudoBlock[0]=0;
}
void DXFDimensionEntity::EvaluateGroup(DXFGroupReader & rDGR)
{
switch (rDGR.GetG()) {
- case 2: strncpy( sPseudoBlock, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
+ case 2: m_sPseudoBlock = OString(rDGR.GetS()); break;
default: DXFBasicEntity::EvaluateGroup(rDGR);
}
}
diff --git a/filter/source/graphicfilter/idxf/dxfentrd.hxx b/filter/source/graphicfilter/idxf/dxfentrd.hxx
index f0c8a92ab60d..2a88788f7a51 100644
--- a/filter/source/graphicfilter/idxf/dxfentrd.hxx
+++ b/filter/source/graphicfilter/idxf/dxfentrd.hxx
@@ -68,8 +68,8 @@ public:
// Eigenschaftenm, die alle Entities besitzen, jeweils
// durch den Gruppencode kommentiert:
- char sLayer[DXF_MAX_STRING_LEN+1]; // 8
- char sLineType[DXF_MAX_STRING_LEN+1]; // 6
+ OString m_sLayer; // 8
+ OString m_sLineType; // 6
double fElevation; // 38
double fThickness; // 39
long nColor; // 62
@@ -210,11 +210,11 @@ public:
DXFVector aP0; // 10,20,30
double fHeight; // 40
- char sText[DXF_MAX_STRING_LEN+1]; // 1
+ OString m_sText; // 1
double fRotAngle; // 50
double fXScale; // 41
double fOblAngle; // 42
- char sStyle[DXF_MAX_STRING_LEN+1]; // 7
+ OString m_sStyle; // 7
long nGenFlags; // 71
long nHorzJust; // 72
long nVertJust; // 73
@@ -235,7 +235,7 @@ public:
DXFVector aP0; // 10,20,30
double fSize; // 40
- char sName[DXF_MAX_STRING_LEN+1]; // 2
+ OString m_sName; // 2
double fRotAngle; // 50
double fXScale; // 41
double fOblAngle; // 51
@@ -254,7 +254,7 @@ class DXFInsertEntity : public DXFBasicEntity {
public:
long nAttrFlag; // 66
- char sName[DXF_MAX_STRING_LEN+1]; // 2
+ OString m_sName; // 2
DXFVector aP0; // 10,20,30
double fXScale; // 41
double fYScale; // 42
@@ -280,15 +280,15 @@ public:
DXFVector aP0; // 10,20,30
double fHeight; // 40
- char sDefVal[DXF_MAX_STRING_LEN+1]; // 1
- char sPrompt[DXF_MAX_STRING_LEN+1]; // 3
- char sTagStr[DXF_MAX_STRING_LEN+1]; // 2
+ OString m_sDefVal; // 1
+ OString m_sPrompt; // 3
+ OString m_sTagStr; // 2
long nAttrFlags; // 70
long nFieldLen; // 73
double fRotAngle; // 50
double fXScale; // 41
double fOblAngle; // 51
- char sStyle[DXF_MAX_STRING_LEN+1]; // 7
+ OString m_sStyle; // 7
long nGenFlags; // 71
long nHorzJust; // 72
long nVertJust; // 74
@@ -309,14 +309,14 @@ public:
DXFVector aP0; // 10,20,30
double fHeight; // 40
- char sText[DXF_MAX_STRING_LEN+1]; // 1
- char sTagStr[DXF_MAX_STRING_LEN+1]; // 2
+ OString m_sText; // 1
+ OString m_sTagStr; // 2
long nAttrFlags; // 70
long nFieldLen; // 73
double fRotAngle; // 50
double fXScale; // 41
double fOblAngle; // 51
- char sStyle[DXF_MAX_STRING_LEN+1]; // 7
+ OString m_sStyle; // 7
long nGenFlags; // 71
long nHorzJust; // 72
long nVertJust; // 74
@@ -542,7 +542,7 @@ class DXFDimensionEntity : public DXFBasicEntity {
public:
- char sPseudoBlock[DXF_MAX_STRING_LEN+1]; // 2
+ OString m_sPseudoBlock; // 2
DXFDimensionEntity();
diff --git a/filter/source/graphicfilter/idxf/dxfreprd.cxx b/filter/source/graphicfilter/idxf/dxfreprd.cxx
index 7a2c93a9d276..3ed02322f688 100644
--- a/filter/source/graphicfilter/idxf/dxfreprd.cxx
+++ b/filter/source/graphicfilter/idxf/dxfreprd.cxx
@@ -299,7 +299,7 @@ void DXFRepresentation::CalcBoundingBox(const DXFEntities & rEntities,
DXFBlock * pB;
DXFBoundingBox aBox;
DXFVector aP;
- pB=aBlocks.Search(pE->sName);
+ pB=aBlocks.Search(pE->m_sName);
if (pB==NULL) break;
CalcBoundingBox(*pB,aBox);
if (aBox.bEmpty==sal_True) break;
@@ -341,7 +341,7 @@ void DXFRepresentation::CalcBoundingBox(const DXFEntities & rEntities,
DXFBlock * pB;
DXFBoundingBox aBox;
DXFVector aP;
- pB=aBlocks.Search(pE->sPseudoBlock);
+ pB = aBlocks.Search(pE->m_sPseudoBlock);
if (pB==NULL) break;
CalcBoundingBox(*pB,aBox);
if (aBox.bEmpty==sal_True) break;
diff --git a/filter/source/graphicfilter/idxf/dxftblrd.cxx b/filter/source/graphicfilter/idxf/dxftblrd.cxx
index f99de87a6df7..eff56636a114 100644
--- a/filter/source/graphicfilter/idxf/dxftblrd.cxx
+++ b/filter/source/graphicfilter/idxf/dxftblrd.cxx
@@ -26,9 +26,7 @@
DXFLType::DXFLType()
{
pSucc=NULL;
- sName[0]=0;
nFlags=0;
- sDescription[0]=0;
nDashCount=0;
}
@@ -41,12 +39,10 @@ void DXFLType::Read(DXFGroupReader & rDGR)
switch (rDGR.GetG())
{
case 2:
- strncpy( sName, rDGR.GetS(), DXF_MAX_STRING_LEN );
- sName[DXF_MAX_STRING_LEN] = 0;
+ m_sName = OString(rDGR.GetS());
break;
case 3:
- strncpy( sDescription, rDGR.GetS(), DXF_MAX_STRING_LEN );
- sDescription[DXF_MAX_STRING_LEN] = 0;
+ m_sDescription = OString(rDGR.GetS());
break;
case 70:
nFlags=rDGR.GetI();
@@ -85,10 +81,8 @@ void DXFLType::Read(DXFGroupReader & rDGR)
DXFLayer::DXFLayer()
{
pSucc=NULL;
- sName[0]=0;
nFlags=0;
nColor=-1;
- sLineType[0]=0;
}
void DXFLayer::Read(DXFGroupReader & rDGR)
@@ -98,12 +92,10 @@ void DXFLayer::Read(DXFGroupReader & rDGR)
switch(rDGR.GetG())
{
case 2:
- strncpy( sName, rDGR.GetS(), DXF_MAX_STRING_LEN );
- sName[DXF_MAX_STRING_LEN] = 0;
+ m_sName = OString(rDGR.GetS());
break;
case 6:
- strncpy( sLineType, rDGR.GetS(), DXF_MAX_STRING_LEN );
- sLineType[DXF_MAX_STRING_LEN] = 0;
+ m_sLineType = OString(rDGR.GetS());
break;
case 70:
nFlags=rDGR.GetI();
@@ -120,15 +112,12 @@ void DXFLayer::Read(DXFGroupReader & rDGR)
DXFStyle::DXFStyle()
{
pSucc=NULL;
- sName[0]=0;
nFlags=0;
fHeight=0.0;
fWidthFak=1.0;
fOblAngle=0.0;
nTextGenFlags=0;
fLastHeightUsed=0.0;
- sPrimFontFile[0]=0;
- sBigFontFile[0]=0;
}
void DXFStyle::Read(DXFGroupReader & rDGR)
@@ -138,16 +127,13 @@ void DXFStyle::Read(DXFGroupReader & rDGR)
switch(rDGR.GetG())
{
case 2:
- strncpy( sName, rDGR.GetS(), DXF_MAX_STRING_LEN );
- sName[DXF_MAX_STRING_LEN] = 0;
+ m_sName = OString(rDGR.GetS());
break;
case 3:
- strncpy( sPrimFontFile, rDGR.GetS(), DXF_MAX_STRING_LEN );
- sPrimFontFile[DXF_MAX_STRING_LEN] = 0;
+ m_sPrimFontFile = OString(rDGR.GetS());
break;
case 4:
- strncpy( sBigFontFile, rDGR.GetS(), DXF_MAX_STRING_LEN );
- sBigFontFile[DXF_MAX_STRING_LEN] = 0;
+ m_sBigFontFile = OString(rDGR.GetS());
break;
case 70:
nFlags=rDGR.GetI();
@@ -177,7 +163,6 @@ DXFVPort::DXFVPort()
{
pSucc=NULL;
- sName[0]=0;
nFlags=0;
fMinX=0;
fMinY=0;
@@ -218,8 +203,7 @@ void DXFVPort::Read(DXFGroupReader & rDGR)
switch(rDGR.GetG())
{
case 2:
- strncpy( sName, rDGR.GetS(), DXF_MAX_STRING_LEN);
- sName[DXF_MAX_STRING_LEN] = 0;
+ m_sName = OString(rDGR.GetS());
break;
case 10: fMinX=rDGR.GetF(); break;
case 11: fMaxX=rDGR.GetF(); break;
@@ -360,31 +344,31 @@ void DXFTables::Clear()
}
-DXFLType * DXFTables::SearchLType(const char * pName) const
+DXFLType * DXFTables::SearchLType(OString const& rName) const
{
DXFLType * p;
for (p=pLTypes; p!=NULL; p=p->pSucc) {
- if (strcmp(pName,p->sName)==0) break;
+ if (rName == p->m_sName) break;
}
return p;
}
-DXFLayer * DXFTables::SearchLayer(const char * pName) const
+DXFLayer * DXFTables::SearchLayer(OString const& rName) const
{
DXFLayer * p;
for (p=pLayers; p!=NULL; p=p->pSucc) {
- if (strcmp(pName,p->sName)==0) break;
+ if (rName == p->m_sName) break;
}
return p;
}
-DXFVPort * DXFTables::SearchVPort(const char * pName) const
+DXFVPort * DXFTables::SearchVPort(OString const& rName) const
{
DXFVPort * p;
for (p=pVPorts; p!=NULL; p=p->pSucc) {
- if (strcmp(pName,p->sName)==0) break;
+ if (rName == p->m_sName) break;
}
return p;
}
diff --git a/filter/source/graphicfilter/idxf/dxftblrd.hxx b/filter/source/graphicfilter/idxf/dxftblrd.hxx
index 359351455340..5d33f1ad723b 100644
--- a/filter/source/graphicfilter/idxf/dxftblrd.hxx
+++ b/filter/source/graphicfilter/idxf/dxftblrd.hxx
@@ -36,9 +36,9 @@ public:
DXFLType * pSucc;
- char sName[DXF_MAX_STRING_LEN+1]; // 2
+ OString m_sName; // 2
long nFlags; // 70
- char sDescription[DXF_MAX_STRING_LEN+1]; // 3
+ OString m_sDescription; // 3
long nDashCount; // 73
double fPatternLength; // 40
double fDash[DXF_MAX_DASH_COUNT]; // 49,49,...
@@ -58,10 +58,10 @@ public:
DXFLayer * pSucc;
- char sName[DXF_MAX_STRING_LEN+1]; // 2
+ OString m_sName; // 2
long nFlags; // 70
long nColor; // 62
- char sLineType[DXF_MAX_STRING_LEN+1]; // 6
+ OString m_sLineType; // 6
DXFLayer();
void Read(DXFGroupReader & rDGR);
@@ -78,15 +78,15 @@ public:
DXFStyle * pSucc;
- char sName[DXF_MAX_STRING_LEN+1]; // 2
+ OString m_sName; // 2
long nFlags; // 70
double fHeight; // 40
double fWidthFak; // 41
double fOblAngle; // 50
long nTextGenFlags; // 71
double fLastHeightUsed; // 42
- char sPrimFontFile[DXF_MAX_STRING_LEN+1]; // 3
- char sBigFontFile[DXF_MAX_STRING_LEN+1]; // 4
+ OString m_sPrimFontFile; // 3
+ OString m_sBigFontFile; // 4
DXFStyle();
void Read(DXFGroupReader & rDGR);
@@ -103,7 +103,7 @@ public:
DXFVPort * pSucc;
- char sName[DXF_MAX_STRING_LEN+1]; // 2
+ OString m_sName; // 2
long nFlags; // 70
double fMinX; // 10
double fMinY; // 20
@@ -164,9 +164,9 @@ public:
void Clear();
// Suche nach Tabelleneintraegen:
- DXFLType * SearchLType(const char * pName) const;
- DXFLayer * SearchLayer(const char * pName) const;
- DXFVPort * SearchVPort(const char * pName) const;
+ DXFLType * SearchLType(OString const& rName) const;
+ DXFLayer * SearchLayer(OString const& rName) const;
+ DXFVPort * SearchVPort(OString const& rName) const;
};