@@ -737,27 +737,25 @@ static std::string FormatSize(size_t size) {
737
737
}
738
738
739
739
std::string ToOctalString (const uint8_t ch) {
740
- std::string result;
741
740
// We can print most printable characters directly. The exceptions are '\'
742
741
// (escape characters), " (would end the string), and ? (trigraphs). The
743
742
// latter may be overly conservative: we compile with C++17 which doesn't
744
743
// support trigraphs.
745
744
if (ch >= ' ' && ch <= ' ~' && ch != ' \\ ' && ch != ' "' && ch != ' ?' ) {
746
745
return std::string (1 , static_cast <char >(ch));
747
- } else {
748
- // All other characters are blindly output as octal.
749
- const char c0 = ' 0' + ((ch >> 6 ) & 7 );
750
- const char c1 = ' 0' + ((ch >> 3 ) & 7 );
751
- const char c2 = ' 0' + (ch & 7 );
752
- return std::string (" \\ " ) + c0 + c1 + c2;
753
746
}
747
+ // All other characters are blindly output as octal.
748
+ const char c0 = ' 0' + ((ch >> 6 ) & 7 );
749
+ const char c1 = ' 0' + ((ch >> 3 ) & 7 );
750
+ const char c2 = ' 0' + (ch & 7 );
751
+ return std::string (" \\ " ) + c0 + c1 + c2;
754
752
}
755
753
756
754
std::vector<std::string> GetOctalTable () {
757
755
size_t size = 1 << 8 ;
758
756
std::vector<std::string> code_table (size);
759
- for (uint8_t i = 0 ; i < size; ++i) {
760
- code_table[i] = ToOctalString (i );
757
+ for (size_t i = 0 ; i < size; ++i) {
758
+ code_table[i] = ToOctalString (static_cast < uint8_t >(i) );
761
759
}
762
760
return code_table;
763
761
}
@@ -1083,7 +1081,7 @@ ExitCode SnapshotBuilder::CreateSnapshot(SnapshotData* out,
1083
1081
}
1084
1082
1085
1083
ExitCode SnapshotBuilder::GenerateAsSource (
1086
- std::string_view out_path,
1084
+ const char * out_path,
1087
1085
const std::vector<std::string>& args,
1088
1086
const std::vector<std::string>& exec_args,
1089
1087
std::optional<std::string_view> main_script_path,
0 commit comments