[Libreoffice-commits] .: Branch 'libreoffice-3-5' - svtools/source
Caolán McNamara
caolan at kemper.freedesktop.org
Mon Dec 19 06:53:28 PST 2011
svtools/source/filter/filter.cxx | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
New commits:
commit 05d602e41958a5c60773884ade725f3a8e051064
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Dec 19 14:48:43 2011 +0000
Resolves: fdo#43082 can't claim its not a DXF just because didn't see SECTION
typedetection doesn't know about 999 COMMENT, it should really.
(cherry picked from commit 71b63586c5fe33fdf836ecb417d11f9c2d4e4b72)
Signed-off-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/svtools/source/filter/filter.cxx b/svtools/source/filter/filter.cxx
index ef07514..f61990b 100644
--- a/svtools/source/filter/filter.cxx
+++ b/svtools/source/filter/filter.cxx
@@ -497,36 +497,36 @@ static sal_Bool ImpPeekGraphicFormat( SvStream& rStream, String& rFormatExtensio
//--------------------------- DXF ------------------------------------
if( !bTest || ( rFormatExtension.CompareToAscii( "DXF", 3 ) == COMPARE_EQUAL ) )
{
- bSomethingTested=sal_True;
+ //Binary DXF File Format
+ if( strncmp( (const char*) sFirstBytes, "AutoCAD Binary DXF", 18 ) == 0 )
+ {
+ rFormatExtension = UniString::CreateFromAscii( "DXF", 3 );
+ return sal_True;
+ }
+ //ASCII DXF File Format
i=0;
while (i<256 && sFirstBytes[i]<=32)
- i++;
+ ++i;
- if (i<256)
+ if (i<256 && sFirstBytes[i]=='0')
{
- if( sFirstBytes[i]=='0' )
- i++;
- else
- i=256;
- }
- while( i<256 && sFirstBytes[i]<=32 )
- i++;
+ ++i;
- if (i+7<256)
- {
- if (strncmp((char*)(sFirstBytes+i),"SECTION",7)==0)
+ //only now do we have sufficient data to make a judgement
+ //based on a '0' + 'SECTION' == DXF argument
+ bSomethingTested=sal_True;
+
+ while( i<256 && sFirstBytes[i]<=32 )
+ ++i;
+
+ if (i+7<256 && (strncmp((const char*)(sFirstBytes+i),"SECTION",7)==0))
{
rFormatExtension = UniString::CreateFromAscii( "DXF", 3 );
return sal_True;
}
}
- if( strncmp( (char*) sFirstBytes, "AutoCAD Binary DXF", 18 ) == 0 )
- {
- rFormatExtension = UniString::CreateFromAscii( "DXF", 3 );
- return sal_True;
- }
}
//--------------------------- PCT ------------------------------------
More information about the Libreoffice-commits
mailing list