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
8ac129a5
Kaydet (Commit)
8ac129a5
authored
Eyl 10, 2015
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Handle IOException during filter detection
Change-Id: Ie2b8b65f0f2b7b34efbba478a7ccda7ef3719bd6
üst
90b0a547
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
77 deletions
+86
-77
svgfilter.cxx
filter/source/svg/svgfilter.cxx
+30
-26
filterdet.cxx
sdext/source/pdfimport/filterdet.cxx
+56
-51
No files found.
filter/source/svg/svgfilter.cxx
Dosyayı görüntüle @
8ac129a5
...
@@ -360,32 +360,36 @@ OUString SAL_CALL SVGFilter::detect(Sequence<PropertyValue>& rDescriptor) throw
...
@@ -360,32 +360,36 @@ OUString SAL_CALL SVGFilter::detect(Sequence<PropertyValue>& rDescriptor) throw
if
(
!
xInput
.
is
())
if
(
!
xInput
.
is
())
return
OUString
();
return
OUString
();
if
(
isStreamGZip
(
xInput
))
try
{
{
if
(
isStreamGZip
(
xInput
))
boost
::
scoped_ptr
<
SvStream
>
aStream
(
utl
::
UcbStreamHelper
::
CreateStream
(
xInput
,
true
));
{
if
(
!
aStream
.
get
())
boost
::
scoped_ptr
<
SvStream
>
aStream
(
utl
::
UcbStreamHelper
::
CreateStream
(
xInput
,
true
));
return
OUString
();
if
(
!
aStream
.
get
())
return
OUString
();
SvStream
*
pMemoryStream
=
new
SvMemoryStream
;
uno
::
Reference
<
io
::
XSeekable
>
xSeek
(
xInput
,
uno
::
UNO_QUERY
);
SvStream
*
pMemoryStream
=
new
SvMemoryStream
;
if
(
!
xSeek
.
is
())
uno
::
Reference
<
io
::
XSeekable
>
xSeek
(
xInput
,
uno
::
UNO_QUERY
);
return
OUString
();
if
(
!
xSeek
.
is
())
xSeek
->
seek
(
0
);
return
OUString
();
xSeek
->
seek
(
0
);
ZCodec
aCodec
;
aCodec
.
BeginCompression
(
ZCODEC_DEFAULT_COMPRESSION
,
false
,
true
);
ZCodec
aCodec
;
aCodec
.
Decompress
(
*
aStream
.
get
(),
*
pMemoryStream
);
aCodec
.
BeginCompression
(
ZCODEC_DEFAULT_COMPRESSION
,
false
,
true
);
aCodec
.
EndCompression
();
aCodec
.
Decompress
(
*
aStream
.
get
(),
*
pMemoryStream
);
pMemoryStream
->
Seek
(
STREAM_SEEK_TO_BEGIN
);
aCodec
.
EndCompression
();
uno
::
Reference
<
io
::
XInputStream
>
xDecompressedInput
(
new
utl
::
OSeekableInputStreamWrapper
(
pMemoryStream
,
true
));
pMemoryStream
->
Seek
(
STREAM_SEEK_TO_BEGIN
);
uno
::
Reference
<
io
::
XInputStream
>
xDecompressedInput
(
new
utl
::
OSeekableInputStreamWrapper
(
pMemoryStream
,
true
));
if
(
xDecompressedInput
.
is
()
&&
isStreamSvg
(
xDecompressedInput
))
return
OUString
(
constFilterName
);
if
(
xDecompressedInput
.
is
()
&&
isStreamSvg
(
xDecompressedInput
))
}
return
OUString
(
constFilterName
);
else
}
{
else
if
(
isStreamSvg
(
xInput
))
{
return
OUString
(
constFilterName
);
if
(
isStreamSvg
(
xInput
))
return
OUString
(
constFilterName
);
}
}
catch
(
css
::
io
::
IOException
&
e
)
{
SAL_WARN
(
"filter"
,
"caught IOException "
+
e
.
Message
);
}
}
return
OUString
();
return
OUString
();
}
}
...
...
sdext/source/pdfimport/filterdet.cxx
Dosyayı görüntüle @
8ac129a5
...
@@ -229,73 +229,78 @@ OUString SAL_CALL PDFDetector::detect( uno::Sequence< beans::PropertyValue >& rF
...
@@ -229,73 +229,78 @@ OUString SAL_CALL PDFDetector::detect( uno::Sequence< beans::PropertyValue >& rF
}
}
if
(
xInput
.
is
()
)
if
(
xInput
.
is
()
)
{
{
uno
::
Reference
<
io
::
XSeekable
>
xSeek
(
xInput
,
uno
::
UNO_QUERY
);
oslFileHandle
aFile
=
NULL
;
if
(
xSeek
.
is
()
)
try
{
xSeek
->
seek
(
0
);
uno
::
Reference
<
io
::
XSeekable
>
xSeek
(
xInput
,
uno
::
UNO_QUERY
);
// read the first 1024 byte (see PDF reference implementation note 12)
if
(
xSeek
.
is
()
)
const
sal_Int32
nHeaderSize
=
1024
;
xSeek
->
seek
(
0
);
uno
::
Sequence
<
sal_Int8
>
aBuf
(
nHeaderSize
);
// read the first 1024 byte (see PDF reference implementation note 12)
sal_uInt64
nBytes
=
0
;
const
sal_Int32
nHeaderSize
=
1024
;
nBytes
=
xInput
->
readBytes
(
aBuf
,
nHeaderSize
);
uno
::
Sequence
<
sal_Int8
>
aBuf
(
nHeaderSize
);
if
(
nBytes
>
5
)
sal_uInt64
nBytes
=
0
;
{
nBytes
=
xInput
->
readBytes
(
aBuf
,
nHeaderSize
);
const
sal_Int8
*
pBytes
=
aBuf
.
getConstArray
();
if
(
nBytes
>
5
)
for
(
unsigned
int
i
=
0
;
i
<
nBytes
-
5
;
i
++
)
{
{
if
(
pBytes
[
i
]
==
'%'
&&
const
sal_Int8
*
pBytes
=
aBuf
.
getConstArray
();
pBytes
[
i
+
1
]
==
'P'
&&
for
(
unsigned
int
i
=
0
;
i
<
nBytes
-
5
;
i
++
)
pBytes
[
i
+
2
]
==
'D'
&&
pBytes
[
i
+
3
]
==
'F'
&&
pBytes
[
i
+
4
]
==
'-'
)
{
{
bSuccess
=
true
;
if
(
pBytes
[
i
]
==
'%'
&&
break
;
pBytes
[
i
+
1
]
==
'P'
&&
pBytes
[
i
+
2
]
==
'D'
&&
pBytes
[
i
+
3
]
==
'F'
&&
pBytes
[
i
+
4
]
==
'-'
)
{
bSuccess
=
true
;
break
;
}
}
}
}
}
}
// check for hybrid PDF
// check for hybrid PDF
oslFileHandle
aFile
=
NULL
;
if
(
bSuccess
&&
if
(
bSuccess
&&
(
aURL
.
isEmpty
()
||
!
comphelper
::
isFileUrl
(
aURL
)
)
(
aURL
.
isEmpty
()
||
!
comphelper
::
isFileUrl
(
aURL
)
)
)
)
{
sal_uInt64
nWritten
=
0
;
if
(
osl_createTempFile
(
NULL
,
&
aFile
,
&
aURL
.
pData
)
!=
osl_File_E_None
)
{
bSuccess
=
false
;
}
else
{
{
sal_uInt64
nWritten
=
0
;
if
(
osl_createTempFile
(
NULL
,
&
aFile
,
&
aURL
.
pData
)
!=
osl_File_E_None
)
{
bSuccess
=
false
;
}
else
{
#if OSL_DEBUG_LEVEL > 1
#if OSL_DEBUG_LEVEL > 1
OSL_TRACE
(
"created temp file %s
\n
"
,
OSL_TRACE
(
"created temp file %s
\n
"
,
OUStringToOString
(
aURL
,
RTL_TEXTENCODING_UTF8
).
getStr
()
);
OUStringToOString
(
aURL
,
RTL_TEXTENCODING_UTF8
).
getStr
()
);
#endif
#endif
osl_writeFile
(
aFile
,
aBuf
.
getConstArray
(),
nBytes
,
&
nWritten
);
osl_writeFile
(
aFile
,
aBuf
.
getConstArray
(),
nBytes
,
&
nWritten
);
OSL_ENSURE
(
nWritten
==
nBytes
,
"writing of header bytes failed"
);
OSL_ENSURE
(
nWritten
==
nBytes
,
"writing of header bytes failed"
);
if
(
nWritten
==
nBytes
)
if
(
nWritten
==
nBytes
)
{
const
sal_uInt32
nBufSize
=
4096
;
aBuf
=
uno
::
Sequence
<
sal_Int8
>
(
nBufSize
);
// copy the bytes
do
{
{
nBytes
=
xInput
->
readBytes
(
aBuf
,
nBufSize
);
const
sal_uInt32
nBufSize
=
4096
;
if
(
nBytes
>
0
)
aBuf
=
uno
::
Sequence
<
sal_Int8
>
(
nBufSize
);
// copy the bytes
do
{
{
osl_writeFile
(
aFile
,
aBuf
.
getConstArray
(),
nBytes
,
&
nWritten
);
nBytes
=
xInput
->
readBytes
(
aBuf
,
nBufSize
);
if
(
n
Written
!=
nBytes
)
if
(
n
Bytes
>
0
)
{
{
bSuccess
=
false
;
osl_writeFile
(
aFile
,
aBuf
.
getConstArray
(),
nBytes
,
&
nWritten
);
break
;
if
(
nWritten
!=
nBytes
)
{
bSuccess
=
false
;
break
;
}
}
}
}
}
while
(
nBytes
==
nBufSize
);
}
while
(
nBytes
==
nBufSize
);
}
}
}
osl_closeFile
(
aFile
);
}
}
osl_closeFile
(
aFile
);
}
catch
(
css
::
io
::
IOException
&
e
)
{
SAL_WARN
(
"sdext.pdfimport"
,
"caught IOException "
+
e
.
Message
);
return
OUString
();
}
}
OUString
aEmbedMimetype
;
OUString
aEmbedMimetype
;
xEmbedStream
=
getAdditionalStream
(
aURL
,
aEmbedMimetype
,
aPwd
,
m_xContext
,
rFilterData
,
false
);
xEmbedStream
=
getAdditionalStream
(
aURL
,
aEmbedMimetype
,
aPwd
,
m_xContext
,
rFilterData
,
false
);
...
...
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