From 096e5e955e75f05858572344b68483aa9f4d23dd Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 1 May 2019 06:46:01 +0800 Subject: [PATCH] Cleaning up unicode conversion and fixing 64bit issues --- .../tools/misc/data_mirror/data_mirrorDlg.cpp | 50 +++++++++---------- .../misc/log_analyser/PlugInSelector.cpp | 4 +- .../tools/misc/log_analyser/ViewDialog.cpp | 49 +++++++++--------- .../misc/log_analyser/log_analyserDlg.cpp | 50 +++++++++---------- .../nel/tools/misc/words_dic/words_dicDlg.cpp | 4 +- 5 files changed, 79 insertions(+), 78 deletions(-) diff --git a/code/nel/tools/misc/data_mirror/data_mirrorDlg.cpp b/code/nel/tools/misc/data_mirror/data_mirrorDlg.cpp index 4fb771d86..602e805b2 100644 --- a/code/nel/tools/misc/data_mirror/data_mirrorDlg.cpp +++ b/code/nel/tools/misc/data_mirror/data_mirrorDlg.cpp @@ -280,8 +280,8 @@ void CData_mirrorDlg::updateList () { // Add the items const CEntryFile &entry = *ite; - uint nItem = List.InsertItem (0, utf8ToTStr(entry.Strings[CEntryFile::Path]), entry.Image); - List.SetItemData (nItem, DWORD(new std::list::iterator (ite))); + uint nItem = List.InsertItem(0, nlUtf8ToTStr(entry.Strings[CEntryFile::Path]), entry.Image); + List.SetItemData (nItem, DWORD_PTR(new std::list::iterator (ite))); // Sub string subString = 1; @@ -289,25 +289,25 @@ void CData_mirrorDlg::updateList () // Add the sizes if (ModifiedFilter != Removed) { - List.SetItemText (nItem, subString++, utf8ToTStr(entry.Strings[CEntryFile::NewSize])); + List.SetItemText(nItem, subString++, nlUtf8ToTStr(entry.Strings[CEntryFile::NewSize])); } if (ModifiedFilter != Added) { - List.SetItemText (nItem, subString++, utf8ToTStr(entry.Strings[CEntryFile::OldSize])); + List.SetItemText(nItem, subString++, nlUtf8ToTStr(entry.Strings[CEntryFile::OldSize])); } // Add the dates if (ModifiedFilter != Removed) { - List.SetItemText (nItem, subString++, utf8ToTStr(entry.Strings[CEntryFile::NewDate])); + List.SetItemText(nItem, subString++, nlUtf8ToTStr(entry.Strings[CEntryFile::NewDate])); } if (ModifiedFilter != Added) { - List.SetItemText (nItem, subString++, utf8ToTStr(entry.Strings[CEntryFile::OldDate])); + List.SetItemText(nItem, subString++, nlUtf8ToTStr(entry.Strings[CEntryFile::OldDate])); } // Add the type - List.SetItemText (nItem, subString++, utf8ToTStr(entry.Strings[CEntryFile::Type])); + List.SetItemText(nItem, subString++, nlUtf8ToTStr(entry.Strings[CEntryFile::Type])); // Next item ite++; @@ -410,7 +410,7 @@ void createDirectory (const string &dir) 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) { SetFileTime (handle, NULL, NULL, &result); @@ -450,18 +450,18 @@ void CData_mirrorDlg::OnOK() { // Copy it const string &itemText = modifiedList[i]; - string source = MainDirectory+itemText; - string dest = MirrorDirectory+itemText; - - progress.DisplayString = "Copy \"" + source + "\" to \"" + dest + "\""; - progress.progress (float(currentFile++)/(float(totalCount))); + string source = MainDirectory + itemText; + string dest = MirrorDirectory + itemText; - string directory = NLMISC::CFile::getPath (dest); - createDirectory (directory.c_str ()); - if (!CopyFile (source.c_str (), dest.c_str (), FALSE)) + progress.DisplayString = "Copy \"" + source + "\" to \"" + dest + "\""; + progress.progress(float(currentFile++) / (float(totalCount))); + + 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"), - MB_OK|MB_ICONEXCLAMATION); + MessageBox(nlUtf8ToTStr("Can't copy file " + source + " in file " + dest), _T("NeL Data Mirror"), + MB_OK | MB_ICONEXCLAMATION); success = false; } else @@ -497,9 +497,9 @@ void CData_mirrorDlg::OnOK() progress.progress (float(currentFile++)/(float(totalCount))); 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); success = false; } @@ -532,9 +532,9 @@ void CData_mirrorDlg::OnOK() progress.DisplayString = "Delete \"" + dest + "\""; 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); success = false; } @@ -596,7 +596,7 @@ void CData_mirrorDlg::OnSize(UINT nType, int cx, int cy) 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) { FILETIME res0; @@ -700,7 +700,7 @@ void CData_mirrorDlg::buildSourceFiles () { FILETIME 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 SHFILEINFO sfi; TCHAR winName[512]; - _tcscpy (winName, utf8ToTStr(aFilename)); + _tcscpy(winName, nlUtf8ToTStr(aFilename)); TCHAR *ptr = winName; while (*ptr) { diff --git a/code/nel/tools/misc/log_analyser/PlugInSelector.cpp b/code/nel/tools/misc/log_analyser/PlugInSelector.cpp index 120ceacaf..abc5ec03c 100644 --- a/code/nel/tools/misc/log_analyser/PlugInSelector.cpp +++ b/code/nel/tools/misc/log_analyser/PlugInSelector.cpp @@ -147,8 +147,8 @@ void CPlugInSelector::OnSelchangeList1() AfxMessageBox( _T("Can't find function getInfoString in dll") ); return; } - GetDlgItem( IDC_GROUP_INFO )->SetWindowText( utf8ToTStr(getFilename(tStrToUtf8(dllName))) ); - GetDlgItem( IDC_PLUGIN_INFO )->SetWindowText(utf8ToTStr(infoFunc()) ); + GetDlgItem(IDC_GROUP_INFO)->SetWindowText(nlUtf8ToTStr(getFilename(NLMISC::tStrToUtf8(dllName)))); + GetDlgItem(IDC_PLUGIN_INFO)->SetWindowText(nlUtf8ToTStr(infoFunc())); // Prepare analyse func AnalyseFunc = (TAnalyseFunc)GetProcAddress( LibInst, "doAnalyse" ); diff --git a/code/nel/tools/misc/log_analyser/ViewDialog.cpp b/code/nel/tools/misc/log_analyser/ViewDialog.cpp index cdc38ed08..5710795bf 100644 --- a/code/nel/tools/misc/log_analyser/ViewDialog.cpp +++ b/code/nel/tools/misc/log_analyser/ViewDialog.cpp @@ -359,7 +359,7 @@ void CViewDialog::getBookmarksAbsoluteLines( vector& bookmarksAbsoluteLine NLMISC::CIFile ifs; - if (ifs.open(tStrToUtf8(filename))) + if (ifs.open(NLMISC::tStrToUtf8(filename))) { char line [1024]; @@ -370,7 +370,7 @@ void CViewDialog::getBookmarksAbsoluteLines( vector& bookmarksAbsoluteLine if ( SessionDatePassed ) { // Stop if the session is finished - if ( (! LogSessionStartDate.IsEmpty()) && (strstr( line, tStrToUtf8(LogDateString).c_str())) ) + if ( (! LogSessionStartDate.IsEmpty()) && (strstr( line, nlTStrToUtf8(LogDateString))) ) { return; } @@ -394,7 +394,7 @@ void CViewDialog::getBookmarksAbsoluteLines( vector& bookmarksAbsoluteLine else { // Look for the session beginning - if ( strstr( line, tStrToUtf8(LogSessionStartDate).c_str()) != NULL ) + if ( strstr( line, nlTStrToUtf8(LogSessionStartDate)) != NULL ) { SessionDatePassed = true; } @@ -466,7 +466,7 @@ std::string CViewDialog::corruptedLinesString( const std::vector& vector::const_iterator 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; } @@ -484,7 +484,7 @@ void CViewDialog::loadFileOrSeries( const vector& bookmarksAbsoluteLines ) if ( LogSessionStartDate.IsEmpty() ) actualFilenames += ":\r\n"; 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); HasCorruptedLines = false; vector corruptedLines; @@ -505,9 +505,9 @@ void CViewDialog::loadFileOrSeries( const vector& bookmarksAbsoluteLines ) if ( SessionDatePassed ) { // 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(); goto endOfLoading; } @@ -540,7 +540,7 @@ void CViewDialog::loadFileOrSeries( const vector& bookmarksAbsoluteLines ) else { // Look for the session beginning - if ( strstr( line, LogSessionStartDate ) != NULL ) + if ( strstr( line, nlTStrToUtf8(LogSessionStartDate) ) != NULL ) { SessionDatePassed = true; } @@ -549,15 +549,15 @@ void CViewDialog::loadFileOrSeries( const vector& bookmarksAbsoluteLines ) if ( SessionDatePassed ) { - actualFilenames += string(filename) + corruptedLinesString( corruptedLines ) + "\r\n"; + actualFilenames += NLMISC::tStrToUtf8(filename) + corruptedLinesString(corruptedLines) + "\r\n"; corruptedLines.clear(); } } else { CString s; - s.Format( "\r\n", filename ); - actualFilenames += s; + s.Format(_T( "\r\n"), filename); + actualFilenames += NLMISC::tStrToUtf8(s); } } @@ -598,7 +598,7 @@ bool CViewDialog::passFilter( const char *text, const std::vector& pos // 1. Positive filter for ( ilf=posFilter.begin(); ilf!=posFilter.end(); ++ilf ) { - found = ( strstr( text, *ilf ) != NULL ); + found = (strstr(text, nlTStrToUtf8(*ilf)) != NULL); if ( found ) { yes = true; // positive filter passed (no need to check another one) @@ -614,7 +614,7 @@ bool CViewDialog::passFilter( const char *text, const std::vector& pos // 2. Negative filter for ( ilf=negFilter.begin(); ilf!=negFilter.end(); ++ilf ) { - found = ( strstr( text, *ilf ) != NULL ); + found = (strstr(text, nlTStrToUtf8(*ilf)) != NULL); if ( found ) { return false; // negative filter not passed (no need to check another one) @@ -665,14 +665,15 @@ void CViewDialog::reloadTrace() if ( SessionDatePassed ) { // Stop if the session is finished - if ( (! LogSessionStartDate.IsEmpty()) && (strstr( line, LogDateString )) ) + if ((!LogSessionStartDate.IsEmpty()) && (strstr(line, nlTStrToUtf8(LogDateString)))) break; // Read if it's a TRACE char *pc = strstr( line, "TRACE" ); 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 ); } @@ -681,7 +682,7 @@ void CViewDialog::reloadTrace() else { // Look for the session beginning - if ( strstr( line, LogSessionStartDate ) != NULL ) + if (strstr(line, nlTStrToUtf8(LogSessionStartDate)) != NULL) { SessionDatePassed = true; } @@ -974,7 +975,7 @@ BOOL CViewDialog::OnInitDialog() CDialog::OnInitDialog(); m_ListCtrl.GetHeaderCtrl()->ModifyStyle( 0, HDS_HIDDEN ); - m_ListCtrl.InsertColumn( 0, "" ); + m_ListCtrl.InsertColumn(0, _T("")); m_ListCtrl.setViewDialog( this ); m_ListCtrl.initIt(); @@ -998,11 +999,11 @@ COLORREF CViewDialog::getTextColorForLine( int index, bool selected ) return ::GetSysColor(COLOR_HIGHLIGHTTEXT); else { - if ( Buffer[index].Find( "DBG" ) != -1 ) + if ( Buffer[index].Find( _T("DBG") ) != -1 ) 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); - 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); else // INF and others return RGB(0,0,0); @@ -1038,7 +1039,7 @@ void formatLogStr( CString& str, bool displayHeaders ) { if ( ! displayHeaders ) { - int pos = str.Find( " : " ); + int pos = str.Find( _T(" : ") ); if ( pos != -1 ) { str.Delete( 0, pos + 3 ); @@ -1156,7 +1157,7 @@ afx_msg LRESULT CViewDialog::OnFindReplace(WPARAM wParam, LPARAM lParam) //BeginFindIndex = getSelectionIndex()+1; //displayString(); 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())->selectText( 1, matchPos, FindStr.GetLength() ); //BeginFindIndex = lineIndex+1; @@ -1176,7 +1177,7 @@ afx_msg LRESULT CViewDialog::OnFindReplace(WPARAM wParam, LPARAM lParam) //BeginFindIndex = getSelectionIndex()-1; //displayString(); 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())->selectText( 1, matchPos, FindStr.GetLength() ); //BeginFindIndex = lineIndex-1; @@ -1185,7 +1186,7 @@ afx_msg LRESULT CViewDialog::OnFindReplace(WPARAM wParam, LPARAM lParam) } } 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 ); //BeginFindIndex = 0; return 0; diff --git a/code/nel/tools/misc/log_analyser/log_analyserDlg.cpp b/code/nel/tools/misc/log_analyser/log_analyserDlg.cpp index e23fd2bd9..afc73018f 100644 --- a/code/nel/tools/misc/log_analyser/log_analyserDlg.cpp +++ b/code/nel/tools/misc/log_analyser/log_analyserDlg.cpp @@ -59,7 +59,7 @@ afx_msg void CLAEdit::OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags ) int start, end; GetSel( start, end ); str = str.Mid( start, end-start ); - int lineNum = atoi( str ); + int lineNum = atoi(nlTStrToUtf8(str)); if ( ! ((lineNum != 0) || (str == "0")) ) break; @@ -203,7 +203,7 @@ BOOL CLog_analyserDlg::OnInitDialog() SetIcon(m_hIcon, FALSE); // Set small icon // Add files given in command-line - string cmdLine = string(theApp.m_lpCmdLine); + string cmdLine = NLMISC::tStrToUtf8(theApp.m_lpCmdLine); vector v; /*int pos = cmdLine.find_first_of(' '); // TODO: handle "" with blank characters while ( pos != string::npos ) @@ -285,9 +285,9 @@ void CLog_analyserDlg::OnDropFiles( HDROP hDropInfo ) DragQueryFile( hDropInfo, i, filename.GetBufferSetLength( 200 ), 200 ); // 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 ); else AfxMessageBox( CString("Plugin already registered: ") + filename ); @@ -310,16 +310,16 @@ bool CLog_analyserDlg::addPlugIn( const std::string& dllName ) { int i = 0; char pluginN [10] = "Plugin0"; - CString pn = theApp.GetProfileString( _T(""), _T(pluginN) ); + CString pn = theApp.GetProfileString(_T(""), nlUtf8ToTStr(pluginN)); while ( ! pn.IsEmpty() ) { - if ( string(pn) == dllName ) + if (NLMISC::tStrToUtf8(pn) == dllName) return false; // already registered ++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() ); return true; } @@ -342,7 +342,7 @@ void CLog_analyserDlg::loadPluginConfiguration() Plugins.push_back( pn ); ++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& pathNames ) { 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; openDialog.m_ofn.lpstrFile = filenameList.GetBufferSetLength( 8192 ); openDialog.m_ofn.nMaxFile = 8192; @@ -402,7 +402,7 @@ void CLog_analyserDlg::addView( std::vector& pathNames ) for ( i=0; i!=pathNames.size(); ++i ) { // 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('.'); if ( (dotpos!=string::npos) && (dotpos > 2) ) { @@ -417,7 +417,7 @@ void CLog_analyserDlg::addView( std::vector& pathNames ) for ( i=0; i!=pathNames.size(); ++i ) { // Set the original names back - string name = pathNames[i]; + string name = NLMISC::tStrToUtf8(pathNames[i]); string::size_type tokenpos = name.find( "ZZZ." ); if ( tokenpos != string::npos ) { @@ -434,7 +434,7 @@ void CLog_analyserDlg::addView( std::vector& pathNames ) else names += "Loading files:\r\n"; for ( i=0; i!=pathNames.size(); ++i ) - names += string(pathNames[i]) + "\r\n"; + names += NLMISC::tStrToUtf8(pathNames[i]) + "\r\n"; displayCurrentLine( names.c_str() ); // Add view and browse sessions if needed @@ -457,7 +457,7 @@ void CLog_analyserDlg::addView( std::vector& pathNames ) */ 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 ) { vector pathNames; @@ -534,7 +534,7 @@ CViewDialog *CLog_analyserDlg::onAddCommon( const vector& filenames ) while ( ! ifs.eof() ) { ifs.getline( line, 1024 ); - if ( strstr( line, LogDateString ) != NULL ) + if ( strstr( line, nlTStrToUtf8(LogDateString) ) != NULL ) { LogSessionsDialog.addLogSession( line ); ++nbsessions; @@ -554,19 +554,19 @@ CViewDialog *CLog_analyserDlg::onAddCommon( const vector& filenames ) case 1: { // 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() - char line [1024]; - ifs.getline( line, 1024 ); - if ( ! ifs.fail() ) + ifstream ifs(view->Filenames[0]); // 1 session => ! Filename.empty() + char line[1024]; + ifs.getline(line, 1024); + if (!ifs.fail()) { - if ( strstr( line, LogDateString ) != NULL ) + if (strstr(line, nlTStrToUtf8(LogDateString)) != NULL) needToChooseSession = false; else if ( string(line).empty() ) { - if ( ! ifs.fail() ) + if (!ifs.fail()) { - ifs.getline( line, 1024 ); - needToChooseSession = (strstr( line, LogDateString ) == NULL); + ifs.getline(line, 1024); + needToChooseSession = (strstr(line, nlTStrToUtf8(LogDateString)) == NULL); } else needToChooseSession = true; @@ -575,7 +575,7 @@ CViewDialog *CLog_analyserDlg::onAddCommon( const vector& filenames ) else needToChooseSession = true; } - break; + break; default: // Several 'Log Starting' => always choice needToChooseSession = true; @@ -620,7 +620,7 @@ void CLog_analyserDlg::getLogSeries( const CString& filenameStr, std::vector& fileList = Dico.getFileList(); for ( vector::const_iterator ifl=fileList.begin(); ifl!=fileList.end(); ++ifl ) { - m_Results.AddString( utf8ToTStr(*ifl) ); + m_Results.AddString( nlUtf8ToTStr(*ifl) ); } }