Skip to content

Commit

Permalink
Fix prefast and copyright check warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
agarwal-sandeep committed May 5, 2016
1 parent 0d5c29b commit 04922c8
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 12 deletions.
18 changes: 11 additions & 7 deletions bin/ch/Debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,8 @@ bool Debugger::SetBaseline()
{
Helpers::LogError(_u("opening baseline file '%s'"), HostConfigFlags::flags.dbgbaseline);
}
else

if(file != nullptr)
{
int fileSize = _filelength(_fileno(file));
if (fileSize <= MAX_BASELINE_SIZE)
Expand Down Expand Up @@ -489,14 +490,17 @@ bool Debugger::CompareOrWriteBaselineFile(LPCWSTR fileName)
return false;
}

int countWritten = static_cast<int>(fwrite(baselineDataANSI, sizeof(baselineDataANSI[0]), strlen(baselineDataANSI), file));
if (countWritten != (int)strlen(baselineDataANSI))
if (file != nullptr)
{
Assert(false);
return false;
}
int countWritten = static_cast<int>(fwrite(baselineDataANSI, sizeof(baselineDataANSI[0]), strlen(baselineDataANSI), file));
if (countWritten != (int)strlen(baselineDataANSI))
{
Assert(false);
return false;
}

fclose(file);
fclose(file);
}

if (!HostConfigFlags::flags.dbgbaselineIsEnabled)
{
Expand Down
5 changes: 4 additions & 1 deletion bin/ch/Encode.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------

if (WScript.arguments.length != 2)
{
Expand Down
11 changes: 9 additions & 2 deletions lib/Jsrt/JsrtDebugUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,16 @@ void JsrtDebugUtils::AddPropertyToObject(Js::DynamicObject * object, JsrtDebugPr
JsrtDebugUtils::AddVarPropertyToObject(object, propertyId, Js::JavascriptNumber::ToVarNoCheck(value, scriptContext), scriptContext);
}

void JsrtDebugUtils::AddPropertyToObject(Js::DynamicObject * object, JsrtDebugPropertyId propertyId, const char16 * value, charcount_t len, Js::ScriptContext * scriptContext)
void JsrtDebugUtils::AddPropertyToObject(Js::DynamicObject * object, JsrtDebugPropertyId propertyId, const char16 * value, size_t len, Js::ScriptContext * scriptContext)
{
JsrtDebugUtils::AddVarPropertyToObject(object, propertyId, Js::JavascriptString::NewCopyBuffer(value, len, scriptContext), scriptContext);
charcount_t charCount = static_cast<charcount_t>(len);

Assert(charCount == len);

if (charCount == len)
{
JsrtDebugUtils::AddVarPropertyToObject(object, propertyId, Js::JavascriptString::NewCopyBuffer(value, charCount, scriptContext), scriptContext);
}
}

void JsrtDebugUtils::AddPropertyToObject(Js::DynamicObject * object, JsrtDebugPropertyId propertyId, Js::JavascriptString* jsString, Js::ScriptContext * scriptContext)
Expand Down
2 changes: 1 addition & 1 deletion lib/Jsrt/JsrtDebugUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class JsrtDebugUtils
static void AddPropertyToObject(Js::DynamicObject* object, JsrtDebugPropertyId propertyId, UINT value, Js::ScriptContext* scriptContext);
static void AddPropertyToObject(Js::DynamicObject* object, JsrtDebugPropertyId propertyId, ULONG value, Js::ScriptContext* scriptContext);
static void AddPropertyToObject(Js::DynamicObject* object, JsrtDebugPropertyId propertyId, LONG value, Js::ScriptContext* scriptContext);
static void AddPropertyToObject(Js::DynamicObject* object, JsrtDebugPropertyId propertyId, const char16 * value, charcount_t len, Js::ScriptContext* scriptContext);
static void AddPropertyToObject(Js::DynamicObject* object, JsrtDebugPropertyId propertyId, const char16 * value, size_t len, Js::ScriptContext* scriptContext);
static void AddPropertyToObject(Js::DynamicObject* object, JsrtDebugPropertyId propertyId, Js::JavascriptString* jsString, Js::ScriptContext* scriptContext);
static void AddPropertyToObject(Js::DynamicObject* object, JsrtDebugPropertyId propertyId, bool value, Js::ScriptContext* scriptContext);
static void AddPropertyToObject(Js::DynamicObject* object, JsrtDebugPropertyId propertyId, Js::Var value, Js::ScriptContext* scriptContext);
Expand Down
8 changes: 7 additions & 1 deletion lib/Jsrt/JsrtDiag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,13 @@ CHAKRA_API JsDiagEvaluate(
return JsErrorDiagObjectNotFound;
}

Js::DynamicObject* result = debuggerStackFrame->Evaluate(scriptContext, expression, wcslen(expression), false);
size_t len = wcslen(expression);
if (len != static_cast<int>(len))
{
return JsErrorInvalidArgument;
}

Js::DynamicObject* result = debuggerStackFrame->Evaluate(scriptContext, expression, static_cast<int>(len), false);

if (result != nullptr)
{
Expand Down

0 comments on commit 04922c8

Please sign in to comment.