Commits

Bob Garwood authored 642e9f42e9e Merge
Merge branch 'master' into CAS-12372

code/casaqt/QtUtilities/QtDBusApp.cc

Modified
61 61
62 62 if ( object_name )
63 63 return *object_name;
64 64
65 65 object_name = new QString( );
66 66 QTextStream(object_name) << object_base << name << "_" << pid;
67 67 return *object_name;
68 68 }
69 69
70 70 QString QtDBusApp::serviceOwner( const QString &service ) {
71 - char *str = strdup(service.toLatin1().data());
72 - char *cur = strtok(str,".");
73 - char *prev = cur;
74 - while ( (cur = strtok(0,".")) ) {
75 - prev = cur;
76 - }
77 - QString result(object_base);
78 - QTextStream(&result) << prev;
79 - return result;
71 + // This is to take the token after the last separator '.'. For example:
72 + // service: edu.nrao.casa.plotms_28834 => "plotms_28834"
73 + QString result(object_base);
74 + auto tokens = service.toLatin1().split('.');
75 + QTextStream(&result) << tokens.back();
76 +
77 + return result;
80 78 }
81 79
82 80 QString QtDBusApp::serviceOwner( const std::string &service ) {
83 81 return serviceOwner(QString(service.c_str()));
84 82 }
85 83
86 84 const QString &QtDBusApp::serviceBase( ) {
87 85 static QString base(service_base);
88 86 return base;
89 87 }

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut