-// 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")); \
+ // there's no risk of this happening in ANSI build
+#if wxUSE_UNICODE
+ if ( bufSize > 4 && str.empty() )
+ {
+ wxLogError(_("Failed to convert file \"%s\" to Unicode."), GetName());
+ return false;