Skip to content

Commit

Permalink
OctonetData: Use hash for channel nativeId
Browse files Browse the repository at this point in the history
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 <julian@jusst.de>
  • Loading branch information
julianscheel committed Jul 6, 2017
1 parent d7bb865 commit 020dd98
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/OctonetData.cpp
Expand Up @@ -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<std::string> hash_fn;
int64_t nativeId = hash_fn(id);

return nativeId;
}
Expand Down

0 comments on commit 020dd98

Please sign in to comment.