Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
ea3e7188
Kaydet (Commit)
ea3e7188
authored
Tem 06, 2017
tarafından
Michael Stahl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
sw: convert SwNumberTree::IsSane to assert() and simplify
Change-Id: Ib2087a53d2a22f5fdafa5c3d0d058dd0ad8ed643
üst
a0dc0d3c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
55 deletions
+28
-55
SwNumberTree.hxx
sw/inc/SwNumberTree.hxx
+4
-7
SwNumberTree.cxx
sw/source/core/SwNumberTree/SwNumberTree.cxx
+24
-48
No files found.
sw/inc/SwNumberTree.hxx
Dosyayı görüntüle @
ea3e7188
...
...
@@ -346,7 +346,7 @@ public:
@retval true the structure of this node is sane
@retval false else
*/
bool
IsSane
(
bool
bRecursive
)
const
;
void
IsSane
(
bool
bRecursive
)
const
;
#endif // DBG_UTIL
protected
:
...
...
@@ -391,15 +391,12 @@ protected:
virtual
void
PostRemove
()
=
0
;
#ifdef DBG_UTIL
/**
Sanity check with loop detection.
/** Sanity check with loop detection.
@param bRecursive descend to children
@param rParents vector for recording path
@retval true this node is sane
@retval false else */
virtual
bool
IsSane
*/
virtual
void
IsSane
(
bool
bRecursive
,
std
::
vector
<
const
SwNumberTreeNode
*>
rParents
)
const
;
#endif // DBG_UTIL
...
...
sw/source/core/SwNumberTree/SwNumberTree.cxx
Dosyayı görüntüle @
ea3e7188
...
...
@@ -23,6 +23,8 @@
#include <osl/diagnose.h>
#include <sal/log.hxx>
#include <cassert>
using
std
::
vector
;
using
std
::
find
;
...
...
@@ -385,7 +387,8 @@ void SwNumberTreeNode::MoveGreaterChildren( SwNumberTreeNode& _rCompareNode,
}
#ifdef DBG_UTIL
SAL_WARN_IF
(
!
IsSane
(
false
)
||
!
_rDestNode
.
IsSane
(
true
),
"sw.core"
,
"insanity"
);
IsSane
(
false
);
_rDestNode
.
IsSane
(
true
);
#endif
}
...
...
@@ -433,7 +436,8 @@ void SwNumberTreeNode::MoveChildren(SwNumberTreeNode * pDest)
OSL_ENSURE
(
mChildren
.
empty
(),
"MoveChildren failed!"
);
#ifdef DBG_UTIL
OSL_ENSURE
(
IsSane
(
false
)
&&
pDest
->
IsSane
(
false
),
"insanity!"
);
IsSane
(
false
);
pDest
->
IsSane
(
false
);
#endif
}
...
...
@@ -585,7 +589,7 @@ void SwNumberTreeNode::AddChild( SwNumberTreeNode * pChild,
}
#ifdef DBG_UTIL
SAL_WARN_IF
(
!
IsSane
(
false
),
"sw.core"
,
"insanity"
);
IsSane
(
false
);
#endif
}
...
...
@@ -678,7 +682,7 @@ void SwNumberTreeNode::RemoveMe()
pSavedParent
->
ClearObsoletePhantoms
();
#ifdef DBG_UTIL
SAL_WARN_IF
(
!
IsSane
(
false
),
"sw.core"
,
"insanity"
);
IsSane
(
false
);
#endif
}
}
...
...
@@ -857,34 +861,22 @@ SwNumberTreeNode::GetChildCount() const
}
#ifdef DBG_UTIL
bool
SwNumberTreeNode
::
IsSane
(
bool
bRecursive
)
const
void
SwNumberTreeNode
::
IsSane
(
bool
bRecursive
)
const
{
vector
<
const
SwNumberTreeNode
*>
aParents
;
return
IsSane
(
bRecursive
,
aParents
);
}
bool
SwNumberTreeNode
::
IsSane
(
bool
bRecursive
,
void
SwNumberTreeNode
::
IsSane
(
bool
bRecursive
,
vector
<
const
SwNumberTreeNode
*>
rParents
)
const
{
bool
bResult
=
true
;
tSwNumberTreeChildren
::
const_iterator
aIt
;
if
(
find
(
rParents
.
begin
(),
rParents
.
end
(),
this
)
!=
rParents
.
end
())
{
OSL_FAIL
(
" I'm my own ancestor!"
);
bResult
=
false
;
}
assert
(
find
(
rParents
.
begin
(),
rParents
.
end
(),
this
)
==
rParents
.
end
());
if
(
!
rParents
.
empty
()
&&
rParents
.
back
()
!=
mpParent
)
{
OSL_FAIL
(
" I'm a bastard!"
);
bResult
=
false
;
}
assert
(
rParents
.
empty
()
||
rParents
.
back
()
==
mpParent
);
rParents
.
push_back
(
this
);
...
...
@@ -895,49 +887,33 @@ bool SwNumberTreeNode::IsSane(bool bRecursive,
{
if
((
*
aIt
)
->
IsPhantom
())
{
if
((
*
aIt
)
->
HasOnlyPhantoms
())
{
bResult
=
false
;
}
SAL_WARN_IF
((
*
aIt
)
->
HasOnlyPhantoms
(),
"sw.core"
,
"HasOnlyPhantoms: is this an error?"
);
if
(
!
bFirst
)
{
OSL_FAIL
(
" found phantom not at first position."
);
bResult
=
false
;
}
assert
(
bFirst
&&
"found phantom not at first position."
);
}
if
((
*
aIt
)
->
mpParent
!=
(
SwNumberTreeNode
*
)
this
)
{
OSL_FAIL
(
"found a bastard"
);
bResult
=
false
;
}
assert
((
*
aIt
)
->
mpParent
==
this
);
if
(
mpParent
)
{
if
(
!
(
*
aIt
)
->
IsPhantom
()
&&
(
*
aIt
)
->
LessThan
(
*
this
))
{
OSL_FAIL
(
" found child less than me"
);
bResult
=
false
;
}
assert
((
*
aIt
)
->
IsPhantom
()
||
!
(
*
aIt
)
->
LessThan
(
*
this
));
}
}
else
{
OSL_FAIL
(
"found child that is NULL"
);
bResult
=
false
;
assert
(
!
"found child that is NULL"
);
}
if
(
bRecursive
)
bResult
=
(
*
aIt
)
->
IsSane
(
bRecursive
,
rParents
)
&&
bResult
;
if
(
bRecursive
)
{
(
*
aIt
)
->
IsSane
(
bRecursive
,
rParents
);
}
bFirst
=
false
;
}
rParents
.
pop_back
();
return
bResult
;
}
#endif // DBG_UTIL
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment