From 6ee28476fa3addc2c2a6ac4fb43d3d6c617b29b0 Mon Sep 17 00:00:00 2001 From: Julian Scheel Date: Thu, 6 Jul 2017 14:21:41 +0200 Subject: [PATCH] OctonetData: Use hash for channel nativeId We previously assumed that the channelId provided by the Octonet would only contain numbers and colons, which unfortunately is not true. The satellite names could contain arbitrary characters, which then caused the conversion to a numeric value to fail, stopping channels from being distinguishable. This caused all EPG events to be mapped to the first channel. Signed-off-by: Julian Scheel --- src/OctonetData.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/OctonetData.cpp b/src/OctonetData.cpp index cb36598..a4eb8ce 100644 --- a/src/OctonetData.cpp +++ b/src/OctonetData.cpp @@ -53,14 +53,8 @@ OctonetData::~OctonetData(void) int64_t OctonetData::parseID(std::string id) { - int64_t nativeId; - size_t strip; - /* Strip colons from id */ - while ((strip = id.find(":")) != std::string::npos) - id.erase(strip, 1); - - std::stringstream ids(id); - ids >> nativeId; + std::hash hash_fn; + int64_t nativeId = hash_fn(id); return nativeId; }