Use OS::SNPrintF instead of snprintf.

Review URL: http://codereview.chromium.org/8339011

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9674 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
keuchel@chromium.org 2011-10-18 09:48:13 +00:00
parent 4e5643a648
commit 69afd18e56

View File

@ -746,7 +746,7 @@ TEST(RegExpScanning) {
}
TEST(ScopePositiosn) {
TEST(ScopePositions) {
// Test the parser for correctly setting the start and end positions
// of a scope. We check the scope positions of exactly one scope
// nested in the global scope of a program. 'inner source' is the
@ -843,21 +843,23 @@ TEST(ScopePositiosn) {
size_t kInnerLen = strlen(source_data[i].inner_source);
size_t kSuffixLen = strlen(source_data[i].outer_suffix);
size_t kProgramSize = kPrefixLen + kInnerLen + kSuffixLen;
i::SmartArrayPointer<char> program(
reinterpret_cast<char*>(malloc(kProgramSize + 1)));
snprintf(*program, kProgramSize + 1, "%s%s%s",
source_data[i].outer_prefix,
source_data[i].inner_source,
source_data[i].outer_suffix);
i::Vector<char> program = i::Vector<char>::New(kProgramSize + 1);
size_t length;
length = i::OS::SNPrintF(program, "%s%s%s",
source_data[i].outer_prefix,
source_data[i].inner_source,
source_data[i].outer_suffix);
ASSERT(length == kProgramSize);
// Parse program source.
i::Handle<i::String> source(
FACTORY->NewStringFromAscii(i::CStrVector(*program)));
FACTORY->NewStringFromAscii(i::CStrVector(program.start())));
i::Handle<i::Script> script = FACTORY->NewScript(source);
i::Parser parser(script, false, NULL, NULL);
parser.SetHarmonyScoping(true);
i::FunctionLiteral* function =
parser.ParseProgram(source, true, i::kNonStrictMode);
ASSERT(function != NULL);
// Check scope types and positions.
i::Scope* scope = function->scope();