Subject: Re: Patch: XHTML importer .htm files
From: Andrew Dunbar (hippietrail@yahoo.com)
Date: Sat May 19 2001 - 13:27:54 CDT
Sam TH wrote:
> 
> On Sat, May 19, 2001 at 11:17:53AM -0700, Aaron Lehmann wrote:
> > On Sat, May 19, 2001 at 01:26:44PM -0500, Sam TH wrote:
> > > > Why should it?
> > >
> > > Since some documents have a .htm extension?  Why shouldn't it?
> >
> > Besides, I am strongly of the opinion that any file operations should
> > be filename-neutral.
> 
> Well, first it tries to recognize contents, but if that fails, would
> you rather it just gave up?
We actually check the filename before the contents but I definitely
agree we should check the contents first:
>From ie_imp.cpp / 170:
        if (ieft == IEFT_Unknown)
        {
                ieft = IE_Imp::fileTypeForSuffix(UT_pathSuffix(szFilename));
        }
        if (ieft == IEFT_Unknown)
        {
                char szBuf[4096];  // 4096 ought to be enough
                int iNumbytes;
                FILE *f;
                // we must open in binary mode for UCS-2 compatibility
                if ( ( f = fopen( szFilename, "rb" ) ) != (FILE *)0 )
                {
                        iNumbytes = fread(szBuf, 1, sizeof(szBuf), f);
                        fclose(f);
                        ieft = IE_Imp::fileTypeForContents(szBuf, iNumbytes);
                }
        }
Andrew Dunbar.
-- http://linguaphile.sourceforge.net _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
This archive was generated by hypermail 2b25 : Sat May 26 2001 - 03:51:05 CDT