@@ -26,30 +26,30 @@ static bool array_valueOf(JSContext *cx, unsigned argc, JS::Value *vp) {
2626 return false ;
2727 }
2828
29- JS::PersistentRootedObject* arrayBuffer = JS::GetMaybePtrFromReservedSlot<JS::PersistentRootedObject>(proxy, OtherSlot);
29+ JS::PersistentRootedObject * arrayBuffer = JS::GetMaybePtrFromReservedSlot<JS::PersistentRootedObject>(proxy, OtherSlot);
3030 JS::RootedObject rootedArrayBuffer (cx, arrayBuffer->get ());
3131
3232 auto byteLength = JS::GetArrayBufferByteLength (rootedArrayBuffer);
3333
34- bool isSharedMemory;
34+ bool isSharedMemory;
3535 JS::AutoCheckCannotGC autoNoGC (cx);
3636 uint8_t *data = JS::GetArrayBufferData (rootedArrayBuffer, &isSharedMemory, autoNoGC);
37-
37+
3838 size_t numberOfDigits = 0 ;
3939 for (size_t i = 0 ; i < byteLength; i++) {
40- numberOfDigits += data[i] < 10 ? 1 : data[i] < 100 ? 2 : 3 ;
40+ numberOfDigits += data[i] < 10 ? 1 : data[i] < 100 ? 2 : 3 ;
4141 }
4242 const size_t STRING_LENGTH = byteLength + numberOfDigits;
43- JS::Latin1Char* buffer = (JS::Latin1Char *)malloc (sizeof (JS::Latin1Char) * STRING_LENGTH);
44-
43+ JS::Latin1Char * buffer = (JS::Latin1Char *)malloc (sizeof (JS::Latin1Char) * STRING_LENGTH);
44+
4545 size_t charIndex = 0 ;
46- sprintf ((char *)&buffer[charIndex], " %d" , data[0 ]);
46+ snprintf ((char *)&buffer[charIndex], 4 , " %d" , data[0 ]);
4747 charIndex += data[0 ] < 10 ? 1 : data[0 ] < 100 ? 2 : 3 ;
4848
4949 for (size_t dataIndex = 1 ; dataIndex < byteLength; dataIndex++) {
5050 buffer[charIndex] = ' ,' ;
5151 charIndex++;
52- sprintf ((char *)&buffer[charIndex], " %d" , data[dataIndex]);
52+ snprintf ((char *)&buffer[charIndex], 4 , " %d" , data[dataIndex]);
5353 charIndex += data[dataIndex] < 10 ? 1 : data[dataIndex] < 100 ? 2 : 3 ;
5454 }
5555
@@ -84,7 +84,7 @@ static bool iterator_next(JSContext *cx, unsigned argc, JS::Value *vp) {
8484 JS::RootedObject thisObj (cx);
8585 if (!args.computeThis (cx, &thisObj)) return false ;
8686
87- JS::PersistentRootedObject* arrayBuffer = JS::GetMaybePtrFromReservedSlot<JS::PersistentRootedObject>(thisObj, BytesIteratorSlotIteratedObject);
87+ JS::PersistentRootedObject * arrayBuffer = JS::GetMaybePtrFromReservedSlot<JS::PersistentRootedObject>(thisObj, BytesIteratorSlotIteratedObject);
8888 JS::RootedObject rootedArrayBuffer (cx, arrayBuffer->get ());
8989
9090 JS::RootedValue rootedNextIndex (cx, JS::GetReservedSlot (thisObj, BytesIteratorSlotNextIndex));
@@ -112,7 +112,7 @@ static bool iterator_next(JSContext *cx, unsigned argc, JS::Value *vp) {
112112 if (!JS_SetProperty (cx, result, " done" , done)) return false ;
113113
114114 if (itemKind == ITEM_KIND_VALUE) {
115- bool isSharedMemory;
115+ bool isSharedMemory;
116116 JS::AutoCheckCannotGC autoNoGC (cx);
117117 uint8_t *data = JS::GetArrayBufferData (rootedArrayBuffer, &isSharedMemory, autoNoGC);
118118
@@ -125,7 +125,7 @@ static bool iterator_next(JSContext *cx, unsigned argc, JS::Value *vp) {
125125 JS::RootedValue rootedNextIndex (cx, JS::Int32Value (nextIndex));
126126 items[0 ].set (rootedNextIndex);
127127
128- bool isSharedMemory;
128+ bool isSharedMemory;
129129 JS::AutoCheckCannotGC autoNoGC (cx);
130130 uint8_t *data = JS::GetArrayBufferData (rootedArrayBuffer, &isSharedMemory, autoNoGC);
131131
@@ -216,8 +216,8 @@ static bool array_iterator_func(JSContext *cx, unsigned argc, JS::Value *vp, int
216216 if (!JS::Construct (cx, constructor_val, JS::HandleValueArray::empty (), &obj)) return false ;
217217 if (!obj) return false ;
218218
219- JS::PersistentRootedObject* arrayBuffer = JS::GetMaybePtrFromReservedSlot<JS::PersistentRootedObject>(proxy, OtherSlot);
220-
219+ JS::PersistentRootedObject * arrayBuffer = JS::GetMaybePtrFromReservedSlot<JS::PersistentRootedObject>(proxy, OtherSlot);
220+
221221 JS::SetReservedSlot (obj, BytesIteratorSlotIteratedObject, JS::PrivateValue (arrayBuffer));
222222 JS::SetReservedSlot (obj, BytesIteratorSlotNextIndex, JS::Int32Value (0 ));
223223 JS::SetReservedSlot (obj, BytesIteratorSlotItemKind, JS::Int32Value (itemKind));
@@ -253,13 +253,13 @@ bool PyBytesProxyHandler::set(JSContext *cx, JS::HandleObject proxy, JS::HandleI
253253 JS::HandleValue v, JS::HandleValue receiver,
254254 JS::ObjectOpResult &result) const {
255255
256- // block all modifications
257-
256+ // block all modifications
257+
258258 PyObject *self = JS::GetMaybePtrFromReservedSlot<PyObject>(proxy, PyObjectSlot);
259259
260260 PyErr_Format (PyExc_TypeError,
261- " '%.100s' object has only read-only attributes" ,
262- Py_TYPE (self)->tp_name );
261+ " '%.100s' object has only read-only attributes" ,
262+ Py_TYPE (self)->tp_name );
263263
264264 return result.failReadOnly ();
265265}
@@ -298,7 +298,7 @@ bool PyBytesProxyHandler::getOwnPropertyDescriptor(
298298
299299 // "length" and "byteLength" properties have the same value
300300 if ((JS_StringEqualsLiteral (cx, idString, " length" , &isProperty) && isProperty) || (JS_StringEqualsLiteral (cx, id.toString (), " byteLength" , &isProperty) && isProperty)) {
301- JS::PersistentRootedObject* arrayBuffer = JS::GetMaybePtrFromReservedSlot<JS::PersistentRootedObject>(proxy, OtherSlot);
301+ JS::PersistentRootedObject * arrayBuffer = JS::GetMaybePtrFromReservedSlot<JS::PersistentRootedObject>(proxy, OtherSlot);
302302
303303 JS::RootedObject rootedArrayBuffer (cx, arrayBuffer->get ());
304304
@@ -314,7 +314,7 @@ bool PyBytesProxyHandler::getOwnPropertyDescriptor(
314314
315315 // "buffer" property
316316 if (JS_StringEqualsLiteral (cx, idString, " buffer" , &isProperty) && isProperty) {
317- JS::PersistentRootedObject* arrayBuffer = JS::GetMaybePtrFromReservedSlot<JS::PersistentRootedObject>(proxy, OtherSlot);
317+ JS::PersistentRootedObject * arrayBuffer = JS::GetMaybePtrFromReservedSlot<JS::PersistentRootedObject>(proxy, OtherSlot);
318318
319319 desc.set (mozilla::Some (
320320 JS::PropertyDescriptor::Data (
@@ -392,10 +392,10 @@ bool PyBytesProxyHandler::getOwnPropertyDescriptor(
392392 // item
393393 Py_ssize_t index;
394394 if (idToIndex (cx, id, &index)) {
395- JS::PersistentRootedObject* arrayBuffer = JS::GetMaybePtrFromReservedSlot<JS::PersistentRootedObject>(proxy, OtherSlot);
395+ JS::PersistentRootedObject * arrayBuffer = JS::GetMaybePtrFromReservedSlot<JS::PersistentRootedObject>(proxy, OtherSlot);
396396 JS::RootedObject rootedArrayBuffer (cx, arrayBuffer->get ());
397397
398- bool isSharedMemory;
398+ bool isSharedMemory;
399399 JS::AutoCheckCannotGC autoNoGC (cx);
400400 uint8_t *data = JS::GetArrayBufferData (rootedArrayBuffer, &isSharedMemory, autoNoGC);
401401
@@ -406,7 +406,7 @@ bool PyBytesProxyHandler::getOwnPropertyDescriptor(
406406 ));
407407
408408 return true ;
409- }
409+ }
410410
411411 PyObject *attrName = idToKey (cx, id);
412412 PyObject *self = JS::GetMaybePtrFromReservedSlot<PyObject>(proxy, PyObjectSlot);
0 commit comments