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
dbf87d21
Kaydet (Commit)
dbf87d21
authored
Eyl 16, 2016
tarafından
Michael Stahl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
coverity#1372990 xmloff: use unique_ptr for RewindMaps
Change-Id: I51e67607d94a465ce39e822f01a0c60efbf1a0f0
üst
c480677f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
18 deletions
+19
-18
xmlictxt.hxx
include/xmloff/xmlictxt.hxx
+3
-3
xmlimp.hxx
include/xmloff/xmlimp.hxx
+3
-2
xmlimp.cxx
xmloff/source/core/xmlimp.cxx
+13
-13
No files found.
include/xmloff/xmlictxt.hxx
Dosyayı görüntüle @
dbf87d21
...
@@ -43,10 +43,10 @@ class XMLOFF_DLLPUBLIC SvXMLImportContext : public ::cppu::WeakImplHelper1< ::cs
...
@@ -43,10 +43,10 @@ class XMLOFF_DLLPUBLIC SvXMLImportContext : public ::cppu::WeakImplHelper1< ::cs
sal_uInt16
mnPrefix
;
sal_uInt16
mnPrefix
;
OUString
maLocalName
;
OUString
maLocalName
;
std
::
unique_ptr
<
SvXMLNamespaceMap
>
mx
RewindMap
;
std
::
unique_ptr
<
SvXMLNamespaceMap
>
m_p
RewindMap
;
SAL_DLLPRIVATE
SvXMLNamespaceMap
*
TakeRewindMap
()
{
return
mxRewindMap
.
release
(
);
}
SAL_DLLPRIVATE
std
::
unique_ptr
<
SvXMLNamespaceMap
>
TakeRewindMap
()
{
return
std
::
move
(
m_pRewindMap
);
}
SAL_DLLPRIVATE
void
PutRewindMap
(
SvXMLNamespaceMap
*
p
)
{
mxRewindMap
.
reset
(
p
);
}
SAL_DLLPRIVATE
void
PutRewindMap
(
std
::
unique_ptr
<
SvXMLNamespaceMap
>
p
)
{
m_pRewindMap
=
std
::
move
(
p
);
}
protected
:
protected
:
...
...
include/xmloff/xmlimp.hxx
Dosyayı görüntüle @
dbf87d21
...
@@ -175,7 +175,7 @@ class XMLOFF_DLLPUBLIC SvXMLImport : public ::cppu::WeakImplHelper8<
...
@@ -175,7 +175,7 @@ class XMLOFF_DLLPUBLIC SvXMLImport : public ::cppu::WeakImplHelper8<
std
::
unique_ptr
<
SvXMLImport_Impl
>
mpImpl
;
// dummy
std
::
unique_ptr
<
SvXMLImport_Impl
>
mpImpl
;
// dummy
SvXMLNamespaceMap
*
mpNamespaceMap
;
std
::
unique_ptr
<
SvXMLNamespaceMap
>
mpNamespaceMap
;
std
::
unique_ptr
<
SvXMLUnitConverter
>
mpUnitConv
;
std
::
unique_ptr
<
SvXMLUnitConverter
>
mpUnitConv
;
SvXMLImportContexts_Impl
maContexts
;
SvXMLImportContexts_Impl
maContexts
;
FastSvXMLImportContexts_Impl
maFastContexts
;
FastSvXMLImportContexts_Impl
maFastContexts
;
...
@@ -200,7 +200,8 @@ class XMLOFF_DLLPUBLIC SvXMLImport : public ::cppu::WeakImplHelper8<
...
@@ -200,7 +200,8 @@ class XMLOFF_DLLPUBLIC SvXMLImport : public ::cppu::WeakImplHelper8<
const
OUString
getNamespacePrefixFromToken
(
sal_Int32
nToken
);
const
OUString
getNamespacePrefixFromToken
(
sal_Int32
nToken
);
void
registerNamespaces
();
void
registerNamespaces
();
void
registerNSHelper
(
sal_Int32
nToken
,
sal_Int32
nPrefix
,
sal_Int32
nNamespace
);
void
registerNSHelper
(
sal_Int32
nToken
,
sal_Int32
nPrefix
,
sal_Int32
nNamespace
);
SvXMLNamespaceMap
*
processNSAttributes
(
const
css
::
uno
::
Reference
<
css
::
xml
::
sax
::
XAttributeList
>&
xAttrList
);
std
::
unique_ptr
<
SvXMLNamespaceMap
>
processNSAttributes
(
const
css
::
uno
::
Reference
<
css
::
xml
::
sax
::
XAttributeList
>&
xAttrList
);
void
Characters
(
const
OUString
&
aChars
);
void
Characters
(
const
OUString
&
aChars
);
protected
:
protected
:
...
...
xmloff/source/core/xmlimp.cxx
Dosyayı görüntüle @
dbf87d21
...
@@ -447,8 +447,6 @@ SvXMLImport::SvXMLImport(
...
@@ -447,8 +447,6 @@ SvXMLImport::SvXMLImport(
SvXMLImport
::~
SvXMLImport
()
throw
()
SvXMLImport
::~
SvXMLImport
()
throw
()
{
{
delete
mpNamespaceMap
;
if
(
mxEventListener
.
is
()
&&
mxModel
.
is
())
if
(
mxEventListener
.
is
()
&&
mxModel
.
is
())
mxModel
->
removeEventListener
(
mxEventListener
);
mxModel
->
removeEventListener
(
mxEventListener
);
}
}
...
@@ -659,9 +657,10 @@ void SAL_CALL SvXMLImport::endDocument()
...
@@ -659,9 +657,10 @@ void SAL_CALL SvXMLImport::endDocument()
}
}
}
}
SvXMLNamespaceMap
*
SvXMLImport
::
processNSAttributes
(
const
uno
::
Reference
<
xml
::
sax
::
XAttributeList
>&
xAttrList
)
std
::
unique_ptr
<
SvXMLNamespaceMap
>
SvXMLImport
::
processNSAttributes
(
const
uno
::
Reference
<
xml
::
sax
::
XAttributeList
>&
xAttrList
)
{
{
SvXMLNamespaceMap
*
pRewindMap
=
nullptr
;
std
::
unique_ptr
<
SvXMLNamespaceMap
>
pRewindMap
;
sal_Int16
nAttrCount
=
xAttrList
.
is
()
?
xAttrList
->
getLength
()
:
0
;
sal_Int16
nAttrCount
=
xAttrList
.
is
()
?
xAttrList
->
getLength
()
:
0
;
for
(
sal_Int16
i
=
0
;
i
<
nAttrCount
;
i
++
)
for
(
sal_Int16
i
=
0
;
i
<
nAttrCount
;
i
++
)
{
{
...
@@ -685,8 +684,8 @@ SvXMLNamespaceMap* SvXMLImport::processNSAttributes(const uno::Reference< xml::s
...
@@ -685,8 +684,8 @@ SvXMLNamespaceMap* SvXMLImport::processNSAttributes(const uno::Reference< xml::s
{
{
if
(
!
pRewindMap
)
if
(
!
pRewindMap
)
{
{
pRewindMap
=
mpNamespaceMap
;
pRewindMap
=
std
::
move
(
mpNamespaceMap
)
;
mpNamespaceMap
=
new
SvXMLNamespaceMap
(
*
mpNamespaceMap
);
mpNamespaceMap
.
reset
(
new
SvXMLNamespaceMap
(
*
pRewindMap
)
);
}
}
const
OUString
&
rAttrValue
=
xAttrList
->
getValueByIndex
(
i
);
const
OUString
&
rAttrValue
=
xAttrList
->
getValueByIndex
(
i
);
...
@@ -719,7 +718,7 @@ void SAL_CALL SvXMLImport::startElement( const OUString& rName,
...
@@ -719,7 +718,7 @@ void SAL_CALL SvXMLImport::startElement( const OUString& rName,
// SAL_INFO("svg", "startElement " << rName);
// SAL_INFO("svg", "startElement " << rName);
// Process namespace attributes. This must happen before creating the
// Process namespace attributes. This must happen before creating the
// context, because namespace decaration apply to the element name itself.
// context, because namespace decaration apply to the element name itself.
SvXMLNamespaceMap
*
pRewindMap
=
processNSAttributes
(
xAttrList
);
std
::
unique_ptr
<
SvXMLNamespaceMap
>
pRewindMap
(
processNSAttributes
(
xAttrList
)
);
// Get element's namespace and local name.
// Get element's namespace and local name.
OUString
aLocalName
;
OUString
aLocalName
;
...
@@ -759,7 +758,7 @@ void SAL_CALL SvXMLImport::startElement( const OUString& rName,
...
@@ -759,7 +758,7 @@ void SAL_CALL SvXMLImport::startElement( const OUString& rName,
// Remember old namespace map.
// Remember old namespace map.
if
(
pRewindMap
)
if
(
pRewindMap
)
xContext
->
PutRewindMap
(
pRewindMap
);
xContext
->
PutRewindMap
(
std
::
move
(
pRewindMap
)
);
// Call a startElement at the new context.
// Call a startElement at the new context.
xContext
->
StartElement
(
xAttrList
);
xContext
->
StartElement
(
xAttrList
);
...
@@ -782,7 +781,7 @@ rName
...
@@ -782,7 +781,7 @@ rName
return
;
return
;
}
}
SvXMLNamespaceMap
*
pRewindMap
(
nullptr
)
;
std
::
unique_ptr
<
SvXMLNamespaceMap
>
pRewindMap
;
{
{
// Get topmost context and remove it from the stack.
// Get topmost context and remove it from the stack.
...
@@ -808,8 +807,8 @@ rName
...
@@ -808,8 +807,8 @@ rName
// Rewind a namespace map.
// Rewind a namespace map.
if
(
pRewindMap
)
if
(
pRewindMap
)
{
{
delete
mpNamespaceMap
;
mpNamespaceMap
.
reset
()
;
mpNamespaceMap
=
pRewindMap
;
mpNamespaceMap
=
std
::
move
(
pRewindMap
)
;
}
}
}
}
...
@@ -879,10 +878,11 @@ void SAL_CALL SvXMLImport::startFastElement (sal_Int32 Element,
...
@@ -879,10 +878,11 @@ void SAL_CALL SvXMLImport::startFastElement (sal_Int32 Element,
{
{
rtl
::
Reference
<
comphelper
::
AttributeList
>
rAttrList
=
new
comphelper
::
AttributeList
;
rtl
::
Reference
<
comphelper
::
AttributeList
>
rAttrList
=
new
comphelper
::
AttributeList
;
maNamespaceHandler
->
addNSDeclAttributes
(
rAttrList
);
maNamespaceHandler
->
addNSDeclAttributes
(
rAttrList
);
SvXMLNamespaceMap
*
pRewindMap
=
processNSAttributes
(
rAttrList
.
get
());
std
::
unique_ptr
<
SvXMLNamespaceMap
>
pRewindMap
(
processNSAttributes
(
rAttrList
.
get
()));
SvXMLImportContext
*
pContext
=
dynamic_cast
<
SvXMLImportContext
*>
(
xContext
.
get
()
);
SvXMLImportContext
*
pContext
=
dynamic_cast
<
SvXMLImportContext
*>
(
xContext
.
get
()
);
if
(
pContext
&&
pRewindMap
)
if
(
pContext
&&
pRewindMap
)
pContext
->
PutRewindMap
(
pRewindMap
);
pContext
->
PutRewindMap
(
std
::
move
(
pRewindMap
)
);
maContexts
.
push_back
(
pContext
);
maContexts
.
push_back
(
pContext
);
}
}
...
...
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