Project Name | CID | Checker | Category | Developer Description |
---|---|---|---|---|
KBibTeX | 90337 | COPY_PASTE_ERROR | Incorrect expression | This copy&paste effect would have been virtually impossible to detect by a human reader -- the two variables that got mixed up had too similar names. |
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
/// Configuration which part to use to open bibliography files QStringList addedKDEServiceAssociations = configGroupAddedKDEServiceAssociations.readXdgListEntry(mimetype, QStringList()); /// Remove KBibTeX from list (will be added later to list's head) addedKDEServiceAssociations.removeAll(kbibtexPartDesktop); if (isPlainTextFormat) { /// Remove Kate from list (will be added later to list's second position) addedKDEServiceAssociations.removeAll(katePartDesktop); /// Add Kate to list's head (will turn up as second) addedKDEServiceAssociations.prepend(katePartDesktop); } /// Add KBibTeX to list's head addedKDEServiceAssociations.prepend(kbibtexPartDesktop); /// Write out and sync changes configGroupAddedKDEServiceAssociations.writeXdgListEntry(mimetype, addedKDEServiceAssociations); configGroupAddedKDEServiceAssociations.sync(); /// Configuration which application NOT to use to open bibliography files QStringList removedAssociations = configGroupRemovedAssociations.readXdgListEntry(mimetype, QStringList()); /// If list of applications not to use is not empty ... if (!removedAssociations.isEmpty()) { /// Remove KBibTeX from list removedAssociations.removeAll(kbibtexApplicationDesktop); if (isPlainTextFormat) /// Remove Kate from list |
<< "removedAssociations" looks like the original copy.
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
removedAssociations.removeAll(kateApplicationDesktop); if (removedAssociations.isEmpty()) /// Empty lists can be removed from configuration file configGroupRemovedAssociations.deleteEntry(mimetype); else /// Write out updated list configGroupRemovedAssociations.writeXdgListEntry(mimetype, removedAssociations); /// Sync changes configGroupRemovedAssociations.sync(); } /// Configuration which part NOT to use to open bibliography files QStringList removedKDEServiceAssociations = configGroupRemovedKDEServiceAssociations.readXdgListEntry(mimetype, QStringList()); /// If list of parts not to use is not empty ... if (!removedKDEServiceAssociations.isEmpty()) { /// Remove KBibTeX part from list removedKDEServiceAssociations.removeAll(kbibtexPartDesktop); if (isPlainTextFormat) /// Remove Kate part from list |
<<< CID 90337: Incorrect expression COPY_PASTE_ERROR <<< "removedAssociations" in "removedAssociations" looks like a copy-paste error.
< Should it say "removedKDEServiceAssociations" instead?
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
removedAssociations.removeAll(katePartDesktop); if (removedKDEServiceAssociations.isEmpty()) /// Empty lists can be removed from configuration file configGroupRemovedKDEServiceAssociations.deleteEntry(mimetype); else /// Write out updated list configGroupRemovedKDEServiceAssociations.writeXdgListEntry(mimetype, removedKDEServiceAssociations); /// Sync changes configGroupRemovedKDEServiceAssociations.sync(); } return true; } bool isKBibTeXdefaultForMimeType(const QString &mimetype) const { /// Fetch all four configuration groups const QStringList addedAssociations = configGroupAddedAssociations.readXdgListEntry(mimetype, QStringList()); const QStringList addedKDEServiceAssociations = configGroupAddedKDEServiceAssociations.readXdgListEntry(mimetype, QStringList()); const QStringList removedAssociations = configGroupRemovedAssociations.readXdgListEntry(mimetype, QStringList()); const QStringList removedKDEServiceAssociations = configGroupRemovedKDEServiceAssociations.readXdgListEntry(mimetype, QStringList()); /// KBibTeX is default editor for bibliography if ... /// - the list of applications associated to mime type is not empty /// - KBibTeX is head of this list /// - KBibTeX is not named in the list of applications not be used /// - the list of parts associated to mime type is not empty /// - KBibTeX part is head of this list /// - KBibTeX part is not named in the list of parts not be used |
original | bibliographyservice.cpp:109 | |
remediation | bibliographyservice.cpp:128 | |
copy_paste_error | bibliographyservice.cpp:128 |