Skip to content

Commit

Permalink
[eServiceReference]
Browse files Browse the repository at this point in the history
* toLCNReferenceString add trailing flag
  • Loading branch information
jbleyel committed Sep 22, 2024
1 parent 8fa8269 commit 99315a2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/dvb/db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2628,7 +2628,7 @@ PyObject *eDVBDB::getAllServicesRaw(int type)
PyTuple_SET_ITEM(tuple, 4, PyUnicode_FromString(!service->m_service_display_name.empty() ? service->m_service_display_name.c_str() : service->m_service_name.c_str()));
int flags = (service->m_flags & (eDVBService::dxIntNewServiceName | eDVBService::dxIntNewProvider)) >> 14;
PyTuple_SET_ITEM(tuple, 5, PyLong_FromLongLong(flags));
PyDict_SetItemString(serviceList, sit->first.toLCNReferenceString().c_str(), tuple);
PyDict_SetItemString(serviceList, sit->first.toLCNReferenceString(false).c_str(), tuple);
Py_DECREF(tuple);
}
break;
Expand Down
2 changes: 1 addition & 1 deletion lib/service/iservice.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class eServiceReference
std::string toString() const;
std::string toCompareString() const;
std::string toReferenceString() const;
std::string toLCNReferenceString() const;
std::string toLCNReferenceString(bool trailing=true) const;
#ifndef SWIG
operator bool() const
{
Expand Down
20 changes: 10 additions & 10 deletions lib/service/service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,16 @@ std::string eServiceReference::toReferenceString() const
return ret;
}

std::string eServiceReference::toLCNReferenceString() const
{
std::string ret;
ret.reserve((4 * sizeof(data)/sizeof(*data)) + 8); /* Estimate required space */

for (unsigned int i=1; i<5; ++i)
{
ret += getNum(data[i], 0x10);
ret += ':';
}
std::string eServiceReference::toLCNReferenceString(bool trailing) const
{
std::string ret;
ret.reserve(24); /* Estimate required space */
char buf[24];
if(trailing)
snprintf(buf, 24, "%X:%X:%X:%X:", data[1], data[2], data[3], data[4]);
else
snprintf(buf, 24, "%X:%X:%X:%X", data[1], data[2], data[3], data[4]);
ret.assign(buf);
return ret;
}

Expand Down

0 comments on commit 99315a2

Please sign in to comment.