From f913cb0aaa67d7bdc8d7fefeaae7d93ae3509f3a Mon Sep 17 00:00:00 2001 From: john30 Date: Sun, 1 Nov 2015 22:39:10 +0100 Subject: [PATCH] fix for extracting ident from filename --- src/lib/ebus/filereader.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/ebus/filereader.h b/src/lib/ebus/filereader.h index a8cb57db..e9f1799a 100644 --- a/src/lib/ebus/filereader.h +++ b/src/lib/ebus/filereader.h @@ -79,7 +79,7 @@ public: } string line; size_t lastSep = filename.find_last_of('/'); - size_t firstDot = filename.find_first_of('.'); + size_t firstDot = filename.find_first_of('.', lastSep+1); string defaultDest = ""; string defaultCircuit = ""; if (lastSep!=string::npos && firstDot==lastSep+1+2) { // potential destination address, matches "^ZZ." @@ -89,8 +89,8 @@ public: if (result!=RESULT_OK || !isValidAddress(zz)) defaultDest = ""; // invalid: not in hex or no master/slave/broadcast address else { - size_t lastDot = filename.find_last_of('.'); - if (lastDot>firstDot && lastDot-firstDot<=5) { // potential ident, matches "^ZZ.IDENT." + size_t lastDot = filename.find_first_of('.', firstDot+1); + if (lastDot>firstDot && lastDot-firstDot<=6) { // potential ident, matches "^ZZ.IDENT." defaultCircuit = filename.substr(firstDot+1, lastDot-firstDot-1); if (defaultCircuit.find_first_of(' ')!=string::npos) defaultCircuit = ""; // invalid: contains spaces