@@ -72,8 +72,8 @@ std::shared_ptr<Runtime> Runtime::get() {
7272Runtime::Runtime ()
7373 : defaultBinding_(COMMONAPI_DEFAULT_BINDING),
7474 defaultFolder_ (COMMONAPI_DEFAULT_FOLDER),
75- isConfigured_(false ),
76- isInitialized_(false ) {
75+ isConfigured_(false ),
76+ isInitialized_(false ) {
7777}
7878
7979Runtime::~Runtime () {
@@ -98,7 +98,7 @@ Runtime::registerFactory(const std::string &_binding, std::shared_ptr<Factory> _
9898 }
9999
100100 if (isRegistered && isInitialized_)
101- _factory->init ();
101+ _factory->init ();
102102
103103 return isRegistered;
104104}
@@ -152,20 +152,20 @@ void Runtime::init() {
152152
153153void
154154Runtime::initFactories () {
155- std::lock_guard<std::mutex> itsLock (factoriesMutex_);
156- if (!isInitialized_) {
157- COMMONAPI_INFO (" Loading configuration file \' " , usedConfig_, " \' " );
158- COMMONAPI_INFO (" Using default binding \' " , defaultBinding_, " \' " );
159- COMMONAPI_INFO (" Using default shared library folder \' " , defaultFolder_, " \' " );
155+ std::lock_guard<std::mutex> itsLock (factoriesMutex_);
156+ if (!isInitialized_) {
157+ COMMONAPI_INFO (" Loading configuration file \' " , usedConfig_, " \' " );
158+ COMMONAPI_INFO (" Using default binding \' " , defaultBinding_, " \' " );
159+ COMMONAPI_INFO (" Using default shared library folder \' " , defaultFolder_, " \' " );
160160
161- if (defaultFactory_)
162- defaultFactory_->init ();
161+ if (defaultFactory_)
162+ defaultFactory_->init ();
163163
164- for (auto f : factories_)
165- f.second ->init ();
164+ for (auto f : factories_)
165+ f.second ->init ();
166166
167- isInitialized_ = true ;
168- }
167+ isInitialized_ = true ;
168+ }
169169}
170170
171171bool
@@ -179,13 +179,13 @@ Runtime::readConfiguration() {
179179#else
180180 if (getcwd (currentDirectory, MAX_PATH_LEN)) {
181181#endif
182- usedConfig_ = currentDirectory;
183- usedConfig_ += " /" ;
184- usedConfig_ += COMMONAPI_DEFAULT_CONFIG_FILE;
182+ usedConfig_ = currentDirectory;
183+ usedConfig_ += " /" ;
184+ usedConfig_ += COMMONAPI_DEFAULT_CONFIG_FILE;
185185
186186 struct stat s;
187187 if (stat (usedConfig_.c_str (), &s) != 0 ) {
188- usedConfig_ = defaultConfig_;
188+ usedConfig_ = defaultConfig_;
189189 if (stat (usedConfig_.c_str (), &s) != 0 ) {
190190 tryLoadConfig = false ;
191191 }
@@ -249,9 +249,9 @@ std::shared_ptr<Proxy>
249249Runtime::createProxy (
250250 const std::string &_domain, const std::string &_interface, const std::string &_instance,
251251 const ConnectionId_t &_connectionId) {
252- if (!isInitialized_) {
253- initFactories ();
254- }
252+ if (!isInitialized_) {
253+ initFactories ();
254+ }
255255
256256 // Check whether we already know how to create such proxies...
257257 std::shared_ptr<Proxy> proxy = createProxyHelper (_domain, _interface, _instance, _connectionId, false );
@@ -270,9 +270,9 @@ std::shared_ptr<Proxy>
270270Runtime::createProxy (
271271 const std::string &_domain, const std::string &_interface, const std::string &_instance,
272272 std::shared_ptr<MainLoopContext> _context) {
273- if (!isInitialized_) {
274- initFactories ();
275- }
273+ if (!isInitialized_) {
274+ initFactories ();
275+ }
276276
277277 // Check whether we already know how to create such proxies...
278278 std::shared_ptr<Proxy> proxy = createProxyHelper (_domain, _interface, _instance, _context, false );
@@ -291,9 +291,9 @@ Runtime::createProxy(
291291bool
292292Runtime::registerStub (const std::string &_domain, const std::string &_interface, const std::string &_instance,
293293 std::shared_ptr<StubBase> _stub, const ConnectionId_t &_connectionId) {
294- if (!isInitialized_) {
295- initFactories ();
296- }
294+ if (!isInitialized_) {
295+ initFactories ();
296+ }
297297
298298 bool isRegistered = registerStubHelper (_domain, _interface, _instance, _stub, _connectionId, false );
299299 if (!isRegistered) {
@@ -309,9 +309,9 @@ Runtime::registerStub(const std::string &_domain, const std::string &_interface,
309309bool
310310Runtime::registerStub (const std::string &_domain, const std::string &_interface, const std::string &_instance,
311311 std::shared_ptr<StubBase> _stub, std::shared_ptr<MainLoopContext> _context) {
312- if (!isInitialized_) {
313- initFactories ();
314- }
312+ if (!isInitialized_) {
313+ initFactories ();
314+ }
315315
316316 bool isRegistered = registerStubHelper (_domain, _interface, _instance, _stub, _context, false );
317317 if (!isRegistered) {
@@ -382,28 +382,28 @@ Runtime::loadLibrary(const std::string &_library) {
382382 }
383383 #else
384384 std::size_t soStart = itsLibrary.rfind (" .so" );
385- if (soStart == std::string::npos) {
386- // Library name does not contain ".so" --> add it
387- itsLibrary += " .so" ;
388- } else if (soStart < itsLibrary.length () - 3 ) {
389- // We found ".so" but even the last one is not the end
390- // of the filename
391- soStart += 3 ;
392-
393- // Check the version information
394- while (soStart < itsLibrary.length ()) {
395- if (itsLibrary[soStart] != ' .'
396- && !std::isdigit (static_cast <unsigned char >(itsLibrary[soStart]))) {
397- break ;
398- }
399- soStart++;
400- }
401-
402- // What should be a version is something else
403- // --> add another ".so"
404- if (soStart < itsLibrary.length ())
405- itsLibrary += " .so" ;
406- }
385+ if (soStart == std::string::npos) {
386+ // Library name does not contain ".so" --> add it
387+ itsLibrary += " .so" ;
388+ } else if (soStart < itsLibrary.length () - 3 ) {
389+ // We found ".so" but even the last one is not the end
390+ // of the filename
391+ soStart += 3 ;
392+
393+ // Check the version information
394+ while (soStart < itsLibrary.length ()) {
395+ if (itsLibrary[soStart] != ' .'
396+ && !std::isdigit (static_cast <unsigned char >(itsLibrary[soStart]))) {
397+ break ;
398+ }
399+ soStart++;
400+ }
401+
402+ // What should be a version is something else
403+ // --> add another ".so"
404+ if (soStart < itsLibrary.length ())
405+ itsLibrary += " .so" ;
406+ }
407407 #endif
408408
409409 bool isLoaded (true );
0 commit comments