MCPcopy Create free account
hub / github.com/apache/brpc / protobuf_style_normalize_filename

Function protobuf_style_normalize_filename

src/mcpack2pb/generator.cpp:1285–1298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1283}
1284
1285static std::string protobuf_style_normalize_filename(const std::string & fname) {
1286 std::string norm_fname;
1287 norm_fname.reserve(fname.size() + 10);
1288 for (size_t i = 0; i < fname.size(); ++i) {
1289 if (fname[i] == '_' || isdigit(fname[i]) || isalpha(fname[i])) {
1290 norm_fname.push_back(fname[i]);
1291 } else {
1292 char symbol[4];
1293 snprintf(symbol, sizeof(symbol), "_%02x", (int)fname[i]);
1294 norm_fname.append(symbol, 3);
1295 }
1296 }
1297 return norm_fname;
1298}
1299
1300static bool generate_registration(
1301 const google::protobuf::FileDescriptor* file,

Callers 1

generate_registrationFunction · 0.85

Calls 5

snprintfFunction · 0.85
reserveMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected