summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-08-04 00:43:50 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2017-08-04 00:43:50 +0100
commite0d7abce1ec33bc66b443d1c33103544383ba453 (patch)
tree921ccbc8ba1aa583c7b75a29c62e6fa81d2655c3
parentPass table object to handler by reference. (diff)
downloadp2pvr-e0d7abce1ec33bc66b443d1c33103544383ba453.tar.bz2
p2pvr-e0d7abce1ec33bc66b443d1c33103544383ba453.tar.xz
p2pvr-e0d7abce1ec33bc66b443d1c33103544383ba453.zip
Prefer unique_ptr over shared_ptr for tmp strings
-rw-r--r--p2pvr/dvb/siParsers/event.cpp2
-rw-r--r--p2pvr/dvb/siParsers/table.cpp8
-rw-r--r--p2pvr/dvb/siParsers/table.h3
3 files changed, 6 insertions, 7 deletions
diff --git a/p2pvr/dvb/siParsers/event.cpp b/p2pvr/dvb/siParsers/event.cpp
index fe51379..801b29a 100644
--- a/p2pvr/dvb/siParsers/event.cpp
+++ b/p2pvr/dvb/siParsers/event.cpp
@@ -142,7 +142,7 @@ SiEpgParser::parseDescriptor_ShortEvent(::DVBSI::EventPtr current, const u_char
}
else {
colon = title->find(':');
- desc = subtitle;
+ std::swap(desc, subtitle);
if (colon != Glib::ustring::npos) {
subtitle = StrPtr(new Glib::ustring(*title, colon + 1, title->length() - colon));
title->resize(colon);
diff --git a/p2pvr/dvb/siParsers/table.cpp b/p2pvr/dvb/siParsers/table.cpp
index 4baa7a5..b4a052a 100644
--- a/p2pvr/dvb/siParsers/table.cpp
+++ b/p2pvr/dvb/siParsers/table.cpp
@@ -42,7 +42,7 @@ SiTableParserBase::StrPtr
SiTableParserBase::convert(const char * txt, size_t len)
{
if (len == 0) {
- return boost::shared_ptr<Glib::ustring>(new Glib::ustring());
+ return StrPtr(new Glib::ustring());
}
char enc[20];
switch (*txt) {
@@ -69,15 +69,15 @@ SiTableParserBase::convert(const char * txt, size_t len)
case 0x06 ... 0x0F:
case 0x12 ... 0x1E:
case 0x00: // empty string
- return boost::shared_ptr<Glib::ustring>(new Glib::ustring());
+ return StrPtr(new Glib::ustring());
}
size_t used = 0, newlen = 0;
GError * err = NULL;
- boost::shared_ptr<gchar> utf8 = boost::shared_ptr<gchar>(g_convert(txt, len, "utf-8", enc, &used, &newlen, &err), g_free);
+ auto utf8 = std::unique_ptr<gchar, decltype(g_free) *>(g_convert(txt, len, "utf-8", enc, &used, &newlen, &err), g_free);
if (err) {
throw Glib::ConvertError(err);
}
- return boost::shared_ptr<Glib::ustring>(new Glib::ustring(utf8.get()));
+ return StrPtr(new Glib::ustring(utf8.get()));
}
}
}
diff --git a/p2pvr/dvb/siParsers/table.h b/p2pvr/dvb/siParsers/table.h
index 17a1fc0..a1a563e 100644
--- a/p2pvr/dvb/siParsers/table.h
+++ b/p2pvr/dvb/siParsers/table.h
@@ -2,7 +2,6 @@
#define DVBSIREADERHELPER_H
#include <glibmm/ustring.h>
-#include <boost/shared_ptr.hpp>
#include <boost/function.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/tuple/tuple_comparison.hpp>
@@ -30,7 +29,7 @@ class DLL_PUBLIC SiTableParserBase : public P2PVR::RawDataClient {
SiTableParserBase();
virtual ~SiTableParserBase() = 0;
- typedef boost::shared_ptr<Glib::ustring> StrPtr;
+ typedef std::unique_ptr<Glib::ustring> StrPtr;
bool NewData(const P2PVR::Data & bytes, const Ice::Current&) override;