--- a/js/src/ctypes/CTypes.cpp
+++ b/js/src/ctypes/CTypes.cpp
@@ -4069,17 +4069,17 @@ BuildTypeSource(JSContext* cx,
AppendString(result, ", [");
for (size_t i = 0; i < fninfo->mArgTypes.length(); ++i) {
BuildTypeSource(cx, fninfo->mArgTypes[i], true, result);
if (i != fninfo->mArgTypes.length() - 1 ||
fninfo->mIsVariadic)
AppendString(result, ", ");
}
if (fninfo->mIsVariadic)
- AppendString(result, "\"...\"");
+ AppendString(result, R"("...")");
AppendString(result, "]");
}
AppendString(result, ")");
break;
}
case TYPE_array: {
// Recursively build the source string, and append '.array(n)',
@@ -4102,19 +4102,19 @@ BuildTypeSource(JSContext* cx,
if (makeShort) {
// Shorten the type declaration by assuming that StructType 't' is bound
// to an in-scope variable of name 't.name'.
AppendString(result, name);
break;
}
// Write the full struct declaration.
- AppendString(result, "ctypes.StructType(\"");
+ AppendString(result, R"(ctypes.StructType(")");
AppendString(result, name);
- AppendString(result, "\"");
+ AppendString(result, R"(")");
// If it's an opaque struct, we're done.
if (!CType::IsSizeDefined(typeObj)) {
AppendString(result, ")");
break;
}
AppendString(result, ", [");
@@ -4125,19 +4125,19 @@ BuildTypeSource(JSContext* cx,
if (!fieldsArray.resize(length))
break;
for (FieldInfoHash::Range r = fields->all(); !r.empty(); r.popFront())
fieldsArray[r.front().value().mIndex] = &r.front();
for (size_t i = 0; i < length; ++i) {
const FieldInfoHash::Entry* entry = fieldsArray[i];
- AppendString(result, "{ \"");
+ AppendString(result, R"({ ")");
AppendString(result, entry->key());
- AppendString(result, "\": ");
+ AppendString(result, R"(": )");
BuildTypeSource(cx, entry->value().mType, true, result);
AppendString(result, " }");
if (i != length - 1)
AppendString(result, ", ");
}
AppendString(result, "])");
break;
@@ -4232,19 +4232,19 @@ BuildDataSource(JSContext* cx,
// The result must be able to ImplicitConvert successfully.
// Wrap in a type constructor, then serialize for ExplicitConvert.
BuildTypeSource(cx, typeObj, true, result);
AppendString(result, "(");
}
// Serialize the pointer value as a wrapped hexadecimal integer.
uintptr_t ptr = *static_cast<uintptr_t*>(data);
- AppendString(result, "ctypes.UInt64(\"0x");
+ AppendString(result, R"(ctypes.UInt64("0x)");
IntegerToString(ptr, 16, result);
- AppendString(result, "\")");
+ AppendString(result, R"("))");
if (isImplicit)
AppendString(result, ")");
break;
}
case TYPE_array: {
// Serialize each element of the array recursively. Each element must
@@ -4283,19 +4283,19 @@ BuildDataSource(JSContext* cx,
for (FieldInfoHash::Range r = fields->all(); !r.empty(); r.popFront())
fieldsArray[r.front().value().mIndex] = &r.front();
for (size_t i = 0; i < length; ++i) {
const FieldInfoHash::Entry* entry = fieldsArray[i];
if (isImplicit) {
- AppendString(result, "\"");
+ AppendString(result, R"(")");
AppendString(result, entry->key());
- AppendString(result, "\": ");
+ AppendString(result, R"(": )");
}
char* fieldData = static_cast<char*>(data) + entry->value().mOffset;
RootedObject entryType(cx, entry->value().mType);
if (!BuildDataSource(cx, entryType, fieldData, true, result))
return false;
if (i + 1 != length)
@@ -6810,23 +6810,21 @@ CreateFunctionInfo(JSContext* cx,
for (uint32_t i = 0; i < args.length(); ++i) {
bool isEllipsis;
if (!IsEllipsis(cx, args[i], &isEllipsis))
return false;
if (isEllipsis) {
fninfo->mIsVariadic = true;
if (i < 1) {
- JS_ReportError(cx, "\"...\" may not be the first and only parameter "
- "type of a variadic function declaration");
+ JS_ReportError(cx, R"("..." may not be the first and only parameter type of a variadic function declaration)");
return false;
}
if (i < args.length() - 1) {
- JS_ReportError(cx, "\"...\" must be the last parameter type of a "
- "variadic function declaration");
+ JS_ReportError(cx, R"("..." must be the last parameter type of a variadic function declaration)");
return false;
}
if (GetABICode(fninfo->mABI) != ABI_DEFAULT) {
JS_ReportError(cx, "Variadic functions must use the __cdecl calling "
"convention");
return false;
}
break;
@@ -8660,23 +8658,23 @@ Int64Base::ToSource(JSContext* cx,
return ArgumentLengthError(cx, "UInt64.prototype.toSource", "no", "s");
}
return ArgumentLengthError(cx, "Int64.prototype.toSource", "no", "s");
}
// Return a decimal string suitable for constructing the number.
AutoString source;
if (isUnsigned) {
- AppendString(source, "ctypes.UInt64(\"");
+ AppendString(source, R"(ctypes.UInt64(")");
IntegerToString(GetInt(obj), 10, source);
} else {
- AppendString(source, "ctypes.Int64(\"");
+ AppendString(source, R"(ctypes.Int64(")");
IntegerToString(static_cast<int64_t>(GetInt(obj)), 10, source);
}
- AppendString(source, "\")");
+ AppendString(source, R"("))");
JSString* result = NewUCString(cx, source);
if (!result)
return false;
args.rval().setString(result);
return true;
}
--- a/js/src/vm/TraceLoggingGraph.cpp
+++ b/js/src/vm/TraceLoggingGraph.cpp
@@ -106,17 +106,17 @@ TraceLoggerGraphState::init()
fprintf(out, "[");
// Write the latest tl-data.*.json file to tl-data.json.
// In most cases that is the wanted file.
js::UniqueChars masterFilename = AllocTraceLogFilename("tl-data.json");
if (FILE* last = fopen(masterFilename.get(), "w")) {
char *basename = strrchr(filename.get(), '/');
basename = basename ? basename + 1 : filename.get();
- fprintf(last, "\"%s\"", basename);
+ fprintf(last, R"("%s")", basename);
fclose(last);
}
#ifdef DEBUG
initialized = true;
#endif
return true;
}
@@ -150,25 +150,24 @@ TraceLoggerGraphState::nextLoggerId()
if (numLoggers > 0) {
int written = fprintf(out, ",\n");
if (written < 0) {
fprintf(stderr, "TraceLogging: Error while writing.\n");
return uint32_t(-1);
}
}
- int written = fprintf(out, "{\"tree\":\"tl-tree.%u.%d.tl\", \"events\":\"tl-event.%u.%d.tl\", "
- "\"dict\":\"tl-dict.%u.%d.json\", \"treeFormat\":\"64,64,31,1,32\"",
+ int written = fprintf(out, R"({"tree":"tl-tree.%u.%d.tl", "events":"tl-event.%u.%d.tl", "dict":"tl-dict.%u.%d.json", "treeFormat":"64,64,31,1,32")",
pid_, numLoggers, pid_, numLoggers, pid_, numLoggers);
if (written > 0) {
char threadName[16];
js::ThisThread::GetName(threadName, sizeof(threadName));
if (threadName[0])
- written = fprintf(out, ", \"threadName\":\"%s\"", threadName);
+ written = fprintf(out, R"(, "threadName":"%s")", threadName);
}
if (written > 0)
written = fprintf(out, "}");
if (written < 0) {
fprintf(stderr, "TraceLogging: Error while writing.\n");
return uint32_t(-1);