Updated sourcery to avoid trigraphs
This commit is contained in:
parent
cefc8dc88d
commit
ecdcb977b1
1 changed files with 7 additions and 0 deletions
|
@ -16,6 +16,7 @@ int main(int argc, char* argv[]){
|
||||||
uint32_t i = 0; //Current line byte counter
|
uint32_t i = 0; //Current line byte counter
|
||||||
uint32_t total = 0; //Finished lines so far byte counter
|
uint32_t total = 0; //Finished lines so far byte counter
|
||||||
std::ifstream inFile(argv[1]);
|
std::ifstream inFile(argv[1]);
|
||||||
|
bool sawQ = false;
|
||||||
while (inFile.good()){
|
while (inFile.good()){
|
||||||
unsigned char thisChar = inFile.get();
|
unsigned char thisChar = inFile.get();
|
||||||
if (!inFile.good()){break;}
|
if (!inFile.good()){break;}
|
||||||
|
@ -26,6 +27,11 @@ int main(int argc, char* argv[]){
|
||||||
case '\t': tmp << "\\t"; break;
|
case '\t': tmp << "\\t"; break;
|
||||||
case '\\': tmp << "\\\\"; break;
|
case '\\': tmp << "\\\\"; break;
|
||||||
case '\"': tmp << "\\\""; break;
|
case '\"': tmp << "\\\""; break;
|
||||||
|
case '?':
|
||||||
|
if (sawQ){tmp << "\"\"";}
|
||||||
|
tmp << "?";
|
||||||
|
sawQ = true;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (thisChar < 32 || thisChar > 126){
|
if (thisChar < 32 || thisChar > 126){
|
||||||
//Convert to octal.
|
//Convert to octal.
|
||||||
|
@ -33,6 +39,7 @@ int main(int argc, char* argv[]){
|
||||||
}else{
|
}else{
|
||||||
tmp << thisChar;
|
tmp << thisChar;
|
||||||
}
|
}
|
||||||
|
sawQ = false;
|
||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
// We print 80 bytes per line, regardless of special characters
|
// We print 80 bytes per line, regardless of special characters
|
||||||
|
|
Loading…
Add table
Reference in a new issue