Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(419)

Unified Diff: src/flags.cc

Issue 1940: Replaced calls to functions that msvc consider deprecated. Used... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/execution.cc ('k') | src/log.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/flags.cc
===================================================================
--- src/flags.cc (revision 280)
+++ src/flags.cc (working copy)
@@ -134,33 +134,33 @@
static char* ToString(Flag::Type type, FlagValue* variable) {
- char* value = NULL;
+ Vector<char> value;
switch (type) {
case Flag::BOOL:
- value = NewArray<char>(6);
- OS::SNPrintF(value, 6, "%s", (variable->b ? "true" : "false"));
+ value = Vector<char>::New(6);
+ OS::SNPrintF(value, "%s", (variable->b ? "true" : "false"));
break;
case Flag::INT:
- value = NewArray<char>(12);
- OS::SNPrintF(value, 12, "%d", variable->i);
+ value = Vector<char>::New(12);
+ OS::SNPrintF(value, "%d", variable->i);
break;
case Flag::FLOAT:
- value = NewArray<char>(20);
- OS::SNPrintF(value, 20, "%f", variable->f);
+ value = Vector<char>::New(20);
+ OS::SNPrintF(value, "%f", variable->f);
break;
case Flag::STRING:
if (variable->s) {
int length = strlen(variable->s) + 1;
- value = NewArray<char>(length);
- OS::SNPrintF(value, length, "%s", variable->s);
+ value = Vector<char>::New(length);
+ OS::SNPrintF(value, "%s", variable->s);
} else {
- value = NewArray<char>(5);
- OS::SNPrintF(value, 5, "NULL");
+ value = Vector<char>::New(5);
+ OS::SNPrintF(value, "NULL");
}
break;
}
- ASSERT(value != NULL);
- return value;
+ ASSERT(!value.is_empty());
+ return value.start();
}
@@ -198,17 +198,17 @@
List<char *>* args = new List<char*>(8);
for (Flag* f = list_; f != NULL; f = f->next()) {
if (!f->IsDefault()) {
- char* cmdline_flag;
+ Vector<char> cmdline_flag;
if (f->type() != Flag::BOOL || *(f->bool_variable())) {
int length = strlen(f->name()) + 2 + 1;
- cmdline_flag = NewArray<char>(length);
- OS::SNPrintF(cmdline_flag, length, "--%s", f->name());
+ cmdline_flag = Vector<char>::New(length);
+ OS::SNPrintF(cmdline_flag, "--%s", f->name());
} else {
int length = strlen(f->name()) + 4 + 1;
- cmdline_flag = NewArray<char>(length);
- OS::SNPrintF(cmdline_flag, length, "--no%s", f->name());
+ cmdline_flag = Vector<char>::New(length);
+ OS::SNPrintF(cmdline_flag, "--no%s", f->name());
}
- args->Add(cmdline_flag);
+ args->Add(cmdline_flag.start());
if (f->type() != Flag::BOOL) {
args->Add(f->StringValue());
}
« no previous file with comments | « src/execution.cc ('k') | src/log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698