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
2df047bf
Kaydet (Commit)
2df047bf
authored
Eki 11, 2013
tarafından
Michael Meeks
Kaydeden (comit)
Matúš Kukan
Eki 17, 2013
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fastparser: cache default namespace token for ooxml.
Change-Id: Iee98ec92380d6d0404ab236e062ddbc2378cda43
üst
c293e73e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
15 deletions
+29
-15
fastparser.cxx
sax/source/fastparser/fastparser.cxx
+18
-12
fastparser.hxx
sax/source/fastparser/fastparser.hxx
+11
-3
No files found.
sax/source/fastparser/fastparser.cxx
Dosyayı görüntüle @
2df047bf
...
@@ -420,10 +420,8 @@ OUString FastSaxParser::GetNamespaceURL( const sal_Char*pPrefix, int nPrefixLen
...
@@ -420,10 +420,8 @@ OUString FastSaxParser::GetNamespaceURL( const sal_Char*pPrefix, int nPrefixLen
// --------------------------------------------------------------------
// --------------------------------------------------------------------
sal_Int32
FastSaxParser
::
GetTokenWith
NamespaceURL
(
const
OUString
&
rNamespaceURL
,
const
sal_Char
*
pName
,
int
nNameLen
)
sal_Int32
FastSaxParser
::
GetTokenWith
ContextNamespace
(
sal_Int32
nNamespaceToken
,
const
sal_Char
*
pName
,
int
nNameLen
)
{
{
sal_Int32
nNamespaceToken
=
GetNamespaceToken
(
rNamespaceURL
);
if
(
nNamespaceToken
!=
FastToken
::
DONTKNOW
)
if
(
nNamespaceToken
!=
FastToken
::
DONTKNOW
)
{
{
sal_Int32
nNameToken
=
GetToken
(
pName
,
nNameLen
);
sal_Int32
nNameToken
=
GetToken
(
pName
,
nNameLen
);
...
@@ -749,9 +747,13 @@ void FastSaxParser::callbackStartElement( const XML_Char* pwName, const XML_Char
...
@@ -749,9 +747,13 @@ void FastSaxParser::callbackStartElement( const XML_Char* pwName, const XML_Char
sal_Int32
nNameLen
,
nPrefixLen
;
sal_Int32
nNameLen
,
nPrefixLen
;
const
XML_Char
*
pName
;
const
XML_Char
*
pName
;
const
XML_Char
*
pPrefix
;
const
XML_Char
*
pPrefix
;
OUString
aNamespace
;
OUString
sNamespace
;
sal_Int32
nNamespaceToken
=
FastToken
::
DONTKNOW
;
if
(
!
rEntity
.
maNamespaceStack
.
empty
())
if
(
!
rEntity
.
maNamespaceStack
.
empty
())
aNamespace
=
rEntity
.
maNamespaceStack
.
top
();
{
sNamespace
=
rEntity
.
maNamespaceStack
.
top
().
msName
;
nNamespaceToken
=
rEntity
.
maNamespaceStack
.
top
().
mnToken
;
}
try
try
{
{
...
@@ -777,8 +779,9 @@ void FastSaxParser::callbackStartElement( const XML_Char* pwName, const XML_Char
...
@@ -777,8 +779,9 @@ void FastSaxParser::callbackStartElement( const XML_Char* pwName, const XML_Char
{
{
if
(
(
nNameLen
==
5
)
&&
(
strcmp
(
pName
,
"xmlns"
)
==
0
)
)
if
(
(
nNameLen
==
5
)
&&
(
strcmp
(
pName
,
"xmlns"
)
==
0
)
)
{
{
// namespace of the element found
// default namespace is the attribute value
aNamespace
=
OUString
(
awAttributes
[
i
+
1
],
strlen
(
awAttributes
[
i
+
1
]
),
RTL_TEXTENCODING_UTF8
);
sNamespace
=
OUString
(
awAttributes
[
i
+
1
],
strlen
(
awAttributes
[
i
+
1
]
),
RTL_TEXTENCODING_UTF8
);
nNamespaceToken
=
GetNamespaceToken
(
sNamespace
);
}
}
}
}
}
}
...
@@ -816,17 +819,20 @@ void FastSaxParser::callbackStartElement( const XML_Char* pwName, const XML_Char
...
@@ -816,17 +819,20 @@ void FastSaxParser::callbackStartElement( const XML_Char* pwName, const XML_Char
splitName
(
pwName
,
pPrefix
,
nPrefixLen
,
pName
,
nNameLen
);
splitName
(
pwName
,
pPrefix
,
nPrefixLen
,
pName
,
nNameLen
);
if
(
nPrefixLen
>
0
)
if
(
nPrefixLen
>
0
)
nElementToken
=
GetTokenWithPrefix
(
pPrefix
,
nPrefixLen
,
pName
,
nNameLen
);
nElementToken
=
GetTokenWithPrefix
(
pPrefix
,
nPrefixLen
,
pName
,
nNameLen
);
else
if
(
!
a
Namespace
.
isEmpty
()
)
else
if
(
!
s
Namespace
.
isEmpty
()
)
nElementToken
=
GetTokenWith
NamespaceURL
(
aNamespace
,
pName
,
nNameLen
);
nElementToken
=
GetTokenWith
ContextNamespace
(
nNamespaceToken
,
pName
,
nNameLen
);
else
else
nElementToken
=
GetToken
(
pName
);
nElementToken
=
GetToken
(
pName
);
if
(
nElementToken
==
FastToken
::
DONTKNOW
)
if
(
nElementToken
==
FastToken
::
DONTKNOW
)
if
(
nPrefixLen
>
0
)
if
(
nPrefixLen
>
0
)
aNamespace
=
GetNamespaceURL
(
pPrefix
,
nPrefixLen
);
{
sNamespace
=
GetNamespaceURL
(
pPrefix
,
nPrefixLen
);
nNamespaceToken
=
GetNamespaceToken
(
sNamespace
);
}
rEntity
.
maNamespaceStack
.
push
(
aNamespace
);
rEntity
.
maNamespaceStack
.
push
(
NameWithToken
(
sNamespace
,
nNamespaceToken
)
);
rEntity
.
startElement
(
nElementToken
,
a
Namespace
,
rEntity
.
startElement
(
nElementToken
,
s
Namespace
,
OUString
(
pName
,
nNameLen
,
RTL_TEXTENCODING_UTF8
),
rEntity
.
mxAttributes
.
get
()
);
OUString
(
pName
,
nNameLen
,
RTL_TEXTENCODING_UTF8
),
rEntity
.
mxAttributes
.
get
()
);
}
}
catch
(
const
Exception
&
e
)
catch
(
const
Exception
&
e
)
...
...
sax/source/fastparser/fastparser.hxx
Dosyayı görüntüle @
2df047bf
...
@@ -51,6 +51,14 @@ typedef ::boost::shared_ptr< NamespaceDefine > NamespaceDefineRef;
...
@@ -51,6 +51,14 @@ typedef ::boost::shared_ptr< NamespaceDefine > NamespaceDefineRef;
typedef
::
boost
::
unordered_map
<
OUString
,
sal_Int32
,
typedef
::
boost
::
unordered_map
<
OUString
,
sal_Int32
,
OUStringHash
,
::
std
::
equal_to
<
OUString
>
>
NamespaceMap
;
OUStringHash
,
::
std
::
equal_to
<
OUString
>
>
NamespaceMap
;
struct
NameWithToken
{
OUString
msName
;
sal_Int32
mnToken
;
NameWithToken
(
const
OUString
&
sName
,
const
sal_Int32
&
nToken
)
:
msName
(
sName
),
mnToken
(
nToken
)
{}
};
// --------------------------------------------------------------------
// --------------------------------------------------------------------
struct
SaxContext
struct
SaxContext
...
@@ -90,7 +98,7 @@ struct Entity : public ParserData
...
@@ -90,7 +98,7 @@ struct Entity : public ParserData
// therefore the exception must be saved somewhere.
// therefore the exception must be saved somewhere.
::
com
::
sun
::
star
::
uno
::
Any
maSavedException
;
::
com
::
sun
::
star
::
uno
::
Any
maSavedException
;
::
std
::
stack
<
OUString
>
maNamespaceStack
;
::
std
::
stack
<
NameWithToken
>
maNamespaceStack
;
/* Context for main thread consuming events.
/* Context for main thread consuming events.
* startElement() stores the data, which characters() and endElement() uses
* startElement() stores the data, which characters() and endElement() uses
*/
*/
...
@@ -138,7 +146,7 @@ public:
...
@@ -138,7 +146,7 @@ public:
void
callbackStartElement
(
const
XML_Char
*
name
,
const
XML_Char
**
atts
);
void
callbackStartElement
(
const
XML_Char
*
name
,
const
XML_Char
**
atts
);
void
callbackEndElement
(
const
XML_Char
*
name
);
void
callbackEndElement
(
const
XML_Char
*
name
);
void
callbackCharacters
(
const
XML_Char
*
s
,
int
nLen
);
void
callbackCharacters
(
const
XML_Char
*
s
,
int
nLen
);
int
callbackExternalEntityRef
(
XML_Parser
parser
,
const
XML_Char
*
openEntityNames
,
const
XML_Char
*
base
,
const
XML_Char
*
systemId
,
const
XML_Char
*
publicId
);
int
callbackExternalEntityRef
(
XML_Parser
parser
,
const
XML_Char
*
openEntityNames
,
const
XML_Char
*
base
,
const
XML_Char
*
systemId
,
const
XML_Char
*
publicId
);
void
callbackEntityDecl
(
const
XML_Char
*
entityName
,
int
is_parameter_entity
,
void
callbackEntityDecl
(
const
XML_Char
*
entityName
,
int
is_parameter_entity
,
const
XML_Char
*
value
,
int
value_length
,
const
XML_Char
*
base
,
const
XML_Char
*
value
,
int
value_length
,
const
XML_Char
*
base
,
const
XML_Char
*
systemId
,
const
XML_Char
*
publicId
,
const
XML_Char
*
systemId
,
const
XML_Char
*
publicId
,
...
@@ -156,7 +164,7 @@ private:
...
@@ -156,7 +164,7 @@ private:
OUString
GetNamespaceURL
(
const
OString
&
rPrefix
)
throw
(
::
com
::
sun
::
star
::
xml
::
sax
::
SAXException
);
OUString
GetNamespaceURL
(
const
OString
&
rPrefix
)
throw
(
::
com
::
sun
::
star
::
xml
::
sax
::
SAXException
);
OUString
GetNamespaceURL
(
const
sal_Char
*
pPrefix
,
int
nPrefixLen
)
throw
(
::
com
::
sun
::
star
::
xml
::
sax
::
SAXException
);
OUString
GetNamespaceURL
(
const
sal_Char
*
pPrefix
,
int
nPrefixLen
)
throw
(
::
com
::
sun
::
star
::
xml
::
sax
::
SAXException
);
sal_Int32
GetNamespaceToken
(
const
OUString
&
rNamespaceURL
);
sal_Int32
GetNamespaceToken
(
const
OUString
&
rNamespaceURL
);
sal_Int32
GetTokenWith
NamespaceURL
(
const
OUString
&
rNamespaceURL
,
const
sal_Char
*
pName
,
int
nNameLen
);
sal_Int32
GetTokenWith
ContextNamespace
(
sal_Int32
nNamespaceToken
,
const
sal_Char
*
pName
,
int
nNameLen
);
void
DefineNamespace
(
const
OString
&
rPrefix
,
const
sal_Char
*
pNamespaceURL
);
void
DefineNamespace
(
const
OString
&
rPrefix
,
const
sal_Char
*
pNamespaceURL
);
void
pushContext
();
void
pushContext
();
...
...
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