Commit 4134ce15 authored by Pavel Vainerman's avatar Pavel Vainerman

fixed minor bug in ORepHelpers::getShortName

parent 2edec4a3
......@@ -19,6 +19,11 @@
- Везде где используется sstream и вызов str(), надо делать ss.rdbuf()->freeze(0);
(http://www.intuit.ru/department/pl/cpp/17/2.html)
- (IONotifyController): Разработать механизм заказа переодических уведомлений (msec), независимо от того, менялись ли датчики..
- (IONotifyController): Разработать механизм заказа группы датчиков сразу (и ответ тоже группой)
Вынести IOController_i::SensorInfo просто в UniSetTypes
(там же где ConsumerInfo и т.п.). И перевести uniset-codegen,
......
......@@ -3,7 +3,7 @@
Name: libuniset
Version: 0.99
Release: eter9
Release: eter11
Summary: UniSet - library for building distributed industrial control systems
License: GPL
Group: Development/C++
......@@ -184,6 +184,9 @@ rm -f %buildroot%_libdir/*.la
%exclude %_pkgconfigdir/libUniSet.pc
%changelog
* Mon Oct 18 2010 Pavel Vainerman <pv@altlinux.ru> 0.99-eter9
- new build
* Wed Oct 13 2010 Ilya Shpigor <elly@altlinux.org> 0.99-eter8
- fix bug in ModbusTCPServer
- add gateway imitation to uniset-mbtcpserver-echo
......
......@@ -193,12 +193,13 @@ namespace ORepHelpers
*/
const string getShortName( const string& fname, const std::string brk )
{
// string::size_type pos = fullName.rfind(brk);
// if( pos == string::npos )
// return fullName;
//
// return fullName.substr( pos+1, fullName.length() );
/*
string::size_type pos = fname.rfind(brk);
if( pos == string::npos )
return fname;
return fname.substr( pos+1, fname.length() );
*/
string::size_type pos1 = fname.rfind(brk);
string::size_type pos2 = fname.rfind(conf->oind->sepName);
......@@ -209,7 +210,7 @@ namespace ORepHelpers
return fname.substr( 0, pos2 );
if( pos2 == string::npos )
return fname.substr( pos1+1, pos1-1 );
return fname.substr( pos1+1, fname.length() );
return fname.substr( pos1+1, pos2-pos1-1 );
}
......
......@@ -2,6 +2,7 @@
#include <string>
#include "Debug.h"
#include "Configuration.h"
#include "ORepHelpers.h"
// --------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
......@@ -22,6 +23,10 @@ int main(int argc, const char **argv)
string t(conf->oind->getTextName(1));
cout << "**** check getTextName: " << ( t.empty() ? "FAILED" : "OK" ) << endl;
string ln("/Projects/Sensors/VeryVeryLongNameSensor_ForTest_AS");
string ln_t("VeryVeryLongNameSensor_ForTest_AS");
cout << "**** check getShortName: " << ( ln_t == ORepHelpers::getShortName(ln) ? "OK" : "FAILED" ) << endl;
string mn(conf->oind->getMapName(1));
cout << "**** check getMapName: " << ( mn.empty() ? "FAILED" : "OK" ) << endl;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment