Skip to content

Commit 5e1b5a4

Browse files
committed
Coverity fixes
1 parent 7a0d041 commit 5e1b5a4

File tree

8 files changed

+38
-20
lines changed

8 files changed

+38
-20
lines changed

src/app/qgsvectorlayerproperties.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,14 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
7474
: QgsOptionsDialogBase( "VectorLayerProperties", parent, fl )
7575
, layer( lyr )
7676
, mMetadataFilled( false )
77+
, mSaveAsMenu( 0 )
78+
, mLoadStyleMenu( 0 )
7779
, mRendererDialog( 0 )
80+
, labelingDialog( 0 )
81+
, labelDialog( 0 )
82+
, actionDialog( 0 )
83+
, diagramPropertiesDialog( 0 )
84+
, mFieldsPropertiesDialog( 0 )
7885
{
7986
setupUi( this );
8087
// QgsOptionsDialogBase handles saving/restoring of geometry, splitter and current tab states,

src/core/gps/qextserialport/posix_qextserialport.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -663,11 +663,11 @@ void QextSerialPort::setTimeout(long millisec)
663663
Posix_Copy_Timeout.tv_usec = millisec % 1000;
664664
if (isOpen()) {
665665
if (millisec == -1)
666-
fcntl(fd, F_SETFL, O_NDELAY);
666+
(void)fcntl(fd, F_SETFL, O_NDELAY);
667667
else
668668
//O_SYNC should enable blocking ::write()
669669
//however this seems not working on Linux 2.6.21 (works on OpenBSD 4.2)
670-
fcntl(fd, F_SETFL, O_SYNC);
670+
(void)fcntl(fd, F_SETFL, O_SYNC);
671671
tcgetattr(fd, & Posix_CommConfig);
672672
Posix_CommConfig.c_cc[VTIME] = millisec/100;
673673
tcsetattr(fd, TCSAFLUSH, & Posix_CommConfig);

src/plugins/grass/qgsgrassnewmapset.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -1263,7 +1263,13 @@ void QgsGrassNewMapset::createMapset()
12631263

12641264
// TODO: add QgsGrass::setLocation or G_make_location with
12651265
// database path
1266-
QgsGrass::activeMode(); // because it calls private QgsGrass::init()
1266+
if ( !QgsGrass::activeMode() ) // because it calls private QgsGrass::init()
1267+
{
1268+
QMessageBox::warning( this, tr( "Create mapset" ),
1269+
tr( "Cannot activate grass" ) );
1270+
return;
1271+
}
1272+
12671273
#if defined(WIN32)
12681274
G__setenv(( char * ) "GISDBASE", QgsGrass::shortPath( mDatabaseLineEdit->text() ).toUtf8().data() );
12691275
#else

src/plugins/grass/qtermwidget/Pty.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,9 @@ void Pty::setWriteable( bool writeable )
226226
struct stat sbuf;
227227
stat( pty()->ttyName(), &sbuf );
228228
if ( writeable )
229-
chmod( pty()->ttyName(), sbuf.st_mode | S_IWGRP );
229+
(void)chmod( pty()->ttyName(), sbuf.st_mode | S_IWGRP );
230230
else
231-
chmod( pty()->ttyName(), sbuf.st_mode & ~( S_IWGRP | S_IWOTH ) );
231+
(void)chmod( pty()->ttyName(), sbuf.st_mode & ~( S_IWGRP | S_IWOTH ) );
232232
}
233233

234234
Pty::Pty()

src/plugins/grass/qtermwidget/k3process.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ bool K3Process::start( RunMode runmode, Communication comm )
317317

318318
close( fd[0] );
319319
// Closing of fd[1] indicates that the execvp() succeeded!
320-
fcntl( fd[1], F_SETFD, FD_CLOEXEC );
320+
(void)fcntl( fd[1], F_SETFD, FD_CLOEXEC );
321321

322322
if ( !commSetupDoneC() )
323323
qDebug() << "Could not finish comm setup in child!" << endl;
@@ -874,15 +874,15 @@ int K3Process::setupCommunication( Communication comm )
874874
{
875875
if ( socketpair( AF_UNIX, SOCK_STREAM, 0, out ) )
876876
goto fail1;
877-
fcntl( out[0], F_SETFD, FD_CLOEXEC );
878-
fcntl( out[1], F_SETFD, FD_CLOEXEC );
877+
(void)fcntl( out[0], F_SETFD, FD_CLOEXEC );
878+
(void)fcntl( out[1], F_SETFD, FD_CLOEXEC );
879879
}
880880
if ( comm & Stderr )
881881
{
882882
if ( socketpair( AF_UNIX, SOCK_STREAM, 0, err ) )
883883
goto fail2;
884-
fcntl( err[0], F_SETFD, FD_CLOEXEC );
885-
fcntl( err[1], F_SETFD, FD_CLOEXEC );
884+
(void)fcntl( err[0], F_SETFD, FD_CLOEXEC );
885+
(void)fcntl( err[1], F_SETFD, FD_CLOEXEC );
886886
}
887887
return 1; // Ok
888888
fail2:
@@ -923,7 +923,7 @@ int K3Process::commSetupDoneP()
923923

924924
if ( communication & Stdin )
925925
{
926-
fcntl( in[1], F_SETFL, O_NONBLOCK | fcntl( in[1], F_GETFL ) );
926+
(void)fcntl( in[1], F_SETFL, O_NONBLOCK | fcntl( in[1], F_GETFL ) );
927927
innot = new QSocketNotifier( in[1], QSocketNotifier::Write, this );
928928
Q_CHECK_PTR( innot );
929929
innot->setEnabled( false ); // will be enabled when data has to be sent

src/plugins/grass/qtermwidget/k3processcontroller.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@ K3ProcessController::K3ProcessController()
105105
abort();
106106
}
107107

108-
fcntl( d->fd[0], F_SETFL, O_NONBLOCK ); // in case slotDoHousekeeping is called without polling first
109-
fcntl( d->fd[1], F_SETFL, O_NONBLOCK ); // in case it fills up
110-
fcntl( d->fd[0], F_SETFD, FD_CLOEXEC );
111-
fcntl( d->fd[1], F_SETFD, FD_CLOEXEC );
108+
(void)fcntl( d->fd[0], F_SETFL, O_NONBLOCK ); // in case slotDoHousekeeping is called without polling first
109+
(void)fcntl( d->fd[1], F_SETFL, O_NONBLOCK ); // in case it fills up
110+
(void)fcntl( d->fd[0], F_SETFD, FD_CLOEXEC );
111+
(void)fcntl( d->fd[1], F_SETFD, FD_CLOEXEC );
112112

113113
d->notifier = new QSocketNotifier( d->fd[0], QSocketNotifier::Read );
114114
d->notifier->setEnabled( true );

src/plugins/grass/qtermwidget/kpty.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,8 @@ bool KPty::open()
370370

371371
//#endif /* HAVE_OPENPTY */
372372

373-
fcntl( d->masterFd, F_SETFD, FD_CLOEXEC );
374-
fcntl( d->slaveFd, F_SETFD, FD_CLOEXEC );
373+
(void)fcntl( d->masterFd, F_SETFD, FD_CLOEXEC );
374+
(void)fcntl( d->slaveFd, F_SETFD, FD_CLOEXEC );
375375

376376
return true;
377377
}
@@ -403,12 +403,12 @@ void KPty::close()
403403
{
404404
if( chown( d->ttyName.data(), 0, st.st_gid == getgid() ? 0 : -1 ) < 0 )
405405
perror( "chown" );
406-
chmod( d->ttyName.data(), S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH );
406+
(void)chmod( d->ttyName.data(), S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH );
407407
}
408408
}
409409
else
410410
{
411-
fcntl( d->masterFd, F_SETFD, 0 );
411+
(void)fcntl( d->masterFd, F_SETFD, 0 );
412412
d->chownpty( false );
413413
}
414414
}

src/providers/grass/qgsgrass.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,12 @@ bool GRASS_LIB_EXPORT QgsGrass::mapRegion( int type, QString gisbase,
12081208
else if ( type == Vector )
12091209
{
12101210
// Get current projection
1211-
region( gisbase, location, mapset, window );
1211+
if ( !region( gisbase, location, mapset, window ) )
1212+
{
1213+
QMessageBox::warning( 0, QObject::tr( "Warning" ),
1214+
QObject::tr( "Cannot read vector map region" ) );
1215+
return false;
1216+
}
12121217

12131218
struct Map_info Map;
12141219

0 commit comments

Comments
 (0)