-// analyse some lines of the file trying to guess it's type.
-// if it fails, it assumes the native type for our platform.
-wxTextFileType wxTextFile::GuessType() const
-{
- wxASSERT( IsOpened() );
-
- // scan the file lines
- size_t nUnix = 0, // number of '\n's alone
- nDos = 0, // number of '\r\n'
- nMac = 0; // number of '\r's
-
- // we take MAX_LINES_SCAN in the beginning, middle and the end of file
- #define MAX_LINES_SCAN (10)
- size_t nCount = m_aLines.Count() / 3,
- nScan = nCount > 3*MAX_LINES_SCAN ? MAX_LINES_SCAN : nCount / 3;
-
- #define AnalyseLine(n) \
- switch ( m_aTypes[n] ) { \
- case wxTextFileType_Unix: nUnix++; break; \
- case wxTextFileType_Dos: nDos++; break; \
- case wxTextFileType_Mac: nMac++; break; \
- default: wxFAIL_MSG(_("unknown line terminator")); \
- }
+ case '\r':
+ if ( chLast == '\r' )
+ {
+ // Mac empty line
+ AddLine(wxEmptyString, wxTextFileType_Mac);
+ lineStart = p + 1;
+ }
+ //else: we don't know what this is yet -- could be a Mac EOL or
+ // start of DOS EOL so wait for next char
+ break;