Cleaning up unicode conversion and fixing 64bit issues
This commit is contained in:
parent
cf370eb03c
commit
096e5e955e
5 changed files with 79 additions and 78 deletions
|
@ -280,8 +280,8 @@ void CData_mirrorDlg::updateList ()
|
||||||
{
|
{
|
||||||
// Add the items
|
// Add the items
|
||||||
const CEntryFile &entry = *ite;
|
const CEntryFile &entry = *ite;
|
||||||
uint nItem = List.InsertItem (0, utf8ToTStr(entry.Strings[CEntryFile::Path]), entry.Image);
|
uint nItem = List.InsertItem(0, nlUtf8ToTStr(entry.Strings[CEntryFile::Path]), entry.Image);
|
||||||
List.SetItemData (nItem, DWORD(new std::list<CEntryFile>::iterator (ite)));
|
List.SetItemData (nItem, DWORD_PTR(new std::list<CEntryFile>::iterator (ite)));
|
||||||
|
|
||||||
// Sub string
|
// Sub string
|
||||||
subString = 1;
|
subString = 1;
|
||||||
|
@ -289,25 +289,25 @@ void CData_mirrorDlg::updateList ()
|
||||||
// Add the sizes
|
// Add the sizes
|
||||||
if (ModifiedFilter != Removed)
|
if (ModifiedFilter != Removed)
|
||||||
{
|
{
|
||||||
List.SetItemText (nItem, subString++, utf8ToTStr(entry.Strings[CEntryFile::NewSize]));
|
List.SetItemText(nItem, subString++, nlUtf8ToTStr(entry.Strings[CEntryFile::NewSize]));
|
||||||
}
|
}
|
||||||
if (ModifiedFilter != Added)
|
if (ModifiedFilter != Added)
|
||||||
{
|
{
|
||||||
List.SetItemText (nItem, subString++, utf8ToTStr(entry.Strings[CEntryFile::OldSize]));
|
List.SetItemText(nItem, subString++, nlUtf8ToTStr(entry.Strings[CEntryFile::OldSize]));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the dates
|
// Add the dates
|
||||||
if (ModifiedFilter != Removed)
|
if (ModifiedFilter != Removed)
|
||||||
{
|
{
|
||||||
List.SetItemText (nItem, subString++, utf8ToTStr(entry.Strings[CEntryFile::NewDate]));
|
List.SetItemText(nItem, subString++, nlUtf8ToTStr(entry.Strings[CEntryFile::NewDate]));
|
||||||
}
|
}
|
||||||
if (ModifiedFilter != Added)
|
if (ModifiedFilter != Added)
|
||||||
{
|
{
|
||||||
List.SetItemText (nItem, subString++, utf8ToTStr(entry.Strings[CEntryFile::OldDate]));
|
List.SetItemText(nItem, subString++, nlUtf8ToTStr(entry.Strings[CEntryFile::OldDate]));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the type
|
// Add the type
|
||||||
List.SetItemText (nItem, subString++, utf8ToTStr(entry.Strings[CEntryFile::Type]));
|
List.SetItemText(nItem, subString++, nlUtf8ToTStr(entry.Strings[CEntryFile::Type]));
|
||||||
|
|
||||||
// Next item
|
// Next item
|
||||||
ite++;
|
ite++;
|
||||||
|
@ -410,7 +410,7 @@ void createDirectory (const string &dir)
|
||||||
|
|
||||||
bool setFileTime(const std::string &filename, const FILETIME &result)
|
bool setFileTime(const std::string &filename, const FILETIME &result)
|
||||||
{
|
{
|
||||||
HANDLE handle = CreateFile (utf8ToTStr(filename), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
HANDLE handle = CreateFile(nlUtf8ToTStr(filename), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
if (handle)
|
if (handle)
|
||||||
{
|
{
|
||||||
SetFileTime (handle, NULL, NULL, &result);
|
SetFileTime (handle, NULL, NULL, &result);
|
||||||
|
@ -450,18 +450,18 @@ void CData_mirrorDlg::OnOK()
|
||||||
{
|
{
|
||||||
// Copy it
|
// Copy it
|
||||||
const string &itemText = modifiedList[i];
|
const string &itemText = modifiedList[i];
|
||||||
string source = MainDirectory+itemText;
|
string source = MainDirectory + itemText;
|
||||||
string dest = MirrorDirectory+itemText;
|
string dest = MirrorDirectory + itemText;
|
||||||
|
|
||||||
progress.DisplayString = "Copy \"" + source + "\" to \"" + dest + "\"";
|
|
||||||
progress.progress (float(currentFile++)/(float(totalCount)));
|
|
||||||
|
|
||||||
string directory = NLMISC::CFile::getPath (dest);
|
progress.DisplayString = "Copy \"" + source + "\" to \"" + dest + "\"";
|
||||||
createDirectory (directory.c_str ());
|
progress.progress(float(currentFile++) / (float(totalCount)));
|
||||||
if (!CopyFile (source.c_str (), dest.c_str (), FALSE))
|
|
||||||
|
string directory = NLMISC::CFile::getPath(dest);
|
||||||
|
createDirectory(directory.c_str());
|
||||||
|
if (!CopyFile(nlUtf8ToTStr(source), nlUtf8ToTStr(dest), FALSE))
|
||||||
{
|
{
|
||||||
MessageBox (("Can't copy file "+source+" in file "+dest).c_str (), _T("NeL Data Mirror"),
|
MessageBox(nlUtf8ToTStr("Can't copy file " + source + " in file " + dest), _T("NeL Data Mirror"),
|
||||||
MB_OK|MB_ICONEXCLAMATION);
|
MB_OK | MB_ICONEXCLAMATION);
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -497,9 +497,9 @@ void CData_mirrorDlg::OnOK()
|
||||||
progress.progress (float(currentFile++)/(float(totalCount)));
|
progress.progress (float(currentFile++)/(float(totalCount)));
|
||||||
|
|
||||||
createDirectory (directory.c_str ());
|
createDirectory (directory.c_str ());
|
||||||
if (!CopyFile (source.c_str (), dest.c_str (), FALSE))
|
if (!CopyFile(nlUtf8ToTStr(source), nlUtf8ToTStr(dest), FALSE))
|
||||||
{
|
{
|
||||||
MessageBox (("Can't copy file "+source+" in file "+dest).c_str (), _T("NeL Data Mirror"),
|
MessageBox(nlUtf8ToTStr("Can't copy file " + source + " in file " + dest), _T("NeL Data Mirror"),
|
||||||
MB_OK|MB_ICONEXCLAMATION);
|
MB_OK|MB_ICONEXCLAMATION);
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
@ -532,9 +532,9 @@ void CData_mirrorDlg::OnOK()
|
||||||
progress.DisplayString = "Delete \"" + dest + "\"";
|
progress.DisplayString = "Delete \"" + dest + "\"";
|
||||||
progress.progress (float(currentFile++)/(float(totalCount)));
|
progress.progress (float(currentFile++)/(float(totalCount)));
|
||||||
|
|
||||||
if (!DeleteFile (dest.c_str ()))
|
if (!DeleteFile(nlUtf8ToTStr(dest)))
|
||||||
{
|
{
|
||||||
MessageBox (("Can't delete the file "+dest).c_str (), _T("NeL Data Mirror"),
|
MessageBox(nlUtf8ToTStr("Can't delete the file " + dest), _T("NeL Data Mirror"),
|
||||||
MB_OK|MB_ICONEXCLAMATION);
|
MB_OK|MB_ICONEXCLAMATION);
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
@ -596,7 +596,7 @@ void CData_mirrorDlg::OnSize(UINT nType, int cx, int cy)
|
||||||
|
|
||||||
bool getFileTime (const std::string &filename, FILETIME &result)
|
bool getFileTime (const std::string &filename, FILETIME &result)
|
||||||
{
|
{
|
||||||
HANDLE handle = CreateFile (utf8ToTStr(filename), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
HANDLE handle = CreateFile(nlUtf8ToTStr(filename), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
if (handle)
|
if (handle)
|
||||||
{
|
{
|
||||||
FILETIME res0;
|
FILETIME res0;
|
||||||
|
@ -700,7 +700,7 @@ void CData_mirrorDlg::buildSourceFiles ()
|
||||||
{
|
{
|
||||||
FILETIME time;
|
FILETIME time;
|
||||||
getFileTime (mainFile, time);
|
getFileTime (mainFile, time);
|
||||||
addEntry (Added, str, time, time);
|
addEntry (Added, str.c_str(), time, time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -812,7 +812,7 @@ void CData_mirrorDlg::addEntry (uint where, const char *filename, FILETIME &newD
|
||||||
// Get the image
|
// Get the image
|
||||||
SHFILEINFO sfi;
|
SHFILEINFO sfi;
|
||||||
TCHAR winName[512];
|
TCHAR winName[512];
|
||||||
_tcscpy (winName, utf8ToTStr(aFilename));
|
_tcscpy(winName, nlUtf8ToTStr(aFilename));
|
||||||
TCHAR *ptr = winName;
|
TCHAR *ptr = winName;
|
||||||
while (*ptr)
|
while (*ptr)
|
||||||
{
|
{
|
||||||
|
|
|
@ -147,8 +147,8 @@ void CPlugInSelector::OnSelchangeList1()
|
||||||
AfxMessageBox( _T("Can't find function getInfoString in dll") );
|
AfxMessageBox( _T("Can't find function getInfoString in dll") );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GetDlgItem( IDC_GROUP_INFO )->SetWindowText( utf8ToTStr(getFilename(tStrToUtf8(dllName))) );
|
GetDlgItem(IDC_GROUP_INFO)->SetWindowText(nlUtf8ToTStr(getFilename(NLMISC::tStrToUtf8(dllName))));
|
||||||
GetDlgItem( IDC_PLUGIN_INFO )->SetWindowText(utf8ToTStr(infoFunc()) );
|
GetDlgItem(IDC_PLUGIN_INFO)->SetWindowText(nlUtf8ToTStr(infoFunc()));
|
||||||
|
|
||||||
// Prepare analyse func
|
// Prepare analyse func
|
||||||
AnalyseFunc = (TAnalyseFunc)GetProcAddress( LibInst, "doAnalyse" );
|
AnalyseFunc = (TAnalyseFunc)GetProcAddress( LibInst, "doAnalyse" );
|
||||||
|
|
|
@ -359,7 +359,7 @@ void CViewDialog::getBookmarksAbsoluteLines( vector<int>& bookmarksAbsoluteLine
|
||||||
|
|
||||||
NLMISC::CIFile ifs;
|
NLMISC::CIFile ifs;
|
||||||
|
|
||||||
if (ifs.open(tStrToUtf8(filename)))
|
if (ifs.open(NLMISC::tStrToUtf8(filename)))
|
||||||
{
|
{
|
||||||
char line [1024];
|
char line [1024];
|
||||||
|
|
||||||
|
@ -370,7 +370,7 @@ void CViewDialog::getBookmarksAbsoluteLines( vector<int>& bookmarksAbsoluteLine
|
||||||
if ( SessionDatePassed )
|
if ( SessionDatePassed )
|
||||||
{
|
{
|
||||||
// Stop if the session is finished
|
// Stop if the session is finished
|
||||||
if ( (! LogSessionStartDate.IsEmpty()) && (strstr( line, tStrToUtf8(LogDateString).c_str())) )
|
if ( (! LogSessionStartDate.IsEmpty()) && (strstr( line, nlTStrToUtf8(LogDateString))) )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -394,7 +394,7 @@ void CViewDialog::getBookmarksAbsoluteLines( vector<int>& bookmarksAbsoluteLine
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Look for the session beginning
|
// Look for the session beginning
|
||||||
if ( strstr( line, tStrToUtf8(LogSessionStartDate).c_str()) != NULL )
|
if ( strstr( line, nlTStrToUtf8(LogSessionStartDate)) != NULL )
|
||||||
{
|
{
|
||||||
SessionDatePassed = true;
|
SessionDatePassed = true;
|
||||||
}
|
}
|
||||||
|
@ -466,7 +466,7 @@ std::string CViewDialog::corruptedLinesString( const std::vector<unsigned int>&
|
||||||
vector<unsigned int>::const_iterator ivc;
|
vector<unsigned int>::const_iterator ivc;
|
||||||
for ( ivc=corruptedLines.begin(); ivc!=corruptedLines.end(); ++ivc )
|
for ( ivc=corruptedLines.begin(); ivc!=corruptedLines.end(); ++ivc )
|
||||||
{
|
{
|
||||||
res += NLMISC::toString("\r\n line %u : %s...", *ivc, tStrToUtf8(Buffer[*ivc].Left(20)).c_str());
|
res += NLMISC::toString("\r\n line %u : %s...", *ivc, NLMISC::tStrToUtf8(Buffer[*ivc].Left(20)).c_str());
|
||||||
}
|
}
|
||||||
HasCorruptedLines = true;
|
HasCorruptedLines = true;
|
||||||
}
|
}
|
||||||
|
@ -484,7 +484,7 @@ void CViewDialog::loadFileOrSeries( const vector<int>& bookmarksAbsoluteLines )
|
||||||
if ( LogSessionStartDate.IsEmpty() )
|
if ( LogSessionStartDate.IsEmpty() )
|
||||||
actualFilenames += ":\r\n";
|
actualFilenames += ":\r\n";
|
||||||
else
|
else
|
||||||
actualFilenames += " for Session of " + tStrToUtf8(LogSessionStartDate) + ":\r\n";
|
actualFilenames += " for Session of " + NLMISC::tStrToUtf8(LogSessionStartDate) + ":\r\n";
|
||||||
bool corruptionDetectionEnabled = (((CButton*)(((CLog_analyserDlg*)GetParent())->GetDlgItem( IDC_DetectCorruptedLines )))->GetCheck() == 1);
|
bool corruptionDetectionEnabled = (((CButton*)(((CLog_analyserDlg*)GetParent())->GetDlgItem( IDC_DetectCorruptedLines )))->GetCheck() == 1);
|
||||||
HasCorruptedLines = false;
|
HasCorruptedLines = false;
|
||||||
vector<unsigned int> corruptedLines;
|
vector<unsigned int> corruptedLines;
|
||||||
|
@ -505,9 +505,9 @@ void CViewDialog::loadFileOrSeries( const vector<int>& bookmarksAbsoluteLines )
|
||||||
if ( SessionDatePassed )
|
if ( SessionDatePassed )
|
||||||
{
|
{
|
||||||
// Stop if the session is finished
|
// Stop if the session is finished
|
||||||
if ( (! LogSessionStartDate.IsEmpty()) && (strstr( line, LogDateString )) )
|
if ( (! LogSessionStartDate.IsEmpty()) && (strstr( line, nlTStrToUtf8(LogDateString) )) )
|
||||||
{
|
{
|
||||||
actualFilenames += string(filename) + corruptedLinesString( corruptedLines ) + "\r\n";
|
actualFilenames += NLMISC::tStrToUtf8(filename) + corruptedLinesString(corruptedLines) + "\r\n";
|
||||||
corruptedLines.clear();
|
corruptedLines.clear();
|
||||||
goto endOfLoading;
|
goto endOfLoading;
|
||||||
}
|
}
|
||||||
|
@ -540,7 +540,7 @@ void CViewDialog::loadFileOrSeries( const vector<int>& bookmarksAbsoluteLines )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Look for the session beginning
|
// Look for the session beginning
|
||||||
if ( strstr( line, LogSessionStartDate ) != NULL )
|
if ( strstr( line, nlTStrToUtf8(LogSessionStartDate) ) != NULL )
|
||||||
{
|
{
|
||||||
SessionDatePassed = true;
|
SessionDatePassed = true;
|
||||||
}
|
}
|
||||||
|
@ -549,15 +549,15 @@ void CViewDialog::loadFileOrSeries( const vector<int>& bookmarksAbsoluteLines )
|
||||||
|
|
||||||
if ( SessionDatePassed )
|
if ( SessionDatePassed )
|
||||||
{
|
{
|
||||||
actualFilenames += string(filename) + corruptedLinesString( corruptedLines ) + "\r\n";
|
actualFilenames += NLMISC::tStrToUtf8(filename) + corruptedLinesString(corruptedLines) + "\r\n";
|
||||||
corruptedLines.clear();
|
corruptedLines.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CString s;
|
CString s;
|
||||||
s.Format( "<Cannot open file %s>\r\n", filename );
|
s.Format(_T( "<Cannot open file %s>\r\n"), filename);
|
||||||
actualFilenames += s;
|
actualFilenames += NLMISC::tStrToUtf8(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -598,7 +598,7 @@ bool CViewDialog::passFilter( const char *text, const std::vector<CString>& pos
|
||||||
// 1. Positive filter
|
// 1. Positive filter
|
||||||
for ( ilf=posFilter.begin(); ilf!=posFilter.end(); ++ilf )
|
for ( ilf=posFilter.begin(); ilf!=posFilter.end(); ++ilf )
|
||||||
{
|
{
|
||||||
found = ( strstr( text, *ilf ) != NULL );
|
found = (strstr(text, nlTStrToUtf8(*ilf)) != NULL);
|
||||||
if ( found )
|
if ( found )
|
||||||
{
|
{
|
||||||
yes = true; // positive filter passed (no need to check another one)
|
yes = true; // positive filter passed (no need to check another one)
|
||||||
|
@ -614,7 +614,7 @@ bool CViewDialog::passFilter( const char *text, const std::vector<CString>& pos
|
||||||
// 2. Negative filter
|
// 2. Negative filter
|
||||||
for ( ilf=negFilter.begin(); ilf!=negFilter.end(); ++ilf )
|
for ( ilf=negFilter.begin(); ilf!=negFilter.end(); ++ilf )
|
||||||
{
|
{
|
||||||
found = ( strstr( text, *ilf ) != NULL );
|
found = (strstr(text, nlTStrToUtf8(*ilf)) != NULL);
|
||||||
if ( found )
|
if ( found )
|
||||||
{
|
{
|
||||||
return false; // negative filter not passed (no need to check another one)
|
return false; // negative filter not passed (no need to check another one)
|
||||||
|
@ -665,14 +665,15 @@ void CViewDialog::reloadTrace()
|
||||||
if ( SessionDatePassed )
|
if ( SessionDatePassed )
|
||||||
{
|
{
|
||||||
// Stop if the session is finished
|
// Stop if the session is finished
|
||||||
if ( (! LogSessionStartDate.IsEmpty()) && (strstr( line, LogDateString )) )
|
if ((!LogSessionStartDate.IsEmpty()) && (strstr(line, nlTStrToUtf8(LogDateString))))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Read if it's a TRACE
|
// Read if it's a TRACE
|
||||||
char *pc = strstr( line, "TRACE" );
|
char *pc = strstr( line, "TRACE" );
|
||||||
if ( pc != NULL )
|
if ( pc != NULL )
|
||||||
{
|
{
|
||||||
if ( PosFilter.empty() || (strncmp( pc-PosFilter[0].GetLength(), PosFilter[0], PosFilter[0].GetLength() ) == 0) )
|
std::string tposFilter0 = NLMISC::tStrToUtf8(PosFilter[0]);
|
||||||
|
if (PosFilter.empty() || (strncmp(pc - PosFilter[0].GetLength(), tposFilter0.c_str(), tposFilter0.size()) == 0))
|
||||||
{
|
{
|
||||||
((CLog_analyserDlg*)GetParent())->insertTraceLine( Index, pc+6 );
|
((CLog_analyserDlg*)GetParent())->insertTraceLine( Index, pc+6 );
|
||||||
}
|
}
|
||||||
|
@ -681,7 +682,7 @@ void CViewDialog::reloadTrace()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Look for the session beginning
|
// Look for the session beginning
|
||||||
if ( strstr( line, LogSessionStartDate ) != NULL )
|
if (strstr(line, nlTStrToUtf8(LogSessionStartDate)) != NULL)
|
||||||
{
|
{
|
||||||
SessionDatePassed = true;
|
SessionDatePassed = true;
|
||||||
}
|
}
|
||||||
|
@ -974,7 +975,7 @@ BOOL CViewDialog::OnInitDialog()
|
||||||
CDialog::OnInitDialog();
|
CDialog::OnInitDialog();
|
||||||
|
|
||||||
m_ListCtrl.GetHeaderCtrl()->ModifyStyle( 0, HDS_HIDDEN );
|
m_ListCtrl.GetHeaderCtrl()->ModifyStyle( 0, HDS_HIDDEN );
|
||||||
m_ListCtrl.InsertColumn( 0, "" );
|
m_ListCtrl.InsertColumn(0, _T(""));
|
||||||
m_ListCtrl.setViewDialog( this );
|
m_ListCtrl.setViewDialog( this );
|
||||||
m_ListCtrl.initIt();
|
m_ListCtrl.initIt();
|
||||||
|
|
||||||
|
@ -998,11 +999,11 @@ COLORREF CViewDialog::getTextColorForLine( int index, bool selected )
|
||||||
return ::GetSysColor(COLOR_HIGHLIGHTTEXT);
|
return ::GetSysColor(COLOR_HIGHLIGHTTEXT);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( Buffer[index].Find( "DBG" ) != -1 )
|
if ( Buffer[index].Find( _T("DBG") ) != -1 )
|
||||||
return RGB(0x80,0x80,0x80);
|
return RGB(0x80,0x80,0x80);
|
||||||
else if ( Buffer[index].Find( "WRN" ) != -1 )
|
else if ( Buffer[index].Find( _T("WRN") ) != -1 )
|
||||||
return RGB(0x80,0,0);
|
return RGB(0x80,0,0);
|
||||||
else if ( (Buffer[index].Find( "ERR" ) != -1) || (Buffer[index].Find( "AST" ) != -1) )
|
else if ( (Buffer[index].Find( _T("ERR") ) != -1) || (Buffer[index].Find( _T("AST") ) != -1) )
|
||||||
return RGB(0xFF,0,0);
|
return RGB(0xFF,0,0);
|
||||||
else // INF and others
|
else // INF and others
|
||||||
return RGB(0,0,0);
|
return RGB(0,0,0);
|
||||||
|
@ -1038,7 +1039,7 @@ void formatLogStr( CString& str, bool displayHeaders )
|
||||||
{
|
{
|
||||||
if ( ! displayHeaders )
|
if ( ! displayHeaders )
|
||||||
{
|
{
|
||||||
int pos = str.Find( " : " );
|
int pos = str.Find( _T(" : ") );
|
||||||
if ( pos != -1 )
|
if ( pos != -1 )
|
||||||
{
|
{
|
||||||
str.Delete( 0, pos + 3 );
|
str.Delete( 0, pos + 3 );
|
||||||
|
@ -1156,7 +1157,7 @@ afx_msg LRESULT CViewDialog::OnFindReplace(WPARAM wParam, LPARAM lParam)
|
||||||
//BeginFindIndex = getSelectionIndex()+1;
|
//BeginFindIndex = getSelectionIndex()+1;
|
||||||
//displayString();
|
//displayString();
|
||||||
CString s;
|
CString s;
|
||||||
s.Format( "Found '%s' (downwards from line %d) at line %d:\r\n%s", FindStr, BeginFindIndex, lineIndex, Buffer[lineIndex] );
|
s.Format( _T("Found '%s' (downwards from line %d) at line %d:\r\n%s"), FindStr, BeginFindIndex, lineIndex, Buffer[lineIndex] );
|
||||||
((CLog_analyserDlg*)GetParent())->displayCurrentLine( s );
|
((CLog_analyserDlg*)GetParent())->displayCurrentLine( s );
|
||||||
((CLog_analyserDlg*)GetParent())->selectText( 1, matchPos, FindStr.GetLength() );
|
((CLog_analyserDlg*)GetParent())->selectText( 1, matchPos, FindStr.GetLength() );
|
||||||
//BeginFindIndex = lineIndex+1;
|
//BeginFindIndex = lineIndex+1;
|
||||||
|
@ -1176,7 +1177,7 @@ afx_msg LRESULT CViewDialog::OnFindReplace(WPARAM wParam, LPARAM lParam)
|
||||||
//BeginFindIndex = getSelectionIndex()-1;
|
//BeginFindIndex = getSelectionIndex()-1;
|
||||||
//displayString();
|
//displayString();
|
||||||
CString s;
|
CString s;
|
||||||
s.Format( "Found '%s' (upwards from line %d) at line %d:\r\n%s", FindStr, BeginFindIndex, lineIndex, Buffer[lineIndex] );
|
s.Format( _T("Found '%s' (upwards from line %d) at line %d:\r\n%s"), FindStr, BeginFindIndex, lineIndex, Buffer[lineIndex] );
|
||||||
((CLog_analyserDlg*)GetParent())->displayCurrentLine( s );
|
((CLog_analyserDlg*)GetParent())->displayCurrentLine( s );
|
||||||
((CLog_analyserDlg*)GetParent())->selectText( 1, matchPos, FindStr.GetLength() );
|
((CLog_analyserDlg*)GetParent())->selectText( 1, matchPos, FindStr.GetLength() );
|
||||||
//BeginFindIndex = lineIndex-1;
|
//BeginFindIndex = lineIndex-1;
|
||||||
|
@ -1185,7 +1186,7 @@ afx_msg LRESULT CViewDialog::OnFindReplace(WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CString s;
|
CString s;
|
||||||
s.Format( "Not found (%s from line %d)", FindDialog->SearchDown() ? "downwards" : "upwards", BeginFindIndex );
|
s.Format( _T("Not found (%s from line %d)"), FindDialog->SearchDown() ? _T("downwards") : _T("upwards"), BeginFindIndex );
|
||||||
AfxMessageBox( s );
|
AfxMessageBox( s );
|
||||||
//BeginFindIndex = 0;
|
//BeginFindIndex = 0;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -59,7 +59,7 @@ afx_msg void CLAEdit::OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags )
|
||||||
int start, end;
|
int start, end;
|
||||||
GetSel( start, end );
|
GetSel( start, end );
|
||||||
str = str.Mid( start, end-start );
|
str = str.Mid( start, end-start );
|
||||||
int lineNum = atoi( str );
|
int lineNum = atoi(nlTStrToUtf8(str));
|
||||||
if ( ! ((lineNum != 0) || (str == "0")) )
|
if ( ! ((lineNum != 0) || (str == "0")) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ BOOL CLog_analyserDlg::OnInitDialog()
|
||||||
SetIcon(m_hIcon, FALSE); // Set small icon
|
SetIcon(m_hIcon, FALSE); // Set small icon
|
||||||
|
|
||||||
// Add files given in command-line
|
// Add files given in command-line
|
||||||
string cmdLine = string(theApp.m_lpCmdLine);
|
string cmdLine = NLMISC::tStrToUtf8(theApp.m_lpCmdLine);
|
||||||
vector<CString> v;
|
vector<CString> v;
|
||||||
/*int pos = cmdLine.find_first_of(' '); // TODO: handle "" with blank characters
|
/*int pos = cmdLine.find_first_of(' '); // TODO: handle "" with blank characters
|
||||||
while ( pos != string::npos )
|
while ( pos != string::npos )
|
||||||
|
@ -285,9 +285,9 @@ void CLog_analyserDlg::OnDropFiles( HDROP hDropInfo )
|
||||||
DragQueryFile( hDropInfo, i, filename.GetBufferSetLength( 200 ), 200 );
|
DragQueryFile( hDropInfo, i, filename.GetBufferSetLength( 200 ), 200 );
|
||||||
|
|
||||||
// Plug-in DLL or log file
|
// Plug-in DLL or log file
|
||||||
if ( getFileExtension( string(filename) ) == "dll" )
|
if ( getFileExtension( NLMISC::tStrToUtf8(filename) ) == "dll" )
|
||||||
{
|
{
|
||||||
if ( addPlugIn( string(filename) ) )
|
if (addPlugIn(NLMISC::tStrToUtf8(filename)))
|
||||||
AfxMessageBox( CString("Plugin added: ") + filename );
|
AfxMessageBox( CString("Plugin added: ") + filename );
|
||||||
else
|
else
|
||||||
AfxMessageBox( CString("Plugin already registered: ") + filename );
|
AfxMessageBox( CString("Plugin already registered: ") + filename );
|
||||||
|
@ -310,16 +310,16 @@ bool CLog_analyserDlg::addPlugIn( const std::string& dllName )
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
char pluginN [10] = "Plugin0";
|
char pluginN [10] = "Plugin0";
|
||||||
CString pn = theApp.GetProfileString( _T(""), _T(pluginN) );
|
CString pn = theApp.GetProfileString(_T(""), nlUtf8ToTStr(pluginN));
|
||||||
while ( ! pn.IsEmpty() )
|
while ( ! pn.IsEmpty() )
|
||||||
{
|
{
|
||||||
if ( string(pn) == dllName )
|
if (NLMISC::tStrToUtf8(pn) == dllName)
|
||||||
return false; // already registered
|
return false; // already registered
|
||||||
++i;
|
++i;
|
||||||
smprintf( pluginN, 10, "Plugin%d", i );
|
smprintf( pluginN, 10, "Plugin%d", i );
|
||||||
pn = theApp.GetProfileString( _T(""), _T(pluginN) );
|
pn = theApp.GetProfileString(_T(""), nlUtf8ToTStr(pluginN));
|
||||||
}
|
}
|
||||||
theApp.WriteProfileString( _T(""), _T(pluginN), dllName.c_str() );
|
theApp.WriteProfileString(_T(""), nlUtf8ToTStr(pluginN), nlUtf8ToTStr(dllName));
|
||||||
Plugins.push_back( dllName.c_str() );
|
Plugins.push_back( dllName.c_str() );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -342,7 +342,7 @@ void CLog_analyserDlg::loadPluginConfiguration()
|
||||||
Plugins.push_back( pn );
|
Plugins.push_back( pn );
|
||||||
++i;
|
++i;
|
||||||
smprintf( pluginN, 10, "Plugin%d", i );
|
smprintf( pluginN, 10, "Plugin%d", i );
|
||||||
pn = theApp.GetProfileString( _T(""), _T(pluginN) );
|
pn = theApp.GetProfileString( _T(""), nlUtf8ToTStr(pluginN) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,7 +373,7 @@ void CLog_analyserDlg::addView( std::vector<CString>& pathNames )
|
||||||
{
|
{
|
||||||
if ( pathNames.empty() )
|
if ( pathNames.empty() )
|
||||||
{
|
{
|
||||||
CFileDialog openDialog( true, NULL, "log.log", OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT, "Log files (*.log)|*.log|All files|*.*||", this );
|
CFileDialog openDialog( true, NULL, _T("log.log"), OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT, _T("Log files (*.log)|*.log|All files|*.*||"), this );
|
||||||
CString filenameList;
|
CString filenameList;
|
||||||
openDialog.m_ofn.lpstrFile = filenameList.GetBufferSetLength( 8192 );
|
openDialog.m_ofn.lpstrFile = filenameList.GetBufferSetLength( 8192 );
|
||||||
openDialog.m_ofn.nMaxFile = 8192;
|
openDialog.m_ofn.nMaxFile = 8192;
|
||||||
|
@ -402,7 +402,7 @@ void CLog_analyserDlg::addView( std::vector<CString>& pathNames )
|
||||||
for ( i=0; i!=pathNames.size(); ++i )
|
for ( i=0; i!=pathNames.size(); ++i )
|
||||||
{
|
{
|
||||||
// Ensure that a log file without number comes *after* the ones with a number
|
// Ensure that a log file without number comes *after* the ones with a number
|
||||||
string name = string(pathNames[i]);
|
string name = NLMISC::tStrToUtf8(pathNames[i]);
|
||||||
string::size_type dotpos = name.find_last_of('.');
|
string::size_type dotpos = name.find_last_of('.');
|
||||||
if ( (dotpos!=string::npos) && (dotpos > 2) )
|
if ( (dotpos!=string::npos) && (dotpos > 2) )
|
||||||
{
|
{
|
||||||
|
@ -417,7 +417,7 @@ void CLog_analyserDlg::addView( std::vector<CString>& pathNames )
|
||||||
for ( i=0; i!=pathNames.size(); ++i )
|
for ( i=0; i!=pathNames.size(); ++i )
|
||||||
{
|
{
|
||||||
// Set the original names back
|
// Set the original names back
|
||||||
string name = pathNames[i];
|
string name = NLMISC::tStrToUtf8(pathNames[i]);
|
||||||
string::size_type tokenpos = name.find( "ZZZ." );
|
string::size_type tokenpos = name.find( "ZZZ." );
|
||||||
if ( tokenpos != string::npos )
|
if ( tokenpos != string::npos )
|
||||||
{
|
{
|
||||||
|
@ -434,7 +434,7 @@ void CLog_analyserDlg::addView( std::vector<CString>& pathNames )
|
||||||
else
|
else
|
||||||
names += "Loading files:\r\n";
|
names += "Loading files:\r\n";
|
||||||
for ( i=0; i!=pathNames.size(); ++i )
|
for ( i=0; i!=pathNames.size(); ++i )
|
||||||
names += string(pathNames[i]) + "\r\n";
|
names += NLMISC::tStrToUtf8(pathNames[i]) + "\r\n";
|
||||||
displayCurrentLine( names.c_str() );
|
displayCurrentLine( names.c_str() );
|
||||||
|
|
||||||
// Add view and browse sessions if needed
|
// Add view and browse sessions if needed
|
||||||
|
@ -457,7 +457,7 @@ void CLog_analyserDlg::addView( std::vector<CString>& pathNames )
|
||||||
*/
|
*/
|
||||||
void CLog_analyserDlg::OnAddtraceview()
|
void CLog_analyserDlg::OnAddtraceview()
|
||||||
{
|
{
|
||||||
CFileDialog openDialog( true, NULL, "log.log", OFN_HIDEREADONLY, "Log files (*.log)|*.log|All files|*.*||", this );
|
CFileDialog openDialog( true, NULL, _T("log.log"), OFN_HIDEREADONLY, _T("Log files (*.log)|*.log|All files|*.*||"), this );
|
||||||
if ( openDialog.DoModal() == IDOK )
|
if ( openDialog.DoModal() == IDOK )
|
||||||
{
|
{
|
||||||
vector<CString> pathNames;
|
vector<CString> pathNames;
|
||||||
|
@ -534,7 +534,7 @@ CViewDialog *CLog_analyserDlg::onAddCommon( const vector<CString>& filenames )
|
||||||
while ( ! ifs.eof() )
|
while ( ! ifs.eof() )
|
||||||
{
|
{
|
||||||
ifs.getline( line, 1024 );
|
ifs.getline( line, 1024 );
|
||||||
if ( strstr( line, LogDateString ) != NULL )
|
if ( strstr( line, nlTStrToUtf8(LogDateString) ) != NULL )
|
||||||
{
|
{
|
||||||
LogSessionsDialog.addLogSession( line );
|
LogSessionsDialog.addLogSession( line );
|
||||||
++nbsessions;
|
++nbsessions;
|
||||||
|
@ -554,19 +554,19 @@ CViewDialog *CLog_analyserDlg::onAddCommon( const vector<CString>& filenames )
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
// 1 'Log Starting' => no choice if it's at the beginning (1st line, or 2nd line with blank 1st)
|
// 1 'Log Starting' => no choice if it's at the beginning (1st line, or 2nd line with blank 1st)
|
||||||
ifstream ifs( view->Filenames[0] ); // 1 session => ! Filename.empty()
|
ifstream ifs(view->Filenames[0]); // 1 session => ! Filename.empty()
|
||||||
char line [1024];
|
char line[1024];
|
||||||
ifs.getline( line, 1024 );
|
ifs.getline(line, 1024);
|
||||||
if ( ! ifs.fail() )
|
if (!ifs.fail())
|
||||||
{
|
{
|
||||||
if ( strstr( line, LogDateString ) != NULL )
|
if (strstr(line, nlTStrToUtf8(LogDateString)) != NULL)
|
||||||
needToChooseSession = false;
|
needToChooseSession = false;
|
||||||
else if ( string(line).empty() )
|
else if ( string(line).empty() )
|
||||||
{
|
{
|
||||||
if ( ! ifs.fail() )
|
if (!ifs.fail())
|
||||||
{
|
{
|
||||||
ifs.getline( line, 1024 );
|
ifs.getline(line, 1024);
|
||||||
needToChooseSession = (strstr( line, LogDateString ) == NULL);
|
needToChooseSession = (strstr(line, nlTStrToUtf8(LogDateString)) == NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
needToChooseSession = true;
|
needToChooseSession = true;
|
||||||
|
@ -575,7 +575,7 @@ CViewDialog *CLog_analyserDlg::onAddCommon( const vector<CString>& filenames )
|
||||||
else
|
else
|
||||||
needToChooseSession = true;
|
needToChooseSession = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Several 'Log Starting' => always choice
|
// Several 'Log Starting' => always choice
|
||||||
needToChooseSession = true;
|
needToChooseSession = true;
|
||||||
|
@ -620,7 +620,7 @@ void CLog_analyserDlg::getLogSeries( const CString& filenameStr, std::vector<CSt
|
||||||
{
|
{
|
||||||
if ( isLogSeriesEnabled() )
|
if ( isLogSeriesEnabled() )
|
||||||
{
|
{
|
||||||
string filename = tStrToUtf8(filenameStr);
|
string filename = NLMISC::tStrToUtf8(filenameStr);
|
||||||
unsigned int dotpos = filename.find_last_of ('.');
|
unsigned int dotpos = filename.find_last_of ('.');
|
||||||
if ( dotpos != string::npos )
|
if ( dotpos != string::npos )
|
||||||
{
|
{
|
||||||
|
|
|
@ -176,7 +176,7 @@ void CWords_dicDlg::lookUp( const CString& inputStr )
|
||||||
const CSString& res = (*ivs);
|
const CSString& res = (*ivs);
|
||||||
if ( showAll || (res.find( "lvl" ) == string::npos) )
|
if ( showAll || (res.find( "lvl" ) == string::npos) )
|
||||||
{
|
{
|
||||||
m_Results.AddString( utf8ToTStr(res) );
|
m_Results.AddString(nlUtf8ToTStr(res));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
lvlRemoved = true;
|
lvlRemoved = true;
|
||||||
|
@ -234,7 +234,7 @@ void CWords_dicDlg::OnFileList()
|
||||||
const vector<string>& fileList = Dico.getFileList();
|
const vector<string>& fileList = Dico.getFileList();
|
||||||
for ( vector<string>::const_iterator ifl=fileList.begin(); ifl!=fileList.end(); ++ifl )
|
for ( vector<string>::const_iterator ifl=fileList.begin(); ifl!=fileList.end(); ++ifl )
|
||||||
{
|
{
|
||||||
m_Results.AddString( utf8ToTStr(*ifl) );
|
m_Results.AddString( nlUtf8ToTStr(*ifl) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue