const auto &building_deny_info_url = build.building_deny_info_url; // a change reduction hack
- const auto letter = build.input[1];
+ Assure(*build.input == '%');
+ const auto letter = build.input[1]; // may be the terminating NUL
switch (letter) {
p = "%";
break;
+ case '\0':
+ // XXX: Partially duplicates error handling code of the `default:` case.
+ // TODO: Refactor bypassBuildErrorXXX() to accept `build` and determine the source of the error.
+ if (building_deny_info_url)
+ bypassBuildErrorXXX("Bare % at the end of deny_info", build.input);
+ else
+ bypassBuildErrorXXX("Bare % at the end of error page", build.input);
+ p = "%";
+ do_quote = 0;
+ break;
+
default:
if (building_deny_info_url)
bypassBuildErrorXXX("Unsupported deny_info %code", build.input);
bypassBuildErrorXXX("Unsupported error page %code", build.input);
// else too many "font-size: 100%;" template errors to report
+ Assure(build.input[1]);
mb.append(build.input, 2);
do_quote = 0;
break;
assert(p);
- debugs(4, 3, "%" << letter << " --> '" << p << "'" );
+ // TODO: Add an I/O manipulator to report non-printable chars better.
+ debugs(4, 3, "%" << (letter ? letter : '?') << " --> '" << p << "'" );
if (do_quote)
p = html_quote(p);
// TODO: Optimize by replacing mb with direct build.output usage.
build.output.append(p, strlen(p));
- build.input += 2;
+ ++build.input; // skip the parsed % character
+ if (letter)
+ ++build.input; // when it was present, skip the parsed letter after %
}
void