Kaydet (Commit) 71b63586 authored tarafından Caolán McNamara's avatar Caolán McNamara

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.
üst 8f480ee6
......@@ -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 ------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment