Skip to content

Commit

Permalink
Merge pull request #10 from afedchin/fix_android
Browse files Browse the repository at this point in the history
Fix android build.
  • Loading branch information
afedchin committed Mar 22, 2015
2 parents 681aa36 + b57a2d3 commit 69e6a6f
Showing 1 changed file with 4 additions and 23 deletions.
27 changes: 4 additions & 23 deletions src/PVRIptvData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,24 +491,6 @@ bool PVRIptvData::LoadPlayList(void)
return true;
}

static bool SafeString2Int(const std::string& str, int& result)
{
try
{
std::size_t lastChar;
result = std::stoi(str, &lastChar, 10);
return lastChar == str.size();
}
catch (std::invalid_argument&)
{
return false;
}
catch (std::out_of_range&)
{
return false;
}
}

bool PVRIptvData::LoadGenres(void)
{
std::string data;
Expand Down Expand Up @@ -551,18 +533,17 @@ bool PVRIptvData::LoadGenres(void)
if (!GetAttributeValue(pGenreNode, "type", buff))
continue;

int iGenreType, iGenreSubType;
if (!SafeString2Int(buff, iGenreType))
if (!StringUtils::IsNaturalNumber(buff))
continue;

PVRIptvEpgGenre genre;
genre.strGenre = pGenreNode->value();
genre.iGenreType = iGenreType;
genre.iGenreType = atoi(buff.c_str());
genre.iGenreSubType = 0;

if ( GetAttributeValue(pGenreNode, "subtype", buff)
&& SafeString2Int(buff, iGenreSubType))
genre.iGenreSubType = iGenreSubType;
&& StringUtils::IsNaturalNumber(buff))
genre.iGenreSubType = atoi(buff.c_str());

m_genres.push_back(genre);
}
Expand Down

0 comments on commit 69e6a6f

Please sign in to comment.