Use single args vector and clear before insertion

This commit is contained in:
Kevin Sawicki 2012-10-08 20:46:44 -07:00
parent 6dcbdfbf55
commit 98c8525bdd

View File

@ -105,7 +105,7 @@ bool Native::Execute(const CefString& name,
char * const paths[] = {rootPath, NULL};
CefRefPtr<CefV8Value> function = arguments[1];
CefV8ValueList args;
FTS *tree = fts_open(paths, FTS_NOCHDIR | FTS_NOSTAT, NULL);
if (tree != NULL) {
FTSENT *entry;
@ -113,11 +113,11 @@ bool Native::Execute(const CefString& name,
if (entry->fts_level == 0)
continue;
if ((entry->fts_info & FTS_D) != 0 || (entry->fts_info & FTS_F) != 0) {
CefV8ValueList args;
int pathLength = entry->fts_pathlen - rootPathLength;
char relative[pathLength + 1];
relative[pathLength] = '\0';
strncpy(relative, entry->fts_path + rootPathLength, pathLength);
args.clear();
args.push_back(CefV8Value::CreateString(relative));
args.push_back(CefV8Value::CreateBool((entry->fts_info & FTS_F) != 0));
if (!function->ExecuteFunction(function, args)->GetBoolValue())