mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 00:41:17 +02:00
eitd: reduce memory use . shrink extended text memory size (capacity) to string size
This commit is contained in:
@@ -199,6 +199,18 @@ void SIevent::parse(Event &event)
|
|||||||
if (start_time && duration)
|
if (start_time && duration)
|
||||||
times.insert(SItime(start_time, duration));
|
times.insert(SItime(start_time, duration));
|
||||||
const DescriptorList &dlist = *event.getDescriptors();
|
const DescriptorList &dlist = *event.getDescriptors();
|
||||||
|
|
||||||
|
int countExtandetText = 0, appendcheck = 0;
|
||||||
|
for (DescriptorConstIterator dit = dlist.begin(); dit != dlist.end(); ++dit){
|
||||||
|
switch ((*dit)->getTag()) {
|
||||||
|
case EXTENDED_EVENT_DESCRIPTOR:
|
||||||
|
countExtandetText++;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
appendcheck = countExtandetText;
|
||||||
for (DescriptorConstIterator dit = dlist.begin(); dit != dlist.end(); ++dit) {
|
for (DescriptorConstIterator dit = dlist.begin(); dit != dlist.end(); ++dit) {
|
||||||
switch ((*dit)->getTag()) {
|
switch ((*dit)->getTag()) {
|
||||||
case SHORT_EVENT_DESCRIPTOR:
|
case SHORT_EVENT_DESCRIPTOR:
|
||||||
@@ -227,7 +239,8 @@ void SIevent::parse(Event &event)
|
|||||||
item.append("\n");
|
item.append("\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
appendExtendedText(getLangIndex(lang), stringDVBUTF8(d->getText(), table, tsidonid));
|
appendExtendedText(getLangIndex(lang), stringDVBUTF8(d->getText(), table, tsidonid),(appendcheck > countExtandetText),(countExtandetText==1));
|
||||||
|
countExtandetText--;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CONTENT_DESCRIPTOR:
|
case CONTENT_DESCRIPTOR:
|
||||||
@@ -556,17 +569,22 @@ void SIevent::appendExtendedText(const std::string &lang, const std::string &tex
|
|||||||
appendExtendedText(getLangIndex(lang), text, append);
|
appendExtendedText(getLangIndex(lang), text, append);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SIevent::appendExtendedText(unsigned int lang, const std::string &text, bool append)
|
void SIevent::appendExtendedText(unsigned int lang, const std::string &text, bool append, bool endappend)
|
||||||
{
|
{
|
||||||
if (CSectionsdClient::LANGUAGE_MODE_OFF == SIlanguage::getMode())
|
if (CSectionsdClient::LANGUAGE_MODE_OFF == SIlanguage::getMode())
|
||||||
lang = 0;
|
lang = 0;
|
||||||
|
|
||||||
for (std::list<SILangData>::iterator it = langData.begin(); it != langData.end(); ++it)
|
for (std::list<SILangData>::iterator it = langData.begin(); it != langData.end(); ++it)
|
||||||
if (it->lang == lang) {
|
if (it->lang == lang) {
|
||||||
if (append)
|
if (append){
|
||||||
it->text[SILangData::langExtendedText] += text;
|
it->text[SILangData::langExtendedText] += text;
|
||||||
else
|
if(endappend && it->text[SILangData::langExtendedText].capacity() > it->text[SILangData::langExtendedText].size()){
|
||||||
|
it->text[SILangData::langExtendedText].reserve();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
it->text[SILangData::langExtendedText] = text;
|
it->text[SILangData::langExtendedText] = text;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -519,7 +519,7 @@ class SIevent
|
|||||||
// Aus dem Extended Descriptor
|
// Aus dem Extended Descriptor
|
||||||
std::string getExtendedText() const;
|
std::string getExtendedText() const;
|
||||||
void appendExtendedText(const std::string &lang, const std::string &text, bool append = true);
|
void appendExtendedText(const std::string &lang, const std::string &text, bool append = true);
|
||||||
void appendExtendedText(unsigned int lang, const std::string &text, bool append = true);
|
void appendExtendedText(unsigned int lang, const std::string &text, bool append = true, bool endappend = false);
|
||||||
void setExtendedText(const std::string &lang, const std::string &text) {
|
void setExtendedText(const std::string &lang, const std::string &text) {
|
||||||
appendExtendedText(lang, text, false);
|
appendExtendedText(lang, text, false);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user