Skip to content

Commit 1cd4ac2

Browse files
mhorowitzbubblesunyum
authored andcommitted
if !WITH_JSCEXTENSIONS, append a \0
Reviewed By: astreet Differential Revision: D3459183 fbshipit-source-id: f62110e67faed827d888afc9a39d1586cdeeb074
1 parent 26e7f8d commit 1cd4ac2

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

ReactCommon/cxxreact/Value.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,18 @@ class String : public noncopyable {
9898

9999
static String createExpectingAscii(const char* utf8, size_t len) {
100100
#if WITH_FBJSCEXTENSIONS
101-
return String(
102-
JSStringCreateWithUTF8CStringExpectAscii(utf8, len), true);
101+
return String(JSStringCreateWithUTF8CStringExpectAscii(utf8, len), true);
103102
#else
104-
return String(JSStringCreateWithUTF8CString(utf8), true);
103+
return createExpectingAscii(std::string(utf8, len));
105104
#endif
106105
}
107106

108107
static String createExpectingAscii(std::string const &utf8) {
109-
return String::createExpectingAscii(utf8.c_str(), utf8.size());
108+
#if WITH_FBJSCEXTENSIONS
109+
return createExpectingAscii(utf8.c_str(), utf8.size());
110+
#else
111+
return String(JSStringCreateWithUTF8CString(utf8.c_str()), true);
112+
#endif
110113
}
111114

112115
static String ref(JSStringRef string) {

0 commit comments

Comments
 (0)