Skip to content

Commit c0fbcf6

Browse files
committed
Change uint8_t and uint16_t to unsigned char & unsigned short respectively in files that don't have the typedef for legacy build
1 parent 5bee76d commit c0fbcf6

7 files changed

Lines changed: 27 additions & 27 deletions

File tree

bin/ch/ChakraRtInterface.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ struct JsAPIHooks
7373
typedef JsErrorCode(WINAPI *JsrtParse)(JsValueRef script, JsSourceContext sourceContext, JsValueRef sourceUrl, JsParseScriptAttributes parseAttributes, JsValueRef *result);
7474
typedef JsErrorCode(WINAPI *JsrtSerialize)(JsValueRef script, JsValueRef *buffer, JsParseScriptAttributes parseAttributes);
7575
typedef JsErrorCode(WINAPI *JsrtRunSerialized)(JsValueRef buffer, JsSerializedLoadScriptCallback scriptLoadCallback, JsSourceContext sourceContext, JsValueRef sourceUrl, JsValueRef * result);
76-
typedef JsErrorCode(WINAPI *JsrtCopyStringUtf8)(JsValueRef value, uint8_t* buffer, size_t bufferSize, size_t* written);
77-
typedef JsErrorCode(WINAPI *JsrtCreateStringUtf8)(const uint8_t *content, size_t length, JsValueRef *value);
76+
typedef JsErrorCode(WINAPI *JsrtCopyStringUtf8)(JsValueRef value, unsigned char* buffer, size_t bufferSize, size_t* written);
77+
typedef JsErrorCode(WINAPI *JsrtCreateStringUtf8)(const unsigned char *content, size_t length, JsValueRef *value);
7878
typedef JsErrorCode(WINAPI *JsrtCreateExternalArrayBuffer)(void *data, unsigned int byteLength, JsFinalizeCallback finalizeCallback, void *callbackState, JsValueRef *result);
7979
typedef JsErrorCode(WINAPI *JsrtCreatePropertyIdUtf8)(const char *name, size_t length, JsPropertyIdRef *propertyId);
8080

@@ -368,8 +368,8 @@ class ChakraRTInterface
368368
static JsErrorCode WINAPI JsParse(JsValueRef script, JsSourceContext sourceContext, JsValueRef sourceUrl, JsParseScriptAttributes parseAttributes, JsValueRef *result) { return HOOK_JS_API(Parse(script, sourceContext, sourceUrl, parseAttributes, result)); }
369369
static JsErrorCode WINAPI JsSerialize(JsValueRef script, JsValueRef *buffer, JsParseScriptAttributes parseAttributes) { return HOOK_JS_API(Serialize(script, buffer, parseAttributes)); }
370370
static JsErrorCode WINAPI JsRunSerialized(JsValueRef buffer, JsSerializedLoadScriptCallback scriptLoadCallback, JsSourceContext sourceContext, JsValueRef sourceUrl, JsValueRef * result) { return HOOK_JS_API(RunSerialized(buffer, scriptLoadCallback, sourceContext, sourceUrl, result)); }
371-
static JsErrorCode WINAPI JsCopyStringUtf8(JsValueRef value, uint8_t* buffer, size_t bufferSize, size_t* written) { return HOOK_JS_API(CopyStringUtf8(value, buffer, bufferSize, written)); }
372-
static JsErrorCode WINAPI JsCreateStringUtf8(const uint8_t *content, size_t length, JsValueRef *value) { return HOOK_JS_API(CreateStringUtf8(content, length, value)); }
371+
static JsErrorCode WINAPI JsCopyStringUtf8(JsValueRef value, unsigned char* buffer, size_t bufferSize, size_t* written) { return HOOK_JS_API(CopyStringUtf8(value, buffer, bufferSize, written)); }
372+
static JsErrorCode WINAPI JsCreateStringUtf8(const unsigned char *content, size_t length, JsValueRef *value) { return HOOK_JS_API(CreateStringUtf8(content, length, value)); }
373373
static JsErrorCode WINAPI JsCreatePropertyIdUtf8(const char *name, size_t length, JsPropertyIdRef *propertyId) { return HOOK_JS_API(CreatePropertyIdUtf8(name, length, propertyId)); }
374374
static JsErrorCode WINAPI JsCreateExternalArrayBuffer(void *data, unsigned int byteLength, JsFinalizeCallback finalizeCallback, void *callbackState, JsValueRef *result) { return HOOK_JS_API(CreateExternalArrayBuffer(data, byteLength, finalizeCallback, callbackState, result)); }
375375
};

bin/ch/Debugger.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ bool Debugger::Initialize()
236236
nullptr, nullptr, &scriptSource));
237237
JsValueRef fname;
238238
ChakraRTInterface::JsCreateStringUtf8(
239-
(const uint8_t*)"DbgController.js", strlen("DbgController.js"), &fname);
239+
(const unsigned char*)"DbgController.js", strlen("DbgController.js"), &fname);
240240
IfJsrtErrorFailLogAndRetFalse(ChakraRTInterface::JsParse(scriptSource,
241241
JS_SOURCE_CONTEXT_NONE, fname, JsParseScriptAttributeLibraryCode,
242242
&globalFunc));
@@ -324,7 +324,7 @@ bool Debugger::SetBaseline()
324324

325325
JsValueRef wideScriptRef;
326326
IfJsrtErrorFailLogAndRetFalse(ChakraRTInterface::JsCreateStringUtf8(
327-
(const uint8_t*)script, strlen(script), &wideScriptRef));
327+
(const unsigned char*)script, strlen(script), &wideScriptRef));
328328

329329
this->CallFunctionNoResult("SetBaseline", wideScriptRef);
330330
}

bin/ch/WScriptJsrt.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ DWORD_PTR WScriptJsrt::sourceContext = 0;
5252
if (FAILED(WideStringToNarrowDynamic(errorMessage, &errorMessageNarrow))) \
5353
{ \
5454
errorCode = ChakraRTInterface::JsCreateStringUtf8( \
55-
(const uint8_t*)outOfMemoryString, \
55+
(const unsigned char*)outOfMemoryString, \
5656
strlen(outOfMemoryString), &errorMessageString); \
5757
} \
5858
else \
5959
{ \
6060
errorCode = ChakraRTInterface::JsCreateStringUtf8( \
61-
(const uint8_t*)errorMessageNarrow, \
61+
(const unsigned char*)errorMessageNarrow, \
6262
strlen(errorMessageNarrow), &errorMessageString); \
6363
free(errorMessageNarrow); \
6464
} \
@@ -91,7 +91,7 @@ bool WScriptJsrt::CreateArgumentsObject(JsValueRef *argsObject)
9191
return false;
9292
}
9393
JsErrorCode errCode = ChakraRTInterface::JsCreateStringUtf8(
94-
(const uint8_t*)argNarrow,
94+
(const unsigned char*)argNarrow,
9595
strlen(argNarrow), &value);
9696
free(argNarrow);
9797
IfJsrtErrorFail(errCode, false);
@@ -326,7 +326,7 @@ JsErrorCode WScriptJsrt::LoadModuleFromString(LPCSTR fileName, LPCSTR fileConten
326326
{
327327
JsValueRef specifier;
328328
errorCode = ChakraRTInterface::JsCreateStringUtf8(
329-
(const uint8_t*)fileName, strlen(fileName), &specifier);
329+
(const unsigned char*)fileName, strlen(fileName), &specifier);
330330
if (errorCode == JsNoError)
331331
{
332332
errorCode = ChakraRTInterface::JsInitializeModuleRecord(
@@ -413,7 +413,7 @@ JsValueRef WScriptJsrt::LoadScript(JsValueRef callee, LPCSTR fileName,
413413
IfJsrtErrorSetGo(ChakraRTInterface::JsCreateExternalArrayBuffer((void*)fileContent,
414414
(unsigned int)strlen(fileContent), nullptr, nullptr, &scriptSource));
415415
JsValueRef fname;
416-
IfJsrtErrorSetGo(ChakraRTInterface::JsCreateStringUtf8((const uint8_t*)fullPathNarrow,
416+
IfJsrtErrorSetGo(ChakraRTInterface::JsCreateStringUtf8((const unsigned char*)fullPathNarrow,
417417
strlen(fullPathNarrow), &fname));
418418
errorCode = ChakraRTInterface::JsRun(scriptSource, GetNextSourceContext(),
419419
fname, JsParseScriptAttributeNone, &returnValue);
@@ -446,7 +446,7 @@ JsValueRef WScriptJsrt::LoadScript(JsValueRef callee, LPCSTR fileName,
446446
IfJsrtErrorSetGo(ChakraRTInterface::JsCreateExternalArrayBuffer((void*)fileContent,
447447
(unsigned int)strlen(fileContent), nullptr, nullptr, &scriptSource));
448448
JsValueRef fname;
449-
IfJsrtErrorSetGo(ChakraRTInterface::JsCreateStringUtf8((const uint8_t*)fullPathNarrow,
449+
IfJsrtErrorSetGo(ChakraRTInterface::JsCreateStringUtf8((const unsigned char*)fullPathNarrow,
450450
strlen(fullPathNarrow), &fname));
451451
errorCode = ChakraRTInterface::JsRun(scriptSource, GetNextSourceContext(),
452452
fname, JsParseScriptAttributeNone, &returnValue);
@@ -724,7 +724,7 @@ bool WScriptJsrt::CreateNamedFunction(const char* nameString, JsNativeFunction c
724724
{
725725
JsValueRef nameVar;
726726
IfJsrtErrorFail(ChakraRTInterface::JsCreateStringUtf8(
727-
(const uint8_t*)nameString, strlen(nameString), &nameVar), false);
727+
(const unsigned char*)nameString, strlen(nameString), &nameVar), false);
728728
IfJsrtErrorFail(ChakraRTInterface::JsCreateNamedFunction(nameVar, callback,
729729
nullptr, functionVar), false);
730730
return true;
@@ -852,7 +852,7 @@ bool WScriptJsrt::Initialize()
852852
IfJsrtErrorFail(CreatePropertyIdFromString("ARCH", &archProperty), false);
853853
JsValueRef archValue;
854854
IfJsrtErrorFail(ChakraRTInterface::JsCreateStringUtf8(
855-
(const uint8_t*)CPU_ARCH_TEXT, strlen(CPU_ARCH_TEXT), &archValue), false);
855+
(const unsigned char*)CPU_ARCH_TEXT, strlen(CPU_ARCH_TEXT), &archValue), false);
856856
IfJsrtErrorFail(ChakraRTInterface::JsSetProperty(platformObject, archProperty,
857857
archValue, true), false);
858858

@@ -861,7 +861,7 @@ bool WScriptJsrt::Initialize()
861861
IfJsrtErrorFail(CreatePropertyIdFromString("LINK_TYPE", &linkProperty), false);
862862
JsValueRef linkValue;
863863
IfJsrtErrorFail(ChakraRTInterface::JsCreateStringUtf8(
864-
(const uint8_t*)LINK_TYPE, strlen(LINK_TYPE), &linkValue), false);
864+
(const unsigned char*)LINK_TYPE, strlen(LINK_TYPE), &linkValue), false);
865865
IfJsrtErrorFail(ChakraRTInterface::JsSetProperty(platformObject, linkProperty,
866866
linkValue, true), false);
867867

@@ -873,7 +873,7 @@ bool WScriptJsrt::Initialize()
873873
IfJsrtErrorFail(CreatePropertyIdFromString("BINARY_PATH", &binaryPathProperty), false);
874874

875875
IfJsrtErrorFail(ChakraRTInterface::JsCreateStringUtf8(
876-
(const uint8_t*)CH_BINARY_LOCATION,
876+
(const unsigned char*)CH_BINARY_LOCATION,
877877
strlen(CH_BINARY_LOCATION), &binaryPathValue), false);
878878
IfJsrtErrorFail(ChakraRTInterface::JsSetProperty(
879879
platformObject, binaryPathProperty, binaryPathValue, true), false);
@@ -883,7 +883,7 @@ bool WScriptJsrt::Initialize()
883883
IfJsrtErrorFail(CreatePropertyIdFromString("OS", &osProperty), false);
884884
JsValueRef osValue;
885885
IfJsrtErrorFail(ChakraRTInterface::JsCreateStringUtf8(
886-
(const uint8_t*)DEST_PLATFORM_TEXT,
886+
(const unsigned char*)DEST_PLATFORM_TEXT,
887887
strlen(DEST_PLATFORM_TEXT), &osValue), false);
888888
IfJsrtErrorFail(ChakraRTInterface::JsSetProperty(platformObject, osProperty,
889889
osValue, true), false);
@@ -964,7 +964,7 @@ JsValueRef __stdcall WScriptJsrt::LoadTextFileCallback(JsValueRef callee, bool i
964964
{
965965
JsValueRef stringObject;
966966
IfJsrtErrorSetGo(ChakraRTInterface::JsCreateStringUtf8(
967-
(const uint8_t*)fileContent,
967+
(const unsigned char*)fileContent,
968968
lengthBytes, &stringObject));
969969
return stringObject;
970970
}
@@ -1189,7 +1189,7 @@ HRESULT WScriptJsrt::CallbackMessage::CallFunction(LPCSTR fileName)
11891189
IfJsrtErrorHR(ChakraRTInterface::JsConvertValueToString(m_function, &stringValue));
11901190

11911191
JsValueRef fname;
1192-
ChakraRTInterface::JsCreateStringUtf8((const uint8_t*)"", strlen(""), &fname);
1192+
ChakraRTInterface::JsCreateStringUtf8((const unsigned char*)"", strlen(""), &fname);
11931193
// Run the code
11941194
errorCode = ChakraRTInterface::JsRun(stringValue, JS_SOURCE_CONTEXT_NONE,
11951195
fname, JsParseScriptAttributeArrayBufferIsUtf16Encoded,

bin/ch/ch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ HRESULT RunScript(const char* fileName, LPCSTR fileContents, JsValueRef bufferVa
291291

292292
JsErrorCode runScript;
293293
JsValueRef fname;
294-
IfJsErrorFailLog(ChakraRTInterface::JsCreateStringUtf8((const uint8_t*)fullPath,
294+
IfJsErrorFailLog(ChakraRTInterface::JsCreateStringUtf8((const unsigned char*)fullPath,
295295
strlen(fullPath), &fname));
296296

297297
if(bufferValue != nullptr)

bin/ch/stdafx.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class AutoString
186186
if (errorCode == JsNoError)
187187
{
188188
data = (char*) malloc((len + 1) * sizeof(char));
189-
uint8_t *udata = (uint8_t*)data;
189+
unsigned char *udata = (unsigned char*)data;
190190
ChakraRTInterface::JsCopyStringUtf8(strValue, udata, len + 1, &length);
191191
AssertMsg(len == length, "If you see this message.. There is something seriously wrong. Good Luck!");
192192
*(data + len) = char(0);

lib/Jsrt/ChakraCore.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ CHAKRA_API
212212
/// </returns>
213213
CHAKRA_API
214214
JsCreateStringUtf8(
215-
_In_ const uint8_t *content,
215+
_In_ const unsigned char *content,
216216
_In_ size_t length,
217217
_Out_ JsValueRef *value);
218218

@@ -232,7 +232,7 @@ CHAKRA_API
232232
/// </returns>
233233
CHAKRA_API
234234
JsCreateStringUtf16(
235-
_In_ const uint16_t *content,
235+
_In_ const unsigned short *content,
236236
_In_ size_t length,
237237
_Out_ JsValueRef *value);
238238

@@ -289,7 +289,7 @@ CHAKRA_API
289289
CHAKRA_API
290290
JsCopyStringUtf8(
291291
_In_ JsValueRef value,
292-
_Out_opt_ uint8_t* buffer,
292+
_Out_opt_ unsigned char* buffer,
293293
_In_ size_t bufferSize,
294294
_Out_opt_ size_t* written);
295295

@@ -323,7 +323,7 @@ CHAKRA_API
323323
_In_ JsValueRef value,
324324
_In_ int start,
325325
_In_ int length,
326-
_Out_opt_ uint16_t* buffer,
326+
_Out_opt_ unsigned short* buffer,
327327
_Out_opt_ size_t* written);
328328

329329
/// <summary>
@@ -445,7 +445,7 @@ CHAKRA_API
445445
CHAKRA_API
446446
JsCopyPropertyIdUtf8(
447447
_In_ JsPropertyIdRef propertyId,
448-
_Out_ uint8_t* buffer,
448+
_Out_ unsigned char* buffer,
449449
_In_ size_t bufferSize,
450450
_Out_ size_t* length);
451451

lib/Runtime/Library/JavascriptArray.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ namespace Js
439439
void SetHasNoMissingValues(const bool hasNoMissingValues = true);
440440

441441
template<typename T>
442-
bool JavascriptArray::IsMissingItemAt(uint32 index) const;
442+
bool IsMissingItemAt(uint32 index) const;
443443
bool IsMissingItem(uint32 index);
444444

445445
virtual bool IsMissingHeadSegmentItem(const uint32 index) const;

0 commit comments

Comments
 (0)