summaryrefslogtreecommitdiff
path: root/svtools
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:53:23 +0000
commit05d602e41958a5c60773884ade725f3a8e051064 (patch)
tree3ade5524662ae7d4794ee1261a4541f3daec8a92 /svtools
parentf6c3626822852cef831f1aca4c33187aaaa66b0c (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. (cherry picked from commit 71b63586c5fe33fdf836ecb417d11f9c2d4e4b72) Signed-off-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svtools')
-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 ------------------------------------