[St-m-svn] SF.net SVN: st-m: [279] trunk/src
Brought to you by:
cnx_glenn
|
From: <cnx...@us...> - 2007-01-11 18:24:17
|
Revision: 279
http://svn.sourceforge.net/st-m/?rev=279&view=rev
Author: cnx_glenn
Date: 2007-01-11 10:24:16 -0800 (Thu, 11 Jan 2007)
Log Message:
-----------
Use a safer way to retrieve TCHAR array length
Modified Paths:
--------------
trunk/src/AboutDlg.cpp
trunk/src/BtOrderDlg.cpp
trunk/src/LogDlg.cpp
trunk/src/MainFrm.cpp
trunk/src/PropertiesDlg.cpp
trunk/src/Win32++/ListView.cpp
trunk/src/Win32++/TreeCtrl.cpp
trunk/src/boot/BtCore.cpp
Modified: trunk/src/AboutDlg.cpp
===================================================================
--- trunk/src/AboutDlg.cpp 2007-01-11 18:11:56 UTC (rev 278)
+++ trunk/src/AboutDlg.cpp 2007-01-11 18:24:16 UTC (rev 279)
@@ -32,7 +32,7 @@
tstring AboutDlg::GetLicenseLocation()
{
TCHAR szFileName[MAX_PATH + 1];
- ::GetModuleFileName(GetModuleHandle(NULL), szFileName, sizeof(szFileName)/sizeof(TCHAR));
+ ::GetModuleFileName(GetModuleHandle(NULL), szFileName, MAX_PATH*sizeof(TCHAR));
File tmp;
tmp.SetPath(szFileName);
tstring license = tmp.GetDir() + _T("license.txt");
Modified: trunk/src/BtOrderDlg.cpp
===================================================================
--- trunk/src/BtOrderDlg.cpp 2007-01-11 18:11:56 UTC (rev 278)
+++ trunk/src/BtOrderDlg.cpp 2007-01-11 18:24:16 UTC (rev 279)
@@ -234,7 +234,7 @@
if(name.length() > 0)
{
TCHAR tmp[MAX_PATH+1];
- ::GetModuleFileName(GetModuleHandle(NULL), tmp, sizeof(tmp)/sizeof(TCHAR));
+ ::GetModuleFileName(GetModuleHandle(NULL), tmp, MAX_PATH*sizeof(TCHAR));
File *file = new File;
file->SetPath(tmp);
path = file->GetDir();
Modified: trunk/src/LogDlg.cpp
===================================================================
--- trunk/src/LogDlg.cpp 2007-01-11 18:11:56 UTC (rev 278)
+++ trunk/src/LogDlg.cpp 2007-01-11 18:24:16 UTC (rev 279)
@@ -31,7 +31,7 @@
void LogDlg::GetLogPath()
{
TCHAR szFileName[MAX_PATH + 1];
- ::GetModuleFileName(GetModuleHandle(NULL), szFileName, sizeof(szFileName)/sizeof(TCHAR));
+ ::GetModuleFileName(GetModuleHandle(NULL), szFileName, MAX_PATH*sizeof(TCHAR));
log.SetPath(szFileName);
tstring path = log.GetDir() + _T("log.log");
log.SetPath(path);
Modified: trunk/src/MainFrm.cpp
===================================================================
--- trunk/src/MainFrm.cpp 2007-01-11 18:11:56 UTC (rev 278)
+++ trunk/src/MainFrm.cpp 2007-01-11 18:24:16 UTC (rev 279)
@@ -421,7 +421,7 @@
void CMainFrame::OnHelpContents()
{
TCHAR szFileName[MAX_PATH + 1];
- ::GetModuleFileName(GetModuleHandle(NULL), szFileName, sizeof(szFileName)/sizeof(TCHAR));
+ ::GetModuleFileName(GetModuleHandle(NULL), szFileName, MAX_PATH*sizeof(TCHAR));
File tmp;
tmp.SetPath(szFileName);
tstring help = tmp.GetDir() + _T("st-m.chm");
Modified: trunk/src/PropertiesDlg.cpp
===================================================================
--- trunk/src/PropertiesDlg.cpp 2007-01-11 18:11:56 UTC (rev 278)
+++ trunk/src/PropertiesDlg.cpp 2007-01-11 18:24:16 UTC (rev 279)
@@ -109,14 +109,14 @@
TabPage.mask = TCIF_TEXT | TCIF_IMAGE;
tstring tmp = files[0].GetName();
TabPage.pszText = const_cast<TCHAR*>(tmp.c_str());
- TabPage.cchTextMax = (int)_tcslen(TabPage.pszText)+1;
+ TabPage.cchTextMax = (int)_tcslen(TabPage.pszText);
TabPage.iImage = 0;
::SendDlgItemMessage(GetHwnd(), IDC_FILETAB, TCM_INSERTITEM, 1, (LPARAM)&TabPage);
if(files[1].GetPath().length() > 0)
{
tmp = files[1].GetName();
TabPage.pszText = const_cast<TCHAR*>(tmp.c_str());
- TabPage.cchTextMax = (int)_tcslen(TabPage.pszText)+1;
+ TabPage.cchTextMax = (int)_tcslen(TabPage.pszText);
TabPage.iImage = 1;
::SendDlgItemMessage(GetHwnd(), IDC_FILETAB, TCM_INSERTITEM, 2, (LPARAM)&TabPage);
}
Modified: trunk/src/Win32++/ListView.cpp
===================================================================
--- trunk/src/Win32++/ListView.cpp 2007-01-11 18:11:56 UTC (rev 278)
+++ trunk/src/Win32++/ListView.cpp 2007-01-11 18:24:16 UTC (rev 279)
@@ -64,7 +64,7 @@
column.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
column.fmt = LVCFMT_LEFT;
column.pszText = (TCHAR*)Title;
- column.cchTextMax = sizeof(column.cchTextMax)/sizeof(TCHAR);
+ column.cchTextMax = (int)_tcslen(Title);
column.cx = width;
column.iSubItem = iSubItem;
@@ -82,7 +82,7 @@
lvItem.iItem = iItem;
lvItem.iSubItem = iSubItem;
lvItem.pszText = (TCHAR*)pszText;
- lvItem.cchTextMax = sizeof(lvItem.cchTextMax)/sizeof(TCHAR);
+ lvItem.cchTextMax = (int)_tcslen(pszText);
if(iImage != -1)
{
Modified: trunk/src/Win32++/TreeCtrl.cpp
===================================================================
--- trunk/src/Win32++/TreeCtrl.cpp 2007-01-11 18:11:56 UTC (rev 278)
+++ trunk/src/Win32++/TreeCtrl.cpp 2007-01-11 18:24:16 UTC (rev 279)
@@ -65,7 +65,7 @@
tvInsert.hInsertAfter = TVI_ROOT;
tvInsert.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvInsert.item.pszText = (TCHAR*)pszText;
- tvInsert.item.cchTextMax = sizeof(tvInsert.item.pszText)/sizeof(TCHAR);
+ tvInsert.item.cchTextMax = (int)_tcslen(pszText);
tvInsert.item.iImage = iImage;
tvInsert.item.iSelectedImage = iSelImage;
@@ -105,7 +105,7 @@
tvInsert.hInsertAfter = TVI_LAST;
tvInsert.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvInsert.item.pszText = (TCHAR*)pszText;
- tvInsert.item.cchTextMax = sizeof(tvInsert.item.pszText)/sizeof(TCHAR);
+ tvInsert.item.cchTextMax = (int)_tcslen(pszText);
tvInsert.item.iImage = iImage;
tvInsert.item.iSelectedImage = iSelImage;
Modified: trunk/src/boot/BtCore.cpp
===================================================================
--- trunk/src/boot/BtCore.cpp 2007-01-11 18:11:56 UTC (rev 278)
+++ trunk/src/boot/BtCore.cpp 2007-01-11 18:24:16 UTC (rev 279)
@@ -919,7 +919,7 @@
BtLog::BtLog()
{
TCHAR szFileName[MAX_PATH + 1];
- ::GetModuleFileName(GetModuleHandle(NULL), szFileName, sizeof(szFileName)/sizeof(TCHAR));
+ ::GetModuleFileName(GetModuleHandle(NULL), szFileName, MAX_PATH*sizeof(TCHAR));
File log;
log.SetPath(szFileName);
path = log.GetDir() + _T("log.log");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|