| 322 | } |
| 323 | |
| 324 | V8_EXPORT const char* GetArrayBufferFromValue(v8::Isolate* Isolate, v8::Value *Value, int *Length, int IsOut) |
| 325 | { |
| 326 | if (IsOut) |
| 327 | { |
| 328 | auto Context = Isolate->GetCurrentContext(); |
| 329 | auto Outer = Value->ToObject(Context).ToLocalChecked(); |
| 330 | auto Realvalue = Outer->Get(Context, FV8Utils::V8String(Isolate, "value")).ToLocalChecked(); |
| 331 | return GetArrayBufferFromValue(Isolate, *Realvalue, Length, false); |
| 332 | } |
| 333 | else |
| 334 | { |
| 335 | if (Value->IsArrayBufferView()) |
| 336 | { |
| 337 | v8::ArrayBufferView * BuffView = v8::ArrayBufferView::Cast(Value); |
| 338 | *Length = static_cast<int>(BuffView->ByteLength()); |
| 339 | auto ABC = BuffView->Buffer()->GetContents(); |
| 340 | return static_cast<char*>(ABC.Data()) + BuffView->ByteOffset(); |
| 341 | } |
| 342 | else if (Value->IsArrayBuffer()) |
| 343 | { |
| 344 | auto Ab = v8::ArrayBuffer::Cast(Value); |
| 345 | auto ABC = Ab->GetContents(); |
| 346 | *Length = static_cast<int>(ABC.ByteLength()); |
| 347 | return static_cast<char*>(ABC.Data()); |
| 348 | } |
| 349 | else |
| 350 | { |
| 351 | return nullptr; |
| 352 | } |
| 353 | } |
| 354 | } |
| 355 | |
| 356 | V8_EXPORT void SetArrayBufferToOutValue(v8::Isolate* Isolate, v8::Value *Value, unsigned char *Bytes, int Length) |
| 357 | { |
nothing calls this directly
no test coverage detected