Bug 111452 - Code violates C++ spec with improper const and iterator declarations
Summary: Code violates C++ spec with improper const and iterator declarations
Status: RESOLVED FIXED
Alias: None
Product: ktouch
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Haavard Froeiland
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-25 02:36 UTC by Garrett Kajmowicz
Modified: 2005-08-27 02:45 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Fixes use of const in map value type (447 bytes, patch)
2005-08-25 02:36 UTC, Garrett Kajmowicz
Details
Iterator now for proper type (644 bytes, patch)
2005-08-25 02:37 UTC, Garrett Kajmowicz
Details
Elliminate improper use of const in reference. (855 bytes, patch)
2005-08-25 02:38 UTC, Garrett Kajmowicz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Garrett Kajmowicz 2005-08-25 02:36:07 UTC
Version:            (using KDE KDE 3.4.2)
Installed from:    Compiled From Sources
Compiler:          GCC Using uClibc++ instead of GNU libstdc++
OS:                Linux

GNU C++ compiler and libstdc++ implementations allow a person to get away with code which violates the C++ standard.  Attached are patches which fix some of these errors in KDEEDU.
Comment 1 Garrett Kajmowicz 2005-08-25 02:36:47 UTC
Created attachment 12364 [details]
Fixes use of const in map value type
Comment 2 Garrett Kajmowicz 2005-08-25 02:37:43 UTC
Created attachment 12365 [details]
Iterator now for proper type
Comment 3 Garrett Kajmowicz 2005-08-25 02:38:25 UTC
Created attachment 12366 [details]
Elliminate improper use of const in reference.
Comment 4 Inge Wallin 2005-08-25 23:25:19 UTC
SVN commit 453333 by ingwa:

Fix bug 111452: Code violates C++ spec with improper const and iterator
		declarations

I will forward port this to 3.5 and trunk.

BUGS: 111452



 M  +1 -1      kig/filters/exporter.cc  
 M  +2 -2      kiten/learn.cpp  
 M  +1 -1      ktouch/src/ktouchstatistics.cpp  


--- branches/KDE/3.4/kdeedu/kig/filters/exporter.cc #453332:453333
@@ -173,7 +173,7 @@
   ObjectHolder* mcurobj;
   const KigWidget& mw;
   Rect msr;
-  std::map<const QColor, int> mcolormap;
+  std::map<QColor, int> mcolormap;
   int mnextcolorid;
   int mcurcolorid;
 
--- branches/KDE/3.4/kdeedu/kiten/learn.cpp #453332:453333
@@ -803,8 +803,8 @@
 	for (; sIt.current(); ++sIt)
 		scores.insert(sIt.current());
 
-	std::multiset<const QListViewItem*>::iterator it = scores.begin();
-	std::multiset<const QListViewItem*>::iterator tmp = scores.begin();
+	std::multiset<const QListViewItem*, scoreCompare>::iterator it = scores.begin();
+	std::multiset<const QListViewItem*, scoreCompare>::iterator tmp = scores.begin();
 
 	int i;
 	for (i = 2; i <= max; ++it)
--- branches/KDE/3.4/kdeedu/ktouch/src/ktouchstatistics.cpp #453332:453333
@@ -155,7 +155,7 @@
     std::set<KTouchCharStats> charStatsSum = m_trainer->m_session.m_charStats;
     unsigned int lastSession=m_trainer->m_sessionHistory.size()-1;
     for (int i=0; i<sessionCountSlider->value(); ++i) {
-        const KTouchTrainingSession &session = m_trainer->m_sessionHistory[lastSession-i];
+        KTouchTrainingSession &session = m_trainer->m_sessionHistory[lastSession-i];
         unsigned int elapsedTime = session.m_elapsedTime;
         unsigned int totalChars = session.m_totalChars;
         unsigned int correctChars = session.m_correctChars;
Comment 5 Inge Wallin 2005-08-25 23:31:17 UTC
SVN commit 453334 by ingwa:

Fix bug 111452: Code violates C++ spec with improper const and
		iterator declarations

CCBUGS: 111452



 M  +1 -1      kig/filters/exporter.cc  
 M  +2 -2      kiten/learn.cpp  


--- branches/KDE/3.5/kdeedu/kig/filters/exporter.cc #453333:453334
@@ -231,7 +231,7 @@
   ObjectHolder* mcurobj;
   const KigWidget& mw;
   Rect msr;
-  std::map<const QColor, int> mcolormap;
+  std::map<QColor, int> mcolormap;
   int mnextcolorid;
   int mcurcolorid;
 
--- branches/KDE/3.5/kdeedu/kiten/learn.cpp #453333:453334
@@ -803,8 +803,8 @@
 	for (; sIt.current(); ++sIt)
 		scores.insert(sIt.current());
 
-	std::multiset<const QListViewItem*>::iterator it = scores.begin();
-	std::multiset<const QListViewItem*>::iterator tmp = scores.begin();
+	std::multiset<const QListViewItem*, scoreCompare>::iterator it = scores.begin();
+	std::multiset<const QListViewItem*, scoreCompare>::iterator tmp = scores.begin();
 
 	int i;
 	for (i = 2; i <= max; ++it)
Comment 6 Matt Rogers 2005-08-27 02:45:12 UTC
SVN commit 453742 by mattr:

 r212@tachyon:  matt | 2005-08-25 20:09:07 -0500
  r174@tachyon (orig r453078):  mkoller | 2005-08-25 01:13:47 -0500
  BUG: 91062
  restore correct calendar at login
  
  r175@tachyon (orig r453079):  binner | 2005-08-25 01:23:22 -0500
  (re)add "Help" button calling the handbook without the need to click a link in a to be first called short-help
  
  r176@tachyon (orig r453081):  scripty | 2005-08-25 01:39:52 -0500
  SVN_SILENT made messages (.desktop file)
  r177@tachyon (orig r453082):  scripty | 2005-08-25 01:40:27 -0500
  SVN_SILENT made messages (.desktop file)
  r178@tachyon (orig r453084):  scripty | 2005-08-25 01:42:03 -0500
  SVN_SILENT made messages (.desktop file)
  r179@tachyon (orig r453085):  scripty | 2005-08-25 01:42:45 -0500
  SVN_SILENT made messages (.desktop file)
  r180@tachyon (orig r453100):  gungl | 2005-08-25 02:14:04 -0500
  avoid an second update of the widgets when pressing Apply or OK
  after a modification in the filter dialog
  
  BUG:104104
  
  r181@tachyon (orig r453103):  jbaptiste | 2005-08-25 02:32:24 -0500
  Added a tooltip to the list view of the profiles to show the network configuration of the selected profile.
  r182@tachyon (orig r453105):  jbaptiste | 2005-08-25 02:45:45 -0500
  Added a tooltip to the list view of the profiles to show the network configuration of the selected profile.
  r183@tachyon (orig r453106):  ojschmidt | 2005-08-25 02:57:51 -0500
  Ask for size of screen edge
  r184@tachyon (orig r453109):  gj | 2005-08-25 03:03:29 -0500
  don't crash on very very outdated cache, this is much more sane than simple asert that causes crash!
  please review, CC me on it. Thanks
  
  r185@tachyon (orig r453126):  binner | 2005-08-25 04:43:49 -0500
  Show icons in category view
  
  r186@tachyon (orig r453174):  mpfeiffer | 2005-08-25 06:23:42 -0500
  86->111 abundance and radii filled
  r187@tachyon (orig r453176):  mm | 2005-08-25 06:32:39 -0500
  if we get a "usb:XXX,YYY" port but don't find it, try with "usb:".
  
  r188@tachyon (orig r453179):  staniek | 2005-08-25 06:49:48 -0500
  More and more apps using SQLite:
  -SQLite2, SQLite 3 mime types and magic data added
   (already defined in may)
  
  
  r189@tachyon (orig r453201):  ogoffart | 2005-08-25 07:54:55 -0500
  automatic port detection doesn't work.   hardcode one
  r190@tachyon (orig r453215):  tokoe | 2005-08-25 08:50:52 -0500
  Fixed code to be C++ standard conform. Thanks for the patch!
  
  BUG:111181
  
  r191@tachyon (orig r453222):  ogoffart | 2005-08-25 09:17:08 -0500
  don't hide the contactlist if there are no systemtray.
  BUG: 110446
  CCMAIL: mattr@kde.org 
  
  r192@tachyon (orig r453253):  ogoffart | 2005-08-25 12:12:05 -0500
  fix Bug 111459: Don't send system colors by default
  BUG: 111459
  CCMAIL mattr@kde.org
  
  r193@tachyon (orig r453262):  ogoffart | 2005-08-25 12:42:50 -0500
  Only try to connect 3 times
  r194@tachyon (orig r453278):  jbaptiste | 2005-08-25 13:58:43 -0500
  - Fixed crash when showing the tooltip of a new profile before it's insn't created.
  - Changed the order of appereance of some of the info in the tooltip.
  r195@tachyon (orig r453283):  ogoffart | 2005-08-25 14:25:24 -0500
  fix Bug 109494: Adding address book link and using name from address book causes name to be blank 
  BUG: 109494
  CCMAIL: mattr@kde.org
  
  r196@tachyon (orig r453288):  whuss | 2005-08-25 14:36:31 -0500
  SVN_SILENT Fix enable-final.
  r197@tachyon (orig r453298):  cloose | 2005-08-25 15:08:28 -0500
  Partly implement wish #84909:
  
  Add autocompletion to text edit in commit dialog. At the moment
  it only supports completion of the selected files.
  
  Also support for the completion modes is missing.
  
  CCBUG: 84909
  
  
  r198@tachyon (orig r453306):  linusmc | 2005-08-25 15:21:07 -0500
  All scalar values can now be dumped from watch-tree.
  All scalar values can now also be copied to clipboard.
  Added support or DGBp variable value changing.
  
  
  r199@tachyon (orig r453308):  jbaptiste | 2005-08-25 15:27:55 -0500
  Make the tooltip not show the IP and broadcast addresses if the boot protocol is DHCP (as there isn't an IP and broadcast addresses saved in the profile in this case).
  r200@tachyon (orig r453318):  hadacek | 2005-08-25 15:56:45 -0500
  fix c++ constness (bug #111304)
  
  r201@tachyon (orig r453320):  sedwards | 2005-08-25 16:02:16 -0500
  Fixes, updates and extra class coverage merged in from upstream.
  * SIP version is now 4.2.1
  * PyQt version is now 3.14.1
  * PyKDE is snapshot 20050628
  
  
  r202@tachyon (orig r453325):  hadacek | 2005-08-25 16:13:27 -0500
  - fix bug #100163 (log file loading)
  - adjust version and changelog
  
  r203@tachyon (orig r453334):  ingwa | 2005-08-25 16:31:09 -0500
  Fix bug 111452: Code violates C++ spec with improper const and
  		iterator declarations
  
  CCBUGS: 111452
  
  
  r204@tachyon (orig r453335):  kling | 2005-08-25 16:34:35 -0500
  Don't create a KHTMLFactory if we've already got one. Blessed by David.
  
  r205@tachyon (orig r453343):  mpyne | 2005-08-25 17:16:31 -0500
  Backport empty option value fix and more generic cxxflags to KDE 3.5.
  
  r206@tachyon (orig r453344):  adridg | 2005-08-25 17:17:55 -0500
  Dox debugging: make cleanup optional, default to on.
  r207@tachyon (orig r453345):  adridg | 2005-08-25 17:19:16 -0500
  Import Bernd (where _has_ he gone off to, anyway?) Gehrmann's good description of the trader syntax so it's in the APIDOX and near the class that it's for.
  r208@tachyon (orig r453346):  henrique | 2005-08-25 17:31:13 -0500
  Change the way file sizes are displayed.
  
  r209@tachyon (orig r453359):  davec | 2005-08-25 18:38:15 -0500
  Correct name of molecule.
  BUG: 94134
  
  r210@tachyon (orig r453362):  jbaptiste | 2005-08-25 18:42:13 -0500
  SVN_SILENT: Commented out the slot updateProfileNameSlot() for now as it probably isn't going to be used anyway (but I'm not sure yet).
  r211@tachyon (orig r453378):  orlovich | 2005-08-25 19:58:28 -0500
  Fix rowIndex to make sure the head goes first. Noticed from reading the code.
  Testcase upcoming.
  
 


 _M            branches/KDE/3.5/kdenetwork/kopete (directory)  
 M  +6 -3      protocols/msn/webcam.cpp  


** branches/KDE/3.5/kdenetwork/kopete #property changes
Name: svk:merge
   - 760c6968-05ff-0310-b53a-f1fc271f67d0:/local/branches/KDE/3.5/kdenetwork/kopete:165
   + 760c6968-05ff-0310-b53a-f1fc271f67d0:/local/branches/KDE/3.5/kdenetwork/kopete:212
--- branches/KDE/3.5/kdenetwork/kopete/protocols/msn/webcam.cpp #453741:453742
@@ -330,7 +330,7 @@
 		QObject::connect(m_listener, SIGNAL(readyAccept()), this, SLOT(slotAccept()));
 		QObject::connect(m_listener, SIGNAL(gotError(int)), this, SLOT(slotListenError(int)));
 				// Listen for incoming connections.
-		bool isListening = m_listener->listen(1);
+		bool isListening = m_listener->listen();
 		kdDebug(14140) << k_funcinfo << (isListening ? QString("listening %1").arg(m_listener->localAddress().toString()) : QString("not listening")) << endl;		
 		
 		rx=QRegExp("<tcpport>([^<]*)</tcpport>");
@@ -494,9 +494,12 @@
 	
 	KConfig *config = KGlobal::config();
 	config->setGroup( "MSN" );
-	m_listener = new KServerSocket( config->readEntry("WebcamPort" ) ,this) ;
-	QString port=m_listener->localAddress().serviceName();
+	QString port=config->readEntry("WebcamPort" );
+	if(port.isEmpty() || port == "0" )
+		port="6891";
 	
+	m_listener = new KServerSocket(port, this) ;
+	
 	return "<" + who + "><version>2.0</version><rid>"+QString::number(rid)+"</rid><udprid>"+QString::number(rid+1)+"</udprid><session>"+QString::number(session)+"</session><ctypes>0</ctypes><cpu>2931</cpu>" +
 			"<tcp><tcpport>"+port+"</tcpport>\t\t\t\t\t\t\t\t  <tcplocalport>"+port+"</tcplocalport>\t\t\t\t\t\t\t\t  <tcpexternalport>"+port+"</tcpexternalport>"+ip+"</tcp>"+
 			"<udp><udplocalport>7786</udplocalport><udpexternalport>31863</udpexternalport><udpexternalip>"+ ip +"</udpexternalip><a1_port>31859</a1_port><b1_port>31860</b1_port><b2_port>31861</b2_port><b3_port>31862</b3_port><symmetricallocation>1</symmetricallocation><symmetricallocationincrement>1</symmetricallocationincrement><udpversion>1</udpversion><udpinternalipaddress1>127.0.0.1</udpinternalipaddress1></udp>"+