Skip to content

Commit

Permalink
fix clang raw string warning
Browse files Browse the repository at this point in the history
  • Loading branch information
holmes1412 committed Mar 23, 2021
1 parent 61f3c02 commit 3736d54
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions src/generator/printer.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ class Printer

void print_thrift_include(const idl_info& cur_info)
{
fprintf(this->out_file, this->thrift_include_format.c_str());
fprintf(this->out_file, "%s", this->thrift_include_format.c_str());
for (const auto& sub_info : cur_info.include_list)
fprintf(this->out_file, "#include \"%s.h\"\n", sub_info.file_name.c_str());

Expand Down Expand Up @@ -257,7 +257,7 @@ class Printer
for (const auto& ele : class_params)
fprintf(this->out_file, "\t%s %s;\n", ele.type_name.c_str(), ele.var_name.c_str());

fprintf(this->out_file, thrift_struct_class_isset_begin_format.c_str());
fprintf(this->out_file, "%s", thrift_struct_class_isset_begin_format.c_str());

for (const auto& ele : class_params)
{
Expand Down Expand Up @@ -294,7 +294,7 @@ class Printer
ele.var_name.c_str(), ele.var_name.c_str());
}

fprintf(this->out_file, thrift_struct_class_operator_equal_end_format.c_str());
fprintf(this->out_file, "%s", thrift_struct_class_operator_equal_end_format.c_str());

fprintf(this->out_file, thrift_struct_class_elements_start_format.c_str(),
class_name.c_str(), class_name.c_str(),
Expand Down Expand Up @@ -345,25 +345,25 @@ class Printer
void print_server_file_include(const std::string& prefix)
{
fprintf(this->out_file, this->srpc_file_include_format.c_str(), prefix.c_str());
fprintf(this->out_file, this->using_namespace_sogou_format.c_str());
fprintf(this->out_file, this->wait_group_declaration_format.c_str());
fprintf(this->out_file, "%s", this->using_namespace_sogou_format.c_str());
fprintf(this->out_file, "%s", this->wait_group_declaration_format.c_str());
}

void print_client_file_include(const std::string& prefix)
{
fprintf(this->out_file, this->srpc_file_include_format.c_str(), prefix.c_str());
fprintf(this->out_file, this->using_namespace_sogou_format.c_str());
fprintf(this->out_file, this->wait_group_declaration_format.c_str());
fprintf(this->out_file, "%s", this->using_namespace_sogou_format.c_str());
fprintf(this->out_file, "%s", this->wait_group_declaration_format.c_str());
}

void print_server_comment()
{
fprintf(this->out_file, this->server_comment_format.c_str());
fprintf(this->out_file, "%s", this->server_comment_format.c_str());
}

void print_client_comment()
{
fprintf(this->out_file, this->client_comment_format.c_str());
fprintf(this->out_file, "%s", this->client_comment_format.c_str());
}

void print_client_define_done(const std::string& method,
Expand Down Expand Up @@ -438,13 +438,13 @@ class Printer

void print_server_main_begin()
{
fprintf(this->out_file, this->server_main_begin_format.c_str());
fprintf(this->out_file, "%s", this->server_main_begin_format.c_str());

if (this->is_thrift)
fprintf(this->out_file, this->server_main_ip_port_format.c_str(), "Thrift");
else
{
fprintf(this->out_file, this->main_PB_VERSION_format.c_str());
fprintf(this->out_file, "%s", this->main_pb_version_format.c_str());
fprintf(this->out_file, this->server_main_ip_port_format.c_str(), "SRPC");
}
}
Expand All @@ -461,18 +461,18 @@ class Printer

void print_server_main_end()
{
fprintf(this->out_file, this->server_main_end_format.c_str());
fprintf(this->out_file, "%s", this->server_main_end_format.c_str());
if (!this->is_thrift)
fprintf(this->out_file, this->main_PB_shutdown_format.c_str());
fprintf(this->out_file, this->main_end_return_format.c_str());
fprintf(this->out_file, "%s", this->main_pb_shutdown_format.c_str());
fprintf(this->out_file, "%s", this->main_end_return_format.c_str());
}

void print_server_class_thrift(const std::string& service, const std::vector<rpc_descriptor>& rpcs)
{
std::string return_type;
std::string handler_params;
std::string send_params;
fprintf(this->out_file, this->server_class_constructor_format.c_str());
fprintf(this->out_file, "%s", this->server_class_constructor_format.c_str());

for (const auto& rpc : rpcs)
{
Expand All @@ -489,7 +489,7 @@ class Printer
rpc.method_name.c_str(), rpc.request_name.c_str(), rpc.response_name.c_str());
}

fprintf(this->out_file, this->server_class_end_format.c_str());
fprintf(this->out_file, "%s", this->server_class_end_format.c_str());
}

void print_server_methods_thrift(const std::string& service, const std::vector<rpc_descriptor>& rpcs)
Expand Down Expand Up @@ -517,7 +517,7 @@ class Printer
void print_server_class(const std::string& service,
const std::vector<rpc_descriptor>& rpcs)
{
fprintf(this->out_file, this->server_class_constructor_format.c_str());
fprintf(this->out_file, "%s", this->server_class_constructor_format.c_str());

for (const auto& rpc : rpcs)
{
Expand All @@ -529,7 +529,7 @@ class Printer
resp.c_str());
}

fprintf(this->out_file, this->server_class_end_format.c_str());
fprintf(this->out_file, "%s", this->server_class_end_format.c_str());
}

void print_server_methods(const std::string& service, const std::vector<rpc_descriptor>& rpcs)
Expand Down Expand Up @@ -573,7 +573,7 @@ class Printer
return_type.c_str(), rpc.method_name.c_str(), recv_params.c_str());
}

fprintf(this->out_file, this->client_class_get_last_thrift_format.c_str());
fprintf(this->out_file, "%s", this->client_class_get_last_thrift_format.c_str());

fprintf(this->out_file, "public:\n");
}
Expand Down Expand Up @@ -603,7 +603,7 @@ class Printer

if (this->is_thrift)
{
fprintf(this->out_file, client_class_private_get_thrift_format.c_str());
fprintf(this->out_file, "%s", client_class_private_get_thrift_format.c_str());
for (const auto& rpc : rpcs)
{
std::string resp = change_include_prefix(rpc.response_name);
Expand Down Expand Up @@ -810,10 +810,10 @@ class Printer

void print_client_main_begin()
{
fprintf(this->out_file, this->client_main_begin_format.c_str());
fprintf(this->out_file, "%s", this->client_main_begin_format.c_str());
if (!this->is_thrift)
fprintf(this->out_file, this->main_PB_VERSION_format.c_str());
fprintf(this->out_file, this->client_main_ip_port_format.c_str());
fprintf(this->out_file, "%s", this->main_pb_version_format.c_str());
fprintf(this->out_file, "%s", this->client_main_ip_port_format.c_str());
}

void print_client_main_service(const std::string& type,
Expand Down Expand Up @@ -870,10 +870,10 @@ class Printer

void print_client_main_end()
{
fprintf(this->out_file, this->client_main_end_format.c_str());
fprintf(this->out_file, "%s", this->client_main_end_format.c_str());
if (!this->is_thrift)
fprintf(this->out_file, this->main_PB_shutdown_format.c_str());
fprintf(this->out_file, this->main_end_return_format.c_str());
fprintf(this->out_file, "%s", this->main_pb_shutdown_format.c_str());
fprintf(this->out_file, "%s", this->main_end_return_format.c_str());
}

void print_end(const std::vector<std::string>& package)
Expand Down Expand Up @@ -1421,7 +1421,7 @@ static void %s_done(%s *response, srpc::RPCContext *context)
}
)";

std::string main_PB_VERSION_format = R"(
std::string main_pb_version_format = R"(
GOOGLE_PROTOBUF_VERIFY_VERSION;)";

std::string client_main_begin_format = R"(
Expand Down Expand Up @@ -1455,7 +1455,7 @@ int main()

std::string client_main_end_format = R"(
wait_group.wait();)";
std::string main_PB_shutdown_format = R"(
std::string main_pb_shutdown_format = R"(
google::protobuf::ShutdownProtobufLibrary();)";
std::string main_end_return_format = R"(
return 0;
Expand Down

0 comments on commit 3736d54

Please sign in to comment.