Some place for small patches

Use this forum to flesh out your feature request before you enter it in <a href="http://dcpp.net/bugzilla/">Bugzilla</a>.

Moderator: Moderators

Locked
Pothead
Posts: 223
Joined: 2005-01-15 06:55

Some place for small patches

Post by Pothead » 2006-06-07 19:33

I was thinking some place dedicated for small patches might be a good idea, either via a Forum section, or a "sticky" bug in bugzilla, or something along them lines.
My reasoning behind this, is because i got a couple of changes for dc++, but think making a bug for them is a bit excessive.
i.e. This one will get rid of the compiler warning about something which is coded fine, but the warnings are annoying.

Code: Select all

Index: trunk/windows/ExListViewCtrl.cpp
===================================================================
--- trunk/windows/ExListViewCtrl.cpp	(revision 613)
+++ trunk/windows/ExListViewCtrl.cpp	(working copy)
@@ -45,9 +45,9 @@
 		lvi.iItem = newPos;
 	}
 	int i = InsertItem(&lvi);
-	int j = 0;
-	for(TStringIter k = l.begin(); k != l.end(); ++k, j++) {
-		SetItemText(i, j, k->c_str());
+	int m = 0;
+	for(TStringIter k = l.begin(); k != l.end(); ++k, m++) {
+		SetItemText(i, m, k->c_str());
 	}
 	EnsureVisible(i, FALSE);
 
and this one is just a little cleanup

Code: Select all

Index: trunk/windows/ADLSProperties.cpp
===================================================================
--- trunk/windows/ADLSProperties.cpp	(revision 613)
+++ trunk/windows/ADLSProperties.cpp	(working copy)
@@ -40,21 +40,14 @@
 	SetDlgItemText(IDC_AUTOQUEUE, CTSTRING(ADLS_DOWNLOAD));
 
 	// Initialize combo boxes
-	::SendMessage(GetDlgItem(IDC_SOURCE_TYPE), CB_ADDSTRING, 0, 
-		(LPARAM)search->SourceTypeToDisplayString(ADLSearch::OnlyFile).c_str());
-	::SendMessage(GetDlgItem(IDC_SOURCE_TYPE), CB_ADDSTRING, 0, 
-		(LPARAM)search->SourceTypeToDisplayString(ADLSearch::OnlyDirectory).c_str());
-	::SendMessage(GetDlgItem(IDC_SOURCE_TYPE), CB_ADDSTRING, 0, 
-		(LPARAM)search->SourceTypeToDisplayString(ADLSearch::FullPath).c_str());
+	::SendMessage(GetDlgItem(IDC_SOURCE_TYPE), CB_ADDSTRING, 0, (LPARAM)CTSTRING(FILENAME));
+	::SendMessage(GetDlgItem(IDC_SOURCE_TYPE), CB_ADDSTRING, 0, (LPARAM)CTSTRING(DIRECTORY));
+	::SendMessage(GetDlgItem(IDC_SOURCE_TYPE), CB_ADDSTRING, 0, (LPARAM)CTSTRING(ADLS_FULL_PATH));
 
-	::SendMessage(GetDlgItem(IDC_SIZE_TYPE), CB_ADDSTRING, 0, 
-		(LPARAM)search->SizeTypeToDisplayString(ADLSearch::SizeBytes).c_str());
-	::SendMessage(GetDlgItem(IDC_SIZE_TYPE), CB_ADDSTRING, 0, 
-		(LPARAM)search->SizeTypeToDisplayString(ADLSearch::SizeKibiBytes).c_str());
-	::SendMessage(GetDlgItem(IDC_SIZE_TYPE), CB_ADDSTRING, 0, 
-		(LPARAM)search->SizeTypeToDisplayString(ADLSearch::SizeMebiBytes).c_str());
-	::SendMessage(GetDlgItem(IDC_SIZE_TYPE), CB_ADDSTRING, 0, 
-		(LPARAM)search->SizeTypeToDisplayString(ADLSearch::SizeGibiBytes).c_str());
+	::SendMessage(GetDlgItem(IDC_SIZE_TYPE), CB_ADDSTRING, 0, (LPARAM)CTSTRING(B));
+	::SendMessage(GetDlgItem(IDC_SIZE_TYPE), CB_ADDSTRING, 0, (LPARAM)CTSTRING(KiB));
+	::SendMessage(GetDlgItem(IDC_SIZE_TYPE), CB_ADDSTRING, 0, (LPARAM)CTSTRING(MiB));
+	::SendMessage(GetDlgItem(IDC_SIZE_TYPE), CB_ADDSTRING, 0, (LPARAM)CTSTRING(GiB));
 
 	// Load search data
 	SetDlgItemText(IDC_SEARCH_STRING, Text::toT(search->searchString).c_str());

TheParanoidOne
Forum Moderator
Posts: 1420
Joined: 2003-04-22 14:37

Post by TheParanoidOne » 2006-06-07 23:49

I'm possibly just being very blind, but for the first one haven't you just replaced the j with an m? What compiler warning does this get rid of?
The world is coming to an end. Please log off.

DC++ Guide | Words

ullner
Forum Moderator
Posts: 333
Joined: 2004-09-10 11:00
Contact:

Post by ullner » 2006-06-08 03:30

'j' is also declared before that in a loop.

Pothead
Posts: 223
Joined: 2005-01-15 06:55

Post by Pothead » 2006-06-08 04:29

Code: Select all

Compiling...
ExListViewCtrl.cpp
c:\dcplusplus\trunk\windows\ExListViewCtrl.cpp(49) : warning C4288: nonstandard extension used : 'j' : loop control variable declared in the for-loop is used outside the for-loop scope; it conflicts with the declaration in the outer scope
c:\dcplusplus\trunk\windows\ExListViewCtrl.cpp(48) : definition of 'j' used
c:\dcplusplus\trunk\windows\ExListViewCtrl.cpp(35) : definition of 'j' ignored

Locked