summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-12-19 14:48:43 +0000
committerCaolán McNamara <caolanm@redhat.com>2011-12-19 14:51:28 +0000
commit71b63586c5fe33fdf836ecb417d11f9c2d4e4b72 (patch)
tree91f821513393d109cdf4b62683145b10185862fe
parent8f480ee6289bc0a4e8100957789fce0966c7e5a9 (diff)
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.
-rw-r--r--svtools/source/filter/filter.cxx36
1 files changed, 18 insertions, 18 deletions
diff --git a/svtools/source/filter/filter.cxx b/svtools/source/filter/filter.cxx
index ef07514285df..f61990b3abc3 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 ------------------------------------