mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 19:11:39 -06:00
Fixes some problems reported by Coverity
- Unchecked dynamic_cast - Uninitialized scalar field - Uninitialized pointer field - Big parameter passed by value
This commit is contained in:
@@ -82,7 +82,7 @@ public:
|
||||
|
||||
void setEditorData(QWidget *editor, const QModelIndex &index) const override {
|
||||
|
||||
NullLineEdit* lineEditor = dynamic_cast<NullLineEdit*>(editor);
|
||||
NullLineEdit* lineEditor = static_cast<NullLineEdit*>(editor);
|
||||
// Set the editor in the null state (unless the user has actually written NULL)
|
||||
if (index.model()->data(index, Qt::UserRole).isNull() &&
|
||||
index.model()->data(index, Qt::DisplayRole) == Settings::getValue("databrowser", "null_text"))
|
||||
@@ -94,7 +94,7 @@ public:
|
||||
}
|
||||
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override {
|
||||
|
||||
NullLineEdit* lineEditor = dynamic_cast<NullLineEdit*>(editor);
|
||||
NullLineEdit* lineEditor = static_cast<NullLineEdit*>(editor);
|
||||
// Restore NULL text (unless the user has already modified the value)
|
||||
if (lineEditor->isNull() && !lineEditor->isModified()) {
|
||||
model->setData(index, Settings::getValue("databrowser", "null_text"), Qt::DisplayRole);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
ExtendedScintilla::ExtendedScintilla(QWidget* parent) :
|
||||
QsciScintilla(parent),
|
||||
showErrorIndicators(true),
|
||||
findReplaceDialog(new FindReplaceDialog(this))
|
||||
{
|
||||
// This class does not set any lexer, that must be done in the child classes.
|
||||
@@ -29,6 +30,7 @@ ExtendedScintilla::ExtendedScintilla(QWidget* parent) :
|
||||
// Enable UTF8
|
||||
setUtf8(true);
|
||||
|
||||
|
||||
// Enable brace matching
|
||||
setBraceMatching(QsciScintilla::SloppyBraceMatch);
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
FindReplaceDialog::FindReplaceDialog(QWidget* parent)
|
||||
: QDialog(parent),
|
||||
ui(new Ui::FindReplaceDialog),
|
||||
foundIndicatorNumber(0),
|
||||
findInProgress(false)
|
||||
{
|
||||
// Create UI
|
||||
|
||||
@@ -869,7 +869,7 @@ void MainWindow::populateTable()
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
void MainWindow::applyBrowseTableSettings(BrowseDataTableSettings storedData, bool skipFilters)
|
||||
void MainWindow::applyBrowseTableSettings(const BrowseDataTableSettings& storedData, bool skipFilters)
|
||||
{
|
||||
// We don't want to pass storedData by reference because the functions below would change the referenced data in their original
|
||||
// place, thus modifiying the data this function can use. To have a static description of what the view should look like we want
|
||||
|
||||
@@ -184,7 +184,7 @@ private:
|
||||
|
||||
sqlb::ObjectIdentifier currentlyBrowsedTableName() const;
|
||||
|
||||
void applyBrowseTableSettings(BrowseDataTableSettings storedData, bool skipFilters = false);
|
||||
void applyBrowseTableSettings(const BrowseDataTableSettings& storedData, bool skipFilters = false);
|
||||
void toggleTabVisible(QWidget* tabWidget, bool show);
|
||||
void restoreOpenTabs(QString tabs);
|
||||
QString saveOpenTabs();
|
||||
|
||||
Reference in New Issue
Block a user