Skip to content

Commit

Permalink
Fix stupid regression which broke 8-bit tti files.
Browse files Browse the repository at this point in the history
  • Loading branch information
ZXGuesser committed Mar 8, 2020
1 parent 2038915 commit bfa5334
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions ttxline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,35 +59,28 @@ void TTXLine::Setm_textline(std::string const& val, bool validateLine)
m_textline = val;
}

/** Validate - given a string, it validates it to ensure that the
* string follows the required format. 7 bit transmission ready.
* It de-escapes and/or remaps characters as detailed in the MRG tti format spec.
* It also treats \r very carefully.
* If the string ends in \r or \r\n then it is treated as a terminator and is discarded.
*/
std::string TTXLine::validate(std::string const& val)
{
char ch;
int j=0;
std::string str=" ";
// std::cout << "Validating length= " << val.length() << std::endl;
for (unsigned int i=0;i<val.length() && j<40;i++)
{
ch=val[i] & 0x7f; // Convert to 7 bits

if (ch==0x1b) // escape?
{
i++;
ch=(val[i] & 0x3f)|0x80;
ch=(val[i] & 0x3f);
}
else if (ch<0x20)

if (ch==0)
{
ch=0x20; // turn all other controls to space character
ch=0x80; // set high bit to escape nulls in strings
}

str[j++]=ch;
}
// std::cout << "Validating done " << std::endl;
return str;
}

Expand Down

0 comments on commit bfa5334

Please sign in to comment.