Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions bin/External/catch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1571,8 +1571,8 @@ std::string toString( std::string const& value );
std::string toString( std::wstring const& value );
std::string toString( const char* const value );
std::string toString( char* const value );
std::string toString( const wchar_t* const value );
std::string toString( wchar_t* const value );
std::string toString( const WCHAR* const value );
std::string toString( WCHAR* const value );
std::string toString( int value );
std::string toString( unsigned long value );
std::string toString( unsigned int value );
Expand Down Expand Up @@ -8095,14 +8095,14 @@ std::string toString( char* const value ) {
return Catch::toString( static_cast<const char*>( value ) );
}

std::string toString( const wchar_t* const value )
std::string toString( const WCHAR* const value )
{
return value ? Catch::toString( std::wstring(value) ) : std::string( "{null string}" );
}

std::string toString( wchar_t* const value )
std::string toString( WCHAR* const value )
{
return Catch::toString( static_cast<const wchar_t*>( value ) );
return Catch::toString( static_cast<const WCHAR*>( value ) );
}

std::string toString( int value ) {
Expand Down Expand Up @@ -10506,4 +10506,3 @@ int main (int argc, char * const argv[]) {
using Catch::Detail::Approx;

#endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED

26 changes: 13 additions & 13 deletions bin/NativeTests/JsRTApiTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ namespace JsRTApiTest
REQUIRE(JsCreateObject(&object) == JsNoError);

JsPropertyIdRef name1 = JS_INVALID_REFERENCE;
const wchar_t* name = nullptr;
const WCHAR* name = nullptr;
REQUIRE(JsGetPropertyIdFromName(_u("stringProperty1"), &name1) == JsNoError);
REQUIRE(JsGetPropertyNameFromId(name1, &name) == JsNoError);
CHECK(!wcscmp(name, _u("stringProperty1")));
Expand Down Expand Up @@ -582,7 +582,7 @@ namespace JsRTApiTest
JsValueRef CALLBACK ExternalFunctionPreScriptAbortionCallback(JsValueRef /* function */, bool /* isConstructCall */, JsValueRef * args /* args */, USHORT /* cargs */, void * /* callbackState */)
{
JsValueRef result = JS_INVALID_REFERENCE;
const wchar_t *scriptText = nullptr;
const WCHAR *scriptText = nullptr;
size_t scriptTextLen;

REQUIRE(JsStringToPointer(args[0], &scriptText, &scriptTextLen) == JsNoError);
Expand All @@ -593,7 +593,7 @@ namespace JsRTApiTest
JsValueRef CALLBACK ExternalFunctionPostScriptAbortionCallback(JsValueRef /* function */, bool /* isConstructCall */, JsValueRef * args /* args */, USHORT /* cargs */, void * /* callbackState */)
{
JsValueRef result = JS_INVALID_REFERENCE;
const wchar_t *scriptText = nullptr;
const WCHAR *scriptText = nullptr;
size_t scriptTextLen;

REQUIRE(JsStringToPointer(args[0], &scriptText, &scriptTextLen) == JsNoError);
Expand Down Expand Up @@ -656,7 +656,7 @@ namespace JsRTApiTest
REQUIRE(JsCreateFunction(ExternalFunctionCallback, nullptr, &function) == JsNoError);
testConstructorName(function, _u(""), 0);

wchar_t name[] = _u("FooName");
WCHAR name[] = _u("FooName");
JsValueRef nameString = JS_INVALID_REFERENCE;
REQUIRE(JsPointerToString(name, _countof(name) - 1, &nameString) == JsNoError);
REQUIRE(JsCreateNamedFunction(nameString, ExternalFunctionCallback, nullptr, &function) == JsNoError);
Expand Down Expand Up @@ -688,7 +688,7 @@ namespace JsRTApiTest

JsValueRef args[] = { GetUndefined() };

// throw from script, handle in host
// throw from script, handle in host
REQUIRE(JsGetPropertyIdFromName(_u("throwAtHost"), &name) == JsNoError);
REQUIRE(JsGetProperty(global, name, &function) == JsNoError);
REQUIRE(JsCallFunction(function, args, _countof(args), &result) == JsErrorScriptException);
Expand All @@ -701,12 +701,12 @@ namespace JsRTApiTest
REQUIRE(JsGetPropertyIdFromName(_u("callHost"), &name) == JsNoError);
REQUIRE(JsSetProperty(global, name, result, true) == JsNoError);

// throw from host callback, catch in script
// throw from host callback, catch in script
REQUIRE(JsGetPropertyIdFromName(_u("callHostWithTryCatch"), &name) == JsNoError);
REQUIRE(JsGetProperty(global, name, &function) == JsNoError);
REQUIRE(JsCallFunction(function, args, _countof(args), &result) == JsNoError);

// throw from host callback, through script, handle in host
// throw from host callback, through script, handle in host
REQUIRE(JsGetPropertyIdFromName(_u("callHostWithNoTryCatch"), &name) == JsNoError);
REQUIRE(JsGetProperty(global, name, &function) == JsNoError);
REQUIRE(JsCallFunction(function, args, _countof(args), &result) == JsErrorScriptException);
Expand Down Expand Up @@ -855,7 +855,7 @@ namespace JsRTApiTest
JsValueRef nameValue = JS_INVALID_REFERENCE;
REQUIRE(JsGetIndexedProperty(propertyNames, indexValue, &nameValue) == JsNoError);

const wchar_t *name = nullptr;
const WCHAR *name = nullptr;
size_t length;
REQUIRE(JsStringToPointer(nameValue, &name, &length) == JsNoError);

Expand All @@ -879,7 +879,7 @@ namespace JsRTApiTest
JsPropertyIdRef propertyId = JS_INVALID_REFERENCE;
JsValueRef outValue = JS_INVALID_REFERENCE;
JsValueRef propertySymbols = JS_INVALID_REFERENCE;
const wchar_t* name = nullptr;
const WCHAR* name = nullptr;
JsPropertyIdType propertyIdType;

REQUIRE(JsCreateObject(&object) == JsNoError);
Expand Down Expand Up @@ -1003,7 +1003,7 @@ namespace JsRTApiTest
bool boolValue;
BYTE *compiledScript = nullptr;
unsigned int scriptSize = 0;
const wchar_t *stringValue;
const WCHAR *stringValue;
size_t stringLength;
ByteCodeCallbackTracker tracker = {};

Expand All @@ -1030,7 +1030,7 @@ namespace JsRTApiTest

tracker.script = script;
REQUIRE(JsRunSerializedScriptWithCallback(
[](JsSourceContext sourceContext, const wchar_t** scriptBuffer)
[](JsSourceContext sourceContext, const WCHAR** scriptBuffer)
{
((ByteCodeCallbackTracker*)sourceContext)->loadedScript = true;
*scriptBuffer = ((ByteCodeCallbackTracker*)sourceContext)->script;
Expand Down Expand Up @@ -1079,7 +1079,7 @@ namespace JsRTApiTest
REQUIRE(oldProtect == PAGE_READWRITE);
tracker.script = scriptFnToString;
REQUIRE(JsRunSerializedScriptWithCallback(
[](JsSourceContext sourceContext, const wchar_t** scriptBuffer)
[](JsSourceContext sourceContext, const WCHAR** scriptBuffer)
{
((ByteCodeCallbackTracker*)sourceContext)->loadedScript = true;
*scriptBuffer = ((ByteCodeCallbackTracker*)sourceContext)->script;
Expand Down Expand Up @@ -1619,7 +1619,7 @@ namespace JsRTApiTest
REQUIRE(JsCreateFunction(ExternalFunctionPostScriptAbortionCallback, nullptr, &postScriptAbortFunction) == JsNoError);
JsValueRef scriptTextArg = JS_INVALID_REFERENCE;

wchar_t *scriptText = const_cast<wchar_t *>(terminationTests[i]);
WCHAR *scriptText = const_cast<WCHAR *>(terminationTests[i]);
REQUIRE(JsPointerToString(scriptText, wcslen(scriptText), &scriptTextArg) == JsNoError);
JsValueRef args[] = { scriptTextArg };

Expand Down
2 changes: 1 addition & 1 deletion bin/ch/ch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ JsRuntimeHandle chRuntime = JS_INVALID_RUNTIME_HANDLE;

BOOL doTTRecord = false;
BOOL doTTDebug = false;
byte ttUri[MAX_PATH * sizeof(wchar_t)];
byte ttUri[MAX_PATH * sizeof(WCHAR)];
size_t ttUriByteLength = 0;
UINT32 snapInterval = MAXUINT32;
UINT32 snapHistoryLength = MAXUINT32;
Expand Down
4 changes: 1 addition & 3 deletions lib/Common/CommonPal.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@
#undef Yield /* winbase.h defines this but we want to use it for Js::OpCode::Yield; it is Win16 legacy, no harm undef'ing it */
#pragma warning(pop)

typedef wchar_t char16;

// xplat-todo: get a better name for this macro
#define _u(s) L##s
#define INIT_PRIORITY(x)
Expand Down Expand Up @@ -635,7 +633,7 @@ void TryFinally(const TryFunc& tryFunc, const FinallyFunc& finallyFunc)
#else
#define __TRY_FINALLY_BEGIN __try
#define __FINALLY __finally
#define __TRY_FINALLY_END
#define __TRY_FINALLY_END
#endif

namespace PlatformAgnostic
Expand Down
4 changes: 2 additions & 2 deletions lib/JITIDL/JITTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ typedef struct PropertyIdArrayIDL

typedef struct JavascriptStringIDL
{
IDL_DEF([size_is(m_charLength + 1)]) wchar_t* m_pszValue;
IDL_DEF([size_is(m_charLength + 1)]) WCHAR* m_pszValue;
unsigned int m_charLength;
} JavascriptStringIDL;

Expand Down Expand Up @@ -553,7 +553,7 @@ typedef struct FunctionBodyDataIDL

IDL_DEF([size_is(referencedPropertyIdCount)]) int * referencedPropertyIdMap;

IDL_DEF([size_is(nameLength)]) wchar_t * displayName;
IDL_DEF([size_is(nameLength)]) WCHAR * displayName;

IDL_DEF([size_is(literalRegexCount)]) CHAKRA_PTR * literalRegexes;

Expand Down
1 change: 1 addition & 0 deletions lib/Jsrt/ChakraCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ typedef void* HANDLE;
typedef unsigned char BYTE;
typedef BYTE byte;
typedef UINT32 DWORD;
typedef unsigned short WCHAR;
#endif

#endif // defined(_WIN32) && defined(_MSC_VER)
Expand Down
2 changes: 1 addition & 1 deletion lib/Jsrt/ChakraCommonWindows.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/// <returns>
/// true if the operation succeeded, false otherwise.
/// </returns>
typedef bool (CHAKRA_CALLBACK * JsSerializedScriptLoadSourceCallback)(_In_ JsSourceContext sourceContext, _Outptr_result_z_ const wchar_t** scriptBuffer);
typedef bool (CHAKRA_CALLBACK * JsSerializedScriptLoadSourceCallback)(_In_ JsSourceContext sourceContext, _Outptr_result_z_ const WCHAR** scriptBuffer);

/// <summary>
/// Parses a script and returns a function representing the script.
Expand Down
2 changes: 1 addition & 1 deletion lib/Jsrt/ChakraDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ typedef unsigned __int32 uint32_t;
/// </remarks>
CHAKRA_API
JsDiagEvaluate(
_In_z_ const wchar_t *expression,
_In_z_ const WCHAR *expression,
_In_ unsigned int stackFrameIndex,
_Out_ JsValueRef *evalResult);

Expand Down
Loading