This forum has been archived. All content is frozen. Please use KDE Discuss instead.

[Kourse 3] Fixing krazy2 issues

Tags: None
(comma "," separated)
HappySmileMan
Alumni
Posts
17
Karma
0
OS

RE: [Kourse 3] Fixing krazy2 issues

Fri Jan 16, 2009 5:03 pm
Patch made for dragonplayer, only very small changes so I figure only one patch is needed (might make another for one of the issues I haven't fixed yet, as explained below.):

Code: Select all
Index: app/mainWindow.cpp
===================================================================
--- app/mainWindow.cpp   (revision 910592)
+++ app/mainWindow.cpp   (working copy)
@@ -220,7 +220,7 @@
         if (args.isSet( "play-dvd" ))
             engine()->playDvd();
         else if (args.count() > 0 ) {
-            open( args.url( 0 ) );
+            this->open( args.url( 0 ) );
             args.clear();
             adjustSize(); //will resize us to reflect the videoWindow's sizeHint()
         }
@@ -272,7 +272,7 @@
     connect( playerStop, SIGNAL( triggered() ), engine(), SLOT( stop() ) );
     addToAc( playerStop )
 
-    KToggleAction* mute = new KToggleAction( KIcon("player-volume-muted"), i18n("Mute"), ac );
+    KToggleAction* mute = new KToggleAction( KIcon("player-volume-muted"), i18nc( "Mute the sound output", "Mute"), ac );
     mute->setObjectName( "mute" );
     mute->setShortcut( Qt::Key_M );
     connect( mute, SIGNAL( toggled( bool ) ), videoWindow(), SLOT( mute( bool ) ) );
@@ -394,7 +394,7 @@
         m_volumeSlider->setDisabled ( engine()->isMuted() );
 
         m_muteCheckBox = new QCheckBox();
-        m_muteCheckBox->setText( i18n( "Mute " ) );
+        m_muteCheckBox->setText( i18nc( "Mute the sound output", "Mute " ) );
         m_muteCheckBox->setChecked ( engine()->isMuted() );
         connect( m_muteCheckBox, SIGNAL( toggled( bool ) ), videoWindow(), SLOT( mute( bool ) ) );
 
@@ -550,17 +550,17 @@
         const KUrl url = KFileDialog::getOpenUrl( KUrl("kfiledialog:///dragonplayer"),mimeFilter.join(" "), this, i18n("Select A File To Play") );
         if( url.isEmpty() )
         {
-             debug() open( url );
         } break;
     case PlayDialog::RECENT_FILE:
       
         break;
     case PlayDialog::VCD:
-        open( KUrl( "vcd://" ) ); // one / is not enough
+        this->open( KUrl( "vcd://" ) ); // one / is not enough
         break;
     case PlayDialog::DVD:
         playDisc();
@@ -611,7 +611,7 @@
 {
     m_playDialog->deleteLater();
     m_playDialog = 0;
-    open( url );
+    this->open( url );
 }
 
 void
@@ -702,7 +702,7 @@
 {
     KUrl::List uriList = KUrl::List::fromMimeData( e->mimeData() );
     if( !uriList.isEmpty() )
-        open( uriList.first() );
+        this->open( uriList.first() );
     else
         engineMessage( i18n("Sorry, no media was found in the drop") );
 }
Index: app/theStream.cpp
===================================================================
--- app/theStream.cpp   (revision 910592)
+++ app/theStream.cpp   (working copy)
@@ -138,8 +138,8 @@
     TheStream::prettyTitle()
     {
         const KUrl& url      = videoWindow()->m_media->currentSource().url();
-        const QString artist = QString();
-        const QString title  = QString();
+        const QString artist;
+        const QString title;
 
         if (hasVideo() && !title.isEmpty())
             return title;
Index: app/actions.cpp
===================================================================
--- app/actions.cpp   (revision 910592)
+++ app/actions.cpp   (working copy)
@@ -67,7 +67,7 @@
 ///Codeine::VolumeAction
 ////////////////////////////////////////////////////
 Codeine::VolumeAction::VolumeAction( QObject *receiver, const char *slot, KActionCollection *ac )
-        : KToggleAction( i18n("Volume"), ac )
+        : KToggleAction( i18nc( "Volume of sound output", "Volume"), ac )
 {
     setObjectName( "volume" );
     setIcon( KIcon( "player-volume" ) );
Index: app/playlistFile.cpp
===================================================================
--- app/playlistFile.cpp   (revision 910592)
+++ app/playlistFile.cpp   (working copy)
@@ -41,9 +41,9 @@
 
     QString &path = m_path = url.path();
 
-    if( path.endsWith( ".pls", Qt::CaseInsensitive ) )
+    if( path.endsWith( QString(".pls"), Qt::CaseInsensitive ) )
         m_type = PLS; else
-    if( path.endsWith( ".m3u", Qt::CaseInsensitive ) )
+    if( path.endsWith( QString(".m3u"), Qt::CaseInsensitive ) )
         m_type = M3U;
     else {
         m_type = Unknown;
@@ -52,7 +52,7 @@
     }
 
     if( m_isRemoteFile ) {
-        path = QString();
+        path.clear();
         if( !KIO::NetAccess::download( url, path, Codeine::mainWindow() ) ) {
             m_error = i18n( "Dragon Player could not download the remote playlist: %1", url.prettyUrl() );
             return;
@@ -91,7 +91,7 @@
 
     for( QString line = stream.readLine(); !line.isNull(); )
     {
-        if( line.startsWith( "File" ) ) {
+        if( line.startsWith( QString("File") ) ) {
             const KUrl url = line.section( '=', -1 );
             const QString title = stream.readLine().section( '=', -1 );
 
@@ -116,7 +116,7 @@
     {
         line = stream.readLine();
 
-        if( line.startsWith( "#EXTINF", Qt::CaseInsensitive ) )
+        if( line.startsWith( QString("#EXTINF"), Qt::CaseInsensitive ) )
             continue;
 
         else if( !line.startsWith( '#' ) && !line.isEmpty() )
Index: app/fht.cpp
===================================================================
--- app/fht.cpp   (revision 910592)
+++ app/fht.cpp   (working copy)
@@ -122,7 +122,7 @@
    }
    semiLogSpectrum(p);
    *out++ = *p = *p / 100;
-   for (k = i = 1, r = m_log; i < n; i++) {
+   for (k = i = 1, r = m_log; i < n; ++i) {
       j = *r++;
       if (i == j)
          *out++ = p[i];
Index: app/stateChange.cpp
===================================================================
--- app/stateChange.cpp   (revision 910592)
+++ app/stateChange.cpp   (working copy)
@@ -143,7 +143,7 @@
         const QString url_string = url.url();
         if( !(url_string.contains( "porn", Qt::CaseInsensitive ) || url_string.contains( "pr0n", Qt::CaseInsensitive )) )
         #endif
-            if( url.protocol() != "dvd" && url.protocol() != "vcd" && url.prettyUrl()!="") {
+            if( url.protocol() != "dvd" && url.protocol() != "vcd" && !url.prettyUrl().isEmpty()) {
                 KConfigGroup config = KConfigGroup( KGlobal::config(), "General" );
                 const QString prettyUrl = url.prettyUrl();
 


Things not fixed:

Check for cpp macros and usage [cpp]... 1 issue found:
debug.h line 44 contains platform specific macro, this should be done using cmake instead, I don't know how I would fix this.

Check for an acceptable license [license]... 2 issues found:
app/recentlyPlayedList.cpp and app/recentlyPlayedList.h missing license.
It's not my own work, AFAIK the actual author would have to do this (just a formality I guess)

Check for Qt classes that should not be used [qclasses]... 2 issues found:
app/playDialog.h/.cpp use a QDialog instead of a KDialog, I've tried changing this and got some weird graphical errors, seems it'd require a bit more changes than the other issues, I'll look at it again and if I do get it to work I'll send in another patch, but no luck so far (don't have much experience)

Sending it to mailing list now.

Last edited by HappySmileMan on Fri Jan 16, 2009 5:04 pm, edited 1 time in total.


HappySmileMan, proud to be a member of KDE forums since 2008-Oct.
fengshaun
Alumni
Posts
32
Karma
0
OS

RE: [Kourse 3] Fixing krazy2 issues

Sat Jan 17, 2009 1:45 am
So are my two patches good enough to be sent to the kdelibs-bugs mailing list?


A proud KDE user and Linux enthusiast.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

RE: [Kourse 3] Fixing krazy2 issues

Sat Jan 17, 2009 10:30 am
@Fengshaun: I think the mailing list for KDE libs ( patches, discussion, etc ) is kde-core-devel@kde.org


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
michael4910
Alumni
Posts
100
Karma
0
OS

RE: [Kourse 3] Fixing krazy2 issues

Sat Jan 17, 2009 10:35 am
Working on konqueror I just wonder why on http://englishbreakfastnetwork.org/kraz ... index.html there are no issues found for i18ncheckarg but my local krazy finds about 50 issues like for example:
Code: Select all
./src/konqview.cpp: single adjective as message, probably ambiguous; use context call to explain what it refers to line#1314

Code: Select all
if ( KMessageBox::warningContinueCancel( 0, i18n(
            "The page you are trying to view is the result of posted form data. "
            "If you resend the data, any action the form carried out (such as search or online purchase) will be repeated. "),
            i18n( "Warning" ), KGuiItem(i18nc( "Resend the data", "Resend" )) ) == KMessageBox::Continue )
        {

Did I miss something?


michael4910, proud to be a member of KDE forums since 2008-Oct.
bruno
KDE Developer
Posts
40
Karma
0
OS

RE: [Kourse 3] Fixing krazy2 issues

Sat Jan 17, 2009 6:06 pm
michael4910 wrote:Working on konqueror I just wonder why on http://englishbreakfastnetwork.org/kraz ... index.html there are no issues found for i18ncheckarg but my local krazy finds about 50 issues like for example:

Did I miss something?



I asked about that, this is the reason :

[quote=Chusslove Illich]Re: Krazy : i18ncheckarg's check not showing issues on EBN

That's because the --priority=important is used for the web report,
reporting only issues that should really be fix. While when you run it
locally without the --priority option, all issues are reported.

You can see all of those locally reported issues are of "add context"
variety. Contexts are very useful for translators, but not so essential on
the technical side. So they drowned the web report, causing people not to
fix even the essential issues, and therefore we decided to relegate them to
lower priority and not show them.[/quote]


bruno, proud to be a member of KDE forums since 2008-Oct.
User avatar
msoeken
Mentor
Posts
300
Karma
4
OS

RE: [Kourse 3] Fixing krazy2 issues

Sun Jan 18, 2009 4:01 pm
fengshaun wrote:So are my two patches good enough to be sent to the kdelibs-bugs mailing list?


Yes, please send them to kde-core-devel@kde.org.


Image
[size=x-small]code | [url=cia.vc/stats/author/msoeken]cia.vc[/url] | [url=kde.org/support]donating KDE[/url] | [url=tinyurl.com/cto4ns]wishlist[/url][/size]
fengshaun
Alumni
Posts
32
Karma
0
OS

RE: [Kourse 3] Fixing krazy2 issues

Sun Jan 18, 2009 6:59 pm
I sent them yesterday, no replies yet.


A proud KDE user and Linux enthusiast.
bruno
KDE Developer
Posts
40
Karma
0
OS

RE: [Kourse 3] Fixing krazy2 issues

Sun Jan 18, 2009 7:09 pm
Someone have an answer for my foreach question?


bruno, proud to be a member of KDE forums since 2008-Oct.
User avatar
msoeken
Mentor
Posts
300
Karma
4
OS

RE: [Kourse 3] Fixing krazy2 issues

Mon Jan 19, 2009 10:27 am
bruno wrote:Someone have an answer for my foreach question?


I had a look into the code of the foreach checker. It seems that QPair is missing as a type to recognize. But your code should be fine. If you want to, you can file a bug report on [url=bugs.kde.org]http://bugs.kde.org[/url]. As I see it, there are just six characters to add to the checker.

Cheers, m.


Image
[size=x-small]code | [url=cia.vc/stats/author/msoeken]cia.vc[/url] | [url=kde.org/support]donating KDE[/url] | [url=tinyurl.com/cto4ns]wishlist[/url][/size]
HappySmileMan
Alumni
Posts
17
Karma
0
OS

RE: [Kourse 3] Fixing krazy2 issues

Mon Jan 19, 2009 11:00 pm
Oh yeah the post to mailing list for my patch is at this page.

Last edited by HappySmileMan on Mon Jan 19, 2009 11:01 pm, edited 1 time in total.


HappySmileMan, proud to be a member of KDE forums since 2008-Oct.
bruno
KDE Developer
Posts
40
Karma
0
OS

RE: [Kourse 3] Fixing krazy2 issues

Mon Jan 19, 2009 11:19 pm
msoeken wrote:I had a look into the code of the foreach checker. It seems that QPair is missing as a type to recognize. But your code should be fine. If you want to, you can file a bug report on [url=bugs.kde.org]http://bugs.kde.org[/url]. As I see it, there are just six characters to add to the checker.


It seem they changed the file, this patch is no longer needed. But I'll look at that.


For http://lxr.kde.org/source/KDE/kdeplasma ... ts.cpp#117 , if I do:
Code: Select all
Index: OpenDocuments.cpp
===================================================================
--- OpenDocuments.cpp   (révision 913834)
+++ OpenDocuments.cpp   (copie de travail)
@@ -113,8 +113,7 @@
     QRegExp * extractor = NULL;
     QString className = task->className();

-    SupportedTask st;
-    foreach (st, m_supportedTasks) {
+    foreach (const SupportedTask &st, m_supportedTasks) {
         if (st.m_classPattern.exactMatch(task->className())) {
             extractor = & st.m_documentNameExtractor;
             break;


I get:
Code: Select all
/home/kdesvn/kdesvn/kdeplasma-addons/applets/lancelot/app/src/models/OpenDocuments.cpp: In member function ‘bool Models::OpenDocuments::setDataForTask(TaskManager::TaskPtr)’:
/home/kdesvn/kdesvn/kdeplasma-addons/applets/lancelot/app/src/models/OpenDocuments.cpp:118: erreur: invalid conversion from ‘const QRegExp*’ to ‘QRegExp*


If I do:
Code: Select all
Index: OpenDocuments.cpp
===================================================================
--- OpenDocuments.cpp   (révision 913834)
+++ OpenDocuments.cpp   (copie de travail)
@@ -113,10 +113,9 @@
     QRegExp * extractor = NULL;
     QString className = task->className();

-    SupportedTask st;
-    foreach (st, m_supportedTasks) {
+    foreach (const SupportedTask &st, m_supportedTasks) {
         if (st.m_classPattern.exactMatch(task->className())) {
-            extractor = & st.m_documentNameExtractor;
+            extractor = new QRegExp(st.m_documentNameExtractor);
             break;
         }
     }
@@ -140,6 +139,7 @@
         description = extractor->cap(2);
     }

+    delete extractor;
     QIcon icon = QIcon(task->icon(32, 32));

     set(index, title, description, icon, uint(task->window()));

It works, but is there a better way?


explicit
Code: Select all
Index: lancelot/libs/lancelot/widgets/PopupList.h
===================================================================
--- lancelot/libs/lancelot/widgets/PopupList.h   (révision 913776)
+++ lancelot/libs/lancelot/widgets/PopupList.h   (copie de travail)
@@ -44,7 +44,7 @@
      * Creates a new Lancelot::PopupList
      * @param parent parent item
      */
-    PopupList(QWidget * parent = 0, Qt::WindowFlags f =  Qt::Window);
+    explicit PopupList(QWidget * parent = 0, Qt::WindowFlags f =  Qt::Window);
 
     /**
      * Destroys Lancelot::PopupList


includes
Code: Select all
Index: lancelot/app/src/models/Sessions.h
===================================================================
--- lancelot/app/src/models/Sessions.h   (révision 913822)
+++ lancelot/app/src/models/Sessions.h   (copie de travail)
@@ -17,8 +17,8 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-#ifndef LANCELOTAPP_MODELS_SESSION_H
-#define LANCELOTAPP_MODELS_SESSION_H
+#ifndef LANCELOTAPP_MODELS_SESSIONS_H
+#define LANCELOTAPP_MODELS_SESSIONS_H
 
 #include "BaseModel.h"
 #include
@@ -44,4 +44,4 @@
 
 } // namespace Models
 
-#endif /* LANCELOTAPP_MODELS_SESSION_H */
+#endif /* LANCELOTAPP_MODELS_SESSIONS_H */
Index: lancelot/libs/lancelot/widgets/ActionListView.h
===================================================================
--- lancelot/libs/lancelot/widgets/ActionListView.h   (révision 913822)
+++ lancelot/libs/lancelot/widgets/ActionListView.h   (copie de travail)
@@ -23,8 +23,8 @@
 #include
 #include
 
-#include
-#include
+#include
+#include
 
 #include
 #include


qclasses
Code: Select all
Index: bball/bballConfig.ui
===================================================================
--- bball/bballConfig.ui   (révision 913748)
+++ bball/bballConfig.ui   (copie de travail)
@@ -14,7 +14,7 @@
   
   
   
-   
+   
     
       
        0


strings
Code: Select all
Index: lancelot/app/src/parts/LancelotPart.cpp
===================================================================
--- lancelot/app/src/parts/LancelotPart.cpp   (révision 913748)
+++ lancelot/app/src/parts/LancelotPart.cpp   (copie de travail)
@@ -342,7 +342,7 @@
             } else if (modelID == "FavoriteApplications") {
                 // We don't want to delete this one (singleton)
                 m_model->addModel(modelID, QIcon(), i18n("Favorite Applications"), model = Models::FavoriteApplications::instance());
-            } else if (modelID.startsWith("Folder ")) {
+            } else if (modelID.startsWith(QString("Folder "))) {
                 modelID.remove(0, 7);
                 m_model->addModel(modelID,
                         QIcon(),
Index: weatherstation/lcd.cpp
===================================================================
--- weatherstation/lcd.cpp   (révision 913748)
+++ weatherstation/lcd.cpp   (copie de travail)
@@ -192,7 +192,7 @@
                     QString id = element.attribute("id");
                     if ((pos = id.lastIndexOf(':')) > -1) {
                         groups[id.left(pos)]  -1) {
Index: twitter/twitter.cpp
===================================================================
--- twitter/twitter.cpp   (révision 913748)
+++ twitter/twitter.cpp   (copie de travail)
@@ -352,7 +352,7 @@
 {
     //kDebug() kill(); //FIXME only clear it if it was showing an error msg
         } else {
             //this is a fake update from a new source
@@ -403,7 +403,7 @@
                 showTweets();
             }
         }
-    } else if (source.startsWith("Error")) {
+    } else if (source.startsWith(QString("Error"))) {
         QString desc = data["description"].toString();
 
         if (desc == "Authentication required"){


syscalls
Code: Select all
Index: lancelot/app/src/models/Places.cpp
===================================================================
--- lancelot/app/src/models/Places.cpp   (révision 913748)
+++ lancelot/app/src/models/Places.cpp   (copie de travail)
@@ -40,9 +40,9 @@
     // We don't want to use addUrl, because of the icons
     add(
         i18n("Home Folder"),
-        getenv("HOME"),
+        qgetenv("HOME"),
         KIcon("user-home"),
-        getenv("HOME")
+        qgetenv("HOME")
     );
 
     add(


bruno, proud to be a member of KDE forums since 2008-Oct.
User avatar
msoeken
Mentor
Posts
300
Karma
4
OS

RE: [Kourse 3] Fixing krazy2 issues

Tue Jan 20, 2009 8:33 am
bruno wrote:
msoeken wrote:I had a look into the code of the foreach checker. It seems that QPair is missing as a type to recognize. But your code should be fine. If you want to, you can file a bug report on [url=bugs.kde.org]http://bugs.kde.org[/url]. As I see it, there are just six characters to add to the checker.


It seem they changed the file, this patch is no longer needed. But I'll look at that.


For http://lxr.kde.org/source/KDE/kdeplasma ... ts.cpp#117 , if I do:
Code: Select all
Index: OpenDocuments.cpp
===================================================================
--- OpenDocuments.cpp   (révision 913834)
+++ OpenDocuments.cpp   (copie de travail)
@@ -113,8 +113,7 @@
     QRegExp * extractor = NULL;
     QString className = task->className();

-    SupportedTask st;
-    foreach (st, m_supportedTasks) {
+    foreach (const SupportedTask &st, m_supportedTasks) {
         if (st.m_classPattern.exactMatch(task->className())) {
             extractor = & st.m_documentNameExtractor;
             break;


I get:
Code: Select all
/home/kdesvn/kdesvn/kdeplasma-addons/applets/lancelot/app/src/models/OpenDocuments.cpp: In member function ‘bool Models::OpenDocuments::setDataForTask(TaskManager::TaskPtr)’:
/home/kdesvn/kdesvn/kdeplasma-addons/applets/lancelot/app/src/models/OpenDocuments.cpp:118: erreur: invalid conversion from ‘const QRegExp*’ to ‘QRegExp*


If I do:
Code: Select all
Index: OpenDocuments.cpp
===================================================================
--- OpenDocuments.cpp   (révision 913834)
+++ OpenDocuments.cpp   (copie de travail)
@@ -113,10 +113,9 @@
     QRegExp * extractor = NULL;
     QString className = task->className();

-    SupportedTask st;
-    foreach (st, m_supportedTasks) {
+    foreach (const SupportedTask &st, m_supportedTasks) {
         if (st.m_classPattern.exactMatch(task->className())) {
-            extractor = & st.m_documentNameExtractor;
+            extractor = new QRegExp(st.m_documentNameExtractor);
             break;
         }
     }
@@ -140,6 +139,7 @@
         description = extractor->cap(2);
     }

+    delete extractor;
     QIcon icon = QIcon(task->icon(32, 32));

     set(index, title, description, icon, uint(task->window()));

It works, but is there a better way?


With the second solution, you still copy the SupportedTask variable which brings no advantage over the initial solution. You just don't have to make it const (but referenced) in the foreach loop:
Code: Select all
foreach (SupportedTask &st, m_supportedTasks) { ... }


Image
[size=x-small]code | [url=cia.vc/stats/author/msoeken]cia.vc[/url] | [url=kde.org/support]donating KDE[/url] | [url=tinyurl.com/cto4ns]wishlist[/url][/size]
bruno
KDE Developer
Posts
40
Karma
0
OS

RE: [Kourse 3] Fixing krazy2 issues

Tue Jan 20, 2009 8:49 am
msoeken wrote:With the second solution, you still copy the SupportedTask variable which brings no advantage over the initial solution. You just don't have to make it const (but referenced) in the foreach loop:
Code: Select all
foreach (SupportedTask &st, m_supportedTasks) { ... }



Are you sure we don't need const? I still get an issue from krazy. Also, do you have news for the "Check for cpp macros and usage [cpp]" issues (CMake HAVE_foo macros)?

Code: Select all
Index: lancelot/app/src/models/OpenDocuments.cpp
===================================================================
--- lancelot/app/src/models/OpenDocuments.cpp   (révision 913851)
+++ lancelot/app/src/models/OpenDocuments.cpp   (copie de travail)
@@ -113,8 +113,7 @@
     QRegExp * extractor = NULL;
     QString className = task->className();

-    SupportedTask st;
-    foreach (st, m_supportedTasks) {
+    foreach (SupportedTask &st, m_supportedTasks) {
         if (st.m_classPattern.exactMatch(task->className())) {
             extractor = & st.m_documentNameExtractor;
             break;


Code: Select all
==>For File Type c++<==
1. Check for foreach loop issues [foreach]... 1 issue found
        lancelot/app/src/models/OpenDocuments.cpp: line#116 (1)


Why should I care? When not using POD types (int, double, pointer, ...) you should use const & for your foreach variables. There are two reasons for this: 1) Prevents you from the mistake of writing foreach loops that modify the list, that is 'foreach(Foo f, list) f.a = f.b = f.c = 0;' compiles but does not modify the contents of list 2) Saves a copy constructor call for each of the list elements


bruno, proud to be a member of KDE forums since 2008-Oct.
User avatar
msoeken
Mentor
Posts
300
Karma
4
OS

RE: [Kourse 3] Fixing krazy2 issues

Wed Jan 21, 2009 6:58 am
bruno wrote:
msoeken wrote:With the second solution, you still copy the SupportedTask variable which brings no advantage over the initial solution. You just don't have to make it const (but referenced) in the foreach loop:
Code: Select all
foreach (SupportedTask &st, m_supportedTasks) { ... }



Are you sure we don't need const? I still get an issue from krazy. Also, do you have news for the "Check for cpp macros and usage [cpp]" issues (CMake HAVE_foo macros)?


What happens if you write const QRegExp * extractor. Does that work. If it does not, we cannot have const, because when assigning the reference to a pointer it can be changed via the pointer.


Image
[size=x-small]code | [url=cia.vc/stats/author/msoeken]cia.vc[/url] | [url=kde.org/support]donating KDE[/url] | [url=tinyurl.com/cto4ns]wishlist[/url][/size]
bruno
KDE Developer
Posts
40
Karma
0
OS

RE: [Kourse 3] Fixing krazy2 issues

Wed Jan 21, 2009 7:13 am
Code: Select all
Index: lancelot/app/src/models/OpenDocuments.cpp
===================================================================
--- lancelot/app/src/models/OpenDocuments.cpp   (révision 913851)
+++ lancelot/app/src/models/OpenDocuments.cpp   (copie de travail)
@@ -110,11 +110,10 @@
     Q_ASSERT(task);

     // kDebug() className() classClass();
-    QRegExp * extractor = NULL;
+    const QRegExp * extractor = NULL;
     QString className = task->className();

-    SupportedTask st;
-    foreach (st, m_supportedTasks) {
+    foreach (const SupportedTask &st, m_supportedTasks) {
         if (st.m_classPattern.exactMatch(task->className())) {
             extractor = & st.m_documentNameExtractor;
             break;


[ 72%] Building CXX object applets/lancelot/app/src/CMakeFiles/plasma_applet_lancelot_part.dir/models/OpenDocuments.o
/home/kdesvn/kdesvn/kdeplasma-addons/applets/lancelot/app/src/models/OpenDocuments.cpp: In member function ‘bool Models::OpenDocuments::setDataForTask(TaskManager::TaskPtr)’:
/home/kdesvn/kdesvn/kdeplasma-addons/applets/lancelot/app/src/models/OpenDocuments.cpp:138: erreur: passing ‘const QRegExp’ as ‘this’ argument of ‘QString QRegExp::cap(int)’ discards qualifiers
/home/kdesvn/kdesvn/kdeplasma-addons/applets/lancelot/app/src/models/OpenDocuments.cpp:139: erreur: passing ‘const QRegExp’ as ‘this’ argument of ‘QString QRegExp::cap(int)’ discards qualifiers
/home/kdesvn/kdesvn/kdeplasma-addons/applets/lancelot/app/src/models/OpenDocuments.cpp: In member function ‘bool Models::OpenDocuments::setDataForTask(TaskManager::TaskPtr)’:
/home/kdesvn/kdesvn/kdeplasma-addons/applets/lancelot/app/src/models/OpenDocuments.cpp:138: erreur: passing ‘const QRegExp’ as ‘this’ argument of ‘QString QRegExp::cap(int)’ discards qualifiers
/home/kdesvn/kdesvn/kdeplasma-addons/applets/lancelot/app/src/models/OpenDocuments.cpp:139: erreur: passing ‘const QRegExp’ as ‘this’ argument of ‘QString QRegExp::cap(int)’ discards qualifiers
make[2]: *** [applets/lancelot/app/src/CMakeFiles/lancelot-menu.dir/models/OpenDocuments.o] Erreur 1


bruno, proud to be a member of KDE forums since 2008-Oct.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], kesang, Sogou [Bot], Yahoo [Bot]