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 4eebfc2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 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 ((uint8_t)val[i] < 0x20) // other ascii control code
{
ch=0x80; // set high bit to escape nulls in strings
break;
}


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

str[j++]=ch;
}
return str;
Expand Down
4 changes: 0 additions & 4 deletions ttxpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,19 +248,15 @@ bool TTXPage::m_LoadTTI(std::string filename)
std::getline(filein, line); // Mask is intended for TED to protecting regions from editing.
break;
case 8 : // "OL" - Output line
// OL,9,ƒA-Z INDEX ‡199ƒNEWS HEADLINES ‡101
std::getline(filein, line, ',');
lineNumber=atoi(line.c_str());
std::getline(filein, line);
if (lineNumber>MAXROW) break;
// std::cerr << "reading " << lineNumber << " line=" << line << std::endl;
p->SetRow(lineNumber,line);
// std::cerr << lineNumber << ": OL partly implemented. " << line << std::endl;
lines++;
break;
case 9 : // "FL"; - Fastext links
// FL,104,104,105,106,F,100
// std::cerr << "FL not implemented\n";
for (int fli=0;fli<6;fli++)
{
if (fli<5)
Expand Down

0 comments on commit 4eebfc2

Please sign in to comment.