Skip to content

Commit

Permalink
Fix TTXLine::validate properly this time (I hope)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZXGuesser committed Mar 12, 2020
1 parent 551a616 commit 4f52a8c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions known_services
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ SERVICEDATA=(\
"Ceefax (Worldwide),svn,https://internal.nathanmediaservices.co.uk/svn/ceefax/Worldwide,Ceefax/regional,Ceefax" \
"Ceefax (Yorks and Lincs),svn,https://internal.nathanmediaservices.co.uk/svn/ceefax/Yorks&Lincs,Ceefax/regional,Ceefax" \
"Chunkytext,git,https://zxnet.co.uk/git/cf.git,Chunkytext," \
"SPARK,git,https://github.com/ZXGuesser/spark-teletext.git,SPARK," \
)
20 changes: 12 additions & 8 deletions ttxline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,23 @@ std::string TTXLine::validate(std::string const& val)
std::string str=" ";
for (unsigned int i=0;i<val.length() && j<40;i++)
{
ch=val[i] & 0x7f; // Convert to 7 bits
if (ch==0x1b) // escape?
ch = val[i] & 0x7f; // 7-bit

if (val[i] == 0x1b) // ascii escape
{
i++;
ch=(val[i] & 0x3f);
ch = val[i] & 0x3f;
}

if (ch==0)
else if (val[i] < 0x20) // other ascii control code
{
ch=0x80; // set high bit to escape nulls in strings
break; // abort
}


if (ch < 0x20)
{
ch |= 0x80; // set high bit on control codes
}

str[j++]=ch;
}
return str;
Expand Down

0 comments on commit 4f52a8c

Please sign in to comment.