// headers
// ============================================================================
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "textfile.h"
#endif
char *strBuf, *strPtr, *strEnd;
char ch, chLast = '\0';
char buf[1024];
- int n, nRead;
+ size_t nRead;
strPtr = strBuf = new char[1024];
strEnd = strBuf + 1024;
- do
+ do
{
nRead = m_file.Read(buf, WXSIZEOF(buf));
- if ( nRead == wxInvalidOffset )
+ if ( nRead == (size_t)wxInvalidOffset )
{
// read error (error message already given in wxFile::Read)
delete[] strBuf;
- return FALSE;
+ return false;
}
- for (n = 0; n < nRead; n++)
+ for (size_t n = 0; n < nRead; n++)
{
ch = buf[n];
- switch ( ch )
+ switch ( ch )
{
case '\n':
// Dos/Unix line termination
*strPtr = '\0';
- AddLine(wxString(strBuf, conv),
+ AddLine(wxString(strBuf, conv),
chLast == '\r' ? wxTextFileType_Dos
: wxTextFileType_Unix);
strPtr = strBuf;
break;
case '\r':
- if ( chLast == '\r' )
+ if ( chLast == '\r' )
{
// Mac empty line
AddLine(wxEmptyString, wxTextFileType_Mac);
strPtr = strBuf;
*(strPtr++) = ch;
}
- else
+ else
{
// add to the current line
*(strPtr++) = ch;
} while ( nRead == WXSIZEOF(buf) );
// anything in the last line?
- if ( strPtr != strBuf )
+ if ( strPtr != strBuf )
{
*strPtr = '\0';
- AddLine(wxString(strBuf, conv),
+ AddLine(wxString(strBuf, conv),
wxTextFileType_None); // no line terminator
}
delete[] strBuf;
- return TRUE;
+ return true;
}
if ( !fileTmp.IsOpened() ) {
wxLogError(_("can't write buffer '%s' to disk."), m_strBufferName.c_str());
- return FALSE;
+ return false;
}
size_t nCount = GetLineCount();