Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: compiled/bindings.ipp

Issue 29404594: Noissue - [emscripten] Replace sprintf() usage by safe alternatives (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Implemented a simple number conversion method Created April 6, 2017, 3:12 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « compiled/String.h ('k') | compiled/filter/ActiveFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiled/bindings.ipp
===================================================================
--- a/compiled/bindings.ipp
+++ b/compiled/bindings.ipp
@@ -444,34 +444,33 @@ namespace bindings_internal
return result;
}
else
throw std::runtime_error("Unexpected return type for " + std::string(call.name));
}
const std::string wrapCall(const FunctionInfo& call)
{
- char buffer[20];
bool hasStringArgs = false;
std::vector<std::string> params;
std::string prefix = "function(";
for (int i = 0; i < call.args.size(); i++)
{
- sprintf(buffer, "arg%i", i);
+ std::string argName("arg" + std::to_string(i));
if (i > 0)
prefix += ", ";
- prefix += buffer;
+ prefix += argName;
if (call.args[i] == TypeCategory::STRING_REF)
{
hasStringArgs = true;
- params.push_back(std::string("createString(") + buffer + ")");
+ params.push_back(std::string("createString(") + argName + ")");
}
else
- params.push_back(buffer);
+ params.push_back(argName);
}
prefix += ")\n{\n";
std::string suffix = "}";
if (call.returnType != TypeCategory::VOID)
suffix = " return result;\n" + suffix;
if (call.returnType == TypeCategory::DEPENDENT_STRING ||
« no previous file with comments | « compiled/String.h ('k') | compiled/filter/ActiveFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld