Skip to content

Commit

Permalink
fix typo, use Q_UNUSED, return null/empty QString() instead literal e…
Browse files Browse the repository at this point in the history
…mpty string
  • Loading branch information
dmarteau committed Jan 10, 2017
1 parent 705547e commit bac1890
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion python/server/qgsserviceregistry.sip
Expand Up @@ -72,7 +72,7 @@ class QgsServiceRegistry
* If the version is not specified then all versions from the specified service * If the version is not specified then all versions from the specified service
* are unloaded * are unloaded
*/ */
int unRegisterService( const QString& name, const QString& version = QString() ); int unregisterService( const QString& name, const QString& version = QString() );


/** /**
* Initialize registry, load modules and auto register services * Initialize registry, load modules and auto register services
Expand Down
5 changes: 3 additions & 2 deletions src/server/qgsserverrequest.cpp
Expand Up @@ -40,9 +40,10 @@ QgsServerRequest::~QgsServerRequest()


} }


QString QgsServerRequest::getHeader( const QString& /*name*/ ) const QString QgsServerRequest::getHeader( const QString& name ) const
{ {
return ""; Q_UNUSED( name );
return QString();
} }


QUrl QgsServerRequest::url() const QUrl QgsServerRequest::url() const
Expand Down
2 changes: 1 addition & 1 deletion src/server/qgsserviceregistry.cpp
Expand Up @@ -148,7 +148,7 @@ void QgsServiceRegistry::registerService( QgsService* service )
} }
} }


int QgsServiceRegistry::unRegisterService( const QString& name, const QString& version ) int QgsServiceRegistry::unregisterService( const QString& name, const QString& version )
{ {
// Check that we have a service of that name // Check that we have a service of that name
int removed = 0; int removed = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/server/qgsserviceregistry.h
Expand Up @@ -84,7 +84,7 @@ class SERVER_EXPORT QgsServiceRegistry
* If the version is not specified then all versions from the specified service * If the version is not specified then all versions from the specified service
* are unloaded * are unloaded
*/ */
int unRegisterService( const QString& name, const QString& version = QString() ); int unregisterService( const QString& name, const QString& version = QString() );


/** /**
* Initialize registry, load modules and auto register services * Initialize registry, load modules and auto register services
Expand Down
3 changes: 2 additions & 1 deletion src/server/services/DummyService/dummy.cpp
Expand Up @@ -31,8 +31,9 @@ class SampleService: public QgsService
return method == QgsServerRequest::GetMethod; return method == QgsServerRequest::GetMethod;
} }


void executeRequest( const QgsServerRequest& /*request*/, QgsServerResponse& response ) void executeRequest( const QgsServerRequest& request, QgsServerResponse& response )
{ {
Q_UNUSED( request );
QgsDebugMsg( "SampleService::executeRequest called" ); QgsDebugMsg( "SampleService::executeRequest called" );
response.write( QString( "Hello world from myService" ) ); response.write( QString( "Hello world from myService" ) );
} }
Expand Down
4 changes: 2 additions & 2 deletions tests/src/python/test_services.py
Expand Up @@ -108,15 +108,15 @@ def test_unregister_services(self):
self.assertEqual( service.version(), "1.0c" ) self.assertEqual( service.version(), "1.0c" )


# Remove one service # Remove one service
removed = reg.unRegisterService("STUFF", "1.0c") removed = reg.unregisterService("STUFF", "1.0c")
self.assertEqual( removed, 1 ) self.assertEqual( removed, 1 )


# Check that we get the highest version # Check that we get the highest version
service = reg.getService("STUFF") service = reg.getService("STUFF")
self.assertEqual( service.version(), "1.0b" ) self.assertEqual( service.version(), "1.0b" )


# Remove all services # Remove all services
removed = reg.unRegisterService("STUFF") removed = reg.unregisterService("STUFF")
self.assertEqual( removed, 2 ) self.assertEqual( removed, 2 )


# Check that there is no more services available # Check that there is no more services available
Expand Down

0 comments on commit bac1890

Please sign in to comment.